query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
sequencelengths
0
101
negative_scores
sequencelengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Perform replacement on specific (un)hyphenated config directives.
def unhyphenate(string) string.to_s.gsub(/(pre|post)xfer/, '\1-xfer') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_conf_directives(config_file, cfg)\n Chef::Log.info \"YAML config file: #{config_file}, conf directive entries: #{cfg}\"\n yaml = YAML::load_file(config_file)\n cfg.each_key { |key|\n val = parse_json(cfg[key])\n yaml[key] = val\n }\n Chef::Log.info \"Merged cassandra YAML config: #{yaml.to_yaml}\"\n\n File.open(config_file, 'w') { |f|\n f.write <<-EOF\n# Cassandra storage config YAML\n#\n# NOTE:\n# See http://wiki.apache.org/cassandra/StorageConfiguration\n# for explanations of configuration directives\n# /NOTE\n#\n# Auto generated by Cassandra cookbook\n EOF\n f.write yaml.to_yaml\n Chef::Log.info \"Saved YAML config to #{config_file}\"\n }\n end", "def merge_conf_directives(config_file, cfg)\n Chef::Log.info \"YAML config file: #{config_file}, conf directive entries: #{cfg}\"\n # Always backup\n bak_file = config_file.sub('.yaml', '_template.yaml')\n File.rename(config_file, bak_file)\n yaml = YAML::load_file(bak_file)\n puts cfg\n\n cfg.each_key { |key|\n if key == \"data_file_directories\"\n val = parse_json(cfg[key]).split(\",\")\n elsif key == \"seed_provider\"\n val = cfg[key]\n else\n val = parse_json(cfg[key])\n end\n yaml[key] = val\n }\n Chef::Log.info \"Merged cassandra YAML config: #{yaml.to_yaml}\"\n\n File.open(config_file, 'w') { |f|\n f.write <<-EOF\n# Cassandra storage config YAML\n#\n# NOTE:\n# See http://wiki.apache.org/cassandra/StorageConfiguration\n# or #{bak_file} file for full\n# explanations of configuration directives\n# /NOTE\n#\n# Auto generated by Cassandra cookbook\n EOF\n f.write yaml.to_yaml\n Chef::Log.info \"Saved YAML config to #{config_file}\"\n }\n end", "def process_directives\n end", "def attribute_to_directive(string)\n unhyphenate(snake_to_space(string))\nend", "def replace_less_extend(less)\n less.gsub(/\\#(\\w+) \\> \\.([\\w-]*)(\\(.*\\));?/, '@include \\1-\\2\\3;')\n end", "def config_substitution(regexp, replacement = nil, *_args)\n return if regexp.nil? || regexp.empty?\n config[:sub].push([Regexp.new(regexp), replacement || ''])\n rescue ArgumentError, RegexpError\n nil\n end", "def fix_subfield_demarcators(value)\n value.gsub(/\\|\\w{1}/,\"--\")\n end", "def config_slapd\n\t\tslapd_conf = File.read('/etc/openldap/slapd.conf')\n\n\t\t# Disable LDAPv2 connections\n\t\tslapd_conf = slapd_conf.gsub(/allow bind_v2/,\"#allow bind_v2\")\n\t\t# Configure the suffix, rootdn, rootpw\n\t\tslapd_conf = slapd_conf.gsub(/suffix\\t\\t\\\"dc=my-domain,dc=com\\\"/,\"suffix \\\"dc=cit470_Team_4,dc=nku,dc=edu\\\"\")\n\t\tslapd_conf = slapd_conf.gsub(/rootdn\\t\\t\\\"cn=Manager,dc=my-domain,dc=com\\\"/,\"rootdn \\\"cn=Manager,dc=cit470_team_4,dc=nku,dc=edu \\\"\") \n\t\tslapd_conf = slapd_conf.gsub(/# rootpw\\t\\t\\{crypt\\}ijFYNcSNctBYg/,\"\\nrootpw \\{SSHA\\}3YGEc7Na9bdBANZ6nahRKhYxn3XCJED4\")\n\n\t\t# Write the slapd.conf file\n\t\tFile.open('/etc/openldap/slapd.conf','w'){|file| file.puts slapd_conf}\n\n\tend", "def key_substitutor(config_key, value)\n lambda do |**args|\n result = []\n value.each do |line|\n replace = line.scan(/<(\\S+)>/).flatten.map(&:to_sym)\n replace.each do |item|\n line = line.sub(\"<#{item}>\", args[item].to_s) if args.key?(item)\n end\n result.push(line) unless /<\\S+>/.match(line)\n end\n if result.empty?\n fail ArgumentError,\n \"Arguments given to #{config_key} yield empty result\"\n end\n preprocess_value(result)\n end\n end", "def substitute_from_config_libraries(sql)\n Admin::ConfigLibrary.make_substitutions! sql, :sql\n sql\n end", "def yaml_file_workaround(current_contents, delete_quotes)\n nested_map = current_contents[/^\\-\\s\\w+:/] ? true : false\n regex = nested_map ? /^(\\-?\\s+)/ : /^(\\s+\\-\\s)/\n if delete_quotes\n current_contents.delete!('\"')\n end\n current_contents.gsub!(regex, ' \\\\1')\n current_contents\n end", "def look_for_directives_in context, comment\n @preprocess.handle comment, context do |directive, param|\n case directive\n when 'main' then\n @options.main_page = param\n ''\n when 'title' then\n @options.default_title = param if @options.respond_to? :default_title=\n ''\n end\n end\n\n comment\n end", "def normalize_package_conf_content(name, flags = nil)\n [ name, normalize_flags(flags) ].join(' ')\n end", "def replace_character_sequence_with_hyphen(string, mode: T.unsafe(nil)); end", "def double_dash_to_sections(text)\n text.to_s.dup.tap do |result|\n result.sub!( /(\\S) +(v[^.\\s]*\\.) */, '\\1 -- \\2 ')\n result.gsub!(/(\\S) *-- *(v[^.\\s]*\\.) */, '\\1; \\2 ')\n end\n end", "def hyphenated(as_vendor_prefix = false)\n self.delimiterize('-', as_vendor_prefix)\n end", "def symbolize_configuration!(config)\r\n [\r\n :project_type,\r\n :environment,\r\n :output_style,\r\n :preferred_syntax,\r\n :sprite_engine,\r\n ].each do |k|\r\n config[k] = config[k].to_sym if config.key? k\r\n end\r\n\r\n config\r\n end", "def shellify_opt(value)\n value.to_s.gsub('_', '-')\n end", "def replace regex, options\n required_options options, [:with, :in]\n add \"sed -i 's/#{regex}/#{options[:with].to_s.gsub('/', '\\/').gsub(\"\\n\", \"\\\\n\")}/' #{options[:in]}\", check_string(options[:with], options[:in])\n end", "def custom_expand(val, conf)\r\n val.gsub!(/\\$\\(([^()]+)\\)/) do |var|\r\n key = $1\r\n if CONFIG.key? key\r\n custom_expand(conf[key], conf)\r\n else\r\n var\r\n end\r\n end\r\n val\r\n end", "def replace_cmd\n sprintf 'sed -i \"s/%s.*/%s%s/\" %s', key_set_string, key_set_string, @config[:value], @file\n end", "def sanitize_config(conf={}, keep=[], dupe=false)\n \t\t(conf = conf.clone) if dupe\n \t\tconf.reject!{|k,v| (!CONFIG_KEYS.include?(k.to_s) or [{},[],''].include?(v)) and !keep.include? k.to_s }\n \t\tconf\n \tend", "def handle_switch(directive, names, extras); end", "def scaffold_fix_template(text)\n text.gsub('-%>', '%>')\n end", "def fix_vagrant_prefix(flags)\n flags.gsub!('/vagrant-substrate/staging', '/opt/vagrant')\nend", "def promote_traditional!\n self.gsub!(TRADITIONAL_REGEX, $1) if self =~ TRADITIONAL_REGEX\n end", "def fix_name_modifiers!\n NAME_MODIFIERS.each do |modifier|\n gsub!(/((?:[[:space:]]|^)#{modifier})([[:space:]]+|-)/) do |_|\n \"#{Regexp.last_match[1].rstrip.downcase}#{Regexp.last_match[2].tr(ASCII_SPACE, NONBREAKING_SPACE)}\"\n end\n end\n\n fix_apostrophe_modifiers!\n self # Allows chaining\n end", "def apply_replacements(word)\n @replacements.each do |pattern, target|\n word.gsub!(pattern, target)\n end\n \n word\n end", "def insert_hyphens(word)\r\n w = word.dup\r\n counter = 0\r\n previous_pos = 0\r\n @hyphenator.hyphenate(w).each do |pos|\r\n if pos != 0 && (w[pos.to_i + counter -1, 1] != '-') && (pos - previous_pos > 2)\r\n w[pos.to_i + counter, 0] = '|'\r\n counter += 1\r\n previous_pos = pos\r\n end\r\n end\r\n w\r\nend", "def substitutions\n subs = self.instance_variables\n subs.delete(config.format_key)\n subs.map { |s| s.to_s.gsub('@', '').to_sym }\n end", "def replace_abbreviations(el, regexps = T.unsafe(nil)); end", "def expand_nobracket config\n placeholder = '__PLCHLD__'\n ph_arr = []\n n = -1\n config.gsub!(/\n # nested brackets:\n (?:!\\?<|!@<+) # conditionals or sections in raw mode\n [\\s\\S]*? # anything, including newlines\n \\n>(?=\\n) # bracket on its own line\n |\n # non-nested sections:\n !@<\n [^>+][^>]* # no + because that signifies raw mode\n >\n |\n # \"regular\" brackets (!<...> and !!<...>):\n !!?<\n [^>]*\n >\n /x) {|m|\n n += 1\n # but we still want to expand !'s in !@<foo\\n...>\n if m[1] == '@'\n m = m[3..-2]\n expand = false\n if m[0] == '+'\n expand = true\n m = m[1..-1]\n end\n expand_nobracket m if expand\n m = '!@<' + m + '>'\n end\n ph_arr.push m\n placeholder + \"<#{n}>\"\n }\n # now the actual substitutions\n # bangs at the beginning of the line - we always expand these, even\n # when whitespace follows them\n config.gsub!(/\n ^\\s* # beginning of line, with possible whitspace\n (![@!?]?) # the type of thing it is\n (\n [^!\\n]* # exclude !'s because there could be two\n # separate !<...>'s on one line\n )$ # end of line, we want to capture everything\n /x, '\\1<\\2>')\n # inline bangs, we stop at whitespace for these\n config.gsub!(/\n (![@!?]?) # the type of thing it is\n (\n [^<@!?\\s] # we have to exclude:\n # - < to avoid adding brackets where they already exist\n # - @!? to avoid premature bracket-adding\n # (ex. !!foo -> !<!foo>)\n \\S* # grab everything until whitespace is found\n )\n /x, '\\1<\\2>')\n # replace the placeholders\n config.gsub!(/#{placeholder}<(\\d+)>/) { ph_arr[$1.to_i] }\n end", "def sanitize_config(trusted)\n if trusted then CUSTOM_RELAXED_CONFIG else Sanitize::Config::BASIC end\n end", "def clean_up_conf_file(conf_file_path)\n conf_items_patterns = { /^tools\\.remindInstall.*\\n/ => \"tools.remindInstall = \\\"FALSE\\\"\",\n /^uuid\\.action.*\\n/ => \"uuid.action = \\\"create\\\"\",\n /^ethernet\\.+generatedAddress.*\\n/ => '' }\n\n content = File.read conf_file_path\n content << \"\\n\"\n\n conf_items_patterns.each_pair do |pattern, new_item|\n unless content.include? new_item\n content.gsub(pattern, '').strip\n content << \"#{new_item}\\n\"\n end\n end\n\n File.open(conf_file_path, 'w') { |f| f.print content }\n end", "def configure_app_name(files)\n files.each do |file|\n gsub_file file, /<%= app_name %>/, app_name\n end\n end", "def config_content(tparam, tvalue)\n fparam = tparam.split('_').map { |e|\n case e\n when 'backuppc'\n 'BackupPC'\n when 'email'\n 'EMail'\n when 'url', 'mmdd'\n e.upcase\n else\n e.capitalize\n end\n }.join\n\n fvalue = case tvalue\n when FalseClass, TrueClass\n tvalue ? 1 : 0\n else\n Regexp.escape(PP.pp(tvalue, '').chomp.tr('\"', \"'\"))\n end\n\n %r{^\\$Conf{#{fparam}}\\s+=\\s+#{fvalue};}m\nend", "def setRemoveHyphenation(value)\n @fields['remove_hyphenation'] = value\n self\n end", "def jekyll(*directives)\n directives.map! do |x|\n case x\n when Symbol\n \"--#{x}\"\n when Hash\n x.map { |k, v| \"--#{k}=#{v}\" }.join(' ')\n else x\n end\n end\n sh \"jekyll #{directives.join(' ')}\"\nend", "def munge\n self.to_s.sub(/\\A(.{1,2}).*/) { |m| $1 + @config[:munge_string] }\n end", "def replace(line)\n return line if line !~ /\\{\\{Gc/\n return line if line =~ /link=none/ || line =~ /dis=false/ || line =~ /dis=true/\n return line.gsub!(/\\{\\{[Gg]c|mod=(\\S+)\\|/, '{{Gc|mod=\\1|dis=false|')\nend", "def replacements; end", "def replace( *ruleses )\n self.dup.replace!( *ruleses )\n end", "def sanitize_prefixed_tags_from(soap)\n soap.gsub /(m|env):/, ''\n end", "def deabbreviate\n str = clone\n ABBREVIATIONS.each do |abbreviations, replacement|\n abbreviations.each do |abbreviation|\n str = str.gsub(/\\b#{abbreviation}[\\.\\b\\s-]+/i, \"#{replacement} \")\n end\n end\n str\n end", "def configure(conf)\n super\n fieldsToMaskFilePath = conf['fieldsToMaskFilePath']\n fieldsToExcludeJSONPaths = conf['fieldsToExcludeJSONPaths']\n handleSpecialCases = conf['handleSpecialEscapedJsonCases']\n\n if fieldsToExcludeJSONPaths != nil && fieldsToExcludeJSONPaths.size() > 0 \n fieldsToExcludeJSONPaths.split(\",\").each do | field |\n # To save splits we'll save the path as an array\n splitArray = field.split(\".\")\n symArray = []\n splitArray.each do | pathPortion |\n symArray.push(pathPortion.to_sym)\n end\n @fieldsToExcludeJSONPathsArray.push(symArray)\n end\n end\n\n File.open(fieldsToMaskFilePath, \"r\") do |f|\n f.each_line do |line|\n value = line.to_s # make sure it's string\n value = value.gsub(/\\s+/, \"\") # remove spaces\n value = value.gsub('\\n', '') # remove line breakers\n\n if value.end_with? \"/i\"\n # case insensitive\n value = value.delete_suffix('/i')\n hashObjectRegex = Regexp.new(/(?::#{value}=>\")(.*?)(?:\")/mi) # mask element in hash object\n innerJSONStringRegex = Regexp.new(/(\\\\+)\"#{value}\\\\+\":\\\\+.+?((?=(})|,( *|)(\\s|\\\\+)\\\")|(?=}\"$))/mi) # mask element in json string using capture groups that count the level of escaping inside the json string\n else\n # case sensitive\n hashObjectRegex = Regexp.new(/(?::#{value}=>\")(.*?)(?:\")/m) # mask element in hash object\n innerJSONStringRegex = Regexp.new(/(\\\\+)\"#{value}\\\\+\":\\\\+.+?((?=(})|,( *|)(\\s|\\\\+)\\\")|(?=}\"$))/m) # mask element in json string using capture groups that count the level of escaping inside the json string\n end\n\n @fields_to_mask.push(value)\n\n hashObjectRegexStringReplacement = \":#{value}=>\\\"#{MASK_STRING}\\\"\"\n @fields_to_mask_regex[hashObjectRegex] = hashObjectRegexStringReplacement\n @fields_to_mask_keys[hashObjectRegex] = value\n\n innerJSONStringRegexStringReplacement = \"\\\\1\\\"#{value}\\\\1\\\":\\\\1\\\"#{MASK_STRING}\\\\1\\\"\"\n @fields_to_mask_regex[innerJSONStringRegex] = innerJSONStringRegexStringReplacement\n @fields_to_mask_keys[innerJSONStringRegex] = value\n end\n end\n\n # if true, each record (a json record), will be checked for a special escaped json cases\n # any found case will be 'gsub' with the right solution \n @handleSpecialEscapedJsonCases = handleSpecialCases != nil && handleSpecialCases.casecmp(\"true\") == 0\n\n puts \"black list fields:\"\n puts @fields_to_mask\n end", "def normalize_delimiters!\n @content.each { |item| item[:delimiter] = default_delimiter if item[:type] == :value }\n end", "def parse_output_configurations(segment)\n segment_hash = @facility_config.details[segment].convert_keys\n segment_array = make_segment_array(segment_hash, segment)\n segment_array = segment_array.collect do |elem|\n actual, default = elem.split('@') #handling default values which is seperated by '@'\n if default && @config_hash[actual].blank?\n default\n elsif @config_hash_keys.include? actual\n @config_hash[actual]\n else\n elem\n end \n end\n Output835.remove_blank(segment_array).join('*')\n end", "def swap_rspec_configuration(key, value); end", "def string_replacements\nend", "def submode_config(config_line)\n command = config_line.strip\n @configuration[command]\n end", "def configure(conf)\n super\n\n @convert.nil? or @convert.each do |field, type|\n if !VALID_CONVERSIONS.include?(type)\n raise ConfigError, \n \"convert #{type} is not one of #{VALID_CONVERSIONS.join(',')}.\"\n end\n end\n\n @gsub_parsed = []\n @gsub.nil? or \n @gsub.each_slice(3) do |field, needle, replacement|\n if [field, needle, replacement].any? {|n| n.nil?}\n raise ConfigError,\n \"gsub #{[field,needle,replacement]} requires 3 elements.\"\n end\n\n @gsub_parsed << {\n field: field,\n needle: (needle.index(\"%{\").nil?? Regexp.new(needle): needle),\n replacement: replacement\n }\n end\n end", "def replace_dashes_with_hyphens(text)\t\t\t\n\ttext.gsub!(/(?<=[a-zA-Z])-(?=[a-zA-Z])/,'\\hyp ')\n\t\n\ttext.scan(/\\*\\*(.*?)\\*\\*/).each do |match|\n\t\tdamaged = match[0]\n\t\trepaired = damaged.gsub('\\hyp ','-')\n\t\ttext.gsub!(damaged,repaired)\n\tend\t\n\n\ttext.scan(/\\[\\[(.*?)\\]\\]/).each do |match|\n\t\tdamaged = match[0]\n\t\trepaired = damaged.gsub('\\hyp ','-')\n\t\ttext.gsub!(damaged,repaired)\n\tend\n\t\n\ttext.scan(/cite{(.*?)}/).each do |match|\n\t\tdamaged = match[0]\n\t\trepaired = damaged.gsub('\\hyp ','-')\n\t\ttext.gsub!(damaged,repaired)\n\tend\t\n\n\ttext\nend", "def url_safe_name\n self.config_type.downcase.gsub(/[^a-zA-Z0-9]+/, '-').chomp('-')\n end", "def gsub_command(system_command)\n command = system_command\n if system_command =~ /^gem/\n command << \" --config-file=features/resources/gem-cucumber.yml\"\n end\n command\nend", "def hide_all_ssns(string)\n string.gsub /\\d{3}-\\d{2}-/, \"XXX-XX-\"\nend", "def replace_keyword_in_requirement\n reqs = Requirement.where(project: project)\n reqs.each do |req|\n next unless req.description.include?(key)\n abbr = \"<abbr title='#{definition}'>#{key}</abbr>\"\n newdesc = if req.description[%r{<abbr title='[A-Za-z0-9 ,.\\-]*'>#{key}</abbr>}]\n req.description.gsub(%r{<abbr title='[A-Za-z0-9 ,.\\-]*'>#{key}</abbr>}, abbr)\n else\n req.description.gsub(key, abbr)\n end\n req.update(description: newdesc)\n req.save\n end\n end", "def munge\n host_name.sub(/\\A(.{1,2}).*/) { |m| $1 + @config[:munge_string] }\n end", "def desensitize(*widgets)\n widgets.each { |w| self[\"#{w}\"].sensitive = false }\n end", "def fix_dash_dash(text); end", "def find_replace(file_name,attribute,find_str,replace_str)\n\n if find_str != replace_str\n #if the string is found, replace\n Chef::Log.debug \"DEBUG: Line in #{ file_name } - #{ find_str } does not match desired configuration, updating with #{ replace_str }\"\n ::File.write(f = \"#{ file_name }\", ::File.read(f).gsub(\"#{ attribute }#{ find_str }\", \"#{ attribute }#{ replace_str }\"))\n end\n\nend", "def substitute_command_variables(cmd)\n substitutions = {\n /@APPLICATION@/ => @application.name,\n /@APP@/ => @application.name,\n /@ENVIRONMENT@/ => @environment.name,\n /@ENV@/ => @environment.name,\n /@RUBY@/ => @instance_paths.ruby_path,\n /@GEM@/ => @instance_paths.gem_path,\n /@CHEF@/ => @instance_paths.chef_path,\n /@KNIFE@/ => @instance_paths.knife_path\n }\n substitutions.keys.each {|key| cmd.gsub!(key, substitutions[key]) }\n cmd\n end", "def optionify\n output = self.apachify\n output = \"-#{output[3..-1]}\" if self.to_s[0..3] == 'not_'\n output\n end", "def optionify\n output = self.apachify\n output = \"-#{output[3..-1]}\" if self.to_s[0..3] == 'not_'\n output\n end", "def descriptor_list_tokens=(tokens)\n self.descriptor_list = tokens.gsub(\"'\", \"\")\n end", "def configure!(parser); end", "def apply_updates_desc(desc)\n return if desc.to_s.empty?\n\n wrap_length = MAX_LINE_LENGTH - WORD_WRAP_INDENT\n\n @control_string.sub!(\n /desc\\s+(((\").*?(?<!\\\\)\")|((').*?(?<!\\\\)')|((%q{).*?(?<!\\\\)[}])|(nil))\\n/m,\n \"desc %q{#{desc}}\".word_wrap(wrap_length).indent(WORD_WRAP_INDENT)\n )\n end", "def promotion_directives\n context[:promotion_directives] ||= {}\n end", "def substituteCustom(mapping)\n mapping.each do |key, value|\n find = key.to_s\n replace = value.to_s\n @slugString = @slugString.gsub(find, replace)\n end\n end", "def normalize_switch raw_switch_arg\n (@shorts[raw_switch_arg] || raw_switch_arg).tr(\"_\", \"-\")\n end", "def expand_build_settings(string, configuration)\n return nil if string.nil?\n\n search_position = 0\n string = string.clone\n\n while (matches = /\\$\\(([^(){}]*)\\)|\\$\\{([^(){}]*)\\}/.match(string, search_position))\n original_macro = matches[1] || matches[2]\n delimiter_length = 3 # $() or ${}\n delimiter_offset = 2 # $( or ${\n search_position = string.index(original_macro) - delimiter_offset\n\n if (m = /^(.+):(.+)$/.match original_macro)\n macro_name = m[1]\n modifier = m[2]\n else\n macro_name = original_macro\n end\n\n expanded_macro = expanded_build_setting macro_name, configuration\n\n search_position += original_macro.length + delimiter_length and next if expanded_macro.nil?\n\n # From the Apple dev portal when creating a new app ID:\n # You cannot use special characters such as @, &, *, ', \"\n # From trial and error with Xcode, it appears that only letters, digits and hyphens are allowed.\n # Everything else becomes a hyphen, including underscores.\n expanded_macro.gsub!(/[^A-Za-z0-9-]/, '-') if modifier == \"rfc1034identifier\"\n\n string.gsub!(/\\$\\(#{original_macro}\\)|\\$\\{#{original_macro}\\}/, expanded_macro)\n search_position += expanded_macro.length\n end\n\n # HACK: When matching against an xcconfig, as here, sometimes the macro is just returned\n # without delimiters as the entire string or as a path component, e.g. TARGET_NAME or\n # PROJECT_DIR/PROJECT_NAME/BridgingHeader.h.\n string = string.split(\"/\").map do |component|\n next component unless component =~ /^[A-Z0-9_]+$/\n expanded_build_setting(component, configuration) || component\n end.join(\"/\")\n\n string\n end", "def line_clean_up(x)\n\t\tx=x.lstrip\n\t\tx=x.gsub(/[a-zA-Z\\]\\'\\\"{\\d]+=[a-zA-Z\\[\\'\\\"{\\d]+/){|x| x.split(\"=\").join(\" = \")}\n\t\t#or equal is failing to work in the same way\n\t\t#x=x.gsub(/[a-zA-Z\\]\\'\\\"{\\d]+=[a-zA-Z\\[\\'\\\"{\\d]+/){|x| x.split(\"||=\").join(\" ||= \")}\n\t\treturn x\n\tend", "def merge_log4j_directives(log4j_file, cfg)\n Chef::Log.info \"Log4j file: #{log4j_file}, log4j directive entries: #{cfg}\"\n # Always backup\n bak_file = log4j_file.sub('.properties', '_template.properties')\n File.rename(log4j_file, bak_file)\n log_props = load_properties(bak_file)\n cfg.each_key { |key|\n val = parse_json(cfg[key])\n log_props[key] = val\n }\n Chef::Log.info \"Merged cassandra log4j : #{log_props.to_yaml}\"\n File.open(log4j_file, 'w') { |f|\n log_props.each {|key,value| f.puts \"#{key}=#{value}\\n\" }\n Chef::Log.info \"Saved Log4j config to #{log4j_file}\"\n }\n end", "def corto_replace(str)\n str = str.gsub(\"$(CORTO_OS)\", CORTO_OS)\n str = str.gsub(\"$(CORTO_MACHINE)\", CORTO_MACHINE)\n str = str.gsub(\"$(CORTO_PLATFORM)\", CORTO_PLATFORM)\n str = str.gsub(\"$(CORTO_TARGET)\", TARGETDIR)\n str = str.gsub(\"$(CORTO_VERSION)\", CORTO_VERSION)\n projectPath = \"\"\n if defined? PACKAGEDIR then\n projectPath = PACKAGEDIR\n end\n str = str.gsub(\"$(CORTO_ETC)\", ENV['CORTO_TARGET'] + \"/etc/corto/#{CORTO_VERSION}/\" + projectPath)\n str = str.gsub(\"$(CORTO_INCLUDE)\", ENV['CORTO_TARGET'] + \"/include/corto/#{CORTO_VERSION}/\" + projectPath)\n str = str.gsub(\"$(CORTO_LIB)\", ENV['CORTO_TARGET'] + \"/lib/corto/#{CORTO_VERSION}/\" + projectPath)\nend", "def corto_replace(str)\n str = str.gsub(\"$(CORTO_OS)\", CORTO_OS)\n str = str.gsub(\"$(CORTO_MACHINE)\", CORTO_MACHINE)\n str = str.gsub(\"$(CORTO_PLATFORM)\", CORTO_PLATFORM)\n str = str.gsub(\"$(CORTO_TARGET)\", TARGETDIR)\n str = str.gsub(\"$(CORTO_VERSION)\", CORTO_VERSION)\n projectPath = \"\"\n if defined? PACKAGEDIR then\n projectPath = PACKAGEDIR\n end\n str = str.gsub(\"$(CORTO_ETC)\", ENV['CORTO_TARGET'] + \"/etc/corto/#{CORTO_VERSION}/\" + projectPath)\n str = str.gsub(\"$(CORTO_INCLUDE)\", ENV['CORTO_TARGET'] + \"/include/corto/#{CORTO_VERSION}/\" + projectPath)\n str = str.gsub(\"$(CORTO_LIB)\", ENV['CORTO_TARGET'] + \"/lib/corto/#{CORTO_VERSION}/\" + projectPath)\nend", "def config_set(config_type, var_name, value, uncomment: false)\n file = \"#{@new_app}/config/#{config_type}.yml\"\n # expecting spaces, possible comment character (#), and key: value\n # capture groups\n # 1: entire string from beginning of the line to the key\n # 2: spaces before the key, not including a comment character\n # 3: just the key\n to_replace = /^((\\s*)(?:#\\s*)?(#{var_name}:)).*$/\n # either construct uncomment version of line or leave it as is\n replace_with = uncomment ? \"\\\\2\\\\3 #{value}\" : \"\\\\1 #{value}\"\n\n gsub_file file, to_replace, replace_with\n end", "def sanitize_description\n self.description = Sanitize.fragment(self.description, Sanitize::Config::BASIC)\n end", "def normalize_config\n @components_in_config = []\n @implicit_component_index = 0\n @inline_components = {}\n c = config.dup\n config.each_pair do |k, v|\n c.delete(k) if self.class.server_side_config_options.include?(k.to_sym)\n c[k] = v.netzke_deep_replace { |el| extend_item(el) } if v.is_a?(Array)\n end\n @normalized_config = c\n end", "def update!(**args)\n @disable_nl_interpretation = args[:disable_nl_interpretation] if args.key?(:disable_nl_interpretation)\n @enable_verbatim_mode = args[:enable_verbatim_mode] if args.key?(:enable_verbatim_mode)\n end", "def manipulate_option(yaml_data_key)\n manipulate_option_raw(\n get_yaml_data( yaml_data_key, 0 ).to_sym,\n get_yaml_data( yaml_data_key, 1 ).to_sym,\n get_yaml_data( yaml_data_key, 2 ),\n get_yaml_data( yaml_data_key, 3 ),\n get_yaml_data( yaml_data_key, 4 )\n )\n end", "def preferred_delimiters; end", "def ns_hyphenate\n to_s.ns_underscore.hyphenate\n end", "def aliases\n @opt_aliases.keys.map {|e| undasherize e }\n end", "def hide_all_ssns(string)\n regexp_key = /(\\d{3}.\\d{2})/\n string.gsub(regexp_key, 'XXX-XX')\nend", "def prepare(tokens); tokens.map { |x| x.gsub(/_/, ' ') } end", "def normalize_options(options)\n # Delete :config because it is not intended to use for running an analyzer\n [:config, :ignore_old_artifacts, :ignore_threshold].each do |ignore_key|\n options.delete(ignore_key)\n end\n options\n end", "def parse! opts, config\n @long_switch = \"#{@long_switch} #{@key.to_s.upcase}\" if @type == :posix and \\\n defined?(@key) && @key\n switches = []\n switches << (defined?(@short_switch) && @short_switch) ? @short_switch : nil\n switches << (defined?(@long_switch) && @long_switch) ? @long_switch : nil\n @description = \"#{@description} (Default: #{@default})\" if @default\n opts.on(switches[0], switches[1], @description) do |o|\n config[@key] = o\n end\n end", "def process_attrasgn exp\n return exp unless @inside_config\n\n if exp.target == RAILS_CONFIG\n # Get rid of '=' at end\n attribute = exp.method.to_s[0..-2].to_sym\n if exp.args.length > 1\n # Multiple arguments?...not sure if this will ever happen\n @tracker.config.rails[attribute] = exp.args\n else\n @tracker.config.rails[attribute] = exp.first_arg\n end\n elsif include_rails_config? exp\n options = get_rails_config exp\n level = @tracker.config.rails\n options[0..-2].each do |o|\n level[o] ||= {}\n\n option = level[o]\n\n if not option.is_a? Hash\n Railroader.debug \"[Notice] Skipping config setting: #{options.map(&:to_s).join(\".\")}\"\n return exp\n end\n\n level = level[o]\n end\n\n level[options.last] = exp.first_arg\n end\n\n exp\n end", "def find_deprecations(config)\n deprecated = false\n if config.key?('editor')\n deprecated = true\n config['editors']['default'] ||= config['editor']\n config.delete('editor')\n Doing.logger.debug('Deprecated:', \"config key 'editor' is now 'editors.default', please update your config.\")\n end\n\n if config.key?('config_editor_app') && !config['editors']['config']\n deprecated = true\n config['editors']['config'] = config['config_editor_app']\n config.delete('config_editor_app')\n Doing.logger.debug('Deprecated:',\n \"config key 'config_editor_app' is now 'editors.config', please update your config.\")\n end\n\n if config.key?('editor_app') && !config['editors']['doing_file']\n deprecated = true\n config['editors']['doing_file'] = config['editor_app']\n config.delete('editor_app')\n Doing.logger.debug('Deprecated:',\n \"config key 'editor_app' is now 'editors.doing_file', please update your config.\")\n end\n\n Doing.logger.warn('Deprecated:', 'outdated keys found, please run `doing config --update`.') if deprecated\n config\n end", "def extract_options_yaml_from_code(code)\n code =~ EMBEDDED_OPTIONS_REGEX\n return $2\n end", "def normalize_options(options)\n options = options.dup\n OPTION_ALIASES.each do |canonical_name, aliases|\n alias_key = aliases.detect { |key| options.key?(key) }\n options[canonical_name] ||= options[alias_key] if alias_key\n options.except!(*aliases)\n end\n\n options\n end", "def merge_directives(target, dirs)\n dirs.each do |dir|\n if (idx = target.find_index { |d| d.graphql_name == dir.graphql_name })\n target.slice!(idx)\n target.insert(idx, dir)\n else\n target << dir\n end\n end\n nil\n end", "def remove_config_comment_lines\n # NOTE: (2016-02-09) jonk => don't want this\n end", "def replace_calculation_semantics(file)\n # split_prop_val.call('(@navbar-padding-vertical / 2) -@navbar-padding-horizontal')\n # #=> [\"(navbar-padding-vertical / 2)\", \"-navbar-padding-horizontal\"]\n split_prop_val = proc { |val|\n s = CharStringScanner.new(val)\n r = []\n buff = ''\n d = 0\n prop_char = %r([\\$\\w\\-/\\*\\+%!])\n while (token = s.scan_next(/([\\)\\(]|\\s+|#{prop_char}+)/))\n buff << token\n case token\n when '('\n d += 1\n when ')'\n d -= 1\n if d == 0\n r << buff\n buff = ''\n end\n when /\\s/\n if d == 0 && !buff.strip.empty?\n r << buff\n buff = ''\n end\n end\n end\n r << buff unless buff.empty?\n r.map(&:strip)\n }\n\n replace_rules file do |rule|\n replace_properties rule do |props|\n props.gsub /(?<!\\w)([\\w-]+):(.*?);/ do |m|\n prop, vals = $1, split_prop_val.call($2)\n next m unless vals.length >= 2 && vals.any? { |v| v =~ /^[\\+\\-]\\$/ }\n transformed = vals.map { |v| v.strip =~ %r(^\\(.*\\)$) ? v : \"(#{v})\" }\n log_transform \"property #{prop}: #{transformed * ' '}\"\n \"#{prop}: #{transformed * ' '};\"\n end\n end\n end\n end", "def update_config(from, to)\n ['.vmx', '.vmxf', '.vmdk'].each do |ext|\n file = File.join @target_vm.path, \"#{to}#{ext}\"\n\n unless File.binary?(file)\n text = (File.read file).gsub from, to\n File.open(file, 'w'){ |f| f.print text }\n end\n\n clean_up_conf_file(file) if ext == '.vmx'\n end\n end", "def dehyphenate_keys=(bool)\n self[:dehyphenate_keys] = bool\n if bool == true\n Hashugar.class_eval(%q[\n def stringify_key(key)\n (key.is_a?(Symbol) ? key.to_s : key).gsub(/-/, '_')\n end\n ])\n elsif bool == false\n Hashugar.class_eval(%q[\n def stringify_key(key)\n key.is_a?(Symbol) ? key.to_s : key\n end\n ])\n else\n raise ArgumentError\n end\n end", "def replace_section_name(section_options)\n section_options = replace_section_name_key(section_options)\n replace_section_name_name(section_options)\n end", "def as_replacements; end", "def as_replacements; end", "def as_replacements; end", "def process config\n replace_variables config.template_location\n\n replace_variables config.generate_settings.command unless config.generate_settings == nil || config.generate_settings.command == nil\n replace_variables config.generate_settings.docker_file unless config.generate_settings == nil || config.generate_settings.docker_file == nil\n\n replace_variables config.build_settings.build_commands.fetch unless config.build_settings == nil || config.build_settings.build_commands.fetch == nil\n replace_variables config.build_settings.build_commands.build unless config.build_settings == nil || config.build_settings.build_commands.build == nil\n replace_variables config.build_settings.build_commands.test unless config.build_settings == nil || config.build_settings.build_commands.test == nil\n\n replace_variables config.build_settings.docker_settings.image unless config.build_settings == nil || config.build_settings.docker_settings.image == nil\n replace_variables config.build_settings.docker_settings.env unless config.build_settings == nil || config.build_settings.docker_settings.env == nil\n replace_variables config.build_settings.docker_settings.binds unless config.build_settings == nil || config.build_settings.docker_settings.binds == nil\n replace_variables config.build_settings.docker_settings.working_directory unless config.build_settings == nil || config.build_settings.docker_settings.working_directory == nil\n\n return config\n end" ]
[ "0.5546376", "0.5542149", "0.55046594", "0.5207952", "0.51040006", "0.50908077", "0.499689", "0.49365768", "0.49196032", "0.4902795", "0.49019387", "0.48948985", "0.4893788", "0.48459893", "0.4840272", "0.4836889", "0.48190486", "0.4800124", "0.47738957", "0.47688666", "0.47662702", "0.47537556", "0.4750438", "0.4744888", "0.4727832", "0.47187114", "0.47127292", "0.46928102", "0.46755666", "0.46690974", "0.46564302", "0.4654983", "0.4652162", "0.46497157", "0.4644227", "0.46346164", "0.46273845", "0.46252185", "0.46093252", "0.45841923", "0.4582789", "0.45803845", "0.456684", "0.45648804", "0.45629263", "0.4547914", "0.45333862", "0.45313084", "0.4515525", "0.45145002", "0.45103535", "0.4510297", "0.4489891", "0.44877774", "0.44845176", "0.447982", "0.44787037", "0.44773015", "0.44737005", "0.44660947", "0.4459912", "0.44593862", "0.44593862", "0.44592533", "0.44576976", "0.44530442", "0.44507366", "0.44495833", "0.4444599", "0.4443736", "0.4434297", "0.4431165", "0.44309464", "0.44309464", "0.443017", "0.44258395", "0.442341", "0.44205305", "0.44101542", "0.44051158", "0.44042584", "0.44021162", "0.43913385", "0.43891034", "0.43872496", "0.43723005", "0.43709248", "0.4370715", "0.43691152", "0.43691057", "0.4366183", "0.43659428", "0.4365757", "0.43645525", "0.43636948", "0.43619597", "0.43588957", "0.43588957", "0.43588957", "0.43579713" ]
0.48970374
11
Expand "snake_case_things" to "snake case things".
def snake_to_space(string) string.to_s.tr('_', ' ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def camel_to_snake_case input\n input = input.to_s.dup\n\n # handle camel case like FooBar => Foo_Bar\n while input.gsub!(/([a-z]+)([A-Z])(\\w+)/) { $1 + '_' + $2 + $3 }\n end\n\n # handle abbreviations like XMLParser => XML_Parser\n while input.gsub!(/([A-Z]+)([A-Z])([a-z]+)/) { $1 + '_' + $2 + $3 }\n end\n\n input\n end", "def to_snake_case\n gsub(/\\W/, '_')\n .gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2')\n .gsub(/([a-z])([A-Z])/, '\\1_\\2')\n .downcase\n .gsub(/_+/, '_')\n end", "def snake_case\n self.gsub(/([a-z])([A-Z])/) {|s| \"#{s[0]}_#{s[1]}\"}.gsub(/([A-Z])([A-Z][a-z])/) {|s| \"#{s[0]}_#{s[1..2]}\"}.downcase\n end", "def pascalcase_to_snakecase(word)\n\tword.gsub(/\\B([A-Z])(?=[a-z0-9])|([a-z0-9])([A-Z])/, '\\2_\\+').downcase\nend", "def to_snake_case\n gsub(/::/, '/')\n .gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2')\n .gsub(/([a-z\\d])([A-Z])/, '\\1_\\2')\n .tr('-', '_')\n .downcase\n end", "def snake_case\n gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2')\n .gsub(/([a-z\\d])([A-Z])/, '\\1_\\2')\n .tr('-', '_')\n .downcase\n end", "def camel_to_snake(input)\n input.gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').downcase\n end", "def camel_to_snake(camel_string)\n camel_string.gsub(/[[:lower:]][[:upper:]]/) { |x| x.chars.join('_').downcase }\nend", "def to_snake\n words = self\n .split(/([[:upper:]][[:lower:]]*)/)\n .select { |word| word.size > 0}\n lower_case_words = words.map { |word| word.downcase }\n lower_case_words.join('_')\n end", "def snakify\n return downcase if match(/\\A[A-Z]+\\z/)\n gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2').\n gsub(/([a-z])([A-Z])/, '\\1_\\2').\n downcase\n end", "def snake_case\n return downcase if match(/\\A[A-Z]+\\z/)\n gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2').\n gsub(/([a-z])([A-Z])/, '\\1_\\2').\n downcase\n end", "def to_snake_case(s)\n s.to_s.split(/(?=[A-Z])/).join(\"_\").downcase\nend", "def underscorize!\n self.replace(self.scan(/[A-Z][a-z]*/).join(\"_\").downcase)\n end", "def snakecase\n str = dup\n str.gsub! /::/, '/'\n str.gsub! /([A-Z]+)([A-Z][a-z])/, '\\1_\\2'\n str.gsub! /([a-z\\d])([A-Z])/, '\\1_\\2'\n str.tr! \".\", \"_\"\n str.tr! \"-\", \"_\"\n str.downcase!\n str\n end", "def snake_to_camel(snake_string)\n string = snake_string.gsub(/(_[a-z])/) {|match| match[1].upcase}\n string\nend", "def snakecase(name)\n name.gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').downcase\n end", "def to_snake_case(str)\n str.chars.map { |e| e == e.upcase ? \"_#{e.downcase}\" : e }.join\nend", "def swap_case(preserve_prefixed_underscores: false)\n LuckyCase.swap_case self, preserve_prefixed_underscores: preserve_prefixed_underscores\n end", "def camel_case_to_snake_case(camel_case)\n camel_case.to_s.gsub(/([a-z])([A-Z])/, '\\1_\\2').gsub(/([A-Z])([A-Z])([a-z])/, '\\1_\\2\\3').downcase\n end", "def snake_case(name)\n name.gsub(/([a-z])([A-Z0-9])/, '\\1_\\2' ).downcase\nend", "def snake_case2\n (self.gsub! /(.)([A-Z])/, '\\1_\\2').downcase\n rescue\n self\n end", "def snake_case_to_camel_case(value)\n pieces = value.to_s.split '_'\n\n (pieces[0] + pieces[1..-1].map(&:capitalize).join).to_sym\n end", "def snake_case(preserve_prefixed_underscores: true)\n LuckyCase.snake_case self, preserve_prefixed_underscores: preserve_prefixed_underscores\n end", "def snake_to_camel(s)\n s.to_s.split('_').map(&:capitalize).join('')\n end", "def titlecase!\n replace(titlecase)\n end", "def name_case!\n self.gsub!(self, self.name_case)\n end", "def upcase!() end", "def camel_to_snake(ident)\n ident = ident.is_a?(String) ? ident.dup : ident.to_s\n ident[0] = ident[0].downcase\n ident.chars.reduce('') { |s, c| s + (/[A-Z]/ =~ c ? \"_#{c.downcase}\" : c) }.to_sym\nend", "def camel_to_snake(ident)\n ident = ident.is_a?(String) ? ident.dup : ident.to_s\n ident[0] = ident[0].downcase\n ident.chars.reduce('') { |s, c| s + (/[A-Z]/ =~ c ? \"_#{c.downcase}\" : c) }.to_sym\nend", "def upper_snake_case(preserve_prefixed_underscores: true)\n LuckyCase.upper_snake_case self, preserve_prefixed_underscores: preserve_prefixed_underscores\n end", "def snake_case(name); end", "def camelize!\n self.titleize!\n self.replace(self[0, 1].downcase + self[1..-1])\n end", "def camel_case\n gsub /(?:^|_)(.)/ do $1.upcase end\n end", "def upcase() end", "def case_fix(name)\r\n fixed_name = name.split(' ')\r\n fixed_name.each do |word|\r\n word.capitalize!\r\n end\r\n fixed_name.join(' ')\r\nend", "def swapcase!() end", "def snake_case(str)\n str = str.dup\n str.gsub!(/[A-Z]/) {|s| \"_\" + s}\n str.downcase!\n str.sub!(/^\\_/, \"\")\n str\nend", "def snake_name\n @_snake_name ||= name_components.map(&:downcase).join('_')\n end", "def keys_to_snake_case(hash)\n hash.transform_keys do |key|\n key.gsub(%r{([A-Z]+)([A-Z][a-z])}, '\\1_\\2')\n .gsub(%r{([a-z\\d])([A-Z])}, '\\1_\\2')\n .downcase\n .to_sym\n end\n end", "def train_case(preserve_prefixed_underscores: true)\n LuckyCase.train_case self, preserve_prefixed_underscores: preserve_prefixed_underscores\n end", "def camel(snake_case)\n snake_case.to_s.capitalize.gsub(/_./) { |match| match[1].upcase }\n end", "def camel_to_snake(string)\n chopped_camel = string.to_s.split(/([A-Z](?:\\d|[a-z])+)/).reject(&:empty?)\n chopped_camel.each_with_index.map {|word, idx| idx == 0 ? word.downcase : word.downcase.prepend('_') }.join\nend", "def snake_case_to_capitalised(str)\n str.split(\"_\").map(&:capitalize).join(\" \")\n end", "def underscore!\n gsub!('::', '_')\n gsub!(/([A-Z\\d]+)([A-Z][a-z])/, '\\1_\\2')\n gsub!(/([a-z\\d])([A-Z])/, '\\1_\\2')\n downcase!\n end", "def swapcase() end", "def studly(s)\n s.gsub(/_(\\w)/) do |match|\n match.sub! '_', ''\n match.upcase\n end\n end", "def upcase\n (self.to_s.upcase! || self).to_sym\n end", "def downcase!() end", "def snake(string)\n string.to_s.gsub(/([a-z])([A-Z])/, '\\1_\\2').downcase.to_sym\n end", "def upcase; end", "def to_camel_case\n return self if self !~ /_/ && self !~ /\\s/ && self =~ /^[A-Z]+.*/\n\n gsub(/[^a-zA-Z0-9ññÑáéíóúÁÉÍÓÚüÜ_]/, \"_\")\n .split(\"_\").map(&:capitalize).join\n end", "def sentence_case(preserve_prefixed_underscores: true)\n LuckyCase.sentence_case self, preserve_prefixed_underscores: preserve_prefixed_underscores\n end", "def variablize(original)\n return original.downcase if original =~ /[A-Z]+/ && original !~ /_/\n return original[0].downcase + original[1..-1] if original !~ /_/\n camelized = original.split('_').map { |e| e.capitalize }.join\n camelized[0].downcase + camelized[1..-1]\n end", "def word_case(preserve_prefixed_underscores: true)\n LuckyCase.word_case self, preserve_prefixed_underscores: preserve_prefixed_underscores\n end", "def upcase_keys!\n replace(upcase_keys)\n end", "def lower_camelcase\n str = dup\n str.gsub!(/\\/(.?)/) { \"::#{$1.upcase}\" }\n str.gsub!(/(?:_+|-+)([a-z])/) { $1.upcase }\n str.gsub!(/(\\A|\\s)([A-Z])/) { $1 + $2.downcase }\n str\n end", "def capitalize(skip_prefixed_underscores: false)\n self.capital skip_prefixed_underscores: skip_prefixed_underscores\n end", "def un_camelcase( s )\n s.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end", "def capitalize!() end", "def studly_caps(delimiter = '_')\n ((self.start_with?(delimiter) ? '' : delimiter) + self).camel_case(delimiter)\n end", "def downcase() end", "def snake_case(group = true)\n\t\t\treturn self unless self =~ %r/[A-Z\\s]/\n\t\t\treverse.scan(%r/[A-Z]+|[^A-Z]*[A-Z]+?|[^A-Z]+/).reverse.map{|word| word.reverse.downcase}.join('_').gsub(/\\s/,'_')\n\t\tend", "def lucky_case(allow_prefixed_underscores: true)\n LuckyCase.case self, allow_prefixed_underscores: allow_prefixed_underscores\n end", "def downcase_keys\n end", "def snakecase(string); end", "def snake_case(str)\n str.gsub(/::/, '/')\n .gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2')\n .gsub(/([a-z\\d])([A-Z])/, '\\1_\\2')\n .tr('-', '_').downcase\n end", "def pretty_title!\n str = self\n str.downcase!\n str = str.split(\" \").map { |word| word.capitalize! }.join(\" \")\n str.gsub! /\\sVs/, ' vs'\n str.gsub! /\\sMd/, ' MD'\n str.gsub! /\\sVersus/, ' versus'\n str.gsub! /\\sLlc/, ' LLC'\n str.gsub! /\\sPc/, ' PC'\n str.gsub! /\\sPa/, ' PA'\n\n # I can't get this to work.. I want Mcfoo to be McFoo but for some reason this wont work -- it does work in rails console\n #str.gsub! /(\\sMc)(.)/, \"#{$1}#{$2.upcase}\"\n str\n end", "def objective_name snake_name\n\tsnake_name.split(\"_\").reduce(\"\") { |result, part| \n\t\tif result != \"\"\n\t\t\tresult + part.capitalize\n\t\telse\n\t\t\tpart\n\t\tend\n\t}\nend", "def camel_case(preserve_prefixed_underscores: true)\n LuckyCase.camel_case self, preserve_prefixed_underscores: preserve_prefixed_underscores\n end", "def titlecase\n gsub(/\\b\\w/){ $`[-1,1] == \"'\" ? $& : $&.upcase }\n end", "def snakify(string)\n string.split(/(?=[A-Z])/).map(&:downcase).join('_')\n end", "def capital_word_case(preserve_prefixed_underscores: true)\n LuckyCase.capital_word_case self, preserve_prefixed_underscores: preserve_prefixed_underscores\n end", "def camelize(first_letter_in_uppercase=true)\n word = self.dup\n if first_letter_in_uppercase\n word.gsub(/\\/(.?)/) { \"::#{$1.upcase}\" }.gsub(/(?:^|_)(.)/) { $1.upcase }\n else\n word.to_s[0].chr.downcase + word.camelize[1..-1]\n end\n end", "def to_camel! # no one should change these unless they can benchmark and prove their way is faster. =)\n @cached_camel_strings ||= {}\n @cached_camel_strings[self] ||= (\n # new_string = self.dup # need to do this since sometimes the string is frozen\n while x = index(\"_\")\n y=x+1\n self[x..y] = self[y..y].capitalize # in my tests, it was faster than upcase\n end\n self\n )\n end", "def snake_case(str)\n str.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/, '\\1_\\2').\n tr('-', '_').\n downcase\n end", "def camelize_and_normalize_name(snake_cased_name)\n result = Client.camelize_name(snake_cased_name.to_s)\n PARAM_NORMALIZATION.each {|k, v| result.gsub!(/#{k}/, v) }\n result\n end", "def favorite_cleaned\n favorite.gsub(' ', '').snake_case\n end", "def humanize\n\t\tself.gsub('_',' ').titlecase\n\tend", "def squash\n upcase.delete('^A-Z0-9')\n end", "def upper_camel_to_lower_underscore(s)\n s = s.gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2')\n s = s.gsub(/([a-z\\d])([A-Z])/, '\\1_\\2')\n s = s.tr('-', '_')\n s = s.downcase\n s\n end", "def snake_case(str)\n str.gsub(/::/, '/')\n .gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2')\n .gsub(/([a-z\\d])([A-Z])/, '\\1_\\2')\n .tr('-', '_')\n .downcase\n end", "def rubyize_keys\n transform_keys do |key|\n key\n .to_s\n .gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2')\n .gsub(/([a-z\\d])([A-Z])/, '\\1_\\2')\n .downcase\n .to_sym\n end\n end", "def to_snake_case(str)\n return downcase if match()\nend", "def humanize\n self.downcase.gsub(/_/, \" \").capitalize\n end", "def upcase(input); end", "def snake_case(string)\n string.gsub(/::/, '/')\n .gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2')\n .gsub(/([a-z\\d])([A-Z])/, '\\1_\\2')\n .tr('-', '_')\n .downcase\n end", "def snake_case(string)\n string.gsub(/::/, '/')\n .gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2')\n .gsub(/([a-z\\d])([A-Z])/, '\\1_\\2')\n .tr('-', '_')\n .downcase\n end", "def snake_case(string)\n string.gsub(/::/, '/')\n .gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2')\n .gsub(/([a-z\\d])([A-Z])/, '\\1_\\2')\n .tr('-', '_')\n .downcase\n end", "def camel_lower(value)\n case value\n when Array then value.map { |item| camel_lower(item) }\n when Hash then value.deep_transform_keys! { |key| camel_lower(key) }\n when Symbol then camel_lower(value.to_s).to_sym\n when String then value.underscore.camelize(:lower)\n else value\n end\n end", "def camel_case\n return self if self !~ /_/ && self =~ /[A-Z]+.*/\n split('_').map{|e| e.capitalize}.join\n end", "def camel_case\n return self if self !~ /_/ && self =~ /[A-Z]+.*/\n split('_').map{|e| e.capitalize}.join\n end", "def downcase_keys!\n replace(downcase_keys)\n end", "def titleify(t)\n t = t.tr('_', ' ')\n t = t.lstrip\n t = t.split.map(&:capitalize).join(' ')\nend", "def camelize\n return self if self !~ /_/ && self =~ /[A-Z]+.*/\n split('_').map{|e| e.capitalize}.join\n end", "def snake_case(str); end", "def camelize\n string = self.dup\n string = string.sub(/^[a-z\\d]*/) { $&.capitalize }\n string.gsub(/(?:_|(\\/))([a-z\\d]*)/) { \"#{$1}#{$2.capitalize}\" }.gsub('/', '::')\n end", "def camelize_keys!(first_letter = :upper)\n transform_keys! { |key| key.to_s.camelize(first_letter) rescue key }\n end", "def smart_titlecase\n small_words = %w(a an and as at but by en for if in of on or the to v v. via vs vs. von)\n\n x = split(\" \").map do |word|\n # note: word could contain non-word characters!\n # downcase all small_words, capitalize the rest\n small_words.include?(word.gsub(/\\W/, \"\").downcase) ? word.downcase! : word.smart_capitalize!\n word\n end\n # capitalize first and last words\n x.first.smart_capitalize!\n x.last.smart_capitalize!\n # small words after colons are capitalized\n x.join(\" \").gsub(/:\\s?(\\W*#{small_words.join(\"|\")}\\W*)\\s/) { \": #{$1.smart_capitalize} \" }\n end", "def to_underscore(string)\n string.gsub(/(.)([A-Z])/,'\\1_\\2').downcase\nend", "def camelize(_uppercase_first_letter = true)\n self.dup.camelize!\n end", "def mixed_case(preserve_prefixed_underscores: true)\n LuckyCase.mixed_case self, preserve_prefixed_underscores: preserve_prefixed_underscores\n end" ]
[ "0.7578399", "0.75528556", "0.7325526", "0.7291911", "0.72699517", "0.7257512", "0.72369784", "0.7211205", "0.7192635", "0.71797615", "0.7105887", "0.7095246", "0.7057289", "0.7047621", "0.70150864", "0.70114154", "0.69946605", "0.69646597", "0.69538486", "0.6944762", "0.6942187", "0.6912675", "0.69117177", "0.6903316", "0.6902284", "0.6877077", "0.6875245", "0.68707037", "0.68707037", "0.6859018", "0.6835712", "0.6825856", "0.680576", "0.6799895", "0.67881066", "0.6773334", "0.6760401", "0.67561716", "0.67496663", "0.67489326", "0.6715437", "0.6705758", "0.66837686", "0.66754925", "0.66665816", "0.666582", "0.6636153", "0.6576046", "0.6571125", "0.65664095", "0.65639454", "0.65616304", "0.6548891", "0.6542804", "0.65318996", "0.65296596", "0.65130585", "0.65118295", "0.65046823", "0.65007496", "0.64829236", "0.64806694", "0.6477054", "0.6476683", "0.6473885", "0.6473184", "0.64714193", "0.64682984", "0.64629227", "0.64624023", "0.64615893", "0.6453854", "0.6438877", "0.64256865", "0.6425476", "0.64233285", "0.6419758", "0.64196455", "0.64183676", "0.6414509", "0.6411216", "0.6398915", "0.6395798", "0.6379565", "0.6363855", "0.6360039", "0.6360039", "0.6360039", "0.6358808", "0.6358753", "0.6358753", "0.6355335", "0.6353124", "0.6346106", "0.63449395", "0.6343261", "0.63394725", "0.6338226", "0.63320696", "0.6329403", "0.63248557" ]
0.0
-1
Converts a provider attribute to an rsync config directive.
def attribute_to_directive(string) unhyphenate(snake_to_space(string)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rename_provider\n attributes.fetch(:renameProvider)\n end", "def provider\n conf['provider'] || 'defaults'\n end", "def resolve_provider\n attributes.fetch(:resolveProvider)\n end", "def customize_provider(name,options)\n custom_config = \"\"\n options.each_pair do |key,value|\n next if global_vagrant_options.include?(key)\n case key\n when 'cpus'\n custom_config << \" prov.vmx['numvcpus'] = '#{value}'\\n\"\n when 'memory'\n custom_config << \" prov.vmx['memsize'] = '#{value}'\\n\"\n when 'mac'\n custom_config << \" prov.vmx['ethernet0.generatedAddress'] = '#{value}'\\n\"\n else\n log.warn(\"Skipped invalid custom option for node #{name}: #{key}=#{value}\")\n end\n end\n custom_config\n end", "def config_for(attr)\n permitted.find { |elem| elem[:attr] == attr.to_s }\n end", "def provider_name=(provider)\n unless provider.nil?\n @provider_name = provider.downcase\n end\n end", "def customize_provider(name,options)\n custom_config = \"\"\n options.each_pair do |key,value|\n next if global_vagrant_options.include?(key)\n case key\n when 'cpus','memory'\n custom_config << \" prov.customize ['modifyvm', :id, '--#{key}','#{value}']\\n\"\n when 'mac'\n custom_config << \" prov.customize ['modifyvm', :id, '--macaddress1','#{value}']\\n\"\n else\n log.warn(\"Skipped invalid custom option for node #{name}: #{key}=#{value}\")\n end\n end\n custom_config\n end", "def provider_directory\n Pathname.new(puppet_lib) + 'provider' + @name\n end", "def node_config(node)\n node.public_send(@attribute)\n end", "def write_conf\n template(new_resource.config_path) do\n source 'rsyncd.conf.erb'\n cookbook 'rsync'\n owner 'root'\n group 'root'\n mode '0640'\n variables(\n globals: global_modules,\n modules: rsync_modules\n )\n notifies :restart, \"service[#{node['rsyncd']['service']}]\", :delayed\n end\n\n service node['rsyncd']['service'] do\n action :nothing\n end\nend", "def provider_config\n @config[:providers].each do |provider|\n # Convert the symbol from the config into a string for comparison\n return (provider[1].nil? ? {} : provider[1]) if provider[0].to_s == @provider_name\n end\n\n nil\n end", "def config_for(dest_path, sync_config_path = nil)\n require 'pdk/util'\n require 'pdk/analytics'\n\n module_root = PDK::Util.module_root\n sync_config_path ||= File.join(module_root, '.sync.yml') unless module_root.nil?\n config_path = File.join(@path, 'config_defaults.yml')\n\n if @config.nil?\n require 'deep_merge'\n conf_defaults = read_config(config_path)\n @sync_config = read_config(sync_config_path) unless sync_config_path.nil?\n @config = conf_defaults\n @config.deep_merge!(@sync_config, knockout_prefix: '---') unless @sync_config.nil?\n end\n file_config = @config.fetch(:global, {})\n file_config['module_metadata'] = @module_metadata\n file_config.merge!(@config.fetch(dest_path, {})) unless dest_path.nil?\n file_config.merge!(@config).tap do |c|\n if uri.default?\n file_value = if c['unmanaged']\n 'unmanaged'\n elsif c['delete']\n 'deleted'\n elsif @sync_config && @sync_config.key?(dest_path)\n 'customized'\n else\n 'default'\n end\n\n PDK.analytics.event('TemplateDir', 'file', label: dest_path, value: file_value)\n end\n end\n end", "def provider_name=(value)\n @provider_name = value\n end", "def rsync_command\n utility(:rsync).dup <<\n archive_option <<\n mirror_option <<\n exclude_option <<\n \" #{Array(additional_rsync_options).join(\" \")}\".rstrip\n end", "def scrub_synchronization_attribute(deal,attr)\n if deal.class.respond_to?(:textiled_attributes) && deal.class.textiled_attributes.include?(attr)\n new_value = deal.send(\"#{attr}_source\")\n else\n new_value = deal.send(attr)\n end\n end", "def generate_config(resource)\n resource = symbolize_hash(convert_to_hash(resource))\n config = []\n config << \"lxc.utsname = #{resource[:utsname]}\"\n if(resource[:aa_profile])\n config << \"lxc.aa_profile = #{resource[:aa_profile]}\"\n end\n [resource[:network]].flatten.each do |net_hash|\n nhsh = Mash.new(net_hash)\n flags = nhsh.delete(:flags)\n %w(type link).each do |k|\n config << \"lxc.network.#{k} = #{nhsh.delete(k)}\" if nhsh[k]\n end\n nhsh.each_pair do |k,v|\n config << \"lxc.network.#{k} = #{v}\"\n end\n if(flags)\n config << \"lxc.network.flags = #{flags}\"\n end\n end\n if(resource[:cap_drop])\n config << \"lxc.cap.drop = #{Array(resource[:cap_drop]).join(' ')}\"\n end\n %w(include pts tty arch devttydir mount mount_entry rootfs rootfs_mount pivotdir).each do |k|\n config << \"lxc.#{k.sub('_', '.')} = #{resource[k.to_sym]}\" if resource[k.to_sym]\n end\n prefix = 'lxc.cgroup'\n resource[:cgroup].each_pair do |key, value|\n if(value.is_a?(Array))\n value.each do |val|\n config << \"#{prefix}.#{key} = #{val}\"\n end\n else\n config << \"#{prefix}.#{key} = #{value}\"\n end\n end\n config.join(\"\\n\") + \"\\n\"\n end", "def format_resource(provider, _)\n str_h1 = '%-80s'\n id = provider['ID']\n body = provider.body\n\n CLIHelper.print_header(str_h1 % \"PROVIDER #{id} INFORMATION\")\n puts format('ID : %<s>s', :s => id)\n puts format('NAME : %<s>s', :s => provider['NAME'])\n\n return if body['provider'] == 'onprem'\n\n # Get max size to adjust all the values\n size = body['connection'].keys.map {|k| k.size }.max\n data = {}\n\n # Generate data value with the new key adjusted format\n body['connection'].map {|k, v| data[k.ljust(size)] = v }\n\n puts\n CLIHelper.print_header(str_h1 % 'CONNECTION INFORMATION')\n data.each do |key, value|\n CLIHelper.scr_bold\n print \"#{key} : \"\n CLIHelper.scr_restore\n puts value\n end\n end", "def provider_path\n provider_directory + \"#{@provider}.rb\"\n end", "def set_provider\n PROVIDERS.each do |name|\n regex_string = PROVIDERS.first.eql?(name) ? name[0..-3] : name\n self.provider = name if link =~ /#{regex_string}/\n end\n end", "def config\n name.split('_')[2] || 'default'\n end", "def submode_config(config_line)\n command = config_line.strip\n @configuration[command]\n end", "def configure_attr(attr, default_value = nil)\n v = instance_variable_get(\"@#{attr}\".to_sym)\n v = default_value if v.nil?\n instance_variable_set(\"@#{attr}\".to_sym, eval_attr(v))\n end", "def rsync_command\n if @config[:rsync][:direction] == 'up'\n from = absolute_path(@config[:local_path])\n to = @config.ssh_user_and_host + ':' + @config[:remote_path]\n else\n from = @config.ssh_user_and_host + ':' + @config[:remote_path]\n to = absolute_path(@config[:local_path])\n end\n \"rsync #{rsync_command_options.join(' ')} '#{from}/' '#{to}'\"\n end", "def diagnostic_provider\n attributes.fetch(:diagnosticProvider)\n end", "def execute_command_provider\n attributes.fetch(:executeCommandProvider)\n end", "def customize_provider(name,options)\n ''\n end", "def resolve_inversion_provider(node, resource)\n inversion_options(node, resource)['provider'] || 'auto'\n end", "def provider=(provider)\n @provider = provider\n end", "def genConf\n conf=\"auto #{@device}\\n\"\n if (ip != nil && netmask != nil)\n conf+=%(iface #{@device} inet static\n address #{@ip}\n netmask #{@netmask}\n)\n else\n conf+=\"iface #{@device} inet dhcp\\n\"\n end\n end", "def config_for(dest_path, sync_config_path = nil)\n module_root = PDK::Util.module_root\n sync_config_path ||= File.join(module_root, '.sync.yml') unless module_root.nil?\n config_path = File.join(@path, 'config_defaults.yml')\n\n if @config.nil?\n conf_defaults = read_config(config_path)\n sync_config = read_config(sync_config_path) unless sync_config_path.nil?\n @config = conf_defaults\n @config.deep_merge!(sync_config, knockout_prefix: '---') unless sync_config.nil?\n end\n file_config = @config.fetch(:global, {})\n file_config['module_metadata'] = @module_metadata\n file_config.merge!(@config.fetch(dest_path, {})) unless dest_path.nil?\n file_config.merge!(@config)\n end", "def to_config\n require_relative '../../puppet/util/docs'\n # Scrub any funky indentation; comment out description.\n str = Puppet::Util::Docs.scrub(@desc).gsub(/^/, \"# \") + \"\\n\"\n\n # Add in a statement about the default.\n str << \"# The default value is '#{default(true)}'.\\n\" if default(true)\n\n # If the value has not been overridden, then print it out commented\n # and unconverted, so it's clear that that's the default and how it\n # works.\n value = @settings.value(self.name)\n\n if value != @default\n line = \"#{@name} = #{value}\"\n else\n line = \"# #{@name} = #{@default}\"\n end\n\n str << (line + \"\\n\")\n\n # Indent\n str.gsub(/^/, \" \")\n end", "def use_provider( provider_class, opts = {} )\n opts = opts.merge( sync_file_path: caller_path( caller ) )\n @provider = provider_class.new( self, opts )\n end", "def configuration\n Rally.provider_configuration[name]\n end", "def type\n :puppet_provider\n end", "def rsync_command_options\n options = ['-rl']\n options << rsync_excludes if rsync_excludes\n options << \"--exclude-from='#{@config[:rsync][:exclude_file]}'\" if @config[:rsync][:exclude_file]\n options << \"--owner --group --chown='#{@config[:rsync][:chown]}'\" if @config[:rsync][:chown]\n options << \"--chmod='#{@config[:rsync][:chmod]}'\" if @config[:rsync][:chmod]\n options << '--delete' if @config[:rsync][:delete]\n options\n end", "def providify\n newparam(:provider)\n nil\n end", "def provider_name\n return @provider_name\n end", "def moniker_provider\n attributes.fetch(:monikerProvider)\n end", "def provider_id=(value)\n @provider_id = value\n end", "def merge_conf_directives(config_file, cfg)\n Chef::Log.info \"YAML config file: #{config_file}, conf directive entries: #{cfg}\"\n # Always backup\n bak_file = config_file.sub('.yaml', '_template.yaml')\n File.rename(config_file, bak_file)\n yaml = YAML::load_file(bak_file)\n puts cfg\n\n cfg.each_key { |key|\n if key == \"data_file_directories\"\n val = parse_json(cfg[key]).split(\",\")\n elsif key == \"seed_provider\"\n val = cfg[key]\n else\n val = parse_json(cfg[key])\n end\n yaml[key] = val\n }\n Chef::Log.info \"Merged cassandra YAML config: #{yaml.to_yaml}\"\n\n File.open(config_file, 'w') { |f|\n f.write <<-EOF\n# Cassandra storage config YAML\n#\n# NOTE:\n# See http://wiki.apache.org/cassandra/StorageConfiguration\n# or #{bak_file} file for full\n# explanations of configuration directives\n# /NOTE\n#\n# Auto generated by Cassandra cookbook\n EOF\n f.write yaml.to_yaml\n Chef::Log.info \"Saved YAML config to #{config_file}\"\n }\n end", "def config_value\n @config_value ||= `#{CONFIG_CMD}`\n end", "def update_provider(file, owner, repo)\n # It looks like the last version is always at the end\n # This saves one HTTP request to owner/repo\n last_version_data = http_get(\"#{owner}/#{repo}/versions\")[\"versions\"].last\n\n version = last_version_data[\"version\"]\n\n archSrc = last_version_data[\"platforms\"].inject({}) do |sum, data|\n arch = data[\"arch\"]\n os = data[\"os\"]\n nix_arch = ARCH_TO_NIX[arch]\n nix_os = OS_TO_NIX[os]\n if nix_arch && nix_os then\n sum[\"#{nix_arch}-#{nix_os}\"] = get_version(owner, repo, version, os, arch)\n end\n sum\n end\n\n data = {\n archSrc: archSrc,\n owner: owner,\n repo: repo,\n version: version,\n }\n\n File.write(file, <<NIX)\n{ mkTerraformProvider }:\nmkTerraformProvider #{to_nix data}\nNIX\nend", "def merge_conf_directives(config_file, cfg)\n Chef::Log.info \"YAML config file: #{config_file}, conf directive entries: #{cfg}\"\n yaml = YAML::load_file(config_file)\n cfg.each_key { |key|\n val = parse_json(cfg[key])\n yaml[key] = val\n }\n Chef::Log.info \"Merged cassandra YAML config: #{yaml.to_yaml}\"\n\n File.open(config_file, 'w') { |f|\n f.write <<-EOF\n# Cassandra storage config YAML\n#\n# NOTE:\n# See http://wiki.apache.org/cassandra/StorageConfiguration\n# for explanations of configuration directives\n# /NOTE\n#\n# Auto generated by Cassandra cookbook\n EOF\n f.write yaml.to_yaml\n Chef::Log.info \"Saved YAML config to #{config_file}\"\n }\n end", "def provider_resource_id=(value)\n @provider_resource_id = value\n end", "def config_content(tparam, tvalue)\n fparam = tparam.split('_').map { |e|\n case e\n when 'backuppc'\n 'BackupPC'\n when 'email'\n 'EMail'\n when 'url', 'mmdd'\n e.upcase\n else\n e.capitalize\n end\n }.join\n\n fvalue = case tvalue\n when FalseClass, TrueClass\n tvalue ? 1 : 0\n else\n Regexp.escape(PP.pp(tvalue, '').chomp.tr('\"', \"'\"))\n end\n\n %r{^\\$Conf{#{fparam}}\\s+=\\s+#{fvalue};}m\nend", "def anchored_attribute(attribute, options = {})\n resource = object.class.name.demodulize.underscore\n anchor_name = [resource, attribute.tr(' ', '_')].join('.').downcase\n anchor_and_label_markup(anchor_name, nil, options)\n end", "def resource_class_name(provider_class_name)\n # Chef lwr/p resource and provider base names are the same\n \"Chef::Resource::#{provider_class_name}\"\n end", "def provider_name(provider)\n Account.provider_name(provider)\n end", "def parse_provider_domain_record_name args\r\n case @options['route_dns_changes_via']\r\n when 'rackspace'\r\n \"#{ args['subdomain'] }.#{ args['domain'] }\"\r\n when 'dnsimple'\r\n args['subdomain']\r\n else\r\n \"#{ args['subdomain'] }.#{ args['domain'] }\"\r\n end\r\n end", "def get_rsync(options)\n 'rsync ./ ' + options[:full_path]\n end", "def resolve_config(**attrs)\n config = config_defaults.merge(attrs.transform_keys(&:to_s))\n file_path = File.join(config['root'], config['config_path'])\n file_config = config_from_file(file_path, mode: config['mode'])\n new DEFAULT_CONFIG.merge(file_config).merge(config_from_env).merge(config)\n end", "def rsync_modules\n rsync_resources.each_with_object({}) do |resource, hash|\n next unless resource.config_path == new_resource.config_path && (\n resource.action == :add ||\n resource.action.include?(:add)\n )\n hash[resource.name] ||= {}\n resource_attributes.each do |key|\n value = resource.send(key)\n next if value.nil?\n hash[resource.name][attribute_to_directive(key)] = value\n end\n end\nend", "def change_plugin_prop(prop, value)\n cmd = <<-END\nobj = AdminConfig.list(\"WebserverPluginSettings\", AdminConfig.getid(\"/Node:#{resource[:nodename]}/Server:#{resource[:name]}/\"))\nAdminConfig.modify(obj, '[[ #{prop} \"#{value}\" ]]')\n END\n cmd\n end", "def for_node config_node\n # nil if no config node\n return nil unless config_node\n return nil if @template.at(canonicalize(config_node.path)).nil?\n # configuation is different in every case\n config = case config_node\n when Nokogiri::XML::Text\n config_node.content == '@' ? {} : {\n as: @options[:symbolize_keys] ? config_node.content.to_sym : config_node.content\n }\n when Nokogiri::XML::Attr\n {\n as: @options[:symbolize_keys] ? config_node.value.to_sym : config_node.value\n }\n when Nokogiri::XML::Element\n as = attribute(config_node, :as)\n {\n as: as ? (@options[:symbolize_keys] ? as.to_sym : as) : nil,\n mode: mode(config_node, as)\n }\n end\n end", "def provider_class\n @provider_class ||= \"::Providers::#{self.provider.camelize}\".constantize.new(self)\n end", "def allowlist_or_whitelist_config(level)\n if Chef::Config[\"#{level}_attribute_whitelist\".to_sym]\n Chef.deprecated(:attribute_whitelist_configuration, \"Attribute whitelist configurations have been deprecated. Use the allowed_LEVEL_attribute configs instead\")\n Chef::Config[\"#{level}_attribute_whitelist\".to_sym]\n else\n Chef::Config[\"allowed_#{level}_attributes\".to_sym]\n end\n end", "def conf_name\n name\n end", "def name\n @provider_name\n end", "def call_provider(value)\n method = self.class.name.to_s + \"=\"\n unless provider.respond_to? method\n self.fail \"The #{provider.class.name} provider can not handle attribute #{self.class.name}\"\n end\n provider.send(method, value)\n end", "def goiardi_options\n new_resource.options ? new_resource.options : \"-c #{merged_conf[:'conf-root']}/#{new_resource.instance_name}.conf\"\n end", "def config_name\n self.class.name.demodulize.underscore\n end", "def set_adhoc_config_value!(key, value, data_type='String')\n config = \"UniversalAr::Config#{data_type.to_s.titleize}\".classify.constantize.find_or_create_by(subject: self, key: key)\n config.update(value: value)\n end", "def get_uplift_config_file \n config_dir_path = get_uplift_config_folder\n file_name = \".vagrant-network.yaml\"\n\n return File.join(config_dir_path, file_name) \n end", "def build_command\n \n # Initialise the excludes array\n excludes = Array.new\n \n # Fill the excludes array from the excludes listed in the config file\n if @ignore\n @ignore.each do |ignore|\n # Ability here to check for ! to see if we should use --include\n if(ignore[0,1] == \"!\")\n ignore.slice!(0)\n excludes << \" --include \\'#{ignore}\\'\"\n else\n excludes << \" --exclude \\'#{ignore}\\'\"\n end\n end\n end\n \n # Build the CLI excludes arguments for rsync\n exclude_cli = excludes.empty? ? '' : excludes.join\n \n # If we're in a dry run, set the rsync option\n dry_run = @dry_run ? ' --dry-run' : ''\n \n # Check for port and identity file\n ssh_options = Array.new\n\n if @remote.has_key?('port')\n if (port=@remote['port']).to_i > 0\n ssh_options << \"-p #{port}\"\n end\n end\n \n if @remote.has_key?('identity_file')\n ssh_options << \"-i #{File.expand_path @remote['identity_file']}\"\n end\n \n # Build additions if there are ssh_options in the array\n ssh_additions = ssh_options.empty? ? '' : \" -e '\" + (ssh_options.unshift('ssh')).join(' ') + \"'\"\n \n # Define the command\n @command = \"#{@rsync} -aiz --no-t --no-p --checksum --delete#{ssh_additions}#{dry_run} --exclude '.git' --exclude '.svn' --exclude '.gitignore' --exclude 'deploy-to.yml'#{exclude_cli} #{@base_dir}/ #{@remote_uri}\"\n \n end", "def configuration\n provider.configuration\n end", "def sync_prefer\n sync_host_port = get_host_port(get_container_name, UNISON_CONTAINER_PORT)\n case @options.fetch('sync_prefer', 'default')\n when 'default' then \"-prefer '#{@options['src']}' -copyonconflict\" # thats our default, if nothing is set\n when 'src' then \"-prefer '#{@options['src']}'\"\n when 'dest' then \"-prefer 'socket://#{@options['sync_host_ip']}:#{sync_host_port}'\"\n else \"-prefer '#{@options['sync_prefer']}'\"\n end\n end", "def provider_name\n object.provider_id.titleize\n end", "def inline_value_provider\n attributes.fetch(:inlineValueProvider)\n end", "def ldap_name(attribute)\n @puppet2ldap[attribute].to_s\n end", "def generate_config_for(mode)\n config_items = []\n @cluster_members.each do |mem|\n # The config item should match the structure NodeInfo\n # in node/cluster/membership.go in order for that one\n # to unmarshal successfully.\n config_item = {node_id: mem.id}\n if :docker.eql? mode\n config_item[:rpc_url] = \"#{mem.id}:#{mem.rpc_port}\"\n config_item[:api_url] = \"#{mem.id}:#{mem.api_port}\"\n else\n config_item[:rpc_url] = \"localhost:#{mem.rpc_port}\"\n config_item[:api_url] = \"localhost:#{mem.api_port}\"\n end\n config_items << config_item\n end\n config_items\n end", "def provider_cli\n @provider_cli ||= begin\n return nil unless name = settings.exists?(\"provider.name\")\n require \"cyoi/cli/providers/provider_cli_#{settings.provider.name}\"\n klass = self.class.provider_cli(settings.provider.name)\n klass.new(settings.provider, hl)\n end\n end", "def config_options\n {\n 'datacenter' => new_resource.datacenter,\n 'template_path' => new_resource.template_path,\n 'power_on' => true,\n 'datastore' => new_resource.datastore,\n 'wait' => true,\n 'hostname' => new_resource.hostname,\n 'name' => new_resource.name,\n 'customization_spec' => {\n 'domain' => new_resource.domain,\n 'ipsettings' => {\n 'ip' => new_resource.ip || node['vcac_vm']['ip'],\n 'gateway' => new_resource.gateway,\n 'subnetMask' => new_resource.subnet_mask,\n },\n }\n }\nend", "def aws_access_key_attribute\n\t\t\"provider_account_#{Digest::MD5.hexdigest(name || 'unknown')}_aws_access_key\"\n\tend", "def shared_config(config)\n config = apply_adapter_name(config)\n extract_base_config(config)\n end", "def edit_leaprc(property, value=nil)\n file_path = leaprc_path\n lines = []\n if File.exist?(file_path)\n regexp = /self\\.#{Regexp.escape(property)} = .*? if @provider_directory_path == '#{Regexp.escape(@provider_directory_path)}'/\n File.readlines(file_path).each do |line|\n unless line =~ regexp\n lines << line\n end\n end\n end\n unless value.nil?\n lines << \"self.#{property} = #{value.inspect} if @provider_directory_path == '#{@provider_directory_path}'\\n\"\n end\n File.open(file_path, 'w') do |f|\n f.write(lines.join)\n end\n rescue Errno::EACCES, IOError => exc\n Util::bail! :error, \"trying to save ~/.leaprc (#{exc}).\"\n end", "def crypto_provider(value = nil)\n config(:crypto_provider, value, CryptoProviders::Sha512)\n end", "def setconfig(str)\n add_cmd str\n end", "def partial_mirror_mode_config=(partial_mirror_mode_config)\n validator = EnumAttributeValidator.new('String', [\"platform-default\", \"disabled\", \"Percentage\", \"Value in GB\"])\n unless validator.valid?(partial_mirror_mode_config)\n fail ArgumentError, \"invalid value for \\\"partial_mirror_mode_config\\\", must be one of #{validator.allowable_values}.\"\n end\n @partial_mirror_mode_config = partial_mirror_mode_config\n end", "def edit_leaprc(property, value=nil)\n file_path = leaprc_path\n lines = []\n if File.exists?(file_path)\n regexp = /self\\.#{Regexp.escape(property)} = .*? if @provider_directory_path == '#{Regexp.escape(@provider_directory_path)}'/\n File.readlines(file_path).each do |line|\n unless line =~ regexp\n lines << line\n end\n end\n end\n unless value.nil?\n lines << \"self.#{property} = #{value.inspect} if @provider_directory_path == '#{@provider_directory_path}'\\n\"\n end\n File.open(file_path, 'w') do |f|\n f.write(lines.join)\n end\n rescue Errno::EACCES, IOError => exc\n Util::bail! :error, \"trying to save ~/.leaprc (#{exc}).\"\n end", "def config_for(node_name)\n data = @groups.data_for(node_name)\n if data\n Bolt::Util.symbolize_keys(data['config'])\n end\n end", "def config_for(key, value)\n \"#{key}=#{value && value}\\n\"\n end", "def config_client_LDAP\n\t\tldap_conf = File.read('/etc/openldap/ldap.conf')\n\n\t\t# Set the BASE suffix to match the BASE suffix from the slapd conf file\n\t\tldap_conf = ldap_conf.gsub(/#BASE\\tdc=example, dc=com/,\"BASE dc=cit470_Team_4,dc=nku,dc=edu\")\n\n\t\t\n\t\t# Write the ldap.conf file\n\t\tFile.open('/etc/openldap/ldap.conf','w'){|file| file.puts ldap_conf}\n\n\t\t# Configure LDAP ACL to allow password changes\n\n\t\tldap=\"access to attrs=userPassword\\nby self write\\nby anonymous auth\\nby * none\\naccess to *\\nby self write\\nby * read\"\n\t\tFile.open('/etc/openldap/ldap.conf','a') {|file| file.puts ldap}\n\t\t\n\tend", "def puppet_name(attribute)\n @ldap2puppet[attribute]\n end", "def config_spec\n @config_spec ||= begin\n spec = RbVmomi::VIM::DVSNetworkResourcePoolConfigSpec.new\n spec.name = resource_pool.name.dup\n spec.key = resource_pool.key.dup\n spec.description = resource_pool.description.dup\n spec.allocationInfo = resource_pool.allocationInfo.dup\n spec.allocationInfo.shares = resource_pool.allocationInfo.shares.dup\n spec.allocationInfo.shares.level = resource_pool.allocationInfo.shares.level.dup\n spec\n end\n end", "def command_config var, val\n config = @data_connection.options.merge({var.intern => val})\n @data_connection.set_options config\n end", "def encryptor_for(attr)\n conductor_for(attr).encryptor\n end", "def [](attr)\n config[attr]\n end", "def munge_config\n @data = @config.send(:data).instance_variable_get(:@data)\n @data[:driver][:instance_name] = @image.id\n suite = @data[:suites].find{ |n| n[:name] == @image.name }\n if suite && suite[:inherit]\n inherited = Linecook::Image.new(suite[:inherit][:name], suite[:inherit][:group], suite[:inherit][:tag])\n inherit(inherited)\n @data[:driver][:image] = \"#{inherited.group}:#{inherited.tag}\"\n @data[:driver][:provision_command] ||= []\n @data[:driver][:provision_command] << 'sed -i \\'s/\\(PasswordAuthentication no\\)/#\\1/g\\' /etc/ssh/sshd_config'\n end\n end", "def completion_provider\n attributes.fetch(:completionProvider)\n end", "def set_provider_config(vm_instance, ci_vm_definition)\n \n vm_instance.vm.provider :virtualbox do |vm|\n \n vm.linked_clone = ci_vm_definition[\"clone\"] || false\n \n vm.customize [\"modifyvm\", :id, \"--memory\", ci_vm_definition[\"memory\"] ]\n vm.customize [\"modifyvm\", :id, \"--cpus\", ci_vm_definition[\"cpu\"] ]\n\n vm.customize [\"modifyvm\", :id, \"--vram\", \"256\"]\n if ci_vm_definition[\"3d\"] == true then\n vm.customize [\"modifyvm\", :id, \"--accelerate3d\", \"on\"]\n else\n vm.customize [\"modifyvm\", :id, \"--accelerate3d\", \"off\"]\n end\n \n if ci_vm_definition[\"sound\"] == true then\n vm.customize [\"modifyvm\", :id, \"--audio\", \"null\", \"--audiocontroller\", \"hda\"]\n end\n \n vm.customize [\"modifyvm\", :id, \"--ioapic\", \"on\"]\n vm.customize [\"setextradata\", \"global\", \"GUI/SuppressMessages\", \"all\"]\n \n vm.gui = ci_vm_definition[\"gui\"] || true\n end\n \n vm_instance.vm.box = ci_vm_definition[\"box\"]\n \n end", "def mirror_locally=(value)\n cobbler('repo', 'edit', '--name=' + @resource[:name], '--mirror-locally=' + value.to_s)\n @property_hash[:mirror_locally]=(value.to_s)\n cobbler('reposync')\n end", "def url_safe_name\n self.config_type.downcase.gsub(/[^a-zA-Z0-9]+/, '-').chomp('-')\n end", "def config=(value); end", "def remote_sync_ftp\n @attributes[:remote_sync_ftp]\n end", "def boolean_attribute(attribute_name, _value)\n\t\t\t%(#{ATTRIBUTES_SEPARATOR}#{attribute_name}='#{attribute_name}')\n\t\tend", "def saml_provider_metadata_url\n @attributes[:saml_provider_metadata_url]\n end", "def get_config_file_project_name\n @metadata[\"short_dest_repo_name\"]\n end", "def provider_name(provider)\n I18n.t(provider, scope: 'account.provider_name')\n end", "def template_config\n File.read(options['puppet_config_template'])\nend", "def determine_rsync\n rsync = @shell.query('RSYNC', 'which rsync 2>/dev/null')\n\n if rsync.empty?\n rsync_cmd = '[ -f /root/.cloudflock/rsync ] && printf ' \\\n '\"/root/.rackspace/rsync\"'\n rsync = @shell.query('LOCAL_RSYNC', rsync_cmd)\n rsync = nil if rsync.empty?\n end\n\n @info[:rsync] = rsync\n end" ]
[ "0.5216947", "0.49287444", "0.4844968", "0.47720864", "0.4707512", "0.4686256", "0.4651102", "0.46352154", "0.46193302", "0.4615709", "0.46130505", "0.4597214", "0.45835844", "0.45732468", "0.45336094", "0.45269358", "0.45252028", "0.4524064", "0.45231974", "0.44971886", "0.44788754", "0.44503248", "0.44261268", "0.4417828", "0.44134045", "0.44013566", "0.4399068", "0.43984482", "0.43938926", "0.43847823", "0.4381037", "0.4377572", "0.43576977", "0.433723", "0.43212828", "0.43063948", "0.43027666", "0.4288483", "0.42694676", "0.42533603", "0.42190516", "0.4218229", "0.4215313", "0.4211536", "0.42041796", "0.41882196", "0.418174", "0.41689003", "0.41657203", "0.41643897", "0.41624337", "0.41616204", "0.41564015", "0.41538557", "0.41509074", "0.4139426", "0.41357526", "0.41354597", "0.4133671", "0.41287953", "0.4128196", "0.41268513", "0.4123286", "0.41198498", "0.41178873", "0.41143367", "0.41137233", "0.41133764", "0.4111437", "0.4107857", "0.4100111", "0.40831676", "0.40830752", "0.40822127", "0.4081805", "0.40800953", "0.407973", "0.4075", "0.40740484", "0.40730223", "0.40695056", "0.40666303", "0.40625384", "0.40602785", "0.40570965", "0.40557352", "0.40485686", "0.40472814", "0.4043154", "0.4041756", "0.4040437", "0.40342665", "0.40278795", "0.40233457", "0.40221074", "0.40166035", "0.40158308", "0.40122524", "0.40110186", "0.4006248" ]
0.407007
80
The list of rsync modules defined in the resource collection.
def rsync_modules rsync_resources.each_with_object({}) do |resource, hash| next unless resource.config_path == new_resource.config_path && ( resource.action == :add || resource.action.include?(:add) ) hash[resource.name] ||= {} resource_attributes.each do |key| value = resource.send(key) next if value.nil? hash[resource.name][attribute_to_directive(key)] = value end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rsync_modules\n rsync_resources.reduce({}) do |hash, resource|\n if resource.config_path == new_resource.config_path && (\n resource.action == :add ||\n resource.action.include?(:add)\n )\n hash[resource.name] ||= {}\n resource_attributes.each do |key|\n value = resource.send(key)\n next if value.nil?\n hash[resource.name][snake_to_space(key)] = value\n end\n end\n\n hash\n end\n end", "def rsync_resources\n run_context.resource_collection.select do |resource|\n resource.is_a?(Chef::Resource::RsyncServe)\n end\n end", "def modules\n @modules.values\n end", "def modules\n @modules.values\n end", "def modules(&block)\r\n if block_given?\r\n Ragweed::Wrap32::list_modules(@pid, &block)\r\n else\r\n ret = []\r\n Ragweed::Wrap32::list_modules(@pid) {|x| ret << x}\r\n return ret\r\n end\r\n end", "def list_modules\n pal.list_modules\n end", "def rest__list\n diff = ret_request_params(:diff)\n project = get_default_project()\n datatype = :module\n remote_repo_base = ret_remote_repo_base()\n\n opts = Opts.new(project_idh: project.id_handle())\n if detail = ret_request_params(:detail_to_include)\n opts.merge!(detail_to_include: detail.map(&:to_sym))\n end\n\n opts.merge!(remote_repo_base: remote_repo_base, diff: diff)\n datatype = :module_diff if diff\n\n rest_ok_response NodeModule.list(opts), datatype: datatype\n end", "def module_names\n @cache[:modules]\n end", "def modules_paths\n puppet_environment.full_modulepath\n end", "def rsync_resources\n ::ObjectSpace.each_object(::Chef::Resource).select do |resource|\n resource.resource_name == :rsync_serve\n end\nend", "def rest__list\n Log.info(MessageQueue.object_id)\n diff = ret_request_params(:diff)\n project = get_default_project()\n namespace = ret_request_params(:module_namespace)\n datatype = :module\n remote_repo_base = ret_remote_repo_base()\n\n opts = Opts.new(project_idh: project.id_handle())\n if detail = ret_request_params(:detail_to_include)\n opts.merge!(detail_to_include: detail.map(&:to_sym))\n end\n\n opts.merge!(remote_repo_base: remote_repo_base, diff: diff, namespace: namespace)\n datatype = :module_diff if diff\n\n # rest_ok_response filter_by_namespace(ComponentModule.list(opts)), :datatype => datatype\n rest_ok_response ComponentModule.list(opts), datatype: datatype\n end", "def rest__list\n diff = ret_request_params(:diff)\n project = get_default_project()\n datatype = :module\n remote_repo_base = ret_remote_repo_base()\n\n opts = Opts.new(project_idh: project.id_handle())\n if detail = ret_request_params(:detail_to_include)\n opts.merge!(detail_to_include: detail.map(&:to_sym))\n end\n\n opts.merge!(remote_repo_base: remote_repo_base, diff: diff)\n datatype = :module_diff if diff\n\n rest_ok_response filter_by_namespace(TestModule.list(opts)), datatype: datatype\n end", "def modules_paths\n puppet_environment.full_modulepath\n end", "def all_modules\n modules_hash.values\n end", "def modules\n Rails.cache.fetch(\"user_modules_#{self.id}\", expire_in: 1.month) do\n self.roles.map(&:parent_modules).flatten.uniq\n end\n end", "def module_config\r\n []\r\n end", "def modules\n @module_ids.collect { |idx| BModule.store[idx] }\n end", "def modules\n modules = {}\n\n begin\n mods = Pathname.new(@conf['mod_dir']).children.select(&:directory?)\n\n mods.each do |m|\n modules[m.basename.to_s] = mod_versions(m)\n end\n rescue StandardError => err\n Pem.log_error(err, @logger)\n raise(err)\n end\n\n modules\n end", "def unique_modules\n @unique_modules\n end", "def modules\n @modules ||= Array.new\n @modules\nend", "def modules(client_id)\n @modules[client_id.to_sym] || []\n end", "def modules\n @modules = @modules.call if @modules.is_a?(Proc)\n @modules\n end", "def submodules\n self.constants\n .map { |name| const_get(name) }\n .select { |const| const.class == Module }\n end", "def modules\n return @modules if @modules\n @modules = @context.modules.sort.find_all{|m| m.document_self}.collect{|m| R2Doc.all_references[m.full_name]}\n end", "def moduleList()\n res = \"\"\n leader = \" \"\n begin\n Dir.foreach($opdir) do |name|\n next unless name =~ /(.*)\\.rb$/\n require File.join(\"ri/op\", $1)\n klass = eval $1\n modDesc = klass::desc\n res << leader << $1 << \": \" << modDesc << \"\\n\"\n end\n rescue\n puts $!\n res = leader + \"no modules found...\"\n end\n res\nend", "def get_installed_modules_for_host(host)\n on host, puppet(\"module list --render-as pson\")\n str = stdout.lines.to_a.last\n pat = /\\(([^()]+)\\)/\n mods = str.scan(pat).flatten\n return mods\n end", "def app_modules\n @app_modules ||= []\n end", "def manifests\n file_list '{manifests,puppet}/**/*.pp'\n end", "def modules_hash\n @modules\n end", "def modules_hash\n @modules\n end", "def client_modules\n get 'client/modules'\n end", "def all_user_modules\n @all_user_modules ||= self.roles.map(&:modules).flatten.uniq\n end", "def folder_modules\n @folder_modules ||= (folder_lib + 'module')\n end", "def list_forge_modules(module_list)\n unless @options[:silent]\n puts \"\\nListing discovered modules from CLI and/or Puppetfile:\\n\\n\"\n module_list.each do |name|\n puts \" #{name}\"\n end\n puts ''\n end\n end", "def select_all_command_modules\n @body = command_modules2json(BeEF::Modules.get_enabled.keys)\n end", "def get_module_dirs(method='tracking')\n load_puppetfile(method)\n module_paths.select{|x| File.basename(File.dirname(x)) == 'modules'}.sort\n end", "def get_repo_list\n Chef::Log.debug(\n \"Fetching all versions of #{new_resource.module_name} \" +\n \"from #{new_resource.repository}.\",\n )\n latest = powershell_out!(\n <<-EOH,\n $splat = @{\n Name = \"#{new_resource.module_name}\"\n Repository = \"#{new_resource.repository}\"\n AllVersions = $True\n }\n (Find-Module @splat).Version.ForEach({$_.ToString()})\n EOH\n ).stdout.to_s.chomp.split(\"\\r\\n\")\n Chef::Log.debug(\"Available versions: #{latest.join(', ')}\")\n\n return latest.map { |v| Gem::Version.new(v) }\n end", "def fetch_syncables\n gh_client.repos.list.select{|repo| repo.permissions.admin}.map(&:full_name)\n end", "def modules\n all(QTest::Module, project: @id)\n end", "def get_list\n @list_of_repos\n end", "def referenced_modules\n # TODO: check content type before scanning\n content.scan(/\\s*(include|extend)\\s+([A-Za-z0-9_\\.]*)/).map { |_, m| m }.uniq\n end", "def sites_to_load\n @appl_settings[:registered_config_modules]\n end", "def files\n return unless git_repo?\n output = Licensed::Shell.execute(\"git\", \"ls-files\", \"--full-name\", \"--recurse-submodules\")\n output.lines.map(&:strip)\n end", "def inspect_modules\n modules = []\n\n if constant.respond_to?(:ancestors)\n parent = inspect_superclass\n\n # Take all the modules included *directly* into the constant.\n modules = constant.ancestors.take_while do |ancestor|\n parent && ancestor != parent\n end\n\n # Get rid of non Module instances and modules that don't have a name.\n modules = modules.select do |mod|\n mod.instance_of?(Module) && mod.name\n end\n end\n\n return modules\n end", "def modules\n content_offset = self.content_offset\n catalog_header = self.words[content_offset+0]\n first_space_block = catalog_header.half_word[0].to_i\n return nil unless first_space_block == 1\n next_catalog_block = catalog_header.half_word[1].to_i\n sectors = self.sectors\n return nil unless next_catalog_block < sectors\n available_space_block_offset = WORDS_PER_SECTOR\n available_space_block_header = self.words[content_offset+available_space_block_offset]\n return nil unless available_space_block_header.half_word[0].to_i == 0\n next_available_spack_block = available_space_block_header.half_word[1].to_i\n return nil unless next_available_spack_block < sectors\n return nil unless compare_executable_checksum(0)\n return nil unless compare_executable_checksum(available_space_block_offset)\n mods = []\n (EXECUTABLE_MODULE_CATALOG_OFFSET...(WORDS_PER_SECTOR-EXECUTABLE_MODULE_CATALOG_SIZE)).step(EXECUTABLE_MODULE_CATALOG_SIZE) do |i|\n module_name = self.words[content_offset+i].bcd_string\n flag_word = self.words[content_offset+i+1]\n type, blocks, first_block = self.class.split_executable_module_flag(flag_word)\n end_block = first_block + blocks\n return nil if type > 3\n return nil if end_block > sectors\n mods << module_name if blocks > 0\n end\n mods\n end", "def included_modules\n end", "def included_modules; end", "def kernel_modules\n cmd_exec('cat /proc/modules').to_s.scan(/^[^ ]+/)\n rescue\n raise 'Could not determine kernel modules'\n end", "def modules_hash\n @modules_hash\n end", "def defined_modules\n # TODO: check content type before scanning\n content.scan(/\\s*module\\s+([A-Za-z0-9_\\.]*)/).flatten\n end", "def global_modules\n node['rsyncd']['globals'].reduce({}) do |hash, (key, value)|\n hash[snake_to_space(key)] = value unless value.nil?\n hash\n end\n end", "def modules\n @registry.values\n .sort_by { |x| x.respond_to?(:priority) ? x.priority : 0 }\n .reverse\n end", "def list\n puts local_resources.map { |name, resource| name }.join(\" \")\n end", "def childModules()\n\t\t\t\tlist = []\t\t\t\n\t\t\t\tdir = Dir.new( path() )\n\t\n\t\t\t\tdir.each do |file|\n\t\t\t\t\tnext unless File.directory?( path() + \"/\" + file )\n\t\t\t\t\tnext if ( file[/^([A-Z][a-z]*)+$/] == nil )\n\t\t\t\t\tlist << childModule( $1 )\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\treturn list\n\t\t\tend", "def listAdmin\n super()\n updateModules()\n\n if @modulesUsed.include?(\"Autograde\") then\n autogradeListAdmin()\n end\n\n if @modulesUsed.include?(\"Scoreboard\") then\n scoreboardListAdmin()\n end\n\n if @modulesUsed.include?(\"Partners\") then\n partnersListAdmin()\n end\n \n if @modulesUsed.include?(\"Svn\") then\n svnListAdmin()\n end\n end", "def orm_modules\n if Merb.const_defined?('Orms')\n Merb::Orms.constants.map { |c| Merb::Orms::const_get(c) }\n else\n []\n end\n end", "def modules\n raise CapabilitiesExceeded\n end", "def dependent_modules\n out = [ ]\n @dependencies.each { |dependency| out << @module_set[dependency] }\n out\n end", "def extension_modules\n local_extensions =\n class <<self\n included_modules-Object.included_modules\n end\n if local_extensions.size > 0\n local_extensions\n else\n [] # There weren't any; must be a literal node\n end\n end", "def all_extensions\n r = []\n manager.Get.each do |ext|\n r << ext\n end\n r\n end", "def files\n modules = (changed?) ? tag_configuration_plugins.collect {|p| p.plugin.modules} : \n plugins.collect {|p| p.modules}\n modules << Plugin::JshubCore.instance.modules\n modules.flatten!\n modules.sort!\n modules.uniq.collect { |m| m.name }\n end", "def index\n @process_modules = ProcessModule.all\n end", "def gaudi_modules\n @config[\"gaudi_modules\"] ||= []\n return @config[\"gaudi_modules\"]\n end", "def list_addons\n Dir.glob(\"/var/lib/apollo/addons/*.gem\")\n end", "def list_modules module_type\n if module_type.empty?\n @colour.help \"ForGen module types: #{MODULE_TYPES}\"\n return\n end\n\n if MODULE_TYPES.include? module_type\n @colour.help \"Listing modules of type #{module_type}:\"\n Dir[\"#{DIR_MODULES}/#{module_type}/**/forgen_metadata.xml\"].select{ |file| !File.directory? file }.each_with_index do |case_name, case_number|\n @colour.help \"#{case_number}) #{case_name}\"\n end\n else\n @colour.error \"Module type [#{module_type}] does not exist\"\n end\nend", "def global_modules\n node['rsyncd']['globals'].each_with_object({}) do |(key, value), hash|\n hash[attribute_to_directive(key)] = value unless value.nil?\n end\nend", "def module_names(set)\n\t\tmodule_sets[set] ? module_sets[set].keys.dup : []\n\tend", "def list\n @@extensions\n end", "def list_imported(regex=//, mib_dir=DEFAULT_MIB_PATH)\n list = []\n Dir[\"#{mib_dir}/*.#{MODULE_EXT}\"].each do |name|\n module_name = File.basename(name, \".*\")\n list << module_name if module_name =~ regex\n end\n list\n end", "def payloads\n\t\treturn module_sets[MODULE_PAYLOAD]\n\tend", "def included_in_modules\n modules = []\n ObjectSpace.each_object(Module) { |k| modules << k if k.included_modules.include?(self) }\n\n modules.reverse.inject([]) do |unique_modules, klass|\n unique_modules << klass unless unique_modules.collect { |k| k.to_s }.include?(klass.to_s)\n unique_modules\n end\n end", "def included_methods\n included_modules.map(&:instance_methods).flatten\n end", "def resource_groups\n @client.resource_groups.list\n end", "def modules; end", "def modules; end", "def modules; end", "def names\n $LOAD_MANAGER.keys\n end", "def resourcegroups\n result = @http.get('/resourcegroups')\n result[1]\n end", "def list\n @repos\n end", "def resources\n Loader.resources.keys\n end", "def included_modules() end", "def list\n display \"Available rsync backup profiles:\"\n\n profiles = _profiles\n\n if profiles.blank?\n return []\n end\n\n profiles.each do |profile|\n display profile['name']\n end\n\n return profiles\n end", "def resource_groups\n refs = references(:resource_groups)\n\n return [] if refs.blank?\n\n refs = refs.map { |x| File.basename(x) }.uniq\n\n @resource_groups ||= if refs.size > record_limit\n set = Set.new(refs)\n collect_inventory(:resource_groups) { @rgs.list(:all => true) }.select do |resource_group|\n set.include?(File.basename(resource_group.id.downcase))\n end\n else\n collect_inventory_targeted(:resource_groups) do\n filter_my_region_parallel_map(refs) do |ref|\n safe_targeted_request { @rgs.get(ref) }\n end\n end\n end\n rescue ::Azure::Armrest::Exception => err\n _log.error(\"Error Class=#{err.class.name}, Message=#{err.message}\")\n []\n end", "def resource_list\n self.resources\n end", "def all_deploy_names reload=false\n return @all_deploy_names if @all_deploy_names && !reload\n\n @all_deploy_names =\n @shell.call(\"ls -rc1 #{self.deploys_path}\").split(\"\\n\")\n end", "def active\n Vimius.config[:submodules].map do |submodule|\n self.submodule(submodule)\n end\n rescue NoMethodError\n []\n end", "def puppet_modules(id)\n criteria = {:type_ids => [Runcible::Extensions::PuppetModule.content_type]}\n unit_search(id, criteria).map { |i| i['metadata'].with_indifferent_access }\n end", "def submodule_dirs\n # Implementation is a little hacky; we run a git command and parse the\n # output.\n cmd = %(git submodule)\n %x(#{cmd}).split(/\\n/).map {|line| line.split(\" \")[1] }\n end", "def service_modules\n modules = []\n ObjectSpace.each_object(Module) do |clazz|\n if clazz < Thrift::Client\n modules << qualified_const(clazz.name.split('::')[0..-2].join('::')) # i miss activesupport...\n end\n end\n modules.delete(Thrift)\n modules\n end", "def dsl_methods\n (Chef::Node.public_instance_methods +\n Chef::Mixin::RecipeDefinitionDSLCore.included_modules.map{|mixin| mixin.public_instance_methods}).flatten.sort.uniq\n end", "def module_extensions(module_)\n current_module_dir = module_dir(module_)\n\n current_module_dir_length = current_module_dir.length + 1\n extensions = Dir[\"#{current_module_dir}/**/*.rb\"].map do |e|\n e[current_module_dir_length..]\n end\n\n extensions.sort!\n extensions\n end", "def names\n fs = []\n %w( READ_WRITE WRITE_ONLY READ_ONLY USE_HOST_PTR ALLOC_HOST_PTR COPY_HOST_PTR HOST_WRITE_ONLY HOST_READ_ONLY HOST_NO_ACCESS ).each { |f|\n fs.push(f) if self.include?( self.class.const_get(f) )\n }\n return fs\n end", "def list\n Dir.glob(\"#{App.config.resource_directory}/*.yaml\").each do |res|\n puts File.basename(res, '.yaml')\n end\n end", "def list\n ridley.environment.all\n end", "def manifests\n api.get('manifests')\n end", "def extended_modules; end", "def module_types\n\t\tmodule_sets.keys.dup\n\tend", "def list_tasks\n config = instantiate_configuration\n config.load 'deploy'\n \n set_up_config(config)\n \n config.task_list(:all)\n end", "def enabled_menu_items\n RetroAM.sorted_menu_items(enabled_modules)\n end", "def command_list\n collect_do - subcommand_list\n end" ]
[ "0.68783104", "0.6765492", "0.66543984", "0.66543984", "0.66269475", "0.64176303", "0.62857777", "0.62831575", "0.6125616", "0.6101923", "0.60965484", "0.60701025", "0.6050221", "0.601773", "0.6007573", "0.59747803", "0.59716237", "0.596777", "0.5943893", "0.5943103", "0.5901777", "0.585741", "0.58469594", "0.58013386", "0.5792901", "0.57672745", "0.5763858", "0.575351", "0.57210153", "0.57210153", "0.5695206", "0.56701505", "0.56443477", "0.5632341", "0.56130147", "0.5607623", "0.55931056", "0.5584983", "0.5581941", "0.55602944", "0.5515225", "0.5495601", "0.549457", "0.54884094", "0.5486833", "0.5486606", "0.5466311", "0.5453713", "0.5439811", "0.54387724", "0.54374826", "0.5437356", "0.54184496", "0.5417028", "0.54038256", "0.5401344", "0.5394162", "0.53815305", "0.5378232", "0.537282", "0.5365945", "0.53624153", "0.5351772", "0.53367555", "0.53356296", "0.53351617", "0.5326084", "0.5304396", "0.5301725", "0.5300556", "0.5300363", "0.5299121", "0.52900404", "0.52834", "0.52834", "0.52834", "0.52807635", "0.52773803", "0.5265447", "0.52625465", "0.5248751", "0.5248503", "0.5242242", "0.52183914", "0.5205629", "0.5199444", "0.51834357", "0.5179984", "0.51706654", "0.5156152", "0.5154616", "0.5146825", "0.5131077", "0.51241213", "0.51239187", "0.5120548", "0.5116744", "0.5104338", "0.5085875", "0.50840867" ]
0.66638005
2
The global rsync configuration
def global_modules node['rsyncd']['globals'].each_with_object({}) do |(key, value), hash| hash[attribute_to_directive(key)] = value unless value.nil? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rsync_command_options\n options = ['-rl']\n options << rsync_excludes if rsync_excludes\n options << \"--exclude-from='#{@config[:rsync][:exclude_file]}'\" if @config[:rsync][:exclude_file]\n options << \"--owner --group --chown='#{@config[:rsync][:chown]}'\" if @config[:rsync][:chown]\n options << \"--chmod='#{@config[:rsync][:chmod]}'\" if @config[:rsync][:chmod]\n options << '--delete' if @config[:rsync][:delete]\n options\n end", "def determine_rsync\n rsync = @shell.query('RSYNC', 'which rsync 2>/dev/null')\n\n if rsync.empty?\n rsync_cmd = '[ -f /root/.cloudflock/rsync ] && printf ' \\\n '\"/root/.rackspace/rsync\"'\n rsync = @shell.query('LOCAL_RSYNC', rsync_cmd)\n rsync = nil if rsync.empty?\n end\n\n @info[:rsync] = rsync\n end", "def rsync_command\n if @config[:rsync][:direction] == 'up'\n from = absolute_path(@config[:local_path])\n to = @config.ssh_user_and_host + ':' + @config[:remote_path]\n else\n from = @config.ssh_user_and_host + ':' + @config[:remote_path]\n to = absolute_path(@config[:local_path])\n end\n \"rsync #{rsync_command_options.join(' ')} '#{from}/' '#{to}'\"\n end", "def rsync_options\n \"-z\"\n end", "def rsync_command\n utility(:rsync).dup <<\n archive_option <<\n mirror_option <<\n exclude_option <<\n \" #{Array(additional_rsync_options).join(\" \")}\".rstrip\n end", "def initialize\n @totalReadData = 0\t\t# variable for counting bytes read from rsync\n @rsync_path = \"/opt/local/bin/rsync\"\n end", "def rsync(wait = false)\n @config ||= LockStep::Config\n @config.destinations.each do |destination|\n # See if we're to use an SSH key\n # and make sure it exists\n ssh_key = false\n if destination.identity_file and destination.hostname\n identity_file = File.expand_path(destination.identity_file)\n ssh_key = identity_file if File.exists?(identity_file)\n end\n\n # Build the rsync command\n command = \"rsync -avz \"\n command << \"-e 'ssh -i #{ssh_key}' \" if ssh_key\n command << \"--delete \" if destination.cleanup\n command << \"#{@config.source_path}/ \"\n command << \"#{destination.user}@\" if destination.user and destination.hostname\n command << \"#{destination.hostname}:\" if destination.hostname\n command << \"#{destination.path}/\"\n\n # A little latency\n sleep 1 if wait\n\n # Re-direct stdout to the log file if we're meant to\n LockStep::Logger.redirect_stdout\n # Run the command\n system command\n end\n rescue Exception => e\n LockStep::Logger.write \"Caught #{e}\"\n end", "def get_rsync(options)\n 'rsync ./ ' + options[:full_path]\n end", "def sync_local\n sync_hash = {\n ['~/Library/Application\\\\ Support/Firefox', '~/Library/Application\\\\ Support/Quicksilver',\n '~/Library/Preferences' ] =>'library/',\n ['~/.boson', '~/.sake', '~/.cronrc', '~/.gemrc', '~/.gitconfig', '~/.gem/specs']=>'dotfiles/',\n }\n sync_hash.each do |src, dest|\n src.each do |e| \n cmd = \"rsync -av #{e} #{File.join('~/backup', dest)}\"\n system cmd\n end\n end\n end", "def write_conf\n template(new_resource.config_path) do\n source 'rsyncd.conf.erb'\n cookbook 'rsync'\n owner 'root'\n group 'root'\n mode '0640'\n variables(\n globals: global_modules,\n modules: rsync_modules\n )\n notifies :restart, \"service[#{node['rsyncd']['service']}]\", :delayed\n end\n\n service node['rsyncd']['service'] do\n action :nothing\n end\nend", "def sync_configuration\n end", "def add_common_configs config\n # Mount the synced folders.\n self.synced_folders do | entry |\n config.vm.synced_folder entry[\"path\"], entry[\"name\"]\n end\n # Forward the ssh port. The id ensures that this is used instead of 2222\n # rather than in addition to.\n config.vm.network :forwarded_port, host: self.ssh_port, guest: 22, id: \"ssh\"\n end", "def sync_config\n return unless config.config_files\n upload_files(config.config_files, release_path.join('config'))\n end", "def rsync_cmd\n cmd = \"rsync -ra #{@path}/* #{@dir}\"\n\n # exclude the files\n excludes.each do |x|\n cmd << \" --exclude=#{x}\"\n end\n\n cmd\n end", "def send_config_files_to_nodes(c)\n run_array_of_tasks(rsync_tasks(\"#{base_tmp_dir}/*\", \"#{remote_base_tmp_dir}\"))\n end", "def rsync_resources\n run_context.resource_collection.select do |resource|\n resource.is_a?(Chef::Resource::RsyncServe)\n end\n end", "def command_for_rsync\n args = []\n args << \"-l #{@options[:user]}\" if @options[:user]\n args << \"-p #{@options[:port]}\" if @options[:port]\n if @options[:keys]\n @options[:keys].each { |key| args << \"-i #{key}\" }\n end\n \"ssh #{args.join(' ')}\"\n end", "def rsync(*sources)\n # Default options include --inplace because we only care about consistency\n # at the end of the job, and rsync will do more work for big files without\n # it.\n #\n # rsync can spend a long time at the far end checking over its files at\n # the far end without transfer, so we want to wait as long as possible\n # without jeopardising the timing of the next backup run.\n #\n #\n args = %w( rsync --archive --xattrs --numeric-ids --delete-excluded --delete-during --inplace --relative )\n\n #\n # Add on the I/O-timeout\n #\n args += ['--timeout', @io_timeout.to_s ] unless ( @io_timeout.nil? )\n\n\n args += ['--rsh', \"ssh -o BatchMode=yes -x -a -i #{@ssh_key} -l #{@destination_user}\"]\n args << '--verbose' if @verbose\n args += @excludes.map { |x| ['--exclude', x] }.flatten\n\n #\n # Add in the rsync excludes and sources files, if present.\n #\n if File.exist?('/etc/byteback/excludes')\n args += ['--exclude-from', '/etc/byteback/excludes']\n end\n\n #\n # Add in an rsync_filter if required.\n #\n if File.exist?('/etc/byteback/rsync_filter')\n args += ['--filter', 'merge /etc/byteback/rsync_filter']\n end\n\n #\n # To add extra rsync flags, a file can be used. This can have flags all on one line, or one per line.\n #\n if File.exist?('/etc/byteback/rsync_flags')\n args += File.readlines('/etc/byteback/rsync_flags').map(&:chomp)\n end\n\n args += ['--rsync-path', 'rsync --fake-super']\n\n args += sources\n args << @destination\n\n log_system(*args)\nend", "def apply_config_settings\n with_setting(:purgedirs) do |purgedirs|\n logger.warn(\"The purgedirs key in r10k.yaml is deprecated. It is currently ignored.\")\n end\n\n with_setting(:cachedir) do |cachedir|\n R10K::Git::Cache.settings[:cache_root] = cachedir\n end\n\n with_setting(:forge) do |forge_settings|\n R10K::Util::SymbolizeKeys.symbolize_keys!(forge_settings)\n proxy = forge_settings[:proxy]\n if proxy\n R10K::Forge::ModuleRelease.settings[:proxy] = proxy\n end\n\n baseurl = forge_settings[:baseurl]\n if baseurl\n R10K::Forge::ModuleRelease.settings[:baseurl] = baseurl\n end\n end\n\n with_setting(:git) do |git_settings|\n R10K::Util::SymbolizeKeys.symbolize_keys!(git_settings)\n provider = git_settings[:provider]\n if provider\n R10K::Git.provider = provider.to_sym\n end\n\n if git_settings[:private_key]\n R10K::Git.settings[:private_key] = git_settings[:private_key]\n end\n\n if git_settings[:username]\n R10K::Git.settings[:username] = git_settings[:username]\n end\n end\n end", "def rsync_resources\n ::ObjectSpace.each_object(::Chef::Resource).select do |resource|\n resource.resource_name == :rsync_serve\n end\nend", "def init_shared_folder(config, settings)\n\n if settings['shared_folder_type'] == \"rsync\"\n # args: do not copy symlinks\n config.vm.synced_folder \"../../\", \"/vagrant\", type: \"rsync\",\n rsync__exclude: settings['rsync_exclude'],\n rsync__chown: true,\n rsync__args: [\"--verbose\", \"--archive\", \"--delete\", \"-z\"]\n else\n config.vm.synced_folder \"../../\", \"/vagrant\", type: \"nfs\", mount_options: [\"rw\", \"tcp\", \"nolock\", \"async\"], nfs_udp: false\n config.nfs.map_uid = Process.uid\n config.nfs.map_gid = Process.gid\n end\n\nend", "def ReadGlobalConfig()\n\n # Load config file\n begin\n conf = YAML.load_file(\"#{$confdir}/#{$globalConfFile}\")\n rescue\n puts \"Unable to locate #{$confdir}/#{$globalConfFile}\"\n conf = {}\n end\n\n Dir.glob(\"#{$confdir}/#{$globalConfDir}/*.yaml\") {|f|\n begin\n conf.merge!(YAML.load_file(f))\n rescue\n puts \"Unable to locate #{f}\"\n conf = {}\n end\n }\n\n $sections.each {|o|\n conf[o] = [] if conf[o].nil?\n }\n conf[:globalConfFile] = \"#{$confdir}/#{$globalConfFile}\"\n conf[:globalConfDir] = \"#{$confdir}/#{$globalConfDir}\"\n\n altConfFile = \"#{$curdir}/.rake/#{$globalConfFile}\"\n if File.exists?(altConfFile)\n begin\n puts \"Reading local config file #{altConfFile}\" if $verbose\n c = YAML.load_file(altConfFile)\n raise \"Invalid yaml file\" if not c\n\n # surcharge d'options\n $sections.each {|s|\n next if c[s].nil?\n if $sections_uniq.include?(s)\n # remove then add option\n c[s].each {|o|\n o2 = o.gsub(/=.*/, \"=\")\n conf[s].delete_if {|o3| o3.start_with?(o2)}\n conf[s].push o\n }\n else\n c[s].each {|o|\n if o[0] == \"!\"\n # delete option\n conf[s].delete o[1..-1]\n else\n # just add option\n conf[s].push o\n end\n }\n end\n }\n rescue\n puts \"Error loading #{altConfFile}\"\n end\n end\n \n conf.each {|k,v|\n if v.class == Array\n conf[k].each_index {|i|\n conf[k][i].gsub!(/%B/, $basedir) if conf[k][i].class == String\n conf[k][i].gsub!(/%b/, $confdir) if conf[k][i].class == String\n }\n else\n conf[k].gsub!(/%B/, $basedir) if conf[k].class == String\n conf[k].gsub!(/%b/, $confdir) if conf[k].class == String\n end\n }\n\n return conf\nend", "def configure\n super()\n syncer_klass.configure(settings) if syncer_klass\n end", "def rsync( srcs, target, opts )\n @commands << rsync_args( host, srcs, target, opts )\n ( rand(2) == 1 ) ? [ [ 'something', 'somefile' ] ] : []\n end", "def config\n runconfig = load_runconfig(File.dirname(@msrun.rawfile))\n @msrun.group ||= runconfig[:group]\n @msrun.user ||= runconfig[:username]\n @msrun.rawid ||= File.basename(@msrun.rawfile, \".RAW\")\n end", "def sync(params)\n if params.has_key?(:group)\n group = params[:group]\n if @environment.in_dry_run_mode\n notify(:msg => \"[#{@name}] Would sync configurations for load balancer #{@config[:host]} to group #{group}\",\n :tags => [:f5, :dryrun])\n else\n notify(:msg => \"[#{@name}] Syncing configurations for load balancer #{@config[:host]} to group #{group}\",\n :tags => [:f5, :trace])\n with_f5('System.ConfigSync') do\n synchronize_to_group(group)\n end\n end\n else\n if @environment.in_dry_run_mode\n notify(:msg => \"[#{@name}] Would sync configurations for load balancer #{@config[:host]}\",\n :tags => [:f5, :dryrun])\n else\n notify(:msg => \"[#{@name}] Syncing configurations for load balancer #{@config[:host]}\",\n :tags => [:f5, :trace])\n with_f5('System.ConfigSync') do\n synchronize_configuration('CONFIGSYNC_ALL')\n end\n end\n end\n nil\n end", "def rsync_with dir\n rsync_options = \"-avP --exclude '*svn*' --exclude '*swp' --exclude '*rbc'\" +\n \" --exclude '*.rej' --exclude '*.orig' --exclude 'lib/rubygems/defaults/*'\"\n sh \"rsync #{rsync_options} bin/gem #{dir}/bin/gem\"\n sh \"rsync #{rsync_options} lib/ #{dir}/lib\"\n sh \"rsync #{rsync_options} test/ #{dir}/test/rubygems\"\n sh \"rsync #{rsync_options} util/gem_prelude.rb #{dir}/gem_prelude.rb\"\nend", "def init_config_folder\n copy_file('config/app.js', src_path('config/app.js'))\n copy_file('config/routes.js', src_path('config/routes.js'))\n copy_file('config/router.js', src_path('config/router.js'))\n end", "def apply_config_settings\n cachedir = setting(:cachedir)\n if cachedir\n R10K::Git::Cache.settings[:cache_root] = cachedir\n end\n end", "def config_for(dest_path, sync_config_path = nil)\n module_root = PDK::Util.module_root\n sync_config_path ||= File.join(module_root, '.sync.yml') unless module_root.nil?\n config_path = File.join(@path, 'config_defaults.yml')\n\n if @config.nil?\n conf_defaults = read_config(config_path)\n sync_config = read_config(sync_config_path) unless sync_config_path.nil?\n @config = conf_defaults\n @config.deep_merge!(sync_config, knockout_prefix: '---') unless sync_config.nil?\n end\n file_config = @config.fetch(:global, {})\n file_config['module_metadata'] = @module_metadata\n file_config.merge!(@config.fetch(dest_path, {})) unless dest_path.nil?\n file_config.merge!(@config)\n end", "def rsync_storage_files_to(instance=nil)\n hide_output {Kernel.system \"#{rsync_storage_files_to_command(instance)}\" if instance}\n end", "def config(kb_tenant_id=nil)\n @@glob_config.merge(get_tenant_config(kb_tenant_id) || {})\n end", "def sync_cmd\n \"rsync --delete -avzhe '#{@ssh_path} -p #{@port}' #{cygdrive_path @log_dir} #{user_at_host}:#{@remote_log_parent_dir}\"\n end", "def config_files(override); end", "def global_config\n # This entire VM Pooler config\n @config\n end", "def configuration_file\n gitpusshuten_root + '/config.rb'\n end", "def config\n config = PcaprLocal::Config.config\n config['couch']['database'] = \"#{config['couch']['database']}_test\"\n config['install_dir'] = \"/tmp/pcapr_local_test\"\n config['pcap_dir'] = \"/tmp/pcapr_local_test/pcaps\"\n config['index_dir'] = \"/tmp/pcapr_local_test/indexes\"\n config['app']['port'] = config['app']['port'].to_i + 1\n config\n end", "def config\n config = PcaprLocal::Config.config\n config['couch']['database'] = \"#{config['couch']['database']}_test\"\n config['install_dir'] = \"/tmp/pcapr_local_test\"\n config['pcap_dir'] = \"/tmp/pcapr_local_test/pcaps\"\n config['index_dir'] = \"/tmp/pcapr_local_test/indexes\"\n config['app']['port'] = config['app']['port'].to_i + 1\n config\n end", "def run!(options)\n display \"Initialising Ssync, performing pre-sync checks ...\"\n\n e! \"Couldn't connect to AWS with the credentials specified in '#{config_path}'.\" unless Setup.aws_credentials_is_valid?\n e! \"Couldn't find the S3 bucket specified in '#{config_path}'.\" unless Setup.bucket_exists?\n e! \"The local path specified in '#{config_path}' does not exist.\" unless Setup.local_file_path_exists?\n\n if options.force?\n display \"Clearing previous sync state ...\"\n clear_sync_state\n end\n create_tmp_sync_state\n\n if last_sync_recorded?\n display \"Performing time based comparison ...\"\n files_modified_since_last_sync\n else\n display \"Performing (potentially expensive) MD5 checksum comparison ...\"\n display \"Generating local manifest ...\"\n generate_local_manifest\n display \"Traversing S3 for remote manifest ...\"\n fetch_remote_manifest\n # note that we do not remove files on s3 that no longer exist on local host.\n # this behaviour may be desirable (ala rsync --delete) but we currently don't support it.\n display \"Performing checksum comparison ...\"\n files_on_localhost_with_checksums - files_on_s3\n end.each do |file|\n encrypt_file(file) if encrypting?\n push_file(file)\n end\n\n finalize_sync_state\n\n display \"Sync complete!\"\n clean_up_encrypted(true) if encrypting?\n \n end", "def configsyncd_state\n super\n end", "def config_for(dest_path, sync_config_path = nil)\n require 'pdk/util'\n require 'pdk/analytics'\n\n module_root = PDK::Util.module_root\n sync_config_path ||= File.join(module_root, '.sync.yml') unless module_root.nil?\n config_path = File.join(@path, 'config_defaults.yml')\n\n if @config.nil?\n require 'deep_merge'\n conf_defaults = read_config(config_path)\n @sync_config = read_config(sync_config_path) unless sync_config_path.nil?\n @config = conf_defaults\n @config.deep_merge!(@sync_config, knockout_prefix: '---') unless @sync_config.nil?\n end\n file_config = @config.fetch(:global, {})\n file_config['module_metadata'] = @module_metadata\n file_config.merge!(@config.fetch(dest_path, {})) unless dest_path.nil?\n file_config.merge!(@config).tap do |c|\n if uri.default?\n file_value = if c['unmanaged']\n 'unmanaged'\n elsif c['delete']\n 'deleted'\n elsif @sync_config && @sync_config.key?(dest_path)\n 'customized'\n else\n 'default'\n end\n\n PDK.analytics.event('TemplateDir', 'file', label: dest_path, value: file_value)\n end\n end\n end", "def config\n @config ||= { :force => false, :quiet => false }\n end", "def sub_config\n puts config_script\n shell(config_script, source_dir(true))\n end", "def rsync(path,options = {})\n unless !File.exists?(path)\n env.ui.info \"[#{@name}] - rsyncing #{path}\"\n command=\"rsync -q --exclude '.DS_Store' --delete -az -e 'ssh #{ssh_commandline_options(options)}' '#{path}/' '#{@user}@#{self.ip_address}:/tmp/#{File.basename(path)}/'\"\n else\n env.ui.info \"[#{@name}] - rsync error: #{path} does no exist\"\n exit\n end\n\n result=ShellResult.new(\"\",\"\",-1)\n env.ui.info \"#{command}\" unless options[:mute]\n IO.popen(\"#{command}\") { |p|\n p.each_line{ |l|\n result.stdout+=l\n print l unless options[:mute]\n }\n result.status=Process.waitpid2(p.pid)[1].exitstatus\n if result.status!=0\n env.ui.info \"Exit status was not 0 but #{result.status}\" unless options[:mute]\n end\n }\n return result\n end", "def sync!\n begin \n FileUtils.touch lock_file_name\n\n rsync_type = seq_complete? ? 'final' : 'partial'\n logger.info \"Starting #{rsync_type} rsync...\"\n\n source_dir = Shellwords.escape(\"#{run_dir}/\")\n dest_dir = Shellwords.escape(File.join(Conf.global_conf[:safe_location_dir], run_name))\n\n Rsync.run(source_dir, dest_dir, '-raP') do |result|\n\n if result.success?\n result.changes.each do |change|\n logger.info \"#{change.filename} (#{change.summary})\"\n end\n logger.info \"#{result.changes.count} change(s) sync'd.\"\n logger.info \"End of #{rsync_type} rsync.\"\n else\n raise Errors::RsyncProcessError.new(\n \"'rsync' exited with nonzero status (#{rsync_type} rsync), motivation: #{result.error}\")\n end\n end\n\n rescue => e\n logger.error \"#{e.class} encountered while performing the sync'ing step\"\n logger.error e.message\n logger.error \"trace:\\n#{e.backtrace.join(\"\\n\")}\"\n Mailer.notify_admins(self, 'sync', e)\n ensure\n FileUtils.rm lock_file_name if File.exists?(lock_file_name)\n end\n end", "def fetch_sync_yml\n if @owner == Pluginsync::Github::INTEL_ORG\n path = File.join(Pluginsync::PROJECT_PATH, 'config_defaults.yml')\n config = Pluginsync::Util.load_yaml(path)\n config.extend Hashie::Extensions::DeepMerge\n config.deep_merge(yml_content('.sync.yml'))\n else\n {}\n end\n end", "def rsync!(host, remote_folder)\n \tputs \"rsync #{folder}/#{name}* #{host}:#{remote_folder}\"\n \t`rsync --delete #{folder}/#{name}* #{host}:#{remote_folder}`\n end", "def version\n display \"#{command_name} v#{StrongspaceRsync::VERSION}\"\n StrongspaceRsync::VERSION\n end", "def copy_config\n template 'config/sidekiq.yml.tt', 'config/sidekiq.yml'\n copy_file 'config/initializers/sidekiq.rb', 'config/initializers/sidekiq.rb'\n end", "def conf\n home.join('nginx.conf')\n end", "def rsync_str(options, src, dest)\n\t\targ = \"rsync \" + options + \" \" + src + \" \" + dest\n\t\tputs \"=> rsync \" + arg\n\t\tsystem arg\n\tend", "def global_config_path\n linux_cfg = '/etc/openshift/' + conf_name\n File.exists?(linux_cfg) ? linux_cfg : File.join(File.expand_path(File.dirname(__FILE__) + \"/../../conf\"), conf_name)\n end", "def synced_folders(vm, host, global)\n if folders = get_config_parameter(host, global, 'synced_folders')\n folders.each do |folder|\n vm.synced_folder folder['src'], folder['dest'], folder['options']\n end\n end\nend", "def sync_prefer\n sync_host_port = get_host_port(get_container_name, UNISON_CONTAINER_PORT)\n case @options.fetch('sync_prefer', 'default')\n when 'default' then \"-prefer '#{@options['src']}' -copyonconflict\" # thats our default, if nothing is set\n when 'src' then \"-prefer '#{@options['src']}'\"\n when 'dest' then \"-prefer 'socket://#{@options['sync_host_ip']}:#{sync_host_port}'\"\n else \"-prefer '#{@options['sync_prefer']}'\"\n end\n end", "def sync\n run 'sync', :quiet => true\n end", "def rc_dirs; end", "def global_config\n @@global_config\n end", "def base_config_path\n BASE_CONFIG_PATH\n end", "def do_local_checkout_and_rsync(svn_username, actor)\n configuration.logger.debug(\"++++ LOCAL CHECKOUT AND RSYNC ++++\")\n rsync_username = configuration[:rsync_username] ? \"#{configuration[:rsync_username]}@\" : \"\"\n local_rsync_cache= configuration[:local_rsync_cache]\n remote_rsync_cache= configuration[:remote_rsync_cache]\n if local_rsync_cache.nil? || remote_rsync_cache.nil?\n throw \"to use rsync local_rsync_cache and remote_rsync_cache must be set\"\n end\n\n configuration.logger.debug \"rm -rf #{local_rsync_cache} && #{svn} export #{svn_username} -q -r#{configuration[:revision]} #{rep_path} #{local_rsync_cache}\"\n\n # update the local svn cache\n run_local(\n \n \"rm -rf #{local_rsync_cache}&& #{svn} export #{svn_username} -q -r#{configuration[:revision]} #{rep_path} #{local_rsync_cache}\"\n )\n\n # rsync with the remote machine(s)\n rcmd = 'rsync '\n # add rsync options\n %w{\n archive\n compress\n copy-links\n cvs-exclude\n delete-after\n no-blocking-io\n stats\n }.each { | opt | rcmd << \"--#{opt} \" }\n\n # excluded files and directories\n excludes= configuration[:rsync_excludes] || []\n excludes.each { |e| rcmd << \" --exclude \\\"#{e}\\\" \" }\n\n # for each server in current task\n actor.current_task.servers.each do |server|\n configuration.logger.debug \"RSyncing deployment cache for #{server}\"\n configuration.logger.debug \"#{rcmd} -e ssh #{local_rsync_cache}/ #{rsync_username}#{server}:#{remote_rsync_cache}/\"\n run_local(\"#{rcmd} -e ssh #{local_rsync_cache}/ #{rsync_username}#{server}:#{remote_rsync_cache}/\")\n end\n\n # copy the remote_rsync_cache on the remote machine as if it has been checked out there\n cmd=\"cp -a #{remote_rsync_cache}/ #{actor.release_path} && \"\n run_remote(actor, cmd)\n end", "def global_config_dir\n '/etc/vgh'\n end", "def config\n @config ||= begin\n if File.exist?(@config_file)\n begin\n YAML.load_file(@config_file) || {}\n rescue Psych::SyntaxError => e\n raise PgSync::Error, e.message\n end\n else\n {}\n end\n end\n end", "def build_rsync_flags options\n flags = @rsync_flags.dup\n\n remote_rsync = 'rsync'\n rsync_sudo = sudo_cmd remote_rsync, options\n\n unless rsync_sudo == remote_rsync\n flags << \"--rsync-path='#{ rsync_sudo.join(\" \") }'\"\n end\n\n flags << \"-e \\\"ssh #{@ssh_flags.join(' ')}\\\"\" if @ssh_flags\n\n flags.concat [*options[:flags]] if options[:flags]\n\n flags\n end", "def rsync_port\n \"-e 'ssh -p #{port}'\"\n end", "def config\n Videojuicer.current_scope.merge(local_config || {})\n end", "def load_config(global)\n config_file_path = File.join(Dir.home, CONFIG_FILE_NAME)\n\n if File.exists?(config_file_path)\n require 'yaml'\n file_settings = YAML.load_file(config_file_path)\n global[:config].merge!(file_settings)\n end\n\nend", "def rsync(local_folder, remote_destination, delete)\n @log.info(\"rsyncing folder '#{local_folder}' to '#{remote_destination}'...\")\n @process_runner.execute!(\"rsync --filter='P *.css' --filter='P apidocs' --filter='P cdn' --filter='P get-started' --partial --archive --checksum --compress --omit-dir-times --quiet#{' --delete' if delete} --chmod=Dg+sx,ug+rw,Do+rx,o+r --protocol=28 --exclude='.snapshot' #{local_folder}/ #{remote_destination}\")\n end", "def create_config \n @config = ::Capistrano::Configuration.new\n if @cloud.debug || @cloud.verbose \n @config.logger.level = @cloud.debug ? ::Capistrano::Logger::MAX_LEVEL : ::Capistrano::Logger::INFO\n else\n @config.logger.level = ::Capistrano::Logger::IMPORTANT\n end\n \n capfile = returning Array.new do |arr|\n Dir[\"#{::File.dirname(__FILE__)}/recipies/*.rb\"].each {|a| arr << \"require '#{a}'\" }\n arr << \"ssh_options[:keys] = '#{@cloud.full_keypair_basename_path}'\"\n \n arr << set_poolparty_roles\n end.join(\"\\n\")\n \n @config.provisioner = self\n @config.cloud = @cloud\n \n @config.load(:string => capfile)\n \n @cloud.deploy_file ? @config.load(@cloud.deploy_file) : @config.set(:user, @cloud.user)\n end", "def config_file\n CONFIG_FILE\n end", "def rsyncu(remote_name, folder)\n namehost, remote_folder, _barefolder = split_url(remote_name)\n rpath = relative_path(folder)\n if File.expand_path(folder) == File.expand_path(dir.to_s)\n raise \"Cannot run rsyncd in the top level of a repository\"\n end \n string = \"rsync -av #{folder}/ #{namehost}:#{remote_folder}/#{rpath}/\"\n\n cif = `ssh #{namehost} \"cd #{remote_folder}/#{rpath} && echo \"START\" && git status\"`\n if cif =~ /START.*modified/m\n raise \"You have some uncommitted changes in the remote folder #{rpath}. Please commit these changes before calling rsyncu\"\n end\n puts string\n system string\n end", "def remote_dir\n @remote_dir ||= configuration[:copy_remote_dir] || \"/tmp\"\n end", "def remote_dir\n @remote_dir ||= configuration[:copy_remote_dir] || \"/tmp\"\n end", "def config\n Cloudtasker.config\n end", "def configuration\n cfg = {}\n cfg[:acl] = @acl.name if (@acl)\n\n if (@command)\n cfg[:command] = @command.source\n else\n cfg[:shell_command_object_group] = @shell_command_object_group.name\n end\n return(cfg)\n end", "def config_file_settings\n Chef::Config[:knife].save(false) # this is like \"dup\" to a (real) Hash, and does not include default values (just user set values)\n end", "def rsync_stat_file(filename)\n RSYNC_STATFILE_PREFIX+filename.gsub(/\\//,'.')+\".\"+HOST\nend", "def configuration\n cfg = {}\n if (@command)\n cfg[:command] = @command.source\n else\n cfg[:shell_command_object_group] = @shell_command_object_group.name\n end\n\n cfg[:acl] = @acl.name if (@acl)\n return(cfg)\n end", "def sync_configuration!\n load_configuration_if_needed! and save\n save_configuration_if_needed!\n end", "def global_configurations\n @_global_configurations ||= []\n end", "def cop_config; end", "def load_config\n\t\t# load conifg\n\t\tend", "def config_defaults(asset_host: nil, mode: ENV.fetch('RACK_ENV', 'development'), root: Dir.pwd)\n {\n 'asset_host' => option_from_env('asset_host') || asset_host,\n 'config_path' => option_from_env('config_path') || DEFAULT_CONFIG.fetch('config_path'),\n 'mode' => option_from_env('mode') || mode,\n 'root' => option_from_env('root') || root,\n }\n end", "def build_command\n \n # Initialise the excludes array\n excludes = Array.new\n \n # Fill the excludes array from the excludes listed in the config file\n if @ignore\n @ignore.each do |ignore|\n # Ability here to check for ! to see if we should use --include\n if(ignore[0,1] == \"!\")\n ignore.slice!(0)\n excludes << \" --include \\'#{ignore}\\'\"\n else\n excludes << \" --exclude \\'#{ignore}\\'\"\n end\n end\n end\n \n # Build the CLI excludes arguments for rsync\n exclude_cli = excludes.empty? ? '' : excludes.join\n \n # If we're in a dry run, set the rsync option\n dry_run = @dry_run ? ' --dry-run' : ''\n \n # Check for port and identity file\n ssh_options = Array.new\n\n if @remote.has_key?('port')\n if (port=@remote['port']).to_i > 0\n ssh_options << \"-p #{port}\"\n end\n end\n \n if @remote.has_key?('identity_file')\n ssh_options << \"-i #{File.expand_path @remote['identity_file']}\"\n end\n \n # Build additions if there are ssh_options in the array\n ssh_additions = ssh_options.empty? ? '' : \" -e '\" + (ssh_options.unshift('ssh')).join(' ') + \"'\"\n \n # Define the command\n @command = \"#{@rsync} -aiz --no-t --no-p --checksum --delete#{ssh_additions}#{dry_run} --exclude '.git' --exclude '.svn' --exclude '.gitignore' --exclude 'deploy-to.yml'#{exclude_cli} #{@base_dir}/ #{@remote_uri}\"\n \n end", "def default_global_config_file\n File.join(File.expand_path(ENV[\"HOME\"]), \".kitchen\", \"config.yml\")\n end", "def set_prerun_config_defaults\n @@config.daemon_name = File.basename(__FILE__) unless @@config.daemon_name\n @@config.pid_file = \"#{@@config.daemon_name}.pid\" unless @@config.pid_file\n @@config.force_kill_wait = nil unless @@config.force_kill_wait\n @@config.group = nil unless @@config.group\n @@config.user = nil unless @@config.user\n end", "def rsync_to_temp\n\t\tputs \"\\n=> copying to temp dir.\\n\"\n\t\tself.rsync_str(@@opt_rsync, @@dir_src, @@dir_temp)\n\tend", "def default_options\n if Object.const_defined?('Rails')\n {\n :file => Rails.root.join('config', 'config.yml'),\n :reload => Rails.env.development?,\n :env => Rails.env\n }\n else\n {\n :file => File.expand_path(\"config.yml\"),\n :reload => false,\n :env => \"development\"\n }\n end\n end", "def config\n @config ||= YAML.load_file(BASE_PATH + '/local.config.yml')\nend", "def rsync(origin, final)\n if !File.directory? final\n FileUtils.mkdir_p(final)\n end\n Helpers::log(\"rsync -avz pipeline@#{@ip}:#{origin} #{final}\")\n `rsync -avz pipeline@#{@ip}:#{origin} #{final}`\n end", "def init_config\n config('asset_dest', 'assets')\n config('keep_files', []).push(config('asset_dest'))\n end", "def sync_folders (vm_config)\n\n synced_folders = list_synced_folders\n synced_folders.each do |synced_folder|\n synced_folder.sync(vm_config)\n end\n\n end", "def rds_configuration\n @rds_configuration ||= { mode: MODE_PUSH }\n end", "def configuration_file_path; end", "def default_config_options\n ini_data = {\n supervisord: config,\n supervisorctl: {},\n 'rpcinterface:supervisor' => {'supervisor.rpcinterface_factory' => 'supervisor.rpcinterface:make_main_rpcinterface'},\n 'include' => {files: ::File.join(confd_path, '*.conf') },\n }\n # Are we using unix or inet?\n if ctl_is_inet?\n # Either numeric or IP/port, means inet.\n ini_data[:inet_http_server] = {port: ctl_listen}\n ini_data[:inet_http_server][:password] = ctl_password if ctl_password\n ini_data[:inet_http_server][:username] = ctl_username if ctl_username\n ini_data[:supervisorctl][:serverurl] = \"http://#{@ctl_bind_host}:#{@ctl_bind_port}\"\n else\n # Otherwise, Unix sockets.\n ini_data[:unix_http_server] = {file: ctl_listen}\n ini_data[:unix_http_server][:password] = ctl_password if ctl_password\n ini_data[:unix_http_server][:username] = ctl_username if ctl_username\n # Maybe deal with chmod somehow? Defaults are safe I think.\n if owner\n chown = owner.dup\n if group\n chown << ':'\n chown << group\n end\n ini_data[:unix_http_server][:chown] = chown\n end\n ini_data[:supervisorctl][:serverurl] = \"unix://#{ctl_listen}\"\n end\n ini_data[:supervisorctl][:password] = ctl_password if ctl_password\n ini_data[:supervisorctl][:username] = ctl_username if ctl_username\n {ini: ini_data}\n end", "def sync_options\n @sync_options ||= session.configuration.options_for_table(left_table)\n end", "def ensure_config\n if ! in_sync?\n File.open(configfile,\"w\") do |f|\n f.write(@config.to_json)\n end\n end\n end", "def config\n Troy.configuration\n end", "def initialize(params={})\n super\n @method = :rsync\n @delete = link_config(:delete).to_s == \"true\"\n end", "def configure\n\n # config file default options\n configuration = {\n :options => {\n :verbose => false,\n :coloring => 'AUTO'\n },\n :mount => {\n :source => {\n :name => nil\n },\n :mountpoint => {\n :name => nil\n },\n :passphrasefile => {\n :name => 'passphrase'\n },\n :keyfile => {\n :name => 'encfs6.xml'\n },\n :cmd => nil,\n :executable => nil\n },\n :unmount => {\n :mountpoint => {\n :name => nil\n },\n :cmd => nil,\n :executable => nil\n },\n :copy => {\n :source => {\n :name => nil\n },\n :destination => {\n :name => nil\n },\n :cmd => nil,\n :executable => nil\n }\n }\n\n # set default config if not given on command line\n config = @options[:config]\n unless config\n config = [\n File.join(@working_dir, \"revenc.conf\"),\n File.join(@working_dir, \".revenc.conf\"),\n File.join(@working_dir, \"config\", \"revenc.conf\"),\n File.expand_path(File.join(\"~\", \".revenc.conf\"))\n ].detect { |filename| File.exists?(filename) }\n end\n\n if config && File.exists?(config)\n # rewrite options full path for config for later use\n @options[:config] = config\n\n # load options from the config file, overwriting hard-coded defaults\n config_contents = YAML::load(File.open(config))\n configuration.merge!(config_contents.symbolize_keys!) if config_contents && config_contents.is_a?(Hash)\n else\n # user specified a config file?, no error if user did not specify config file\n raise \"config file not found\" if @options[:config]\n end\n\n # the command line options override options read from the config file\n @options = configuration[:options].merge!(@options)\n @options.symbolize_keys!\n\n # mount, unmount and copy configuration hashes\n @options[:mount] = configuration[:mount].recursively_symbolize_keys! if configuration[:mount]\n @options[:unmount] = configuration[:unmount].recursively_symbolize_keys! if configuration[:unmount]\n @options[:copy] = configuration[:copy].recursively_symbolize_keys! if configuration[:copy]\n end", "def place_config\n if self.valid? and self.connect then\n @ssh_connection.scp.upload!(StringIO.new(@config.to_s), \"/tmp/system.cfg\")\n end\n end", "def config\n @config_file\n end", "def default_config\n { purge: true }\n end" ]
[ "0.7164629", "0.7123198", "0.6964019", "0.6893977", "0.68736655", "0.6516026", "0.63349116", "0.6333167", "0.62511927", "0.62055963", "0.6114623", "0.6109834", "0.6106116", "0.6040857", "0.60234106", "0.59825504", "0.5970224", "0.59294295", "0.5913603", "0.5912944", "0.5882138", "0.5872485", "0.58566827", "0.58268726", "0.58108026", "0.5793329", "0.5743839", "0.57391995", "0.5725214", "0.57182026", "0.57041544", "0.56954473", "0.56784105", "0.56461847", "0.5640642", "0.5633784", "0.56238663", "0.56238663", "0.5611799", "0.5605073", "0.5602856", "0.55879134", "0.55666023", "0.55581224", "0.55568975", "0.55523527", "0.55340433", "0.55317086", "0.55171025", "0.55068904", "0.5486843", "0.548472", "0.5483616", "0.54712075", "0.54611504", "0.54568726", "0.54442513", "0.5432999", "0.54311633", "0.5428079", "0.54245514", "0.5416562", "0.5413813", "0.53842765", "0.53829086", "0.5380178", "0.5363401", "0.53622735", "0.53612304", "0.53376687", "0.5334706", "0.53342915", "0.5326797", "0.5325212", "0.530112", "0.52979606", "0.52898455", "0.5276233", "0.52760506", "0.5269188", "0.5264639", "0.5262446", "0.5261136", "0.52608615", "0.52592707", "0.5252595", "0.52515155", "0.52470076", "0.524449", "0.52431536", "0.5242244", "0.52368873", "0.5227544", "0.5225171", "0.52228624", "0.5222109", "0.5221768", "0.5217054", "0.52143687", "0.5212519", "0.5211935" ]
0.0
-1
GET /http_requests GET /http_requests.json
def index @http_requests = HttpRequest.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_json()\n\n http = Net::HTTP.new(STATUS_URI.host, STATUS_URI.port)\n http.use_ssl = false\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Get.new(\"/api/services.json\")\n\n response = http.request(request)\n JSON.parse(response.body)\nend", "def request (url_requested, api_key)\n url_builded = url_requested + \"&api_key=\" + api_key\n\n url = URI(url_builded)\n\n https = Net::HTTP.new(url.host, url.port)\n https.use_ssl = true\n\n request = Net::HTTP::Get.new(url)\n\n response = https.request(request)\n\n JSON.parse(response.read_body)\nend", "def index\n @http_requests = HttpRequest.order(\"created_at DESC\").page(params[:page]).per(10)\n end", "def run_json_http_request\n uri = URI.parse @json_url\n http = Net::HTTP.new uri.host, uri.port\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n \n # set up request\n request = Net::HTTP::Get.new uri.request_uri\n \n # get response, convert to hash\n response = http.request request\n response_hash = JSON.parse response.body\n end", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n puts JSON.pretty_generate(result)\n result\nend", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend", "def request_data(request_url)\n\n uri = URI.parse(request_url)\n response = Net::HTTP.get_response(uri)\n data = JSON.parse(response.body)\n return data\n\nend", "def index\n @requests = Request.all\n\n render json: @requests\n end", "def list_requests\n # stub\n end", "def get_json(path)\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n #puts \"🤖 GET #{path}\"\n #puts \"HTTP #{response.code}\"\n #puts JSON.pretty_generate(result)\n result\nend", "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()\n return @http.request(@req)\n end", "def http( *args )\n p http_get( *args )\n end", "def get_requests\n @requests\n end", "def httpget(url, corpNum, userID = '')\n headers = {\n \"x-pb-version\" => KAKAOCERT_APIVersion,\n \"Accept-Encoding\" => \"gzip,deflate\",\n }\n\n if corpNum.to_s != ''\n headers[\"Authorization\"] = \"Bearer \" + getSession_Token(corpNum)\n end\n\n if userID.to_s != ''\n headers[\"x-pb-userid\"] = userID\n end\n\n uri = URI(getServiceURL() + url)\n request = Net::HTTP.new(uri.host, 443)\n request.use_ssl = true\n\n Net::HTTP::Get.new(uri)\n\n res = request.get(uri.request_uri, headers)\n\n if res.code == \"200\"\n if res.header['Content-Encoding'].eql?('gzip')\n JSON.parse(gzip_parse(res.body))\n else\n JSON.parse(res.body)\n end\n else\n raise KakaocertException.new(JSON.parse(res.body)[\"code\"],\n JSON.parse(res.body)[\"message\"])\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 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 simple_request(method, url)\n uri = URI.parse(url)\n request = Net::HTTP::Get.new(uri)\n request.content_type = \"application/json\"\n request[\"Accept\"] = \"application/json\"\n request[\"App-Id\"] = ENV[\"salt_edge_app_id\"]\n request[\"Secret\"] = ENV[\"salt_edge_secret\"]\n\n req_options = {\n use_ssl: uri.scheme == \"https\",\n } \n\n response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|\n http.request(request)\n end\n\n #puts response.body\n return JSON.parse(response.body)\n end", "def requests\n @requests_obj.list\n end", "def requests\n REQUESTS\n end", "def request(args = {})\n response = @client.get(args[:url],\n argument_hash(args[:args] || {},\n args[:symbols] || []))\n JSON.parse(response.body)\n end", "def api_get url_suffix\n url = URI::encode \"#{@@oauth_info[:api_url]}/gems/#{url_suffix}\"\n data = {:client_id => @@oauth_info[:client_id]}\n headers = {:Authorization => \"Bearer #{@access_token}\"}\n\n conn = get_conn url\n #Try request 3 times\n for i in 1..3\n res = conn.get(url, data, headers)\n if res.status == 200 then return JSON.parse(res.body) end\n sleep 1\n end\n raise OAuthSessionError, \"GET Failed. Status: #{res.status}. Body: #{res.body}\"\n end", "def request(url, expires_in)\n return [] unless enabled?\n\n response = http.cache(expires_in).get(url)\n return [] if response.status != 200\n JSON.parse(response.to_s.force_encoding(\"utf-8\"))\n end", "def get(request)\n do_request(request) { |client| client.http_get }\n end", "def get(path)\n request = Net::HTTP::Get.new @uri.path+'/'+path\n request.basic_auth @api_key, ''\n request['User-Agent'] = USER_AGENT\n response = @https.request request\n JSON.parse response.body\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 request_api(url)\n begin\n response = RestClient.get(url)\n print(\"response: \", response)\n JSON.parse(response)\n rescue\n return nil\n end\n \n \n end", "def get_request\n# Use our @http_object object's request method to call the\n# Net::HTTP::Get class and return the resulting response object\n @http_object.request(Net::HTTP::Get.new(@url.request_uri))\n end", "def request_json(url)\n JSON.parse(@access_token.get(\"#{SITE}#{url}\").body)\n end", "def list_requests_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: RequestApi.list_requests ...'\n end\n if @api_client.config.client_side_validation && opts[:'x_rh_persona'] && !['approval/admin', 'approval/approver', 'approval/requester'].include?(opts[:'x_rh_persona'])\n fail ArgumentError, 'invalid value for \"x_rh_persona\", must be one of approval/admin, approval/approver, approval/requester'\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling RequestApi.list_requests, must be smaller than or equal to 1000.'\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 RequestApi.list_requests, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"offset\"]\" when calling RequestApi.list_requests, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/requests'\n\n # query parameters\n query_params = {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].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 header_params[:'x-rh-persona'] = opts[:'x_rh_persona'] if !opts[:'x_rh_persona'].nil?\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['Basic_auth']\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 => 'RequestCollection')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RequestApi#list_requests\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def make_request(url)\n response = RestClient.get(url)\n parsed_response = JSON(response)[\"items\"]\nend", "def http_get(request)\n tries = 3\n begin\n curl = Curl::Easy.new request\n curl.useragent = USER_AGENT\n curl.perform\n begin\n JSON.parse curl.body_str\n rescue JSON::ParserError => err\n @log.warn \"Could not parse response for #{request} - this is probably not a json response: #{curl.body_str}\"\n return nil\n end\n rescue Curl::Err::ConnectionFailedError => err\n @log.error \"Connection failed: #{err}\"\n tries -= 1\n sleep 3\n if tries > 0\n retry\n else\n nil\n end\n rescue Curl::Err::RecvError => err\n @log.error \"Failure when receiving data from the peer: #{err}\"\n tries -= 1\n sleep 3\n if tries > 0\n retry\n else\n nil\n end\n rescue Curl::Err => err\n @log.error \"Failure in Curl call: #{err}\"\n tries -= 1\n sleep 3\n if tries > 0\n retry\n else\n nil\n end\n end\n end", "def do_request()\n uri = URI.parse(API_BASE_URL + build_request_path())\n response = Net::HTTP.get_response(uri)\n response.body\n end", "def get_request(options, path)\n\n result = {}\n\n http = Net::HTTP.new(ENV['NESSUS_HOST'], options[:port])\n http.use_ssl = @use_ssl\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n http.start do |http|\n req = Net::HTTP::Get.new(path)\n\n # we make an HTTP basic auth by passing the\n # username and password\n req['X-ApiKeys'] = \"accessKey=#{ENV['NESSUS_ACCESS_KEY']}; secretKey=#{ENV['NESSUS_SECRET_KEY']}\"\n \n resp, data = http.request(req)\n \n if resp.code.eql? '200'\n #print \"Data: \" + JSON.pretty_generate(JSON.parse(resp.body.to_s))\n result = JSON.parse(resp.body.to_s)\n else\n puts \"Error: \" + resp.code.to_s + \"\\n\" + resp.body\n end\n end\n\n return result\n end", "def request(url,token = nil)\n url = URI(\"#{url}&api_key=#{token}\") # se quita uri y parentesis\n #puts url_string\n \n \n https = Net::HTTP.new(url.host, url.port)\n https.use_ssl = true\n request = Net::HTTP::Get.new(url)\n response = https.request(request)\n data = JSON.parse(response.read_body)\n #puts data\nend", "def do_get\n Net::HTTP.get(URI.parse(api_url))\n end", "def prepare_http_requests\n {\n label: :lyft_prices,\n url: @lyft_api_service.price_url([@trip.destination.lat, @trip.destination.lng], [@trip.origin.lat, @trip.origin.lng]),\n action: :get,\n options: {\n head: @lyft_api_service.headers \n }\n }\n end", "def invoke_request(url)\n site = RestClient::Resource.new(url, \"dHgVM1emGoTyr8zHmVNH\")\n return JSON.parse(site.get(:accept=>\"application/json\"))\nend", "def invoke_request(url)\n site = RestClient::Resource.new(url, \"dHgVM1emGoTyr8zHmVNH\")\n return JSON.parse(site.get(:accept=>\"application/json\"))\nend", "def get(url, headers = {})\n http :get, \"#{url}.json\", headers\n end", "def getJson(url)\r\n request_uri = url\r\n request_query = ''\r\n url = \"#{request_uri}#{request_query}\"\r\n result = getJsonFromUrl(url)\r\n return result\r\nend", "def api_fetch(url)\n JSON.parse(RestClient.get url)\nend", "def get_data\n uri = URI(\"#{@url_base}/#{@url_path}\")\n uri.query = @params\n use_ssl = { use_ssl: uri.scheme == 'https', verify_mode: OpenSSL::SSL::VERIFY_NONE }\n response = {}\n\n Net::HTTP.start(uri.host, uri.port, use_ssl) do |http|\n request = Net::HTTP::Get.new(uri)\n response = http.request(request)\n end\n\n raise JSON.parse(response.body)['error'] if !JSON.parse(response.body)['error'].nil?\n\n raise \"page_arg_must_be_integer\" if !@page_number.empty? && @page_number.scan(/\\d/).join('').to_i == 0\n\n raise \"no_response\" if JSON.parse(response.body).nil?\n\n raise \"no_orders_found\" if JSON.parse(response.body)['orders'].nil?\n\n { res: JSON.parse(response.body), status: get_response_status(response) }\n end", "def api_request\n url = URI.parse(\"https://catfact.ninja/fact\")\n response = Net::HTTP.get_response(url)\n JSON.parse(response.body)[\"fact\"]\n end", "def http_request\n lines = []\n request = data[:request]\n\n verb, override = method_and_override(request[:verb])\n\n lines << \"%s %s HTTP/1.1\" % [verb, request[:path]]\n\n lines << \"X-Http-Method-Override: #{override}\" if override\n\n lines << \"Host: #{host}\"\n\n (request[:headers] || {}).each_pair do |key, value|\n lines << \"#{key}: #{value}\"\n end\n\n if request[:data]\n lines << \"Content-Type: application/json; charset=utf-8\"\n lines << \"\"\n lines << JSON.pretty_generate(request[:data])\n end\n\n lines.join(\"\\n\")\n end", "def json_get(url)\n get url, :parse=>true\n end", "def get_request\n # Use our @http_object object's request method to call the\n # Net::HTTP::Get class and return the resulting response object\n @http_object.request(Net::HTTP::Get.new(@url.request_uri))\n end", "def http\n HTTP .headers(accept: \"application/json\")\n # .via(\"127.0.0.1\", 8888)\n end", "def http; end", "def perform_get(rest_url, request)\n query_params = request.api_params.blank? ? '' : to_query_params(request.api_params)\n url = \"#{rest_url}&#{query_params}\"\n\n response = RestClient::Request.execute(\n method: request.http_method,\n url: url,\n headers: request.header_params,\n read_timeout: 30,\n open_timeout: 15\n )\n JSON.parse(response)\n end", "def httpget(url, corpNum, userID = '')\n headers = {\n \"x-pb-version\" => BaseService::POPBILL_APIVersion,\n \"Accept-Encoding\" => \"gzip,deflate\",\n }\n\n if corpNum.to_s != ''\n headers[\"Authorization\"] = \"Bearer \" + getSession_Token(corpNum)\n end\n\n if userID.to_s != ''\n headers[\"x-pb-userid\"] = userID\n end\n\n uri = URI(getServiceURL() + url)\n\n request = Net::HTTP.new(uri.host, 443)\n request.use_ssl = true\n\n Net::HTTP::Get.new(uri)\n\n res = request.get(uri.request_uri, headers)\n\n if res.code == \"200\"\n if res.header['Content-Encoding'].eql?('gzip')\n JSON.parse(gzip_parse(res.body))\n else\n JSON.parse(res.body)\n end\n else\n raise PopbillException.new(JSON.parse(res.body)[\"code\"],\n JSON.parse(res.body)[\"message\"])\n end\n end", "def perform_api_request(query) \n request = Net::HTTP::Post.new( \n $url.path + ($url.query != nil ? (\"?\" + $url.query) : \"\"), \n initheader = {\"Content-Type\" => \"application/json\", \n \"X-Replicon-Security-Context\" => \"User\"}) \n request.basic_auth($companyKey + \"\\\\\" + $loginname, $password) \n request.body = JSON.generate(query) \n \n server = Net::HTTP.new($url.host, $url.port) \n server.use_ssl = $url.scheme == \"https\" \n response = server.start {|http| http.request(request)} \n \n http_code = response.code.to_i \n if http_code != 200 \n puts response.body \n raise \"Expected success code 200, but was #{http_code}\" \n end \n \n return JSON.parse(response.body) \nend", "def http_get(path, query, format = :json)\n uri = URI.parse(\"http://#{Jamendo::API_SERVER}/v#{Jamendo::API_VERSION}/#{path}#{query}\")\n puts uri.request_uri\n http = Net::HTTP.new(uri.host, uri.port) \n request = Net::HTTP::Get.new(uri.request_uri)\n begin\n response = http.request(request)\n result = parse_response(response)\n assert_response(result[:headers])\n return result[:results]\n rescue JamendoError => e\n e.inspect\n end\n end", "def requests_get\n @attributes[:requests_get]\n end", "def index\n temp = current_user.id\n # Auf Methode warten, nur noch offene, in der Zukunft liegende Requests \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 url\n puts \"COMMUNICATING WITH TOGGL SERVER COMMUNICATING WITH TOGGL SERVER\"\n uri = URI.parse( url )\n http = Net::HTTP.new( uri.host, uri.port )\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new( uri.request_uri )\n request.basic_auth( @api_key, \"api_token\" )\n request[\"Content-Type\"] = \"application/json\"\n response = http.request( request )\n \n if response.code.to_i==200 # OK\n hash = JSON.parse( response.body )\n elsif response.code.to_i==403 # Authentication\n raise Exceptions::AuthenticationError\n else\n puts \"Error, code #{ response.code }.\"\n puts response.body\n end\n end", "def get_json(uri)\n start = Time.now\n attempt = 0\n begin\n res = @http.get(\n uri,\n 'Accept' => 'text/plain',\n 'User-Agent' => user_agent,\n 'Accept-Encoding' => ''\n )\n raise Error, \"Failed to retrieve #{uri} (#{res.code}): #{res.body}\" unless res.code == '200'\n info(\"GET #{uri}: #{res.code}/#{res.body.length}b in #{age(start)}\")\n JSON.parse(res.body)\n rescue StandardError => e\n attempt += 1\n raise e if attempt >= @attempts\n retry\n end\n end", "def http_method\n :get\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", "def fetch_url(https,req)\n res = https.request(req)\n case res\n when Net::HTTPSuccess\n answer=JSON.parse(res.body)\n return answer\n else\n puts \"HTTP Error #{res.code} calling #{https}\"\n res.error!\n end\nend", "def get_all_requests_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: EnvironmentServiceApi.get_all_requests ...'\n end\n # resource path\n local_var_path = '/environments'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'created'] = opts[:'created'] if !opts[:'created'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].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 header_params[:'Authorization'] = opts[:'authorization'] if !opts[:'authorization'].nil?\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] || 'File' \n\n # auth_names\n auth_names = opts[:auth_names] || []\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: EnvironmentServiceApi#get_all_requests\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def perform\n requests = session.requests\n number_width = Math.log10(requests.length).to_i + 1\n displayed_one = false\n requests.each_with_index do |request, index|\n next unless request.response\n\n puts(strong('-' * 80)) if displayed_one\n displayed_one = true\n\n number = (index + 1).to_s.rjust(number_width)\n print \"#{strong number} \"\n show_request request\n\n puts unless request.headers.empty?\n show_headers request.headers,\n show_asterisk_next_to: HTTY::Request::COOKIES_HEADER_NAME,\n show_mercantile_next_to: HTTY::Request::AUTHORIZATION_HEADER_NAME\n\n unless request.body.to_s.empty?\n puts\n puts request.body\n end\n\n puts\n show_response request.response\n\n puts unless request.response.headers.empty?\n show_headers request.response.headers,\n show_asterisk_next_to: HTTY::Response::COOKIES_HEADER_NAME\n\n unless request.response.body.to_s.empty?\n puts\n puts request.response.body\n end\n end\n end", "def index\n @requests = Request.all\n end", "def index\n @requests = Request.all\n end", "def index\n @requests = Request.all\n end", "def index\n @requests = Request.all\n end", "def index\n @requests = Request.all\n end", "def index\n @requests = Request.all\n end", "def index\n @requests = Request.all\n end", "def index\n @requests = Request.all\n end", "def index\n @requests = Request.all\n end", "def index\n @requests = Request.all\n end", "def index\n unless params[:requests] && params[:requests].is_a?(Array)\n render :json => {:error => \"Must pass an array of requests\"}, :status => :bad_request and return\n end\n\n if params[:requests].size > MAX_REQUESTS\n render :json => {:error => \"This batch API accepts a maximum of #{MAX_REQUESTS} requests\"}, :status => :bad_request and return\n end\n\n fetcher = Batchy::Fetcher.new(app: Rails.application, requests: params[:requests]).run\n render :json => {:succeeded => fetcher.succeeded, :failed => fetcher.failed, :responses => fetcher.responses}, :status => :ok\n end", "def web_request\n response_string = RestClient.get('http://www.swapi.co/api/people/')\n response_hash = JSON.parse(response_string)\nend", "def get_json(path)\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n\n result\nend", "def get_rest_api(endpoint, http)\n rest_api_endpoint = \"/classifier-api/v1/#{endpoint}\"\n\n # Create an HTTP GET request against the specified REST API endpoint.\n request = Net::HTTP::Get.new(rest_api_endpoint)\n # Submit the request\n response = http.request(request)\n # Return the response body (JSON containing the results of the query).\n response.body\nend", "def gather_issues\n url = \"#{URL}/projects/foreman/issues.json?status_id=1&limit=100&release_id=#{@current_release_id}\"\n puts url\n uri = URI(URI.escape(url))\n response = Net::HTTP.get(uri)\n JSON.parse(response)\nend", "def get(url, opts = {})\n response = RestClient::Request.new(\n method: :get,\n url: \"#{ENDPOINT_URL}/#{url}\",\n verify_ssl: false,\n headers: {\n 'Content-Type' => 'application/json',\n 'Authorization' => \"Basic #{authorization_hash}\",\n 'client-id' => client_id,\n 'access-token' => access_token\n },\n payload: opts\n ).execute\n\n JSON.parse(response)\n end", "def json_get(path, params={})\n json_request(:get, path, params)\n end", "def api_request(input_args)\n addr = URI(api_url)\n parms = input_args.clone\n parms = api_defaults.merge(parms)\n addr.query = URI.encode_www_form(parms)\n JSON.parse(Net::HTTP.get(addr))\n end", "def get\n uri = request_uri\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new(uri.request_uri)\n retries = Europeana.max_retries\n \n begin\n response = http.request(request)\n rescue Timeout::Error, Errno::ECONNREFUSED, EOFError\n retries -= 1\n raise unless retries > 0\n sleep Europeana.retry_delay\n retry\n end\n \n json = JSON.parse(response.body)\n raise Errors::RequestError, json['error'] unless json['success']\n json\n rescue JSON::ParserError\n if response.code.to_i == 404\n # Handle HTML 404 responses on malformed record ID, emulating API's\n # JSON response.\n raise Errors::RequestError, \"Invalid record identifier: #{@id}\"\n else\n raise Errors::ResponseError\n end\n end", "def getJson(url)\n\t\tencoded_url = URI.encode(\"https://cryptic-mountain-56365.herokuapp.com/api/v1\"+url)\n\t\turi = URI.parse(encoded_url)\n\t\tjson = Net::HTTP.get(uri)\n\tend", "def index\n @requests = Request.where(status: -1)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end", "def api_request(&block)\n response = block.call\n if response.status == 307 and response.body =~ /^\\/REST\\//\n response.body.sub!('/REST/','') \n response = get(response.body)\n end\n parse_response(JSON.parse(response.body || '{}'))\n end", "def friend_requests\n get(\"users/requests\").requests\n end", "def get endpoint\n do_request :get, endpoint\n end", "def signrequests_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SignrequestsApi.signrequests_list ...'\n end\n # resource path\n local_var_path = '/signrequests/'\n\n # query parameters\n query_params = {}\n query_params[:'who'] = opts[:'who'] if !opts[:'who'].nil?\n query_params[:'from_email'] = opts[:'from_email'] if !opts[:'from_email'].nil?\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 = ['Token']\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 => 'InlineResponse2005')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SignrequestsApi#signrequests_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def request(service, method = :get, payload = {})\n res = Infosimples::Data::HTTP.request(\n url: BASE_URL.gsub(':service', service),\n http_timeout: timeout,\n method: method,\n payload: payload.merge(\n token: token,\n timeout: timeout,\n max_age: max_age,\n header: 1\n )\n )\n JSON.parse(res)\n end", "def makeApiRequest(page_number)\n\t \turi = URI(\"https://api.salesloft.com/v2/people.json?include_paging_counts=true&per_page=100&page=#{page_number}\")\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new(uri)\n request[\"Authorization\"] = \"Bearer #{ENV['SALESLOFT_APPLICATION_SECRET']}\"\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n response = http.request(request)\n response_body = JSON.parse(response.body)\n return response_body\n\t end", "def get_response\n parse_response(parse_JSON(get_request))\n end", "def get(http: HTTParty)\n http.get(url)\n end", "def get_request(url)\n\n request = Net::HTTP::Get.new(url)\n request['content-type'] = 'application/x-www-form-urlencoded'\n request['accept'] = '*/*'\n return request\nend", "def requests\n\t\tRequest.find(:all)\n\tend", "def get url, params={}, headers={}\n uri = URI.parse(url)\n path = uri.path + \"?\" + query_string(default_params.merge(params))\n response = http(uri.host, uri.port).get(path, default_headers.merge(headers))\n JSON.parse(response.body)\n end", "def request_info\n @requests = Request.ordered\n end", "def room_descriptions_method\r\n my_port = 8081\r\n htttproomnumber = $roomnumber\r\n roomsNtext = \"/#{htttproomnumber}\"\r\n rooms_message = \"/rooms#{roomsNtext}\"\r\n url = URI.parse(\"http://localhost:#{my_port}#{rooms_message}\")\r\n req = Net::HTTP::Get.new(url.to_s)\r\n res = Net::HTTP.start(url.host, url.port){|http|\r\n http.request(req)\r\n }\r\n my_json = JSON.parse(res.body) \r\n return my_json[\"room\"].to_s\r\nend", "def rest_get(url)\n JSON.parse(RestClient.get(url))\n end", "def index\n @requests = Request.all\n end" ]
[ "0.67624205", "0.6735118", "0.67234886", "0.6703622", "0.6599823", "0.6565737", "0.6565737", "0.65357167", "0.6492485", "0.64919305", "0.64406955", "0.6413719", "0.63831383", "0.63780355", "0.6366384", "0.63175565", "0.6286214", "0.62749106", "0.62749106", "0.6258267", "0.623815", "0.6236543", "0.62298673", "0.62223804", "0.6184326", "0.61649466", "0.61509305", "0.6125074", "0.6110034", "0.60903627", "0.6090286", "0.60864836", "0.6078365", "0.6063813", "0.60503185", "0.6045607", "0.6044518", "0.6042038", "0.60224247", "0.6013992", "0.6013992", "0.6008136", "0.6006567", "0.5985294", "0.5944776", "0.5933601", "0.5930655", "0.59286606", "0.5919778", "0.5896071", "0.58960354", "0.58956486", "0.5892082", "0.58909184", "0.5890276", "0.5889112", "0.58890474", "0.5881297", "0.5876236", "0.5875246", "0.5872445", "0.58689684", "0.5864349", "0.5863103", "0.5855345", "0.5855345", "0.5855345", "0.5855345", "0.5855345", "0.5855345", "0.5855345", "0.5855345", "0.5855345", "0.5855345", "0.58521914", "0.5850727", "0.584894", "0.584394", "0.5841028", "0.58365697", "0.58346176", "0.58337504", "0.58302814", "0.5819737", "0.5816747", "0.5797177", "0.5786744", "0.5784961", "0.5784394", "0.57692844", "0.5769084", "0.57677525", "0.5767531", "0.57655084", "0.5764152", "0.5763515", "0.5755944", "0.57559323", "0.575273", "0.57438356" ]
0.6648942
4
GET /http_requests/1 GET /http_requests/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n puts JSON.pretty_generate(result)\n result\nend", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend", "def get_json()\n\n http = Net::HTTP.new(STATUS_URI.host, STATUS_URI.port)\n http.use_ssl = false\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Get.new(\"/api/services.json\")\n\n response = http.request(request)\n JSON.parse(response.body)\nend", "def run_json_http_request\n uri = URI.parse @json_url\n http = Net::HTTP.new uri.host, uri.port\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n \n # set up request\n request = Net::HTTP::Get.new uri.request_uri\n \n # get response, convert to hash\n response = http.request request\n response_hash = JSON.parse response.body\n end", "def get_json(path)\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n #puts \"🤖 GET #{path}\"\n #puts \"HTTP #{response.code}\"\n #puts JSON.pretty_generate(result)\n result\nend", "def request (url_requested, api_key)\n url_builded = url_requested + \"&api_key=\" + api_key\n\n url = URI(url_builded)\n\n https = Net::HTTP.new(url.host, url.port)\n https.use_ssl = true\n\n request = Net::HTTP::Get.new(url)\n\n response = https.request(request)\n\n JSON.parse(response.read_body)\nend", "def index\n @http_requests = HttpRequest.order(\"created_at DESC\").page(params[:page]).per(10)\n end", "def request_data(request_url)\n\n uri = URI.parse(request_url)\n response = Net::HTTP.get_response(uri)\n data = JSON.parse(response.body)\n return data\n\nend", "def api_get url_suffix\n url = URI::encode \"#{@@oauth_info[:api_url]}/gems/#{url_suffix}\"\n data = {:client_id => @@oauth_info[:client_id]}\n headers = {:Authorization => \"Bearer #{@access_token}\"}\n\n conn = get_conn url\n #Try request 3 times\n for i in 1..3\n res = conn.get(url, data, headers)\n if res.status == 200 then return JSON.parse(res.body) end\n sleep 1\n end\n raise OAuthSessionError, \"GET Failed. Status: #{res.status}. Body: #{res.body}\"\n end", "def index\n @requests = Request.all\n\n render json: @requests\n end", "def index\n @http_requests = HttpRequest.all\n end", "def http( *args )\n p http_get( *args )\n end", "def simple_request(method, url)\n uri = URI.parse(url)\n request = Net::HTTP::Get.new(uri)\n request.content_type = \"application/json\"\n request[\"Accept\"] = \"application/json\"\n request[\"App-Id\"] = ENV[\"salt_edge_app_id\"]\n request[\"Secret\"] = ENV[\"salt_edge_secret\"]\n\n req_options = {\n use_ssl: uri.scheme == \"https\",\n } \n\n response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|\n http.request(request)\n end\n\n #puts response.body\n return JSON.parse(response.body)\n end", "def get_json(uri)\n start = Time.now\n attempt = 0\n begin\n res = @http.get(\n uri,\n 'Accept' => 'text/plain',\n 'User-Agent' => user_agent,\n 'Accept-Encoding' => ''\n )\n raise Error, \"Failed to retrieve #{uri} (#{res.code}): #{res.body}\" unless res.code == '200'\n info(\"GET #{uri}: #{res.code}/#{res.body.length}b in #{age(start)}\")\n JSON.parse(res.body)\n rescue StandardError => e\n attempt += 1\n raise e if attempt >= @attempts\n retry\n end\n end", "def request(url, expires_in)\n return [] unless enabled?\n\n response = http.cache(expires_in).get(url)\n return [] if response.status != 200\n JSON.parse(response.to_s.force_encoding(\"utf-8\"))\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 httpget(url, corpNum, userID = '')\n headers = {\n \"x-pb-version\" => KAKAOCERT_APIVersion,\n \"Accept-Encoding\" => \"gzip,deflate\",\n }\n\n if corpNum.to_s != ''\n headers[\"Authorization\"] = \"Bearer \" + getSession_Token(corpNum)\n end\n\n if userID.to_s != ''\n headers[\"x-pb-userid\"] = userID\n end\n\n uri = URI(getServiceURL() + url)\n request = Net::HTTP.new(uri.host, 443)\n request.use_ssl = true\n\n Net::HTTP::Get.new(uri)\n\n res = request.get(uri.request_uri, headers)\n\n if res.code == \"200\"\n if res.header['Content-Encoding'].eql?('gzip')\n JSON.parse(gzip_parse(res.body))\n else\n JSON.parse(res.body)\n end\n else\n raise KakaocertException.new(JSON.parse(res.body)[\"code\"],\n JSON.parse(res.body)[\"message\"])\n end\n end", "def request(args = {})\n response = @client.get(args[:url],\n argument_hash(args[:args] || {},\n args[:symbols] || []))\n JSON.parse(response.body)\n end", "def get()\n return @http.request(@req)\n end", "def get_json(path)\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n\n result\nend", "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 getJson(url)\r\n request_uri = url\r\n request_query = ''\r\n url = \"#{request_uri}#{request_query}\"\r\n result = getJsonFromUrl(url)\r\n return result\r\nend", "def get(path)\n request = Net::HTTP::Get.new @uri.path+'/'+path\n request.basic_auth @api_key, ''\n request['User-Agent'] = USER_AGENT\n response = @https.request request\n JSON.parse response.body\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 request_api(url)\n begin\n response = RestClient.get(url)\n print(\"response: \", response)\n JSON.parse(response)\n rescue\n return nil\n end\n \n \n end", "def make_request(url)\n response = RestClient.get(url)\n parsed_response = JSON(response)[\"items\"]\nend", "def get\n uri = request_uri\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new(uri.request_uri)\n retries = Europeana.max_retries\n \n begin\n response = http.request(request)\n rescue Timeout::Error, Errno::ECONNREFUSED, EOFError\n retries -= 1\n raise unless retries > 0\n sleep Europeana.retry_delay\n retry\n end\n \n json = JSON.parse(response.body)\n raise Errors::RequestError, json['error'] unless json['success']\n json\n rescue JSON::ParserError\n if response.code.to_i == 404\n # Handle HTML 404 responses on malformed record ID, emulating API's\n # JSON response.\n raise Errors::RequestError, \"Invalid record identifier: #{@id}\"\n else\n raise Errors::ResponseError\n end\n end", "def invoke_request(url)\n site = RestClient::Resource.new(url, \"dHgVM1emGoTyr8zHmVNH\")\n return JSON.parse(site.get(:accept=>\"application/json\"))\nend", "def invoke_request(url)\n site = RestClient::Resource.new(url, \"dHgVM1emGoTyr8zHmVNH\")\n return JSON.parse(site.get(:accept=>\"application/json\"))\nend", "def json_get(url)\n get url, :parse=>true\n end", "def http_get(request)\n tries = 3\n begin\n curl = Curl::Easy.new request\n curl.useragent = USER_AGENT\n curl.perform\n begin\n JSON.parse curl.body_str\n rescue JSON::ParserError => err\n @log.warn \"Could not parse response for #{request} - this is probably not a json response: #{curl.body_str}\"\n return nil\n end\n rescue Curl::Err::ConnectionFailedError => err\n @log.error \"Connection failed: #{err}\"\n tries -= 1\n sleep 3\n if tries > 0\n retry\n else\n nil\n end\n rescue Curl::Err::RecvError => err\n @log.error \"Failure when receiving data from the peer: #{err}\"\n tries -= 1\n sleep 3\n if tries > 0\n retry\n else\n nil\n end\n rescue Curl::Err => err\n @log.error \"Failure in Curl call: #{err}\"\n tries -= 1\n sleep 3\n if tries > 0\n retry\n else\n nil\n end\n end\n end", "def api_fetch(url)\n JSON.parse(RestClient.get url)\nend", "def request_json(url)\n JSON.parse(@access_token.get(\"#{SITE}#{url}\").body)\n end", "def get(url, headers = {})\n http :get, \"#{url}.json\", headers\n end", "def list_requests\n # stub\n end", "def get(request)\n do_request(request) { |client| client.http_get }\n end", "def http_get(path, query, format = :json)\n uri = URI.parse(\"http://#{Jamendo::API_SERVER}/v#{Jamendo::API_VERSION}/#{path}#{query}\")\n puts uri.request_uri\n http = Net::HTTP.new(uri.host, uri.port) \n request = Net::HTTP::Get.new(uri.request_uri)\n begin\n response = http.request(request)\n result = parse_response(response)\n assert_response(result[:headers])\n return result[:results]\n rescue JamendoError => e\n e.inspect\n end\n end", "def get_request\n# Use our @http_object object's request method to call the\n# Net::HTTP::Get class and return the resulting response object\n @http_object.request(Net::HTTP::Get.new(@url.request_uri))\n end", "def request(url,token = nil)\n url = URI(\"#{url}&api_key=#{token}\") # se quita uri y parentesis\n #puts url_string\n \n \n https = Net::HTTP.new(url.host, url.port)\n https.use_ssl = true\n request = Net::HTTP::Get.new(url)\n response = https.request(request)\n data = JSON.parse(response.read_body)\n #puts data\nend", "def index\n @requests = Request.where(status: -1)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end", "def execute\n uri = request_uri\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new(uri.request_uri)\n retries = Europeana.max_retries\n \n begin\n response = http.request(request)\n rescue Timeout::Error, Errno::ECONNREFUSED, EOFError\n retries -= 1\n raise unless retries > 0\n sleep Europeana.retry_delay\n retry\n end\n \n json = JSON.parse(response.body)\n raise Errors::RequestError, json['error'] unless json['success']\n json\n rescue JSON::ParserError\n raise Errors::ResponseError\n end", "def getJson(url)\n\t\tencoded_url = URI.encode(\"https://cryptic-mountain-56365.herokuapp.com/api/v1\"+url)\n\t\turi = URI.parse(encoded_url)\n\t\tjson = Net::HTTP.get(uri)\n\tend", "def get_request(options, path)\n\n result = {}\n\n http = Net::HTTP.new(ENV['NESSUS_HOST'], options[:port])\n http.use_ssl = @use_ssl\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n http.start do |http|\n req = Net::HTTP::Get.new(path)\n\n # we make an HTTP basic auth by passing the\n # username and password\n req['X-ApiKeys'] = \"accessKey=#{ENV['NESSUS_ACCESS_KEY']}; secretKey=#{ENV['NESSUS_SECRET_KEY']}\"\n \n resp, data = http.request(req)\n \n if resp.code.eql? '200'\n #print \"Data: \" + JSON.pretty_generate(JSON.parse(resp.body.to_s))\n result = JSON.parse(resp.body.to_s)\n else\n puts \"Error: \" + resp.code.to_s + \"\\n\" + resp.body\n end\n end\n\n return result\n end", "def perform_api_request(query) \n request = Net::HTTP::Post.new( \n $url.path + ($url.query != nil ? (\"?\" + $url.query) : \"\"), \n initheader = {\"Content-Type\" => \"application/json\", \n \"X-Replicon-Security-Context\" => \"User\"}) \n request.basic_auth($companyKey + \"\\\\\" + $loginname, $password) \n request.body = JSON.generate(query) \n \n server = Net::HTTP.new($url.host, $url.port) \n server.use_ssl = $url.scheme == \"https\" \n response = server.start {|http| http.request(request)} \n \n http_code = response.code.to_i \n if http_code != 200 \n puts response.body \n raise \"Expected success code 200, but was #{http_code}\" \n end \n \n return JSON.parse(response.body) \nend", "def get_json(url)\n @response = RestClient.get url\n while @response.nil? do\n if @response.code == 200\n @response = RestClient.get url\n end\n end\n @json_file = JSON.parse(@response)\n end", "def json_get(path, params={})\n json_request(:get, path, params)\n end", "def get_json_stats_from(ip, port)\n Net::HTTP.start(ip, port) {|http| http.get('/stats.json') }.body rescue \"{}\"\nend", "def readJSONFromUrl(url)\n # use GET request to retrieve the json\n uri = URI(url)\n response = Net::HTTP.get(uri)\n json = JSON.parse(response)\n return json\nend", "def get_requests\n @requests\n end", "def fetch_url(https,req)\n res = https.request(req)\n case res\n when Net::HTTPSuccess\n answer=JSON.parse(res.body)\n return answer\n else\n puts \"HTTP Error #{res.code} calling #{https}\"\n res.error!\n end\nend", "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 requests\n @requests_obj.list\n end", "def do_get\n Net::HTTP.get(URI.parse(api_url))\n end", "def http; end", "def get(path)\n req = Net::HTTP::Get.new(@base_url + path)\n response = handle_request(req)\n response.each {|k,v| puts \"#{k}: #{v}\"}\n response\n end", "def do_request()\n uri = URI.parse(API_BASE_URL + build_request_path())\n response = Net::HTTP.get_response(uri)\n response.body\n end", "def api_fetch(url)\n JSON.parse(URI.open(url).read)\nend", "def room_descriptions_method\r\n my_port = 8081\r\n htttproomnumber = $roomnumber\r\n roomsNtext = \"/#{htttproomnumber}\"\r\n rooms_message = \"/rooms#{roomsNtext}\"\r\n url = URI.parse(\"http://localhost:#{my_port}#{rooms_message}\")\r\n req = Net::HTTP::Get.new(url.to_s)\r\n res = Net::HTTP.start(url.host, url.port){|http|\r\n http.request(req)\r\n }\r\n my_json = JSON.parse(res.body) \r\n return my_json[\"room\"].to_s\r\nend", "def get_request( id )\n url = \"#{self.url}/#{id}?auth=#{self.authtoken}\"\n status, response = rest_get( url )\n return status, response['details'] if ok?( status ) && response['details']\n return status, ''\n end", "def perform_get(rest_url, request)\n query_params = request.api_params.blank? ? '' : to_query_params(request.api_params)\n url = \"#{rest_url}&#{query_params}\"\n\n response = RestClient::Request.execute(\n method: request.http_method,\n url: url,\n headers: request.header_params,\n read_timeout: 30,\n open_timeout: 15\n )\n JSON.parse(response)\n end", "def gather_issues\n url = \"#{URL}/projects/foreman/issues.json?status_id=1&limit=100&release_id=#{@current_release_id}\"\n puts url\n uri = URI(URI.escape(url))\n response = Net::HTTP.get(uri)\n JSON.parse(response)\nend", "def requests\n REQUESTS\n end", "def httpget(url, corpNum, userID = '')\n headers = {\n \"x-pb-version\" => BaseService::POPBILL_APIVersion,\n \"Accept-Encoding\" => \"gzip,deflate\",\n }\n\n if corpNum.to_s != ''\n headers[\"Authorization\"] = \"Bearer \" + getSession_Token(corpNum)\n end\n\n if userID.to_s != ''\n headers[\"x-pb-userid\"] = userID\n end\n\n uri = URI(getServiceURL() + url)\n\n request = Net::HTTP.new(uri.host, 443)\n request.use_ssl = true\n\n Net::HTTP::Get.new(uri)\n\n res = request.get(uri.request_uri, headers)\n\n if res.code == \"200\"\n if res.header['Content-Encoding'].eql?('gzip')\n JSON.parse(gzip_parse(res.body))\n else\n JSON.parse(res.body)\n end\n else\n raise PopbillException.new(JSON.parse(res.body)[\"code\"],\n JSON.parse(res.body)[\"message\"])\n end\n end", "def restRequest(url)\n printDebugMessage('restRequest', 'Begin', 11)\n printDebugMessage('restRequest', 'url: ' + url, 12)\n # Split URL into components\n uri = URI.parse(url)\n # Create a HTTP connection\n httpConn = Net::HTTP.new(uri.host, uri.port)\n # Get the resource\n if uri.query\n path = \"#{uri.path}?#{uri.query}\"\n else\n path = uri.path\n end\n resp, data = httpConn.get(path, {'User-agent' => getUserAgent()})\n case resp\n when Net::HTTPSuccess, Net::HTTPRedirection\n # OK\n else\n $stderr.puts data\n resp.error!\n end\n printDebugMessage('restRequest', 'data: ' + data, 21)\n printDebugMessage('restRequest', 'End', 11)\n return data\n end", "def index\n temp = current_user.id\n # Auf Methode warten, nur noch offene, in der Zukunft liegende Requests \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 make_request(uri)\n response = Net::HTTP.get_response(uri)\n JSON.parse(response.body)\n end", "def get_data\n uri = URI(\"#{@url_base}/#{@url_path}\")\n uri.query = @params\n use_ssl = { use_ssl: uri.scheme == 'https', verify_mode: OpenSSL::SSL::VERIFY_NONE }\n response = {}\n\n Net::HTTP.start(uri.host, uri.port, use_ssl) do |http|\n request = Net::HTTP::Get.new(uri)\n response = http.request(request)\n end\n\n raise JSON.parse(response.body)['error'] if !JSON.parse(response.body)['error'].nil?\n\n raise \"page_arg_must_be_integer\" if !@page_number.empty? && @page_number.scan(/\\d/).join('').to_i == 0\n\n raise \"no_response\" if JSON.parse(response.body).nil?\n\n raise \"no_orders_found\" if JSON.parse(response.body)['orders'].nil?\n\n { res: JSON.parse(response.body), status: get_response_status(response) }\n end", "def perform\n requests = session.requests\n number_width = Math.log10(requests.length).to_i + 1\n displayed_one = false\n requests.each_with_index do |request, index|\n next unless request.response\n\n puts(strong('-' * 80)) if displayed_one\n displayed_one = true\n\n number = (index + 1).to_s.rjust(number_width)\n print \"#{strong number} \"\n show_request request\n\n puts unless request.headers.empty?\n show_headers request.headers,\n show_asterisk_next_to: HTTY::Request::COOKIES_HEADER_NAME,\n show_mercantile_next_to: HTTY::Request::AUTHORIZATION_HEADER_NAME\n\n unless request.body.to_s.empty?\n puts\n puts request.body\n end\n\n puts\n show_response request.response\n\n puts unless request.response.headers.empty?\n show_headers request.response.headers,\n show_asterisk_next_to: HTTY::Response::COOKIES_HEADER_NAME\n\n unless request.response.body.to_s.empty?\n puts\n puts request.response.body\n end\n end\n end", "def net_http_get_package_info\n thread = @thread\n timestamp = Time.now.utc.strftime(\"%Y-%m-%dT%H:%M:%S\\+0000\")\n\n uri = URI(\"#{@sendsafely_url}/#{API}/package/#{@thread}/\")\n\n req = Net::HTTP::Get.new(uri)\n req['Content-Type'] = 'application/json'\n req['ss-api-key'] = @sendsafely_key_id\n req['ss-request-timestamp'] = timestamp\n req['ss-request-signature'] = OpenSSL::HMAC.hexdigest(\"SHA256\", @sendsafely_key_secret, @sendsafely_key_id+\"/#{API}/package/#{thread}\"+timestamp)\n\n res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) {|http|\n http.request(req)\n }\n\n puts res.body\n end", "def get_inf(url)\n\turi = URI.parse(url)\n\tresponse = Net::HTTP.get_response(uri)\n\tJSON.parse(response.body)\nend", "def show\n @request = Request.find(params[:id])\n\n render json: @request\n end", "def rest_get(url)\n JSON.parse(RestClient.get(url))\n end", "def get_request\n # Use our @http_object object's request method to call the\n # Net::HTTP::Get class and return the resulting response object\n @http_object.request(Net::HTTP::Get.new(@url.request_uri))\n end", "def make_http_request\n Net::HTTP.get_response('localhost', '/ping', 3000).body\nend", "def api_request(input_args)\n addr = URI(api_url)\n parms = input_args.clone\n parms = api_defaults.merge(parms)\n addr.query = URI.encode_www_form(parms)\n JSON.parse(Net::HTTP.get(addr))\n end", "def index\n @requests = Request.all\n end", "def index\n @requests = Request.all\n end", "def index\n @requests = Request.all\n end", "def index\n @requests = Request.all\n end", "def index\n @requests = Request.all\n end", "def index\n @requests = Request.all\n end", "def index\n @requests = Request.all\n end", "def index\n @requests = Request.all\n end", "def index\n @requests = Request.all\n end", "def index\n @requests = Request.all\n end", "def get(url, opts = {})\n response = RestClient::Request.new(\n method: :get,\n url: \"#{ENDPOINT_URL}/#{url}\",\n verify_ssl: false,\n headers: {\n 'Content-Type' => 'application/json',\n 'Authorization' => \"Basic #{authorization_hash}\",\n 'client-id' => client_id,\n 'access-token' => access_token\n },\n payload: opts\n ).execute\n\n JSON.parse(response)\n end", "def web_request\n response_string = RestClient.get('http://www.swapi.co/api/people/')\n response_hash = JSON.parse(response_string)\nend", "def get_rest_api(endpoint, http)\n rest_api_endpoint = \"/classifier-api/v1/#{endpoint}\"\n\n # Create an HTTP GET request against the specified REST API endpoint.\n request = Net::HTTP::Get.new(rest_api_endpoint)\n # Submit the request\n response = http.request(request)\n # Return the response body (JSON containing the results of the query).\n response.body\nend", "def request(type, *attributes)\n raw = RestClient.send(type, *attributes, :'User-Agent' => \"WhatsThisClient (https://github.com/whats-this/owo.rb, v#{OwO::VERSION})\")\n json = parse_json(raw)\n return json\n rescue RestClient::RequestEntityTooLarge\n raise OwO::Err::TooLarge, 'Requested files are too large!'\n rescue RestClient::Unauthorized\n raise OwO::Err::BadToken, 'Token is invalid!'\n rescue RestClient::BadRequest => e\n raw = e.response\n json = parse_json(raw)\n raise OwO::Err::TooManyFiles, 'You requested too many files!' if json.is_a?(Hash) && json['description'] == 'too many files'\n raise OwO::Err::BadURL, 'Your URL is invalid!' if !json.is_a?(Hash) && raw == 'invalid URL'\n err = if json.is_a?(Hash)\n json['description']\n else\n raw\n end\n raise err\n rescue RestClient::InternalServerError\n raise OwO::Err::ServerFail, 'Server Error!'\n rescue RuntimeError => e\n raise e\n end", "def index\n unless params[:requests] && params[:requests].is_a?(Array)\n render :json => {:error => \"Must pass an array of requests\"}, :status => :bad_request and return\n end\n\n if params[:requests].size > MAX_REQUESTS\n render :json => {:error => \"This batch API accepts a maximum of #{MAX_REQUESTS} requests\"}, :status => :bad_request and return\n end\n\n fetcher = Batchy::Fetcher.new(app: Rails.application, requests: params[:requests]).run\n render :json => {:succeeded => fetcher.succeeded, :failed => fetcher.failed, :responses => fetcher.responses}, :status => :ok\n end", "def perform_request url, verb = :get, body = nil, options = {}\n options_id = options.inspect\n can_cache = [:post, :put].include?(verb) ? false : cached?\n if can_cache && result = store.get(\"#{clean_url(url)}#{options_id}\")\n return JSON.parse(result)\n end\n response = perform_rate_limited_request(url, verb, body, options)\n store.setex \"#{clean_url(url)}#{options_id}\", ttl, response.to_json if can_cache\n response\n end", "def _request(url, type, key)\n url = URI(url)\n type ||= :GET\n req_path = \"#{url.path}?#{url.query}\"\n\n if type == :GET\n req = Net::HTTP::Get.new(req_path)\n elsif type == :POST\n req = Net::HTTP::Post.new(req_path)\n end\n\n req.add_field('X-Vermillion-Key', key)\n req.add_field('Accept', 'application/json')\n req.add_field('Cache-Control', 'no-cache')\n req.add_field('From', @config.get(:user))\n req.add_field('User-Agent', 'Vermillion Client 1.0')\n\n res = Net::HTTP.new(url.host, url.port).start do |http|\n http.request(req)\n end\n\n res\n end", "def get(url)\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n\n response = http.get(\"#{uri.path}?auto\")\n\n unless response.code == \"200\"\n puts \"Failed to retrieve #{url}: #{response.code}\"\n exit 3\n end\n\n response.body\nend", "def getstubjson(title_number)\n uri = URI.parse($STUBJSON)\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new('/' + title_number)\n request.basic_auth $http_auth_name, $http_auth_password\n response = http.request(request)\n if (response.code != '200') then\n raise \"Error in getting JSON for: \" + title_number\n end\n return response.body\nend", "def invoke_request(url)\n site = RestClient::Resource.new(url, \"dHgVM1emGoTyr8zHmVNH\")\n\n begin\n response = site.get(:accept=>\"application/json\")\n # puts \"URL response: #{response}\"\n return JSON.parse(response)\n rescue => e\n e.response\n return nil\n end\nend", "def api_request\n url = URI.parse(\"https://catfact.ninja/fact\")\n response = Net::HTTP.get_response(url)\n JSON.parse(response.body)[\"fact\"]\n end", "def get\n start { |connection| connection.request http :Get }\n end", "def json_req(uri)\n begin\n resp = RestClient.get(uri, accept: :json)\n rescue RestClient::ExceptionWithResponse => e\n code = e.response.code\n raise RequestError.new(\"failed to retrieve JWK, status #{code}\", code)\n end\n\n JSON.parse resp.body\n end", "def get endpoint\n do_request :get, endpoint\n end" ]
[ "0.68759495", "0.68390095", "0.68390095", "0.68246204", "0.6697538", "0.6669717", "0.6602752", "0.6462156", "0.64515334", "0.63651067", "0.635556", "0.6340648", "0.6272035", "0.6267208", "0.62251824", "0.6224961", "0.6203947", "0.6176129", "0.61726964", "0.6171526", "0.6146873", "0.6139874", "0.6139874", "0.613805", "0.6137731", "0.61319155", "0.60915375", "0.6083828", "0.60736656", "0.60638416", "0.60638416", "0.6061351", "0.60458976", "0.6042487", "0.6013194", "0.60075253", "0.60050267", "0.600215", "0.59907603", "0.5948244", "0.5926445", "0.5918315", "0.5917321", "0.5898915", "0.5878234", "0.5862744", "0.5859487", "0.5858809", "0.5855226", "0.5848947", "0.5847497", "0.5840139", "0.58341885", "0.5827707", "0.5821456", "0.58023673", "0.579642", "0.57945585", "0.5789977", "0.5783788", "0.5781333", "0.57747936", "0.5770433", "0.57602596", "0.5756494", "0.5746832", "0.57453996", "0.5744415", "0.57356334", "0.5733277", "0.57309246", "0.5729169", "0.57269186", "0.5724759", "0.5721078", "0.5716287", "0.5712389", "0.5699817", "0.5699817", "0.5699817", "0.5699817", "0.5699817", "0.5699817", "0.5699817", "0.5699817", "0.5699817", "0.5699817", "0.56990385", "0.56987315", "0.5698633", "0.5695132", "0.5686885", "0.568415", "0.5682991", "0.5681546", "0.56775135", "0.5673019", "0.5671926", "0.5664797", "0.5661992", "0.5660086" ]
0.0
-1
POST /http_requests POST /http_requests.json
def create @http_request = HttpRequest.new(http_request_params) respond_to do |format| if @http_request.save format.html { redirect_to @http_request, notice: 'Http request was successfully created.' } format.json { render action: 'show', status: :created, location: @http_request } else format.html { render action: 'new' } format.json { render json: @http_request.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def http_post(path, request)\n @http.post(\n :body => JSON(:request => request.to_hash),\n :headers => headers,\n :path => \"/api/v2/#{path}\",\n :expects => [200, 201, 202]\n )\n end", "def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{path}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts JSON.pretty_generate(result)\n result\nend", "def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{path}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts result[:result]\n result\nend", "def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{uri}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts result[:result]\n result\nend", "def post_json(path, body)\n uri = build_uri(path)\n #puts \"🤖 POST #{path}\"\n #puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n #puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n #puts result[:result]\n result\nend", "def post_rest_api(endpoint, data, http)\n rest_api_endpoint = \"/classifier-api/v1/#{endpoint}\"\n\n # Create an HTTP POST request against the specified REST API endpoint\n request = Net::HTTP::Post.new(rest_api_endpoint)\n # Set the Content-Type and data of the HTTP POST request\n request.content_type = \"application/json\"\n request.body = data\n # Submit the request\n response = http.request(request)\n # Return the response bosy (JSON containing the result of the POST operation)\n response.body\nend", "def post_json(path, body)\n uri = build_uri(path)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n result = JSON.parse(response.body)\n puts result\n result\nend", "def post()\n return @http.request(@req)\n end", "def http_post(url, data)\n\turi = URI(url)\n\treq = Net::HTTP::Post.new(uri.path, initheader = {'Content-Type' =>'application/json'})\n req.body = data.to_json\n response = Net::HTTP.new(uri.host, uri.port).start {|http| http.request(req) }\n return response\nend", "def upload_submission(sub_info)\n uri = URI.parse(TARGET_API)\n http = Net::HTTP.new(uri.host, uri.port)\n\n req = Net::HTTP::Post.new(\"/ontologies/#{sub_info['ontology']['acronym']}/submissions\")\n req['Content-Type'] = 'application/json'\n req['Authorization'] = \"apikey token=#{TARGET_APIKEY}\"\n\n # Check if the source BioPortal is pulling the ontology from an URL\n # If yes then we will pull the ontology from this place (allow auto update of the ontology when the ontology is changed in its source URL)\n if sub_info['pullLocation'].nil?\n pull_location = \"#{sub_info['ontology']['links']['download']}?apikey=#{SOURCE_APIKEY}\"\n else\n pull_location = sub_info['pullLocation']\n end\n\n # Extract contacts\n contacts = []\n sub_info['contact'].each do |contact|\n contacts.push({'name': contact['name'],'email': contact['email']})\n end\n\n # Build the json body\n # hasOntologyLanguage options: OWL, UMLS, SKOS, OBO\n # status: alpha, beta, production, retired\n req.body = {\n 'contact': contacts,\n 'hasOntologyLanguage': sub_info['hasOntologyLanguage'],\n 'released': sub_info['released'],\n 'ontology': \"#{TARGET_API}/ontologies/#{sub_info['ontology']['acronym']}\",\n 'description': sub_info['description'],\n 'status': sub_info['status'],\n 'version': sub_info['version'],\n 'homepage': sub_info['homepage'],\n 'documentation': sub_info['documentation'],\n 'publication': sub_info['publication'],\n 'naturalLanguage': sub_info['naturalLanguage'],\n 'pullLocation': pull_location\n }.to_json\n\n #puts req.body.to_s\n response = http.start do |http|\n http.request(req)\n end\n\n return response\nend", "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 http_post_request\n begin\n return http_client.post(http_path_query, compressed_request, http_headers)\n rescue APIKeyError\n log 'error - you must set your api_key.'\n rescue TimeoutError\n log 'fail - timeout while contacting the api server.'\n rescue Exception => e\n log \"fail - exception raised during http post. (#{e.class.name}: #{e.message})\"\n end\n nil\n end", "def post\n @response_body = make_request(\"#{api_url}#{endpoint}\", request_body.to_json)\n puts \"GLIMR POST: #{endpoint} - #{request_body.to_json}\" if ENV.key?('GLIMR_API_DEBUG')\n end", "def post_request(secureNetId, secureKey, url)\n uri = URI.parse(url) # Parse the URI\n http = Net::HTTP.new(uri.host, uri.port) # New HTTP connection\n http.use_ssl = true # Must use SSL!\n req = Net::HTTP::Post.new(uri.request_uri) # HTTP POST request \n body = {} # Request body hash\n yield body # Build body of request\n req.body = body.to_json # Convert hash to json string\n req[\"Content-Type\"] = 'application/json' # JSON body\n req[\"Origin\"] = 'worldpay.com' # CORS origin\n req.basic_auth secureNetId, secureKey # HTTP basic auth\n res = http.request(req) # Make the call\n return JSON.parse(res.body) # Convert JSON to hashmap\nend", "def post(request)\n do_request(request) { |client| client.http_post request.body }\n end", "def httppost(url, corpNum, postData, action = '', userID = '', contentsType = '')\n\n headers = {\n \"x-lh-version\" => KAKAOCERT_APIVersion,\n \"Accept-Encoding\" => \"gzip,deflate\",\n }\n\n apiServerTime = @linkhub.getTime(@useStaticIP, @useGAIP)\n\n hmacTarget = \"POST\\n\"\n hmacTarget += Base64.strict_encode64(Digest::SHA256.digest(postData)) + \"\\n\"\n hmacTarget += apiServerTime + \"\\n\"\n\n hmacTarget += KAKAOCERT_APIVersion + \"\\n\"\n\n key = Base64.decode64(@linkhub._secretKey)\n\n data = hmacTarget\n digest = OpenSSL::Digest.new(\"sha256\")\n hmac = Base64.strict_encode64(OpenSSL::HMAC.digest(digest, key, data))\n\n headers[\"x-kc-auth\"] = @linkhub._linkID+' '+hmac\n headers[\"x-lh-date\"] = apiServerTime\n\n if contentsType == ''\n headers[\"Content-Type\"] = \"application/json; charset=utf8\"\n else\n headers[\"Content-Type\"] = contentsType\n end\n\n headers[\"Authorization\"] = \"Bearer \" + getSession_Token(corpNum)\n\n\n uri = URI(getServiceURL() + url)\n\n https = Net::HTTP.new(uri.host, 443)\n https.use_ssl = true\n Net::HTTP::Post.new(uri)\n\n res = https.post(uri.request_uri, postData, headers)\n\n if res.code == \"200\"\n if res.header['Content-Encoding'].eql?('gzip')\n JSON.parse(gzip_parse(res.body))\n else\n JSON.parse(res.body)\n end\n else\n raise KakaocertException.new(JSON.parse(res.body)[\"code\"],\n JSON.parse(res.body)[\"message\"])\n end\n end", "def perform_api_request(query) \n request = Net::HTTP::Post.new( \n $url.path + ($url.query != nil ? (\"?\" + $url.query) : \"\"), \n initheader = {\"Content-Type\" => \"application/json\", \n \"X-Replicon-Security-Context\" => \"User\"}) \n request.basic_auth($companyKey + \"\\\\\" + $loginname, $password) \n request.body = JSON.generate(query) \n \n server = Net::HTTP.new($url.host, $url.port) \n server.use_ssl = $url.scheme == \"https\" \n response = server.start {|http| http.request(request)} \n \n http_code = response.code.to_i \n if http_code != 200 \n puts response.body \n raise \"Expected success code 200, but was #{http_code}\" \n end \n \n return JSON.parse(response.body) \nend", "def send_request(req); end", "def post_request(options, path, post_data)\n\n result = {}\n\n http = Net::HTTP.new(ENV['NESSUS_HOST'], options[:port])\n http.use_ssl = @use_ssl\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n http.start do |http|\n req = Net::HTTP::Post.new(path)\n\n req['X-ApiKeys'] = \"accessKey=#{ENV['NESSUS_ACCESS_KEY']}; secretKey=#{ENV['NESSUS_SECRET_KEY']}\"\n req.body = post_data\n \n resp, data = http.request(req)\n \n if resp.code.eql? '200'\n #print \"Data: \" + JSON.pretty_generate(JSON.parse(resp.body.to_s))\n result = JSON.parse(resp.body.to_s)\n else\n puts \"Error: \" + resp.code.to_s + \"\\n\" + resp.body\n end\n end\n\n return result\n end", "def request_json\n @request.headers[\"Content-Type\"] = 'application/json'\n @request.headers[\"Accept\"] = 'application/json'\n end", "def create\n\t\turi = URI.parse(Counter::Application.config.simplyurl)\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\n\t\trequest = Net::HTTP::Post.new('/offsets.json')\n\t\tputs params\n\t\tputs params.slice(*['custids','acctids','itemids'])\n\t\t\n\t\t# ok, this join stuff is bogus - it encodes properly, but the other side only sees the last element and loses the array type - it's just string\n\t\t# this way, i 'split' it at the other side to recover my array\n\t\t# it should work without the join/split crap, but it doesn't\n\t\trequest.set_form_data({:custids => ( params['custids'] || []).join(','), :acctids => ( params['acctids'] || []).join(','), :itemids => ( params['itemids'] || []).join(','), :amount => params['amount'], :type => params['type']})\n\t\t\n\t\tputs request.body\n\t\t\n\t\tresponse = http.request(request)\n\t\tputs response.body\n\n respond_to do |format|\n format.html { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n format.json { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n end\n end", "def post_request(device_id, epoch_time)\n uri = URI.parse(BASE_URL)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = false\n request = Net::HTTP::Post.new(\"/#{device_id}/#{epoch_time}\")\n response = http.request(request)\n response.code == \"200\"\nend", "def post_as_json(data)\n uri = URI.parse(LISTENER)\n http = Net::HTTP.new(uri.host, uri.port)\n http.read_timeout = 0.5\n begin\n request = Net::HTTP::Post.new(uri.request_uri, {'Content-Type' => 'application/json'})\n request.body = data.to_json\n http.request(request){|res| puts \"Post status: #{res.body}\" }\n rescue StandardError => e\n puts \"Failed sending data: #{e.message}\"\n end\nend", "def post_api(path, params={}, headers={})\n headers.merge!('CONTENT_TYPE' => \"application/json\")\n post path, params, headers\nend", "def request_content\n @request_content ||= begin\n uri = URI(http_request[:url])\n req = Net::HTTP::Post.new(uri.path, http_request[:headers])\n\n # Add task headers\n req[Cloudtasker::Config::TASK_ID_HEADER] = id\n req[Cloudtasker::Config::RETRY_HEADER] = retries\n\n # Set job payload\n req.body = http_request[:body]\n req\n end\n end", "def http_post_request(req_body)\n\t\t#New http request (uri library deals with port and host on its own when parsing the url)\n\t\thttp = Net::HTTP.new(@uri.host, @uri.port)\n\t\t#Original api url get does not need SSL (bad solution but any other way would not seem to work properly)\n\t\tif caller[1][/`.*'/].nil? or not (caller[1][/`.*'/][1..-2] == \"initialize\")\n\t\t\t#Https security stuff (don't need security when getting initial api url)\n\t\t\thttp.use_ssl = true\n\t\t\thttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\t\tend\n\t\t#Post request using uri\n\t\trequest = Net::HTTP::Post.new(@uri.request_uri)\n\t\t#Sets request to use basic authentication using the given username and api_key\n\t\trequest.basic_auth(@username, @api_key)\n\t\t#Sets request to use json content type\n\t\trequest.content_type = \"application/json\"\n\t\t#Sets request body to json file passed\n\t\trequest.body = req_body\n\t\t#Executes setup request and returns body\n\t\thttp.request(request).body\n\tend", "def send_request(request)\n begin\n postData = HTTParty.post(REQUEST_URL, body: request.to_json, :headers => { 'Content-Type' => 'application/json' })\n rescue EOFError,SocketError => error\n sleep(0.5)\n STDERR.puts \"retrying request\"\n retry\n end\n return JSON.parse(postData.body)\n end", "def test_post_sample_traces\n header 'Content-Type', 'application/json'\n\n (0..4).each do |i|\n data = File.read \"sample-traces/#{i}.json\"\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n assert last_response.ok?\n end\n end", "def request_post(path, data)\n\ttimestamp = Time.now.utc.iso8601\n\tauth = create_hmac_auth(\"POST\", path, timestamp)\n\t\n\turi = URI($baseUrl + path)\n\n\trequest = Net::HTTP::Post.new(uri)\n\trequest.add_field(\"Content-Type\", \"application/json\")\n\trequest.add_field(\"x-hp-hmac-authentication\", auth)\n\trequest.add_field(\"x-hp-hmac-date\", timestamp)\n\trequest.body = data\n\n\tresponse = Net::HTTP.start(uri.host, uri.port,\n\t\t:use_ssl => uri.scheme == 'https',\n\t\t:verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|\n\t\thttp.request(request)\n\tend\n\n\treturn response\nend", "def post(url, payload)\n url = URI.parse(url)\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n request = Net::HTTP::Post.new(url.path+'?access_token=verysecret')\n request.content_type = 'application/json'\n request.body = JSON.generate(payload)\n response = http.start {|http| http.request(request) }\n begin\n return JSON.parse(response.body)\n rescue\n # Log as a problematic case with rule number and line\n $problems.write \"#{$index}, #{payload}, #{response.body}\\n\"\n return nil\n end\nend", "def perform_request(method, path, params, body)\n CONNECTION.run_request \\\n method.downcase.to_sym,\n path,\n ( body ? MultiJson.dump(body): nil ),\n {'Content-Type' => 'application/json'}\n end", "def create_recipe_request(version, auth_headers, data = {})\n post \"/api/recipes\", params: data, headers: {'Content-Type' => \"application/json\", 'Accept' => \"application/vnd.ink.#{version}\" }.merge(auth_headers)\nend", "def http_post(url, hash=nil, _port=nil, headers=nil)\n \n resp, data = http_request(url, \"post\", hash, _port, headers)\n\treturn [resp, data]\nend", "def send_request method, params, &block\n message = {\n jsonrpc: \"2.0\",\n method: method,\n params: params,\n id: @next_request_id\n }\n json = message.to_json\n requests[@next_request_id] = Request.new(@next_request_id, &block)\n envelope = \"Content-Length: #{json.bytesize}\\r\\n\\r\\n#{json}\"\n queue envelope\n @next_request_id += 1\n end", "def post_request(path, params={}, options={})\n request(:post, path, params, options)\n end", "def http_post(path, data, content_type = 'application/json')\n http_methods(path, :post, data, content_type)\n end", "def post(url, payload, headers={})\n payload = MultiJson.encode(payload)\n headers = headers.merge({:content_type => 'application/json'})\n request(:post, url, payload, headers)\n end", "def send_request(request) # :nodoc:\n response = @http.request(request)\n validate_response(response)\n JSON.parse(response.body)\n end", "def httppost(url, corpNum, postData, action = '', userID = '', contentsType = '')\n\n headers = {\n \"x-pb-version\" => BaseService::POPBILL_APIVersion,\n \"Accept-Encoding\" => \"gzip,deflate\",\n }\n\n if contentsType == ''\n headers[\"Content-Type\"] = \"application/json; charset=utf8\"\n else\n headers[\"Content-Type\"] = contentsType\n end\n\n if corpNum.to_s != ''\n headers[\"Authorization\"] = \"Bearer \" + getSession_Token(corpNum)\n end\n\n if userID.to_s != ''\n headers[\"x-pb-userid\"] = userID\n end\n\n if action.to_s != ''\n headers[\"X-HTTP-Method-Override\"] = action\n end\n\n uri = URI(getServiceURL() + url)\n\n https = Net::HTTP.new(uri.host, 443)\n https.use_ssl = true\n Net::HTTP::Post.new(uri)\n\n res = https.post(uri.request_uri, postData, headers)\n\n if res.code == \"200\"\n if res.header['Content-Encoding'].eql?('gzip')\n JSON.parse(gzip_parse(res.body))\n else\n JSON.parse(res.body)\n end\n else\n raise PopbillException.new(JSON.parse(res.body)[\"code\"],\n JSON.parse(res.body)[\"message\"])\n end\n end", "def send_request(batch)\n payload = batch.to_s\n request = Net::HTTP::Post.new(@path, @headers)\n\n if self.class.stub\n logger.debug \"stubbed request to #{@path}: \" \\\n \"batch = '#{batch}'\"\n\n [200, '', 'OK']\n else\n # If `start` is not called, Ruby adds a 'Connection: close' header to\n # all requests, preventing us from reusing a connection for multiple\n # HTTP requests\n @http.start unless @http.started?\n\n response = @http.request(request, payload)\n [response.code.to_i, response.body, response.message]\n end\n end", "def create(url, data)\n RestClient.post ENV['APIBASE']+url, data, :content_type => :json\nend", "def http_post(url, params, json = false)\n content_type = {}\n if json && params\n params = params.to_json\n content_type['Content-Type'] = 'application/json'\n end\n headers = @auth_headers.merge(content_type)\n exponential_backoff do\n @mutex.synchronize do\n begin\n response = @agent.post(url, params, headers)\n return JSON.parse(response.body)\n rescue Net::HTTP::Persistent::Error\n reset_http_agent\n response = @agent.post(url, params, headers)\n return JSON.parse(response.body)\n end\n end\n end\n end", "def make_json_request( opts={} )\n\t\topts = TEST_JSON_REQUEST_OPTS.merge( opts )\n\t\theaders = normalize_headers( opts, TEST_JSON_HEADERS )\n\t\theaders.delete( 'URI' ) # JSON requests don't have one\n\n\t\tMongrel2.log.debug \"JSON request, headers = %p, opts = %p\" % [ headers, opts ]\n\n\t\theaderstring = TNetstring.dump( Yajl::Encoder.encode(headers) )\n\t\tbodystring = TNetstring.dump( Yajl::Encoder.encode(opts[:body] || []) )\n\n\t\t# UUID ID PATH SIZE:HEADERS,SIZE:BODY,\n\t\treturn \"%s %d %s %s%s\" % [\n\t\t\topts[:uuid],\n\t\t\topts[:id],\n\t\t\topts[:path],\n\t\t\theaderstring,\n\t\t\tbodystring,\n\t\t]\n\tend", "def send_request; end", "def http_accept_json(http_method, params, data=nil)\n url = URI.parse(\"http://localhost:7000/test/#{params}\")\n\n Net::HTTP.start(url.host, url.port) do |http|\n initheader = {'Accept:' => 'application/json'}\n response = case http_method\n when :GET\n http.get(url.path, initheader)\n when :PUT\n http.put(url.path, data, initheader)\n when :POST\n http.post(url.path, data, initheader)\n when :DELETE\n http.delete(url.path, initheader)\n end\n JSON.parse(response.body)\n end\nend", "def make_post_request url, body, headers = []\n make_request url, method: ::Rack::POST, body: body, headers: headers\n end", "def post(request)\n # sure thing!\n json_response(200, { message: \"This dummy POST endpoint didn't do anything.\" })\n end", "def make_json_request( opts={} )\n\t\topts = TEST_JSON_REQUEST_OPTS.merge( opts )\n\t\theaders = normalize_headers( opts, TEST_JSON_HEADERS )\n\t\theaders.delete( 'URI' ) # JSON requests don't have one\n\n\t\tMongrel2.log.debug \"JSON request, headers = %p, opts = %p\" % [ headers, opts ]\n\n\t\theaderstring = TNetstring.dump( Yajl::Encoder.encode(headers) )\n\t\tbodystring = TNetstring.dump( Yajl::Encoder.encode(opts[:body] || []) )\n\n\t\t# UUID ID PATH SIZE:HEADERS,SIZE:BODY,\n\t\tdata = \"%s %d %s %s%s\" % [\n\t\t\topts[:uuid],\n\t\t\topts[:id],\n\t\t\topts[:path],\n\t\t\theaderstring,\n\t\t\tbodystring,\n\t\t]\n\t\treturn data.encode( 'binary' )\n\tend", "def make_json_request( opts={} )\n\t\topts = TEST_JSON_REQUEST_OPTS.merge( opts )\n\t\theaders = normalize_headers( opts, TEST_JSON_HEADERS )\n\t\theaders.delete( 'URI' ) # JSON requests don't have one\n\n\t\tMongrel2.log.debug \"JSON request, headers = %p, opts = %p\" % [ headers, opts ]\n\n\t\theaderstring = TNetstring.dump( Yajl::Encoder.encode(headers) )\n\t\tbodystring = TNetstring.dump( Yajl::Encoder.encode(opts[:body] || []) )\n\n\t\t# UUID ID PATH SIZE:HEADERS,SIZE:BODY,\n\t\tdata = \"%s %d %s %s%s\" % [\n\t\t\topts[:uuid],\n\t\t\topts[:id],\n\t\t\topts[:path],\n\t\t\theaderstring,\n\t\t\tbodystring,\n\t\t]\n\t\treturn data.encode( 'binary' )\n\tend", "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 make_request\n response = @http.request(@request)\n end", "def run_json_http_request\n uri = URI.parse @json_url\n http = Net::HTTP.new uri.host, uri.port\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n \n # set up request\n request = Net::HTTP::Get.new uri.request_uri\n \n # get response, convert to hash\n response = http.request request\n response_hash = JSON.parse response.body\n end", "def post endpoint, data\n do_request :post, endpoint, data\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 post_json(url, ls_data)\n uri = URI.parse(url)\n request = Net::HTTP::Post.new(uri.request_uri, HEADER_JSON)\n request.body = ls_data\n request.basic_auth(@nsx_user, @nsx_password)\n response = Net::HTTP.start(uri.host, uri.port, :use_ssl => true,\n :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |https|\n https.request(request)\n end\n return JSON.parse(response.body)['id'] \\\n if check_response(response, 201)\n end", "def api_request(name) \n\tresponse = HTTParty.post('https://api.talentiq.co/v2/person', \n :body => {:name => name }.to_json,\n :headers => { 'Content-Type' => 'application/json', \n \t\t\t'x-api-key:' => 'e058cdd334c69c31d45d87e44b405d128a9e8937939e7d0ab2496334',\n 'Accept' => 'application/json' })\n puts response.body\nend", "def execute_http_request(http, request)\n @response = http.request(request)\n @http_headers = {}\nend", "def post(request)\n _request(request) { |client, options| client.post options }\n end", "def generate_request(url, method, prepped_json = nil)\n uri = URI.parse url\n http = Net::HTTP.new uri.host, uri.port\n \n if uri.instance_of? URI::HTTPS\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n\n if method == 'post'\n request = Net::HTTP::Post.new uri.request_uri\n else\n request = Net::HTTP::Get.new uri.request_uri\n end\n request.add_field 'Content-Type', 'application/json'\n request.add_field 'Authorization', 'JWT ' + SiteSetting.moderator_json_web_token\n \n if prepped_json\n request.body = prepped_json\n end\n\n return http.request request\n end", "def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end", "def post(url, payload = {}, headers = {})\n http :post, \"#{url}.json\", payload.to_json, headers\n end", "def add_requests\n @request = Requests.new(@txn_name, self.config, self.name, self.probability, self.type)\n end", "def post_request(object)\n end", "def post_request(client, post_information_hash, additional_hash = nil)\n new_hash = {:content_type => \"application/json\"}\n additional_hash ||= {} \n new_hash.merge!(additional_hash)\n\n begin\n client.post(JSON.generate(post_information_hash, {:max_nesting => 100}), new_hash)\n rescue OpenSSL::SSL::SSLError => e\n raise \"SSLError occurred when calling REST service; #{e}\"\n rescue RestClient::Exception => e # if the request failed, RestClient will throw an error. We want to retrieve that error and the response within\n puts \"RestClient::Exception hit when calling REST service\"\n puts e\n puts e.response\n return e.response\n rescue => e\n raise \"Unexpected error occurred when calling REST service; #{e}\"\n end\n end", "def send_request method, params = {}\n uri = URI.parse(@api_url)\n if Time.now.to_i > @exp + 3600\n get_acces_token\n @exp = Time.now.to_i\n end\n required = { 'access_token' => @access_token, 'method' => method }\n params = required.merge(params)\n params = URI.escape(params.collect{ |k,v| \"#{k}=#{v}\"}.join('&'))\n http = Net::HTTP.new(uri.host, uri.port)\n req = Net::HTTP::Post.new(uri.request_uri)\n req['User-Agent'] = \"zhzhussupovkz pleer.com-ruby-api\"\n req.body = params\n res = http.request(req)\n if res.code == \"200\"\n data = res.body\n result = JSON.parse(data)\n else\n puts \"Invalid getting data from server\"\n exit\n end\n end", "def new_feature_request(folder_id, feature_content, file_name)\n url = URI(\"#{$base_url}/api/projects/#{$project_id}/folders/#{folder_id}/create_from_feature\")\n\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n request = Net::HTTP::Post.new(url)\n request[\"accept\"] = 'application/vnd.api+json; version=1'\n request[\"access-token\"] = $access_token\n request[\"uid\"] = $uid\n request[\"client\"] = $client\n request[\"Content-Type\"] = 'application/json'\n\n data = {\n data: {\n attributes: {\n \"feature\": feature_content\n }\n }\n }\n\n request.body = JSON.generate(data)\n response = http.request(request)\n\n if response.code == 200.to_s\n $created_count = $created_count + 1\n $success_uploaded_count = $success_uploaded_count + 1\n $uploaded_features_list.push(file_name)\n puts \"Feature '#{get_name_feature_from_file(feature_content)}' created.\"\n else\n $fail_uploaded_count = $fail_uploaded_count + 1\n $not_uploaded_features_list.push(file_name)\n end\n\n response.code\nend", "def api_v11_batch_post_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi#api_v11_batch_post ...\"\n end\n \n # resource path\n path = \"/api/v11/batch\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = []\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = []\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#api_v11_batch_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def http_request\n @http_request ||= begin\n request = request_for_verb\n add_post_data(request)\n add_bearer_token(request)\n add_headers(request)\n request\n end\n end", "def do_POST(request, response)\n\n @aspecto_repeater.repeat request\n @bugsnag_repeater.repeat request\n\n # Turn the WEBrick HttpRequest into our internal HttpRequest delegate\n request = Maze::HttpRequest.new(request)\n\n content_type = request['Content-Type']\n if %r{^multipart/form-data; boundary=([^;]+)}.match(content_type)\n boundary = WEBrick::HTTPUtils::dequote($1)\n body = WEBrick::HTTPUtils.parse_form_data(request.body, boundary)\n hash = {\n body: body,\n request: request,\n response: response\n }\n else\n # \"content-type\" is assumed to be JSON (which mimics the behaviour of\n # the actual API). This supports browsers that can't set this header for\n # cross-domain requests (IE8/9)\n digests = check_digest request\n hash = {\n body: JSON.parse(request.body),\n request: request,\n response: response,\n digests: digests\n }\n end\n if @schema\n schema_errors = @schema.validate(hash[:body])\n hash[:schema_errors] = schema_errors.to_a\n end\n add_request(hash)\n\n # For the response, delaying if configured to do so\n response_delay_ms = Server.response_delay_ms\n if response_delay_ms.positive?\n $logger.info \"Waiting #{response_delay_ms} milliseconds before responding\"\n sleep response_delay_ms / 1000.0\n end\n\n set_response_header response.header\n response.status = post_status_code\n rescue JSON::ParserError => e\n msg = \"Unable to parse request as JSON: #{e.message}\"\n if Maze.config.captured_invalid_requests.include? @request_type\n $logger.error msg\n Server.invalid_requests.add({\n reason: msg,\n request: request,\n body: request.body\n })\n else\n $logger.warn msg\n end\n rescue StandardError => e\n if Maze.config.captured_invalid_requests.include? @request_type\n $logger.error \"Invalid request: #{e.message}\"\n Server.invalid_requests.add({\n invalid: true,\n reason: e.message,\n request: {\n request_uri: request.request_uri,\n header: request.header,\n body: request.inspect\n }\n })\n else\n $logger.warn \"Invalid request: #{e.message}\"\n end\n end", "def send_request_for(testcase)\n @http_client.send_request(testcase.request['method'], testcase.request['path'], testcase.request['headers'], testcase.request['body'], testcase.request['parameters'])\n end", "def post\n resource.post(request, response)\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 create_http_request(http_method,path,*arguments)\n http_method=http_method.to_sym\n if [:post,:put].include?(http_method)\n data=arguments.shift\n end\n headers=(arguments.first.is_a?(Hash) ? arguments.shift : {})\n case http_method\n when :post\n request=Net::HTTP::Post.new(path,headers)\n request[\"Content-Length\"]=0 # Default to 0\n when :put\n request=Net::HTTP::Put.new(path,headers)\n request[\"Content-Length\"]=0 # Default to 0\n when :get\n request=Net::HTTP::Get.new(path,headers)\n when :delete\n request=Net::HTTP::Delete.new(path,headers)\n when :head\n request=Net::HTTP::Head.new(path,headers)\n else\n raise ArgumentError, \"Don't know how to handle http_method: :#{http_method.to_s}\"\n end\n if data.is_a?(Hash)\n request.set_form_data(data)\n elsif data\n request.body=data.to_s\n request[\"Content-Length\"]=request.body.length\n end\n request\n end", "def http_request(params)\n Net::HTTP::Post.new(endpoint.request_uri).tap do |request|\n request.body = URI.encode_www_form params\n request.content_type = 'application/x-www-form-urlencoded; charset=utf-8'\n end\n end", "def make_post_request(route:, headers: nil, body: nil)\n post route, params: body, headers: headers\nend", "def request(method, parameters={})\n body = wrap_json(method, parameters)\n header = {'Content-Type' => \"text/json\"}\n \n # Clear retry cound here so it's fresh for each new request we make\n @retries = 0\n \n # Send the request\n send_request(body, header)\n\n end", "def post(path, data = {})\n request 'POST', path, body: data.to_json\n end", "def post_recording_batchrequests_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RecordingApi.post_recording_batchrequests ...\"\n end\n \n \n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling RecordingApi.post_recording_batchrequests\" if body.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/recording/batchrequests\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n \n auth_names = ['PureCloud OAuth']\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 => 'BatchDownloadJobSubmissionResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RecordingApi#post_recording_batchrequests\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_http_request(http_method, path, *arguments)\n http_method = http_method.to_sym\n\n if [:post, :put, :patch].include?(http_method)\n data = arguments.shift\n end\n\n # if the base site contains a path, add it now\n uri = URI.parse(site)\n path = uri.path + path if uri.path && uri.path != '/'\n\n headers = arguments.first.is_a?(Hash) ? arguments.shift : {}\n\n case http_method\n when :post\n request = Net::HTTP::Post.new(path,headers)\n request[\"Content-Length\"] = '0' # Default to 0\n when :put\n request = Net::HTTP::Put.new(path,headers)\n request[\"Content-Length\"] = '0' # Default to 0\n when :patch\n request = Net::HTTP::Patch.new(path,headers)\n request[\"Content-Length\"] = '0' # Default to 0\n when :get\n request = Net::HTTP::Get.new(path,headers)\n when :delete\n request = Net::HTTP::Delete.new(path,headers)\n when :head\n request = Net::HTTP::Head.new(path,headers)\n else\n raise ArgumentError, \"Don't know how to handle http_method: :#{http_method.to_s}\"\n end\n\n if data.is_a?(Hash)\n request.body = OAuth::Helper.normalize(data)\n request.content_type = 'application/x-www-form-urlencoded'\n elsif data\n if data.respond_to?(:read)\n request.body_stream = data\n if data.respond_to?(:length)\n request[\"Content-Length\"] = data.length.to_s\n elsif data.respond_to?(:stat) && data.stat.respond_to?(:size)\n request[\"Content-Length\"] = data.stat.size.to_s\n else\n raise ArgumentError, \"Don't know how to send a body_stream that doesn't respond to .length or .stat.size\"\n end\n else\n request.body = data.to_s\n request[\"Content-Length\"] = request.body.length.to_s\n end\n end\n\n request\n end", "def send_request(request)\n\n factory_hash = request.to_hash\n @request.body = factory_hash.to_json\n\n # send request\n response = @http.request(@request)\n http_response = HttpResponse.new(response)\n\n parser = InjectionResponseParser.new\n parser.parse(http_response)\n\n end", "def exec_post(req, data, exit_on_fail = false)\n response_hash = exec_api_call('POST', req, data, exit_on_fail)\n response_hash[:response]\n end", "def post operation, data={}\n body = case data\n when String\n body = data\n else\n Yajl::Encoder.encode(data)\n end\n\n request = new_request operation, body\n request.sign sts\n hydra.queue request\n hydra.run\n response = request.response\n puts response.inspect if @debug\n\n if response.code == 200\n Yajl::Parser.parse response.body\n else\n raise_error response\n end\n end", "def do_request(homework)\n uri = URI.parse('https://webhook.site/1e9a10c7-54e0-414b-a1a7-3a7dad38c56d')\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n req = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json')\n req.body = {\n homework_source: homework.source_code,\n student: fullname,\n pr_title: homework.pr_title\n }.to_json\n http.request(req)\n end", "def api_request(data)\n params = {'id' => next_sequence_number!}\n params['sid'] = sid if sid\n json_data = [data].to_json\n\n response_body = get_api_response(params,json_data)\n parse_json_response(response_body)\n end", "def post url, payload\n RestClient::Request.execute(:method => :post, :url => url, :payload => payload, :headers => lbaas_headers, :timeout => @timeout, :open_timeout => @open_timeout)\n end", "def request(http_method, path, body = '', headers = {})\n puts \"#{http_method}: #{path} - [#{body}]\" if @http_debug\n @request_client.request(http_method, path, body, headers)\n end", "def request_post(path, data)\n\ttimestamp = Time.now.utc.iso8601\n\tauth = create_hmac_auth(\"POST\", path, timestamp)\n\t\n\turi = URI($baseUrl + path)\n\n\trequest = Net::HTTP::Post.new(uri)\n\trequest.add_field(\"Content-Type\", \"application/json\")\n\trequest.add_field(\"x-hp-hmac-authentication\", auth)\n\trequest.add_field(\"x-hp-hmac-date\", timestamp)\n\trequest.add_field(\"x-hp-hmac-algorithm\", \"SHA256\")\n\trequest.body = data\n\n\tresponse = Net::HTTP.start(uri.host, uri.port,\n\t\t:use_ssl => uri.scheme == 'https',\n\t\t:verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|\n\t\thttp.request(request)\n\tend\n\n\treturn response\nend", "def raw_post_request raw_params\n json_body = raw_params.to_json\n Rubix.logger.log(Logger::DEBUG, \"SEND: #{json_body}\") if Rubix.logger\n Net::HTTP::Post.new(uri.path).tap do |req|\n req['Content-Type'] = 'application/json-rpc'\n req.body = json_body\n end\n end", "def http_request_params\n params.require(:http_request).permit(:method, :parameters, :ip_address)\n end", "def post(request_opts = {})\n store_result(http(request_opts).post(resolved_path, @attrs))\n end", "def send_request(method, path, fields = {})\n response = send_logged_request(URI(base_url + path), method, request_data(fields))\n fail UnexpectedHttpResponse, response unless response.is_a? Net::HTTPSuccess\n JSON.parse(response.body)\n end", "def create_json_request(code)\n parameters = {\n \t\"code\" => code,\n\t\"level\" => self.level,\n\t\"format\" => \"json\",\n\t\"info\" => self.op\n }\n end", "def post_json(endpoint, payload, username = nil, password = nil, endpoint_stub = API_ENDPOINT)\n uri = URI(\"#{endpoint_stub}#{endpoint}\")\n\n res = ''\n Net::HTTP.start(uri.host, uri.port,\n :use_ssl => uri.scheme == 'https', \n :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|\n req = Net::HTTP::Post.new(uri.request_uri)\n req.basic_auth(username, password) if username && password\n req['Content-Type'] = 'application/json'\n req.body = payload.to_json\n\n res = http.request(req)\n end\n\n JSON.parse(res.body.to_s)\nend", "def post_request(params, useSSL=false)\n # get a server handle\n port = (useSSL == true) ? 443 : 80\n http_server = Net::HTTP.new(API_HOST, port)\n http_server.use_ssl = useSSL\n \n # build a request\n http_request = Net::HTTP::Post.new(API_PATH_REST)\n http_request.form_data = params\n \n # get the response XML\n return http_server.start{|http| http.request(http_request)}.body\n end", "def _http_post resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Post.new(path)\n _build_request resource, request\nend", "def _http_post resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Post.new(path)\n _build_request resource, request\nend", "def http_request\n lines = []\n request = data[:request]\n\n verb, override = method_and_override(request[:verb])\n\n lines << \"%s %s HTTP/1.1\" % [verb, request[:path]]\n\n lines << \"X-Http-Method-Override: #{override}\" if override\n\n lines << \"Host: #{host}\"\n\n (request[:headers] || {}).each_pair do |key, value|\n lines << \"#{key}: #{value}\"\n end\n\n if request[:data]\n lines << \"Content-Type: application/json; charset=utf-8\"\n lines << \"\"\n lines << JSON.pretty_generate(request[:data])\n end\n\n lines.join(\"\\n\")\n end", "def send_request(params)\n response = self.class.post(URL, body: params)\n JSON.parse response.body\n end", "def send_post_request(url, payload, content_type = 'application/json')\n # set the uri\n url = URI(url)\n\n # set http settings\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n # set request\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = content_type\n request[\"cache-control\"] = 'no-cache'\n\n # set the payload\n request.body = payload\n\n # send the request and get whatever is the response\n response = http.request(request)\n\n # return the response by reading the body\n return response.read_body\n end" ]
[ "0.68028075", "0.6712006", "0.66034895", "0.65734494", "0.65374625", "0.64450926", "0.6416786", "0.6347915", "0.62424594", "0.6216529", "0.61464345", "0.61391103", "0.61169314", "0.6080915", "0.6062944", "0.603822", "0.596609", "0.5958362", "0.59456944", "0.594175", "0.594077", "0.58963543", "0.58927494", "0.5878598", "0.5877151", "0.58663875", "0.5835707", "0.5825669", "0.58153105", "0.58067024", "0.5803733", "0.57911766", "0.5773812", "0.57704437", "0.5768751", "0.5767576", "0.57304597", "0.57285494", "0.5725677", "0.570963", "0.5691931", "0.5680346", "0.5670332", "0.5667028", "0.56502795", "0.56458277", "0.5645336", "0.5644789", "0.5644789", "0.564421", "0.56433076", "0.5642109", "0.56329876", "0.5631261", "0.56214505", "0.5619874", "0.5615314", "0.5614854", "0.56063336", "0.56045276", "0.55995613", "0.55984277", "0.55949354", "0.5589724", "0.5584893", "0.5570513", "0.5567265", "0.5565943", "0.55533206", "0.5549961", "0.5549003", "0.5547", "0.55272245", "0.5526356", "0.5525705", "0.552532", "0.552423", "0.5523996", "0.5523502", "0.5516822", "0.55156153", "0.5511085", "0.55103284", "0.55062294", "0.54944885", "0.54886764", "0.5479276", "0.54752123", "0.5470764", "0.5469523", "0.54620576", "0.54615706", "0.5460159", "0.5457459", "0.54571176", "0.54571176", "0.54529786", "0.5451946", "0.5451295" ]
0.60756767
15
PATCH/PUT /http_requests/1 PATCH/PUT /http_requests/1.json
def update respond_to do |format| if @http_request.update(http_request_params) format.html { redirect_to @http_request, notice: 'Http request was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @http_request.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch!\n request! :patch\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!(**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 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 @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 api_patch(path, data = {})\n api_request(:patch, path, :data => data)\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 @req.update(req_params)\n format.json { render :json => {:status => 'success'}}\n# format.html { redirect_to @req, notice: 'Req was successfully updated.' }\n# format.json { render :show, status: :ok, location: @req }\n# else\n format.json { render :json => {:status => 'failed'}}\n# format.html { render :edit }\n# format.json { render json: @req.errors, status: :unprocessable_entity }\n# end\n# end\n end", "def patch(url, payload)\n url = URI.parse(url)\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n request = Net::HTTP::Patch.new(url.path+'?access_token=verysecret')\n request.content_type = 'application/json'\n request.body = JSON.generate(payload)\n response = http.start {|http| http.request(request) }\n begin\n return JSON.parse(response.body)\n rescue\n # Log as a problematic case with rule number and line\n $problems.write \"#{$index}, #{payload}, #{response.body}\\n\"\n return nil\n end\nend", "def rest_patch(base_uri,json_payload,params)\n begin\n @response = RestClient.patch(base_uri,json_payload,params)\n rescue => e\n puts @response.code\n end\n return @response\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(url, data)\n RestClient.put url, data, :content_type => :json\nend", "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 #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 @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(&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 @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_feature_request(folder_id, feature_content, file_name)\n url = URI(\"#{$base_url}/api/projects/#{$project_id}/folders/#{folder_id}/update_from_feature\")\n\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n request = Net::HTTP::Patch.new(url)\n request[\"accept\"] = 'application/vnd.api+json; version=1'\n request[\"access-token\"] = $access_token\n request[\"uid\"] = $uid\n request[\"client\"] = $client\n request[\"Content-Type\"] = 'application/json'\n\n data = {\n data: {\n attributes: {\n \"feature\": feature_content\n }\n }\n }\n\n request.body = JSON.generate(data)\n response = http.request(request)\n\n if response.code == 200.to_s\n update_response = JSON.parse(response.read_body)['data']\n puts \"Feature '#{update_response['attributes']['name']}' with '#{update_response['attributes']['scenarios-count']} scenario(s)' updated.\"\n $success_uploaded_count = $success_uploaded_count + 1\n $uploaded_features_list.push(file_name)\n $updated_count = $updated_count + 1\n else\n $fail_uploaded_count = $fail_uploaded_count + 1\n $not_uploaded_features_list.push(file_name)\n end\n\n response.code\nend", "def patch(path, opts = {})\n request(:patch, path, opts).body\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 @contact = current_user.contacts.find(params[:contact_id])\n @request = @contact.requests.find(params[:id])\n\n respond_with @request do |format|\n if @request.update_attributes(params[:request])\n @requests = @contact.requests.last_requests\n format.html { redirect_to(contact_requests_path, :notice => t('messages.updated')) }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end", "def patch(path, data, params = {}, request_options = {})\n request(:patch, path, data, params)\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 put!\n request! :put\n end", "def patch(url, options = {}, &block)\n request HttpPatch, url, options, &block\n end", "def update_request?(http_method = nil)\n http_method = http_method.downcase.to_sym if http_method.is_a?(String)\n %i[put post patch].include?(http_method || @verb)\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 request = Request.find_by_id(params[:id])\n if request\n request.status = 1\n if request.save\n render json: {\n status: 'success',\n message: 'Request marked as fulfilled',\n },\n status: :ok\n else\n render json: {\n status: 'error',\n message: 'Request failed',\n data: request.errors,\n },\n status: :unprocessable_entity\n end\n else\n render status: :unauthorized\n end\n end", "def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\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 begin\n @job_request = job_requests.find( params[ :id ] )\n rescue ActiveRecord::RecordNotFound\n @job_request = nil\n end\n\n respond_to do |format|\n if @job_request && @job_request.update_attributes( params[ :job_request ] )\n format.html { redirect_to root_path, notice: \"Job Requests Updated Successfully\"}\n format.json { head :no_content }\n else\n format.html { redirect_to root_path, notice: \"Update Failed\" }\n format.json { render json: @job_request.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", "def patch(path, data)\n request 'PATCH', path, body: data.to_json\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 patch(request)\n request.method = :patch\n request.call\n end", "def update # PATCH\n raise NotImplementedError\n end", "def patch request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, query_string_params = transcode_patch_request request_pb\n response = @client_stub.make_patch_request(\n uri: uri,\n body: body,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def patch request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, query_string_params = transcode_patch_request request_pb\n response = @client_stub.make_patch_request(\n uri: uri,\n body: body,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def patch_kubernetes_version_with_http_info(moid, kubernetes_version, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: KubernetesApi.patch_kubernetes_version ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling KubernetesApi.patch_kubernetes_version\"\n end\n # verify the required parameter 'kubernetes_version' is set\n if @api_client.config.client_side_validation && kubernetes_version.nil?\n fail ArgumentError, \"Missing the required parameter 'kubernetes_version' when calling KubernetesApi.patch_kubernetes_version\"\n end\n # resource path\n local_var_path = '/api/v1/kubernetes/Versions/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.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/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\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(kubernetes_version)\n\n # return_type\n return_type = opts[:debug_return_type] || 'KubernetesVersion'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"KubernetesApi.patch_kubernetes_version\",\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(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: KubernetesApi#patch_kubernetes_version\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\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 http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end", "def update\n #@service_request = ServiceRequest.find(params[:id])\n\n respond_to do |format|\n if @service_request.update_attributes(service_request_params)\n format.html { redirect_to @service_request, notice: 'Service request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @service_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(operation, path, value = nil)\n ensure_client && ensure_uri\n body = {\n 'op' => operation,\n 'path' => path,\n 'value' => value\n }\n response = @client.rest_patch(@data['uri'], { 'Content-Type' => 'application/json-patch+json', 'body' => [body] }, @api_version)\n @client.response_handler(response)\n end", "def patch(path, opts = {}, &block)\n request(:patch, path, opts, &block)\n end", "def patch(path, opts = {}, &block)\n request(:patch, path, opts, &block)\n end", "def rm_update path, data, msg\n\n re = rm_request path, data, 'PUT'\n puts re.body\n chk (re.code!='200'), msg + \"\\n#{re.code} #{re.msg}\\n\\n\"\n return true\n\nend", "def rm_request path, data = nil,method = nil, verbose = false\n reply = nil\n hdrs = {'Content-Type'=>'application/json', 'X-Redmine-API-Key' => $settings['redmine_api_key']}\n reply = Net::HTTP.start($settings['redmine_host'], $settings['redmine_port']) do |http|\n if data\n if !method || method == 'POST'\n puts \"POST #{path}\" if verbose\n http.request_post(path,data.to_json, hdrs)\n elsif method == 'PUT'\n # code for PUT here\n puts \"PUT #{path}\" if verbose\n http.send_request 'PUT', path, JSON.unparse(data), hdrs\n end\n else\n puts \"GET #{path}\" if verbose\n http.request_get(path, hdrs)\n end\n end\n return reply\nend", "def update(request)\n end", "def update(request)\n end", "def update\n respond_to do |format|\n if @request.update(request_params)\n format.html { redirect_to root_path, 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 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 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 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 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 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 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 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 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 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 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 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 patch(payload)\n post_like payload, Net::HTTP::Patch.new(@uri.path)\n end", "def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend", "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 patch(path, **args); end", "def patch(url, data, headers = {})\n request(:patch, url, headers, :data => data)\n end", "def update number, routes\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 << \"/tns/{number}\"\r\n\r\n # process optional query parameters\r\n query_builder = APIHelper.append_url_with_template_parameters query_builder, {\r\n \"number\" => number,\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\" => \"Flowroute SDK 1.0\",\r\n \"content-type\" => \"application/json; charset=utf-8\"\r\n }\r\n\r\n response = CustomAuthUtility.append_custom_auth_params method:'PATCH',\r\n query_url:query_url,\r\n body:\"{\\\"routes\\\": #{routes.to_json}}\",\r\n headers:headers\r\n\r\n # Error handling using HTTP status codes\r\n if response.code == 401\r\n raise APIException.new \"NOT AUTHORIZED\", 401, response.raw_body\r\n elsif response.code == 500\r\n raise APIException.new \"APPLICATION/SERVER ERROR\", 500, response.raw_body\r\n elsif !(response.code.between?(200,206)) # [200,206] = HTTP OK\r\n raise APIException.new \"HTTP Response Not OK\", response.code, response.raw_body\r\n end\r\n\r\n response.body\r\n end", "def patch(path, body_params = {})\n debug_log \"PATCH #{@host}#{path} body:#{body_params}\"\n headers = { 'Content-Type' => 'application/json' }\n res = connection.run_request :put, path, body_params.to_json, headers\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end", "def update\n @request_status = RequestStatus.find(params[:id])\n\n respond_to do |format|\n if @request_status.update_attributes(params[:request_status])\n format.html { redirect_to @request_status, notice: 'Request status was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @request_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(attrs = nil)\n attrs ||= attributes.changed_attributes\n\n execute_request('PATCH') do |uri, headers|\n HTTP.http_client.patch(\n uri,\n body: adapter.serialize(attrs),\n header: headers.merge(CONTENT_TYPE_HEADERS)\n )\n end\n end", "def update\n @request = Request.find(params[:id])\n @request.update_attributes(params[:request])\n #respond_with(@request)\n case params[:request][:status]\n when \"0\"\n redirect_to rejected_owner_requests_path and return\n when \"1\"\n redirect_to pending_owner_requests_path and return\n when \"2\"\n redirect_to accepted_owner_requests_path and return\n when \"3\"\n redirect_to rented_owner_requests_path and return\n end\n end", "def patch(operation, path, value)\n response = @client.rest_patch(@data['uri'], 'body' => [{ op: operation, path: path, value: value }])\n @client.response_handler(response)\n end", "def patch(path, data, options = {})\n uri = build_uri(path, options)\n\n request = Net::HTTP::Patch.new(uri.request_uri)\n set_authorisation_header(request)\n request.set_form_data(data)\n\n response = https_client(uri).request(request)\n end", "def patch\n end", "def requests_put\n @attributes[:requests_put]\n end", "def change_requests(force = false)\n requests = []\n # get the URI path for this object.\n uri = self.uri_path\n\n # generate the request to update the object (PUT)\n if attribute_changes? || force\n # if it's new, then we should call :post for creating the object.\n method = new? ? :post : :put\n r = Request.new(method, uri, body: attribute_updates)\n r.tag = object_id\n requests << r\n end\n\n # if the object is not new, then we can also add all the relational changes\n # we need to perform.\n if @id.present? && relation_changes?\n relation_change_operations.each do |ops|\n next if ops.empty?\n r = Request.new(:put, uri, body: ops)\n r.tag = object_id\n requests << r\n end\n end\n requests\n end", "def patch(query_url,\r\n headers: {},\r\n parameters: {})\r\n HttpRequest.new(HttpMethodEnum::PATCH,\r\n query_url,\r\n headers: headers,\r\n parameters: parameters)\r\n end", "def patch\n req.patch?\n end", "def update!(**args)\n @client = args[:client] if args.key?(:client)\n @list_update_requests = args[:list_update_requests] if args.key?(:list_update_requests)\n end", "def from_merge_patch_json\n if request.patch?\n from_json\n else\n 415\n end\n end", "def update\n respond_to do |format|\n if @service_request.update(service_request_params)\n format.html { redirect_to @service_request, notice: 'Service request was successfully updated.' }\n format.json { render :show, status: :ok, location: @service_request }\n else\n format.html { render :edit }\n format.json { render json: @service_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @http_body = args[:http_body] if args.key?(:http_body)\n end", "def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", {\"passed\" => success}.to_json, :content_type => :json\nend", "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\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 respond_to do |format|\n if @request_service.update(request_service_params)\n format.html { redirect_to @request_service, notice: 'Request service was successfully updated.' }\n format.json { render :show, status: :ok, location: @request_service }\n else\n format.html { render :edit }\n format.json { render json: @request_service.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @feature_request.update(feature_request_params)\n format.html { redirect_to @feature_request, notice: 'Feature request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @feature_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def edit\n @appointment_request = current_user.requests.find_by(\n id: params[:request_id]\n )\n\n if @appointment_request.present?\n render json: { appointment_request: @appointment_request, status: 200 }\n else\n render json: { status: 404, layout: false }, status: 404\n end\n end", "def update\n respond_to do |format|\n if @reqstatus.update(reqstatus_params)\n format.html { redirect_to @reqstatus, notice: 'Reqstatus was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @reqstatus.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @status_request.update(status_request_params)\n format.html { redirect_to @status_request, notice: 'Status request was successfully updated.' }\n format.json { render :show, status: :ok, location: @status_request }\n else\n format.html { render :edit }\n format.json { render json: @status_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @gig_request = GigRequest.find(params[:id])\n\n respond_to do |format|\n if @gig_request.update_attributes(params[:gig_request])\n format.html { redirect_to @gig_request, notice: 'Gig request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gig_request.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.66446257", "0.657836", "0.6403797", "0.6403797", "0.6403797", "0.6403797", "0.64008933", "0.631353", "0.6285412", "0.6282243", "0.616621", "0.6133736", "0.6131959", "0.6127629", "0.6119125", "0.60907555", "0.60907555", "0.6090604", "0.6081874", "0.60616857", "0.605691", "0.605691", "0.60494685", "0.6036416", "0.60322833", "0.60322833", "0.60071963", "0.59933066", "0.59921646", "0.5991581", "0.5987076", "0.59755147", "0.59680474", "0.59680474", "0.5960207", "0.59557205", "0.5945818", "0.5919007", "0.5912127", "0.5909003", "0.59078616", "0.5906989", "0.5893518", "0.5872035", "0.5872035", "0.5854662", "0.58470625", "0.5835947", "0.5824205", "0.5775246", "0.5765609", "0.5765609", "0.5758581", "0.5755354", "0.573531", "0.573531", "0.5724382", "0.57166207", "0.57166207", "0.57166207", "0.57166207", "0.57166207", "0.57166207", "0.57166207", "0.57166207", "0.57166207", "0.57166207", "0.57166207", "0.5713426", "0.5713278", "0.57111865", "0.5710451", "0.57077837", "0.56972057", "0.5688416", "0.56589293", "0.5647813", "0.56476665", "0.562547", "0.5618731", "0.5614431", "0.56113994", "0.56110096", "0.5609229", "0.5608489", "0.56004876", "0.5594413", "0.5593425", "0.5592055", "0.5588479", "0.5585915", "0.5579709", "0.55752134", "0.5573613", "0.5555061", "0.5548723", "0.5540493", "0.55374795", "0.5527643" ]
0.67752284
0
DELETE /http_requests/1 DELETE /http_requests/1.json
def destroy @http_request.destroy respond_to do |format| format.html { redirect_to http_requests_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 @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 @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 @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 delete(path)\n RestClient.delete request_base+path\n end", "def deleteRequest\n\n end", "def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\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 deleteExecution(execution_id)\n uri = URI(RUNDECKSERVER + ':' + RUNDECKPORT + '/api/12/execution/' + execution_id)\n http = Net::HTTP.new(uri.host, uri.port)\n headers = {'Content-Type'=> 'application/jsonr','X-RunDeck-Auth-Token'=> API_KEY }\n r = http.delete(uri.path, headers) \n return r\nend", "def delete endpoint\n do_request :delete, endpoint\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def delete(request)\n do_request(request) { |client| client.http_delete }\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n head :no_content\n end", "def delete\n request(:delete)\n end", "def destroy\n scope = Request.where(:user_id => current_user.id)\n\n @request = scope.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 delete!( opts = {} )\n http_action :delete, nil, opts\n end", "def delete_requests\n self.requests.each {|request| request.destroy}\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 @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 delete(url)\n do_request(\"delete\", url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete!\n request! :delete\n end", "def delete\n start { |connection| connection.request http :Delete }\n end", "def delete\n client.delete(\"/#{id}\")\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 delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end", "def http_delete(path, data = nil, content_type = 'application/json')\n http_methods(path, :delete, data, content_type)\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 delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end", "def destroy\n @request = @skill.requests.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to myrequests_path }\n format.json { head :no_content }\n end\n end", "def destroy\n #@service_request = ServiceRequest.find(params[:id])\n @service_request.destroy\n\n respond_to do |format|\n format.html { redirect_to service_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 admin_requests_url }\n format.json { head :no_content }\n end\n end", "def delete(request_opts = {})\n store_result(http(request_opts).delete(resolved_path))\n end", "def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end", "def destroy\n @gig_request = GigRequest.find(params[:id])\n @gig_request.destroy\n\n respond_to do |format|\n format.html { redirect_to gig_requests_url }\n format.json { head :no_content }\n end\n end", "def http_delete(opts={})\n ret=http_delete_low(opts)\n if ret.is_a?(Hash) and ret.has_key?('error') and ret['error']=='Invalid Credentials' then\n\tauthdefault\n\tret=http_delete_low(opts)\n\treturn ret\n else\n\treturn ret\n end\n end", "def delete(path)\n request(:delete, path)\n end", "def delete(name)\n request(uri = uri(name), Net::HTTP::Delete.new(uri.request_uri))\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.xml { head :ok }\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.xml { head :ok }\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.xml { head :ok }\n end\n end", "def destroy\n @request_status = RequestStatus.find(params[:id])\n @request_status.destroy\n\n respond_to do |format|\n format.html { redirect_to request_statuses_url }\n format.json { head :no_content }\n end\n end", "def delete\n api_client.delete(url)\n end", "def incident_delete(statuspage_id, incident_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['incident_id'] = incident_id\n\n request :method => :post,\n :url => @url + 'incident/delete',\n :payload => data\n end", "def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end", "def delete(path)\n request 'DELETE', path\n end", "def delete(url, headers={})\n RestClient.delete url, headers\n end", "def destroy\n @request = Request.find(params[:id])\n @request_items = @request.request_items\n @request_items.each do |ri|\n ri.destroy\n end\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to(requests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n render status: 200, json: @request_item.destroy\n end", "def http_delete(path, headers = {})\n clear_response\n path = process_path(path)\n @success_code = 204\n @response = http.delete(path, headers)\n parse_response? ? parsed_response : response.body\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 @visit_request.destroy\n respond_to do |format|\n format.html { redirect_to visit_requests_url, notice: 'Visit request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(*args)\n Request.delete(*args)\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 delete\n delete_from_server single_url\n end", "def destroy\n @status_request.destroy\n respond_to do |format|\n format.html { redirect_to status_requests_url, notice: 'Status request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @request_call = RequestCall.find(params[:id])\n @request_call.destroy\n\n respond_to do |format|\n format.html { redirect_to request_calls_url }\n format.json { head :no_content }\n end\n end", "def delete\n RestClient.delete(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end", "def destroy\n @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 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 @crawl_request = CrawlRequest.find(params[:id])\n @crawl_request.destroy\n\n head :no_content\n end", "def destroy\n @crawl_request = CrawlRequest.find(params[:id])\n @crawl_request.destroy\n\n head :no_content\n end", "def destroy\r\n @project_request = ProjectRequest.find(params[:id])\r\n @project_request.delete\r\n \r\n respond_to do |format|\r\n format.html { redirect_to my_requests_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @req.destroy\n respond_to do |format|\n flash[:notice] = \"Req was successfully destroyed.\"\n format.html { redirect_to reqs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @request.image = nil\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 deleted_request\n r = {}\n render json: r,\n root: :data,\n status: :no_content\n end", "def destroy\n @modrequest.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\n end" ]
[ "0.72902673", "0.72698855", "0.72698855", "0.72698855", "0.7269352", "0.7248202", "0.7248202", "0.7248202", "0.7248202", "0.7248202", "0.7248202", "0.7142104", "0.7133003", "0.71133417", "0.7000527", "0.69743675", "0.6964436", "0.69609666", "0.69480914", "0.69298136", "0.692875", "0.68937165", "0.68865365", "0.68797994", "0.68530375", "0.6847548", "0.6837326", "0.68346524", "0.68346524", "0.68346524", "0.68346524", "0.68346524", "0.68346524", "0.68346524", "0.68346524", "0.68346524", "0.68346524", "0.68346524", "0.68346524", "0.68346524", "0.68346524", "0.68346524", "0.68346524", "0.68346524", "0.68346524", "0.6828664", "0.6824891", "0.6824891", "0.682114", "0.6806936", "0.67977256", "0.67759115", "0.67759115", "0.67759115", "0.67759115", "0.6758998", "0.67589486", "0.67529154", "0.6750468", "0.6748339", "0.674102", "0.6731938", "0.67262655", "0.6725613", "0.6718816", "0.6717687", "0.67167115", "0.669209", "0.66896856", "0.66896856", "0.66896856", "0.66852665", "0.6661419", "0.6652237", "0.6634667", "0.6627937", "0.6627315", "0.66251636", "0.6617053", "0.6616334", "0.66144747", "0.66140103", "0.66069967", "0.66063654", "0.6586279", "0.6585326", "0.6584691", "0.65802836", "0.6577847", "0.6569144", "0.6569144", "0.6567477", "0.6567477", "0.65536344", "0.65472466", "0.6541839", "0.65275383", "0.6520603", "0.6511009" ]
0.76185346
1
Use callbacks to share common setup or constraints between actions.
def set_http_request @http_request = HttpRequest.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 http_request_params params.require(:http_request).permit(:ip, :address) 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 strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \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 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 filtering_params\n params.permit(:email)\n end", "def active_code_params\n params[:active_code].permit\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 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 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 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 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 maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\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 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 droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\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.6981606", "0.6784227", "0.6746523", "0.67439264", "0.67361516", "0.6593381", "0.6506166", "0.64994407", "0.6483518", "0.64797056", "0.64578557", "0.6441216", "0.63811713", "0.63773805", "0.6366333", "0.63217646", "0.6301816", "0.63009787", "0.6294436", "0.62940663", "0.6292164", "0.62917984", "0.62836355", "0.6242686", "0.6241917", "0.62210834", "0.6214862", "0.62125784", "0.619428", "0.617912", "0.617705", "0.61735916", "0.6163706", "0.61532795", "0.6152666", "0.6148062", "0.6123372", "0.61180484", "0.61088324", "0.6106139", "0.60925204", "0.608326", "0.60711503", "0.606551", "0.60216546", "0.6018924", "0.6015004", "0.60106766", "0.6008301", "0.6008301", "0.60028726", "0.60020626", "0.5999236", "0.59931505", "0.5993037", "0.59917194", "0.5982164", "0.5968051", "0.5960277", "0.5960268", "0.5960012", "0.59594494", "0.5954652", "0.5954304", "0.59440255", "0.59404963", "0.59404963", "0.59401006", "0.593522", "0.5932182", "0.5925528", "0.5924541", "0.5918796", "0.59123147", "0.5910144", "0.5909186", "0.5907257", "0.5899382", "0.5897783", "0.58972496", "0.58958495", "0.58948576", "0.5892734", "0.5888056", "0.58843875", "0.58818483", "0.5873746", "0.58700997", "0.5870056", "0.5869255", "0.58668107", "0.58662325", "0.5865003", "0.5862908", "0.5862406", "0.58614665", "0.5859661", "0.585562", "0.5855185", "0.58523446", "0.58504915" ]
0.0
-1
Obtain a latex representation of the matrix
def latex_matrix if @type == "controlled" @matrix.map { |value, matrix| [value, latex_matrix_for(matrix)] } else latex_matrix_for @matrix end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def latex_matrix(matrix)\n output = \"\\\\begin{tabular}{|#{'r|' * matrix.first.length}}\\n\"\n output << \"\\\\hline\\n\"\n output << matrix.map { |line| line.join(' & ') }.join(\"\\\\\\\\\\n\\\\hline\\n\")\n output << \"\\\\\\\\\\n\"\n output << \"\\\\hline\\n\"\n output << \"\\\\end{tabular}\\n\"\n output\nend", "def to_s\n @matrix.inject('') do |combined_rows, row|\n formatted_row =\n row.inject('') { |combined_cells, cell| \"#{combined_cells} #{cell}\" }\n \"#{combined_rows}\\n#{formatted_row}\"\n end\n end", "def to_s\n set_current_position!\n matrix.reverse.map { |row| row.join(' ') }.join(\"\\n\")\n end", "def to_s\n \"Matrix[\" + @rows.collect{\n |row|\n \"[\" + row.collect{|e| e.to_s}.join(\", \") + \"]\" # no yield\n }.join(\", \")+\"]\"\n end", "def print_matrix\n width = @rows.flatten.max.to_s.size\n if width > 4 then\n width = width - 0.5\n end\n puts @rows.map { |a|\n \"|#{ a.map { |i|\n outp = \"\"\n num, den = i.to_fraction\n if den == 1 then\n outp += \"#{num}\"\n else\n outp += \"#{num}/#{den}\"\n end\n \"#{outp.rjust(width)} |\"\n }.join }\"\n }\n puts \"↓\"\n end", "def children_to_latex\n array_to_latex(@children)\n end", "def latex!\n ToLatex::LatexString.new self\n end", "def to_s \n\t\t\"#{@mat}\"\n\tend", "def render_matrix\n Matrix.rows render_rows\n end", "def to_latex\n children_to_latex\n end", "def to_s\n s = \"\"\n i = 0\n while(i < @col)\n j = 0\n while(j < @fil)\n s += \"#{@matrix[i][j].to_s}\\t\"\n j += 1\n end\n s += \"\\n\"\n i += 1\n end\n s\n end", "def to_s\n cad = \" \"\n for i in 0...nfil\n cad << \" [ \"\n for j in 0...ncol\n\tcad << \"#{mat[i][j]} \"\n end\n cad << \"]\"\n cad << \"\\n \"\n end\n return cad\n end", "def latex(s)\n convert(s, mime: 'text/latex')\n end", "def to_matlab_string\n '[' + map{|e| e.to_s}.join(', ') + ']'\n end", "def latex_table(data, top_headings, left_headings)\n matrix = [[''] + top_headings] +\n left_headings.zip(data).map { |heading, line| [heading] + line }\n latex_matrix matrix\nend", "def print_matrix\n @matrix.each do |m|\n print \"#{m}\\n\"\n end\n end", "def display\t\n \tstring = \"\\n +-----------------------+\".green\n \[email protected]_index{ |i|\n \tstring += \"\\n |\".green\n v = @matrix[i]\n \tv.each_index{|j|\n \t\tif (v[j] != 0)\n \t\t\tstring += \" \" + v[j].to_s\n \t\telse \n \t\t\tstring += \" .\"\n \t\tend\n \t\t\t\t\n \t\tif (j == 2 || j == 5 || j == 8)\n \t\t\tstring += \" |\".green\n \t\tend\n \t\t}\n \t\tif (i == 2 || i == 5)\n \t\t\tstring += \"\\n |-------+-------+-------|\".green\n \t\tend\n \t}\n \tstring += \"\\n +-----------------------+\".green\n\tend", "def to_s\n \n # Determine the column width\n col_width = data.last.last.to_s.length\n \n # Determine the table width\n table_width = ( col_width + 1 ) * data.length + 1\n \n # Convert 2D Array to String\n data.map { |row| '|' + row.map { |val| val.to_s.ljust( col_width ) }.join('|') + '|' }.join(\"\\n#{ '-' * table_width }\\n\")\n \n end", "def print_matrix(matrix)\n puts separator = '-' * matrix.first.length * 6 + '--'\n\n matrix.each do |row|\n line = ''\n row.each do |col|\n line += col.to_s.rjust(3).ljust(6)\n end\n puts \"|#{line}|\".yellow\n end\n\n puts separator\nend", "def to_s\n matS = \"\"\n for i in 0...@nF do\n for j in 0...@nC do\n matS = matS + @matriz[i][j].to_s + \" \"\n end\n matS = matS + \"\\n\"\n end\n matS\n end", "def text_representation(allow_z=true,allow_m=true) #:nodoc:\r\n tex_rep = \"#{@x} #{@y}\"\r\n tex_rep += \" #{@z}\" if @with_z and allow_z\r\n tex_rep += \" #{@m}\" if @with_m and allow_m\r\n tex_rep\r\n end", "def text_representation(allow_z = true, allow_m = true) #:nodoc:\n tex_rep = \"#{@x} #{@y}\"\n tex_rep += \" #{@z}\" if @with_z && allow_z\n tex_rep += \" #{@m}\" if @with_m && allow_m\n tex_rep\n end", "def to_s\n matString = \"\"\n for i in 0...@nFil do\n for j in 0...@mCol do\n matString = matString + @matriz[i][j].to_s + \" \"\n end\n matString = matString + \"\\n\"\n end\n matString\n end", "def to_latex(*args)\n @output_format = :latex\n @options += args\n convert\n end", "def to_s\n aux = \"\"\n for i in 0...@f\n for j in 0...@c\n\tif((!@matriz[i].nil?) && (!@matriz[i][j].nil?))\n\t aux = aux + @matriz[i][j].to_s + \"\\t\"\n\telse\n\t aux = aux + \"0\\t\"\n\tend\n end\n aux = aux + \"\\n\"\n end\n aux\n end", "def to_s\n\t\taux = \"\"\n\t\[email protected] do |i|\n\t\t\[email protected] do |j|\n\t\t\t\taux << \"#{pos[i][j]}\\t\"\n\t\t\tend\n\t\t\taux << \"\\n\"\n\t\tend\n\t\taux\n\tend", "def math(s)\n convert(\"$$#{s}$$\", mime: 'text/latex')\n end", "def to_s\n\t\t\taux = \"\"\n\t\t\[email protected] do |i|\n\t\t\t\[email protected] do |j|\n\t\t\t\t\taux << \"#{pos[i][j]}\\t\"\n\t\t\t\tend\n\t\t\t\taux << \"\\n\"\n\t\t\tend\n\t\t\taux\n\t\tend", "def to_latex(sheetname: @xlsx.default_sheet,\n string_format: @string_format,\n float_format: @float_format,\n date_format: @date_format,\n time_format: @time_format,\n bool_true: @bool_true, bool_false: @bool_false,\n auto_width: @auto_width,\n xxx: nil\n )\n @xlsx.sheet(sheetname) #set default sheetname\n sheet = @xlsx.sheet_for(sheetname)\n @log.info(\"Convert Sheet %s to LaTeX\" % sheetname)\n \n tex = []\n max_columns = 1\n widths = Hash.new(0) #maximum width per column. Needed for auto_width\n sheet.each_row do |line|\n lineval = []\n max_columns = @xlsx.last_column if @xlsx.last_column > max_columns\n line.each_with_index{| cell,colnum |\n @log.debug(\"%s(%i,%i): %s <%s> %s\" % [sheetname,cell.coordinate.column,cell.coordinate.row, cell.type.inspect, cell.value.inspect, cell.inspect]) if @log.debug?\n right_justified = false\n \n case cell.type\n when nil #Overwritten parts in multicol/multirow\n @log.warn(\"%s(%i,%i) contains Nil - Ok for multicolumn. Multirow is not supported\" % [sheetname,cell.coordinate.column,cell.coordinate.row])\n case lineval.last\n when /multicolumn\\{(\\d+)\\}/\n lineval.last.sub!(/multicolumn\\{(\\d+)\\}/, 'multicolumn{%i}' % [$1.to_i + 1])\n else #First combined cell\n #Ignore the width of the mutlicolumn command.\n #I expect the merged cells are long enough to compensate the additional length\n widths[colnum-1] = lineval.last.size if lineval.last.size > widths[colnum-1]\n lineval << ('\\multicolumn{2}{c}{%s}' % lineval.pop)\n end\n next\n when :float\n value = float_format % cell.value\n when :string\n value = string_format % cell.value\n when :formula\n @log.info(\"%s(%i,%i): Found formula %s. Take result %s\" % [sheetname,cell.coordinate.column,cell.coordinate.row, cell.formula, cell.value])\n value = cell.value\n when :boolean\n value = case cell.value\n when 'TRUE'; bool_true\n when 'FALSE'; bool_false\n else\n @log.warn(\"Don't know how to handle boolean %s\" % cell.value)\n cell.value\n end\n when :date\n value = cell.value.strftime(date_format)\n when :datetime\n value = cell.value.strftime(time_format)\n else\n #~ * :date * :percentage * :time * :datetime.\n @log.error(\"%s(%i,%i) Undefined celltype %s -%s\" % [sheetname,cell.coordinate.column,cell.coordinate.row,cell.type.inspect, cell.inspect])\n #~ value = cell.excelx_value\n value = cell.value\n end\n if value.respond_to?(:gsub)\n value.gsub!('<', '\\textless{}')\n value.gsub!('>', '\\textgreater{}')\n value.gsub!('$', '\\$')\n value.gsub!('&', '\\&')\n value.gsub!('%', '\\%')\n end\n \n if font = @xlsx.font(cell.coordinate.row,cell.coordinate.column)\n value = '\\textbf{%s}' % value.strip if font.bold?\n value = '\\emph{%s}' % value.strip if font.italic?\n value = '\\underline{%s}' % value.strip if font.underline?\n value = string_format % value if cell.type == :string\n end\n lineval << value\n widths[colnum] = value.to_s.size if value.to_s.size > widths[colnum]\n }\n tex << lineval\n end\n #Prepare auto width if requested\n tex.map{|tabline|\n tabline.map!.with_index{|cell,i| \n if cell =~ /\\\\multicolumn\\{(\\d+)\\}/ #Calculate offset for next column\n width = -3 #3 corresponds to the ' & ' and we need one less.\n i.upto($1.to_i){|i2| width += widths[i2] + 3} #calculate width up to next cell\n '%-*s' % [width,cell]\n else\n '%*s' % [widths[i],cell]\n end\n }\n } if auto_width\n\n [\n \"\\\\begin{tabular}{%s}\" % ('c|'* max_columns),\n tex.map{|tabline| tabline.join(' & ')}.join(\"\\\\\\\\\\n\"),\n '\\end{tabular}'\n ].join(\"\\n\")\n end", "def to_s\n\t\t@tam_alto.times do |i|\n\t\t\t@tam_ancho.times do |j|\n\t\t\t\tprint @plano[i][j].to_s + \" \"\n\t\t\tend\n\t\t\tprint \"\\n\"\n\t\tend\n\tend", "def to_s\n \"#{self.class} <#{@rows} x #{@cols}>: #{@fm.each_slice(@cols).to_a}\"\n end", "def to_latex(options = {})\n fmt = LaTeXFormatter.new(self, **options)\n yield fmt if block_given?\n fmt.output\n end", "def pp_matrix(matrix)\n matrix.each { |x| puts x.map { |y| y.inspect[1...-1].split('').join(' ') + ' , ' }.join[0...-3] }\n print_new_line\nend", "def to_s\n \"#{@row_idx+1}&#{('A'.ord+@col_idx).chr}\"\n end", "def to_s\n str = \"\\n A B C\\n\\n\"\n str += \" +---+---+---+\\n\"\n SIZE.times.each do |row|\n str += \" #{row + 1} |\" + SIZE.times.map { |column| \" #{ @store[cell_index_at(row,column)] || \" \" } |\" }.join + \"\\n\"\n str += \" +---+---+---+\\n\"\n end\n return str + \"\\n\"\n end", "def to_s\n # The widest item in the table is used to set the width of all the\n # columns.\n item_width = widest_item\n row_label_width = row_labels.map { |label| label.to_s.jlength }.max\n # Enumerate rows prepending column labels.\n ([col_labels] + self).zip([\" \"] + row_labels).map do |row, row_label|\n # Enumerate row items prepending row labels.\n ([sprintf(\"%-#{row_label_width}s\", row_label)] + row.map do |item|\n # Center each item in a space as wide as the widest column.\n item_to_s(item).center(item_width)\n end).join(\" \").rstrip\n end.join(\"\\n\")\n end", "def to_s\r\n\t\t\r\n\t\tmatrizMuestra = Array.new(@fil) {Array.new(@col) {0}}\r\n\t\t\r\n\t\tnumEle = 0\r\n\t\ti = 0\r\n\t\t\t\r\n\t\twhile i < @numElementos\t\t\t\t\t\t\r\n\t\t\t\r\n\t\t\tmatrizMuestra[@filM[i]][@colM[i]] = @eleM[i]\r\n\t\t\t\r\n\t\t\ti += 1\r\n\t\tend\r\n\t\t\r\n\t\t#puts \"muestra = #{matrizMuestra}\"\r\n\t\treturn matrizMuestra\r\n\t\t\r\n\tend", "def to_s\n\t\t%Q(\n\t\t\t#{@layout[0][0]}|#{@layout[0][1]}|#{@layout[0][2]}\n\t\t\t-+-+-\n\t\t\t#{@layout[1][0]}|#{@layout[1][1]}|#{@layout[1][2]}\n\t\t\t-+-+-\n\t\t\t#{@layout[2][0]}|#{@layout[2][1]}|#{@layout[2][2]}\n\t\t\t)\n\tend", "def to_s\n @squares.map do |row|\n row.map(&:to_s).join(\" \")\n end.join(\"\\n\")\n end", "def inspect\n to_table.render :ascii\n end", "def transformation_matrix(*matrix)\n if matrix.length != 6\n raise ArgumentError,\n 'Transformation matrix must have exacty 6 elements'\n end\n values = matrix.map { |x| format '%.5f', x }.join(' ')\n save_graphics_state if block_given?\n\n add_to_transformation_stack(*matrix)\n\n renderer.add_content \"#{values} cm\"\n if block_given?\n yield\n restore_graphics_state\n end\n end", "def sales_report_ascii\n \" ##### ###### \\n\" +\n \" # # ## # ###### #### # # ###### ##### #### ##### #####\\n\" +\n \" # # # # # # # # # # # # # # # # \\n\" +\n \" ##### # # # ##### #### ###### ##### # # # # # # # \\n\" +\n \" # ###### # # # # # # ##### # # ##### # \\n\" +\n \" # # # # # # # # # # # # # # # # # \\n\" +\n \" ##### # # ###### ###### #### # # ###### # #### # # # \\n\" +\n \"********************************************************************************\"\nend", "def to_s\n formatted = \"\"\n\n @grid.each do |x|\n formatted << x.join(\" \") + \"\\n\\n\"\n formatted.gsub!(\"u\\s\\s\\s\", \"u\\s\\s\")\n end\n\n formatted\n end", "def to_s\n board_2d.map do |row|\n row.map { |letter| '%-3s' % letter }.join(' ')\n end.join(\"\\n\")\n end", "def to_latex(*)\n opts = options.merge(:text=>html, :file=>refile(:latex), :type=>:latex)\n Latex.new(opts)\n end", "def to_s\n \"(#{cols},#{rows})\"\n end", "def to_s\n str = \"\"\n count_row = 0\n count_col = 0\n str << \"-\"*25 << \"\\n\"\n rows.each do |row|\n row.each do |ele|\n str << ele.to_s << \" \"\n count_col += 1\n if count_col == 3\n str << \"| \"\n count_col = 0\n end\n end\n count_row += 1\n if count_row == 3\n str << \"\\n\" << \"-\"*25 << \"\\n\"\n count_row = 0\n else\n str << \"\\n\"\n end\n end\n str << \"-\"*25\n end", "def to_s\n \"| #{cells.join(' | ')} |\"\n end", "def to_s\n width = 3\n translations = {\n \"\\n\" => \"\\\\n\",\n \"\\t\" => \"\\\\t\",\n \" \" => \"\\\\s\"\n }\n\n str = \"Transition table:\\n\"\n\n str += \"\".ljust(width)\n @characters.each do |c|\n c = translations[c] if translations.has_key?(c)\n str += c.ljust(width)\n end\n\n str += \"\\n\"\n\n @transition_table.each.with_index do |row, index|\n str += index.to_s.ljust(width)\n @characters.each do |c|\n str += row[c].to_s.ljust(width)\n end\n str += \"\\n\"\n end\n\n str += \"\\nLambda table:\\n\"\n\n str += \"\".ljust(width)\n (0..@state_counter).each do |row|\n str += row.to_s.ljust(width)\n end\n\n str += \"\\n\"\n\n (0..@state_counter).each.with_index do |row, index|\n str += index.to_s.ljust(width)\n (0..@state_counter).each do |col|\n str += @lambda_table[row][col].to_s.ljust(width)\n end\n str += \"\\n\"\n end\n\n return str\n end", "def to_s\n string_to_add = \" with cells: \"\n @reconstructed_table.each do |row|\n string_to_add += \"\\n\\t#{row}\"\n end\n super + string_to_add\n end", "def to_s\n\t\t\ts = edge_row + \"\\n\"\n\t\t\t@n_rows.times do |r|\n\t\t\t\ts << \"|\"\n\t\t\t\t@n_cols.times do |c|\n\t\t\t\t\tcorrect_row_index = @n_rows - r -1 \n\t\t\t\t\t#flip board updside down for representation\n\t\t\t\t\ts << \"#{represent_entry(correct_row_index,c)} |\"\n\t\t\t\tend\n\t\t\t\ts << \"\\n\"\n\t\t\tend\n\t\t\ts << edge_row + \"\\n\"\n\t\t\ts << \" \" + (0..@n_cols -1).to_a.join(' ') + \"\\n\"\n\t\t\treturn s\n\t\tend", "def to_s\n # find the largest number of digits in the numbers we\n # are printing\n digits = max_digits @size**2\n\n # create the row divider. flexible based on size of numbers\n # and the square.\n divider = \"+\"+(\"-\"*(@size*(3+digits)-1))+\"+\\n\"\n\n # build each row by formatting the numbers to the max\n # digits needed and adding pipe dividers\n (0...@size).inject(divider) do |output,i|\n output + \"| \" +\n @square[i].map{|x| \"%#{digits}d\" % x}.join(\" | \") +\n \" |\\n\" + divider\n end\n end", "def inspect\n return if @arr.empty?\n w = @arr.compact.collect { |row| row.size }.max\n result = \"\\n \" \n w.times do |y|\n result += '%3d'%y\n end\n result += \"\\n\"\n @arr.each_index do |x|\n result += '%3d:'%x\n if @arr[x]\n @arr[x].each do |val|\n result += val.nil? ? ' ' : '%3d'%val\n end\n end\n result += \"\\n\"\n end\n result\n end", "def color_matrix(txt = \"[X]\")\n size = String.colors.length\n String.colors.each do |color|\n String.colors.each do |back|\n print txt.colorize(color: color, background: back)\n end\n puts \" < #{color}\"\n end\n String.colors.reverse.each_with_index do |back, index|\n puts \"#{\"|\".rjust(txt.length) * (size - index)} < #{back}\"\n end\n \"\"\n end", "def print_matrix(m, row = nil, col = nil, rbold = nil)\n print \"\\n\"\n for i in 0..m.size-1\n print \"|\\t\"\n for j in 0..m[i].size-1\n n = m[i][j]\n if n.is_a? Numeric\n n = n.round(2)\n #n = n.to_r.rationalize(Rational('0.005')) #printar em fração\n #n = n.numerator if n.denominator == 1\n\n if row==i&&col==j\n print n.to_s.reverse_color\n elsif rbold == i\n print n.to_s.bold.bg_blue\n else\n print n\n end\n else\n print n\n end\n print \"\\t\" \n end\n puts \"|\"\n end\n print \"\\n\"\nend", "def to_s\n str = '';\n coefficient_arr_size = coefficient_arr.size\n\n @coefficient_arr.each_with_index do |el, idx|\n sign = el < 0 || idx == 0 ? '' : ' + '\n iks_add = coefficient_arr_size - (idx + 1) > 0 ? \"x^#{coefficient_arr_size - (idx + 1)}\" : ''\n str += \"#{sign}#{el.to_s.gsub('-', ' - ')}#{iks_add}\" if el != 0\n end\n\n str\n end", "def color_matrix( txt = \"[X]\" )\n size = String.colors.length\n String.colors.each do | color |\n String.colors.each do | back |\n print txt.colorize( :color => color, :background => back )\n end\n puts \" < #{color}\"\n end\n String.colors.reverse.each_with_index do | back, index |\n puts \"#{\"|\".rjust(txt.length)*(size-index)} < #{back}\"\n end\n \"\"\n end", "def to_tex\n ERB.new(IO.read(TEMPLATE_PATH)).result(binding)\n end", "def to_ascii(width_multiplier = 2)\n output = ''\n present.each_index do |i|\n output << present[i] * width_multiplier\n output << \"\\n\" if (i + 1) % @width == 0\n end\n output\n end", "def text_rendering_matrix\n @text_rendering_matrix ||= begin\n state_matrix = TransformationMatrix.new(\n state[:text_font_size] * state[:h_scaling], 0,\n 0, state[:text_font_size],\n 0, state[:text_rise]\n )\n state_matrix.multiply!(\n @text_matrix.a, @text_matrix.b,\n @text_matrix.c, @text_matrix.d,\n @text_matrix.e, @text_matrix.f\n )\n state_matrix.multiply!(\n ctm.a, ctm.b,\n ctm.c, ctm.d,\n ctm.e, ctm.f\n )\n end\n end", "def to_s \n output = \"\"\n @height.times do |y|\n @width.times do |x|\n output << (@cells.include?([x,y]) ? '*' : '-')\n end\n output << \"\\n\"\n end\n output\n end", "def to_s\n header_output = build_header_output\n data_output = build_data_output\n\n string = ''\n string << Yummi.colorize(@title, @style[:title]) << $/ if @title\n string << Yummi.colorize(@description, @style[:description]) << $/ if @description\n table_data = header_output + data_output\n if @layout == :vertical\n # don't use array transpose because the data may differ in each line size\n table_data = rotate table_data\n end\n string << content(table_data)\n end", "def properties\n printf(@colt_property.toString(@colt_matrix))\n end", "def display_matrix( matrix )\n return if ! matrix.keys[0]\n\n state_names = matrix.keys\n event_names = matrix[matrix.keys[0]].keys\n len_ev = 8\n event_names.each { |k| len_ev = k.length if k.length > len_ev }\n\n printf( \"%*s \", len_ev, \"\" )\n state_names.each { |st| printf( \"%-6s \", st ) }\n printf( \"\\n\" )\n\n event_names.each do |ev|\n printf( \"%-*s \", len_ev, ev )\n state_names.each do |st|\n w = st.length > 6 ? st.length : 6\n printf( \"%-*s \", w, matrix[st][ev] )\n end\n printf( \"\\n\" )\n end\nend", "def content (data)\n string = ''\n data.each_index do |i|\n row = data[i]\n row.each_index do |j|\n column = row[j]\n column ||= {:value => nil, :color => nil}\n width = max_width data, j\n alignment = (@align[j] or @default_align)\n value = Aligner.align alignment, column[:value].to_s, width\n value = Yummi.colorize value, column[:color] unless @no_colors\n string << value\n string << (' ' * @colspan)\n end\n string.strip! << $/\n end\n string\n end", "def translate_matrix\n @board_matrix.each do |array|\n array.each_with_index do |element, i|\n case element\n when 0\n array[i] = ' O '\n when 1\n array[i] = ' X '\n end\n end\n end\n end", "def print_equation(matrix, vector)\n matrix.each_with_index do |row, row_idx|\n print row[0].negative? ? '- ' : ' '\n row.each_with_index do |value, col_idx|\n print \"#{value.abs.to_s.split('').join(' ')} #{VARIABLES[col_idx]}\" \\\n \"\\t#{col_idx + 1 < row.length ? signal(row[col_idx + 1]) : ''}\"\n end\n puts \" = #{vector[row_idx].to_s.split('').join(' ')}\"\n end\nend", "def to_s\n return \"\" if @grid.length == 0\n str = \"\\n\"\n\t\tfor i in 0...@rows\n\t\t\tfor j in 0...@cols\n\t\t\t\tif @grid[i][j] == 0\n\t\t\t\t\tstr += ' . '\n\t\t\t\telse\n\t\t\t\t\tstr += ' X '\n\t\t\t\tend\n\t\t\tend\n\t\t\tstr += \"\\n\"\n\t\tend\n str\n end", "def to_s\n\t\[email protected]{|l|\n\t\t\tl.map{|b|\n\t\t\t\tb ? \"*\":\" \"\n\t\t\t}.join\n\n\t\t}.join(\"\\n\")\n\tend", "def to_s(options = {})\n defaults = {cell_width: 3,\n cell_height: 1}\n options.reverse_merge!(defaults)\n \n s = String.new\n # Den følgende kode er lidt rodet, men princippet er forklaret i rapporten under afsnit 6.2.\n @grid.each do |row|\n row.each do |cell|\n s << \"+\"\n cell.connected_up ? s << \" \"*options[:cell_width] : s << \"-\"*options[:cell_width]\n options[:cell_height].times do\n s << \"\\v\"+\"\\b\"+\"\\b\"*options[:cell_width]\n cell.connected_left ? s << \" \" : s << \"|\"\n s << \" \"*options[:cell_width]\n end\n s << \"\\e[A\"*options[:cell_height]\n end\n s << \"+\"+\"\\v\\b|\"*options[:cell_height]+\"\\n\"\n end\n @width.times do\n s << \"+\"\n s << \"-\"*options[:cell_width]\n end\n s << \"+\\n\"\n return s\n end", "def output_image\n @transformed_matrix.each do |element|\n puts element.join\n end\n end", "def to_ascii\n lines = []\n cols = col_count\n min_row.upto(max_row) do |row|\n line = \"%03d:\" % row # left-padded row number\n (cols - row).times {line << ' '}\n\n min_col.upto(max_col) do |col|\n line << ' '\n line << (@board[[row,col,0]] || '.').to_s\n end\n\n lines << line\n end\n\n lines.join \"\\n\"\n end", "def generate_html\n\n # Return our to_string function if we aren't reconstructed yet\n return self.to_s if !@reconstructed_table\n\n # Create an HTML table\n html = \"<table style='border:1px solid black'>\\n\";\n\n # Loop over each row and create a new table row\n @reconstructed_table.each do |row|\n html += \"<tr>\\n\";\n\n # Loop over each column and place the cell value into a td\n row.each do |column|\n to_show = column\n to_show = \"&nbsp;\" if to_show == \"\"\n html += \"<td style='border:1px solid black'>#{to_show}</td>\\n\";\n end\n\n # Close the row\n html += \"</tr>\\n\";\n end\n\n # Close the table\n html += \"</table>\\n\";\n return html\n end", "def links_to_matrix_children matrix\n matrix.children.collect { |child| link_to(child.id, child) }.to_sentence\n end", "def to_s\n @board.reduce(\"\") do |string, row|\n string_row = row.join(\" \").sub(/Q /, \"Qu\")\n string + string_row + \"\\n\"\n end\n end", "def to_s\n print_board = ''\n sudoku_board = @board.each { |row| print_board += row.join('') + \"\\n\" }\n print_board\n end", "def to_s\n result = \"--puzzle--\\n\"\n 9.times do |row|\n result << horiz_line if (row % 3).zero?\n line = @lines[row]\n 9.times do |col|\n result << '|' if column_before col\n square = line[col]\n if square.empty?\n result << '_'\n elsif square.metadata[:found]\n result << square.value.to_s.green\n else\n result << square.value.to_s\n end\n result << ' ' unless column_before(col + 1)\n result << '|' if col == 8\n end\n result << \"\\n\"\n result << horiz_line if row == 8\n end\n result\n end", "def write_matrix\n array = Array.new\n @left_system_of_equations.keys.each do |key|\n array << @left_system_of_equations[key]\n end\n @right_system_of_equations.keys.each do |key|\n array << @right_system_of_equations[key]\n end\n @array << array\n end", "def latex_environment(type, el, text); end", "def to_s\n \"(#{@x.map(&:to_s).join(\" * \")})\"\n end", "def to_s\n array.map { |x| x.map { |y| y.zero? ? ' ' : '█' }.join }.join(\"\\n\")\n end", "def to_s\n \"√(#{@x})\"\n end", "def set_char_matrix(rows,cols)\n # maximum number of displayable characters in any row\n cols = 0 if cols < 0\n cols = 99 if cols > 99\n @cols = cols\n @gsi.mnc = @cols.to_s.rjust(2,' ')\n\n # maximum number of displayable rows\n rows = 0 if rows < 0\n rows = 99 if rows > 99\n @rows = rows\n @gsi.mnr = @rows.to_s.rjust(2,' ')\n end", "def to_s\n self.to_a.map{ |row| row.join(' ') }.join(\"\\n\")\n end", "def to_s\n output = []\n @letters.values.each_slice(@letters.column_size) do |row|\n output << row.map{ |x| self.class.i_to_s(x) }.join(' ')\n end\n output.join(\"\\n\\n\").upcase.gsub('#', ' ')\n end", "def output_matrices(p)\n m = matrixjson(p)\n m.each do |d|\n puts d[0]\n d[1].each do |mr|\n mr.each do |c|\n print \"#{c}#{c.to_s == \" \" || c < 10 ? ' ' : ''} \"\n end\n puts\n end\n puts\n end\nend", "def to_s\n \"#{@imc}, #{@resul}, #{@rcc}\"\n end", "def to_s\n s = \"\"\n for i in 0...@filas\n for j in 0...@columnas\n s += \"#{@pos[i][j].to_s} \"\n end\n puts \" \"\n end\n s\n end", "def to_ascii\n out = \"+-+-+-+-+-+-+-+-+\\n\"\n squares.ranks.each do |row|\n row.each do |square|\n out += \"|#{square || ' '}\"\n end\n out += \"|\\n+-+-+-+-+-+-+-+-+\\n\"\n end\n out\n end", "def to_tex(\n lang = I18n.locale,\n db_table = \"db_table_name\",\n title = \"Jasper ist doof 3\",\n lecturer_first = \"Oliver\",\n lecturer_last = \"Istdoof\",\n gender = :both,\n tutors = [\"Mustafa Mustermann\", \"Fred Nurk\", \"Ashok Kumar\",\n \"Juan Pérez\", \"Jakob Mierscheid\", \"Iwan Iwanowitsch\",\n \"Pierre Dupont\", \"John Smith\", \"Eddi Exzellenz\",\n \"Joe Bloggs\", \"John Doe\", \"Stefan ist doof\",\n \"Beccy ist doof\"],\n term = \"the same term as last year\",\n barcode = \"00000000\")\n\n # in case someone didn’t give us symbols\n lang, gender = lang.to_sym, gender.to_sym\n\n # set lang and load locales for default strings that are not part of\n # the form\n I18n.locale = lang\n I18n.load_path += Dir.glob(File.join(Rails.root, 'config/locales/*.yml'))\n I18n.load_path.uniq!\n\n tex = \"\"\n\n # form header and preamble\n tex << \"\\\\documentclass[#{I18n.t(:tex_babel_lang)}]{eval}\\n\"\n tex << \"\\\\lecturerFirst{#{lecturer_first.escape_for_tex}}\\n\"\n tex << \"\\\\lecturerLast{#{lecturer_last.escape_for_tex}}\\n\"\n tex << \"\\\\lecture{#{title.escape_for_tex}}\\n\"\n tex << \"\\\\dbtable{#{db_table}}\\n\"\n tex << \"\\\\term{#{term.escape_for_tex}}\\n\"\n tex << \"\\\\noAnswerText{#{I18n.t(:no_answer)}}\\n\"\n # note: these cannot be customized per tutor, as the tutor is not\n # known yet. They will be filled in result.pdf, so give placeholders\n # instead.\n tex << \"\\\\setTutor{#{I18n.t(:tutor)}}\\n\"\n tex << \"\\\\setMyTutor{#{I18n.t(:my_tutor)}}\\n\"\n\n # tutors\n tutors.collect! { |t| t.escape_for_tex }\n tex << \"\\\\tutors{\\n \"\n (0..(TUTOR_BOX_COUNT-2)).each do |i|\n tex << \"\\\\tutorbox[#{i+1}][#{tutors[i] || \"\\\\\\\\ \"}]\".ljust(35)\n tex << ((i%5 == 4) ? '\\\\\\\\'+\"\\n \" : ' & ')\n end\n tex << \"\\\\tutorbox[#{TUTOR_BOX_COUNT}][\\\\ #{I18n.t(:none)}] \\n\"\n tex << \"}\\n\\n\"\n\n tex << get_texhead(lang) + \"\\n\"\n tex << \"\\\\begin{document}\\n\"\n tex << tex_header(lang, gender, barcode) + \"\\n\\n\\n\"\n tex << tex_questions(lang, gender) + \"\\n\"\n tex << get_texfoot(lang) + \"\\n\"\n tex << \"\\\\end{document}\"\n\n tex\n end", "def dump_matrix(*arg)\n matrix = self.to_matrix(*arg)\n sorted = @index.sort {|a,b| a[1] <=> b[1]}\n \"[# \" + sorted.collect{|x| x[0]}.join(\", \") + \"\\n\" +\n\tmatrix.to_a.collect{|row| ' ' + row.inspect}.join(\",\\n\") + \"\\n]\"\n end", "def latex?\n false\n end", "def to_s_corrected\n @cells.map { |row| row.join(' ') }.join(\"\\n\")\n end", "def print_matrix(m)\n (0...m.length).each do |i|\n step = 0\n (0..i).each do |_j|\n print \"#{m[i - step][step]} \"\n step += 1\n end\n puts ''\n end\nend", "def to_text\n text = \"\"\n @board_of_stone.each{|row|\n row.each{|stone|\n text << stone.to_s\n }\n text << \"\\n\"\n }\n return text\n end", "def __write_matrix(name, mx, dict)\n __write_with_log(name) do |io| \n i = -1\n mx.each_value do |v|\n io.puts \"result__[#{i += 1}] = #{v.subs(dict)};\"\n end\n end\n end", "def print_matrix\n for i in 0...@number_of_rows\n for j in 0...@number_of_columns\n print @matrix[i][j]\n end\n puts ''\n end\n end", "def dump_matrix(*arg)\n matrix = self.to_matrix(*arg)\n sorted = @index.sort {|a,b| a[1] <=> b[1]}\n \"[# \" + sorted.collect{|x| x[0]}.join(\", \") + \"\\n\" +\n matrix.to_a.collect{|row| ' ' + row.inspect}.join(\",\\n\") + \"\\n]\"\n end", "def products_ascii\n\t \" _ _ \\n\" +\n\t \" | | | | \\n\" +\n\t \" _ __ _ __ ___ __| |_ _ ___| |_ ___ \\n\" +\n\t \"| '_ \\\\| '__/ _ \\\\ / _` | | | |/ __| __/ __|\\n\" +\n\t \"| |_) | | | (_) | (_| | |_| | (__| |_\\\\__ \\\\\\n\" +\n\t \"| .__/|_| \\\\___/ \\\\__,_|\\\\__,_|\\\\___|\\\\__|___/\\n\" +\n\t \"| | \\n\" +\n\t \"|_| \"\nend", "def ascii_sales\n\" _ _ \n ___ __ _| | ___ ___ _ __ ___ _ __ ___ _ __| |_ \n/ __|/ _` | |/ _ \\/ __| | '__/ _ \\ '_ \\ / _ \\| '__| __|\n\\__ \\ (_| | | __/\\__ \\ | | | __/ |_) | (_) | | | |_ \n|___/\\__,_|_|\\___||___/ |_| \\___| .__/ \\___/|_| \\__|\n |_| \n\\n\" \n end" ]
[ "0.8290379", "0.71012217", "0.68977416", "0.6761417", "0.6572086", "0.65711564", "0.6568459", "0.65282416", "0.6520839", "0.65132385", "0.6478552", "0.63378495", "0.62582946", "0.624844", "0.6235852", "0.6088534", "0.60782826", "0.60709083", "0.6010628", "0.59935045", "0.5988137", "0.5985352", "0.59721446", "0.59548026", "0.5939091", "0.58856213", "0.58799255", "0.58624554", "0.58605415", "0.58591795", "0.5850912", "0.5791363", "0.57840884", "0.57596326", "0.5719479", "0.5712671", "0.5711979", "0.57070464", "0.5700168", "0.5697708", "0.567356", "0.5670044", "0.5666566", "0.56594706", "0.5658225", "0.5652653", "0.5644941", "0.5635334", "0.56279945", "0.5623915", "0.56181383", "0.5607017", "0.5606348", "0.56058276", "0.5600236", "0.55981094", "0.5595086", "0.5594263", "0.55935454", "0.5593257", "0.55688965", "0.55671024", "0.5565294", "0.5563828", "0.55592984", "0.5558401", "0.5549148", "0.5529196", "0.5524911", "0.54898447", "0.5485469", "0.54778373", "0.5473616", "0.5466002", "0.5453865", "0.54462564", "0.54439896", "0.5443792", "0.54215044", "0.54157406", "0.54107666", "0.53916955", "0.5378996", "0.53757477", "0.5371667", "0.5366387", "0.53636634", "0.53608984", "0.53607744", "0.5358996", "0.5357281", "0.53550476", "0.5347135", "0.53338575", "0.5330943", "0.53306466", "0.5327903", "0.532713", "0.53236943", "0.5319891" ]
0.8112606
1
GET /invoice_taxes/1 GET /invoice_taxes/1.json
def show @invoice_tax = InvoiceTax.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @invoice_tax } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_taxes\n self.class.get(\"/aldebaran-taxes/v2/taxes\", :basic_auth => @auth)\n end", "def index\n @taxes = params['item_id'] ? Item.find(params['item_id']).taxes : Tax.all\n render json: @taxes\n end", "def index\n @taxes = Tax.all\n\n render json: @taxes\n end", "def set_taxes\n @taxes = Tax.find(params[:id])\n end", "def index\n @taxes = Tax.all\n end", "def get_taxes_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TaxesApi.get_taxes ...\"\n end\n # resource path\n local_var_path = \"/taxes\"\n\n # query parameters\n query_params = {}\n query_params[:'includes'] = @api_client.build_collection_param(opts[:'includes'], :csv) if !opts[:'includes'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'order_by'] = @api_client.build_collection_param(opts[:'order_by'], :multi) if !opts[:'order_by'].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 = ['APIKeyHeader']\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 => 'InlineResponse2002')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TaxesApi#get_taxes\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def request_tax_invoice\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/request_tax_invoice\").body)\n @attributes = response['items']\n true\n end", "def get_tax_rates\n response_xml = http_get(@client, \"#{xero_url}/TaxRates\")\n parse_response(response_xml, {}, {:request_signature => 'GET/tax_rates'})\n end", "def show\n @company = Company.first\n @invoice = Invoice.find(params[:id])\n @invoice.client = Client.find(@invoice.client_id)\n @items = Item.find_all_by_invoice_id(@invoice.invoice_id)\n # @invoice.tax_value = Taxis.find(:all, :conditions => { :id => @invoice.tax_id })\n # tax_value = @invoice.tax.value\n #@tax_amount = @invoice.subtotal * (1 - @tax.value/100)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoice }\n format.pdf do\n render :pdf => \"file_name\"\n end\n end\n end", "def index\n @transaction_goods_taxes = Transaction::Goods::Taxe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @transaction_goods_taxes }\n end\n end", "def index\n @form_excise_taxes = FormExciseTax.all\n end", "def tax\n Tax.find(self.tax_id)\n end", "def send_tax_invoice\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/send_tax_invoice\").body)\n @attributes = response['items']\n true\n end", "def tax_index\n\n end", "def view(options = {})\n body = options.has_key?(:query) ? options[:query] : {}\n\n response = @client.get \"/core.tax/view/#{@tax_id}\", body, options\n\n return response\n end", "def tax_1\n get_or_build_tax_for_key(\"tax_1\")\n end", "def tax_rates\n @tax_rates ||= @api.get('TaxRates')['TaxRates'] || []\n end", "def get_taxes(opts = {})\n data, _status_code, _headers = get_taxes_with_http_info(opts)\n return data\n end", "def query_tax_rates(options={})\n path = \"/api/v2/compliance/taxrates\"\n get(path, options)\n end", "def index\n @quarter_income_taxes = QuarterIncomeTax.all\n end", "def index\n @taxons = Taxon.all\n end", "def index\n @incoming_service_taxes = IncomingServiceTax.new.index(params[:start_date], params[:end_date])\n end", "def tr_pq_taxes(pq)\n\t \tresponse = \"\"\n\t \titf = pq[:priced_itinerary][:air_itinerary_pricing_info][:itin_total_fare]\n\t \ttaxes = itf[:taxes][:tax_breakdown_code]\n\t \tcode_tax = itf[:taxes][:tax][:@tax_code]\n\t \tdiv_taxes = taxes.each_slice(4).to_a\n\t \tdiv_taxes.each {\n\t \t\t|ts|\n\t \t\tresponse += \"<tr>\"\n\t \t\tresponse += \"<td>#{code_tax}</td>\"\n\t \t\tts.each { |t| response += \"<td>#{t}</td>\" }\n\t \t\tresponse += \"</tr>\"\n\t \t\tcode_tax = \"\" #el codigo del impuesto solo va en la primer fila\n\t \t}\n\t \treturn response\n\t end", "def index\n @pagto_taxas = PagtoTaxa.all\n end", "def show\n render json: @tax\n end", "def url\n '/api/invoices'\n end", "def find_tax\n @tax = Tax.find_by(id: params[:id])\n end", "def new\n @invoice_tax = InvoiceTax.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice_tax }\n end\n end", "def invoice_tax(taxable_sub_total)\n ZipCodeTax.invoice_tax(zip_code_5_digit, taxable_sub_total)\n end", "def get_tax_region(id)\n path = \"/api/v2/compliance/taxregions/#{id}\"\n get(path)\n end", "def get_taxi\n begin\n plate_no = params[:plate_no]\n taxi = Taxi.find_or_create_by(plate_no: plate_no)\n data = taxi.summary() #taxi_json_with_ratings(taxi)\n\n render json: {data:data, success:true}\n rescue Exception => e\n render json:{success:false, message: e.to_s}\n end\n end", "def show\n @taxi = Taxi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @taxi }\n end\n end", "def sales_tax(options = {})\n options = options.inject({}) { |memo,(k, v)| memo[k.to_sym] = v; memo }\n required_options = %w(from to tax_values)\n\n # Raise an error if the required option is not defined\n required_options.each { |val| raise ArgumentError, \"Missing option :#{val}\" if !options.include?(val.to_sym) }\n\n response = client.request(:get_sales_tax_value) do |soap|\n soap.body = {\n 'UserID' => configuration.user_id,\n 'Password' => configuration.password,\n 'ShipFrom' => options[:from].to_soap,\n 'ShipTo' => options[:to].to_soap,\n 'TaxValueRequests' => { 'TaxValueRequest' => options[:tax_values].map(&:to_soap) }\n }\n end\n\n response_code = response[:get_sales_tax_value_response][:get_sales_tax_value_result][:service_status][:status_nbr]\n\n # Raise exceptions if there was an error when calculating the tax\n case response_code.to_i\n when 401\n raise RuntimeError, 'Invalid From address.'\n when 402\n raise RuntimeError, 'Invalid To address.'\n when 403\n raise RuntimeError, 'Invalid Taxability category.'\n when 500\n raise RuntimeError, 'Internal Strikeiron server error.'\n end\n\n Strikeiron::TaxResult.from_soap(response[:get_sales_tax_value_response][:get_sales_tax_value_result][:service_result])\n end", "def get_taxon(taxonomy_id, taxon_id)\n get \"/api/taxonomies/#{taxonomy_id}/taxons/#{taxon_id}\"\n end", "def tax_2\n get_or_build_tax_for_key(\"tax_2\")\n end", "def show\n @taxirequest = Taxirequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @taxirequest }\n end\n end", "def index\n @monthly_income_taxes = MonthlyIncomeTax.all\n end", "def ticket_tax(accounting_element)\n\t \taccounting_element[:taxes][:tax][:@amount]\n\t end", "def tax\n price_as_price.tax\n end", "def terms id, date = Date.today.to_s, page = 1\n uri = \"#{BASE_URL}/gauges/#{id}/terms?date=#{date}&page=#{page}}\"\n fetch uri\n end", "def index\n @invoices = @user.invoices.all\n render json: @invoices, status: :ok\n end", "def index\n @tax_returns = TaxReturn.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tax_returns }\n end\n end", "def index\n @taxfrees = Taxfree.all\n end", "def show\n @tax_rate = TaxRate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tax_rate }\n end\n end", "def index\n #@tax_ps = TaxP.find(:all)\n @tax_ps = @tax_paid_and_refund.tax_ps\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tax_ps }\n end\n end", "def show\n @invoice = Invoice.find(params[:id])\n @subtotals = producto_subtotal(params[:id])\n @cantidades = producto_cantidad(params[:id])\n @precio_unitario = precio_unitario(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoice }\n end\n end", "def add_taxes_with_http_info(tax, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TaxesApi.add_taxes ...\"\n end\n # verify the required parameter 'tax' is set\n if @api_client.config.client_side_validation && tax.nil?\n fail ArgumentError, \"Missing the required parameter 'tax' when calling TaxesApi.add_taxes\"\n end\n # resource path\n local_var_path = \"/taxes\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(tax)\n auth_names = ['APIKeyHeader']\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 => 'InlineResponse2012')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TaxesApi#add_taxes\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def all_invoices\n @gateway.get_invoices.invoices\n end", "def taxes\n wizard_step(STEPS)\n end", "def index\n @taxe_values = Taxe::Value.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @taxe_values }\n end\n end", "def index\n @tax_informations = TaxInformation.all\n end", "def index\n @tax_rates = TaxRate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tax_rates }\n end\n end", "def delete_tax(id)\n @client.raw('delete', \"/ecommerce/taxes/#{id}\")\n end", "def show\n @tax_type = TaxType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tax_type }\n end\n end", "def create\n @invoice_tax = InvoiceTax.new(params[:invoice_tax])\n\n respond_to do |format|\n if @invoice_tax.save\n format.html { redirect_to @invoice_tax, notice: 'Invoice tax was successfully created.' }\n format.json { render json: @invoice_tax, status: :created, location: @invoice_tax }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice_tax.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @user_taxi_calls = UserTaxiCall.all\n end", "def get_taxonomies(options = {})\n get \"/api/taxonomies\", options\n end", "def set_taxi\n @taxi = Taxi.find(params[:id])\n end", "def set_taxi\n @taxi = Taxi.find(params[:id])\n end", "def get_tax_by_id_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TaxesApi.get_tax_by_id ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling TaxesApi.get_tax_by_id\"\n end\n # resource path\n local_var_path = \"/taxes/{id}/\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\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 = ['APIKeyHeader']\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 => 'InlineResponse2012')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TaxesApi#get_tax_by_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def query_tax_regions(options={})\n path = \"/api/v2/compliance/taxregions\"\n get(path, options)\n end", "def invoice(options = nil)\n request = Request.new(@client)\n path = \"/products/\" + CGI.escape(@id) + \"/invoices\"\n data = {\n\n }\n\n response = Response.new(request.post(path, data, options))\n return_values = Array.new\n \n body = response.body\n body = body[\"invoice\"]\n invoice = Invoice(self._client)\n return_values.push(invoice.fill_with_data(body))\n\n \n return_values[0]\n end", "def show\n @taxinomy = Taxinomy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @taxinomy }\n end\n end", "def total_taxes\n @total_taxes = 0\n @list.each do |item, quantity|\n @total_taxes += quantity * item.taxes\n end\n puts \"Sales Taxes: #{MONEY_FORMAT % @total_taxes}\"\n end", "def text_pq_taxes(pq)\n\t \titf = pq[:priced_itinerary][:air_itinerary_pricing_info][:itin_total_fare]\n\t \ttaxes = itf[:taxes][:tax_breakdown_code]\n\t \treturn \"#{itf[:taxes][:tax][:@tax_code]} #{taxes.join(\" \")}\"\n\t end", "def set_tax\n @tax = Tax.find(params[:id])\n end", "def set_tax\n @tax = Tax.find(params[:id])\n end", "def aniade_taxones_query\n end", "def tax\n unescape params['x_tax']\n end", "def sales_invoice(id)\n get \"sales_invoices/#{id}\"\n end", "def tax\n unescape params['x_tax']\n end", "def as_json \n {\n id: id,\n tax: tax,\n subtotal: subtotal,\n total: total \n }\n end", "def import_tax_profile() path = \"/api/v2/taxprofile\"\n post(path) end", "def invoice\n @ipn['invoice']\n end", "def invoice\n params['txnid']\n end", "def included_taxes(amount)\r\n tax_rate = BigDecimal.new('0')\r\n # perform approximate base amount calculation\r\n included = @taxes.find_all {|tax| tax.included}\r\n included.each do |tax|\r\n tax_rate += tax.effective_rate\r\n end\r\n approx_base = amount / (BigDecimal.new('1.0') + tax_rate)\r\n\r\n #use approximate base to calculate included taxes.\r\n included.each do |tax|\r\n tax.amount = approx_base * tax.effective_rate\r\n end\r\n included\r\n end", "def tax_total\n adjustments.where(:originator_type => \"TaxRate\").map(&:amount).sum\n end", "def calculate_total_for_tax(invoice, tax_rate)\n total_amount = total_tax_amount = 0\n\n components = invoice.\n all_items.\n flatten.\n select { |component| component.tax_rate == tax_rate }\n\n components.each do |component|\n total_amount += component.price\n total_tax_amount += component.calculate_tax\n end\n\n [total_amount, total_tax_amount]\n end", "def destroy\n @invoice_tax = InvoiceTax.find(params[:id])\n @invoice_tax.destroy\n\n respond_to do |format|\n format.html { redirect_to invoice_taxes_url }\n format.json { head :no_content }\n end\n end", "def update_item_taxes_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CatalogApi.update_item_taxes ...\"\n end\n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling CatalogApi.update_item_taxes\" if body.nil?\n # resource path\n local_var_path = \"/v2/catalog/update-item-taxes\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n \n header_params['Square-Version'] = \"2018-07-12\"\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 = ['oauth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'UpdateItemTaxesResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CatalogApi#update_item_taxes\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def gst_tax_rate\n if !self.tax_accounts.blank?\n self.tax_accounts.first.accountable.tax_rate\n end\n end", "def conv_tax\n ((self.respond_to?(:tax) && tax) || 0).to_r\n end", "def tax_params\n res = ActiveModelSerializers::Deserialization.jsonapi_parse(params, {})\n end", "def index\n @invoice_items = @invoice.invoice_items\n end", "def index\n @invoices = Invoice.all.order(invoice_date: :desc).order(created_at: :desc).paginate(:page => params[:page], per_page: 10)\n\n render json: {invoices: @invoices, total_pages: @invoices.total_pages, current_page: @invoices.current_page}\n end", "def invoice\n params['txnid']\n end", "def show\n @bill = Bill.find(params[:id])\n if @bill.complete \n @taxinvoice = Taxinvoice.where(:ref_id => @bill.id)\n end\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bill }\n format.json { render :json => @bill }\n end\n end", "def index\n @invoice = Invoice.new\n @customers = Customer.all\n @invoices = Array.new\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invoice }\n end\n end", "def show\n @taxon_with_name = TaxonWithName.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @taxon_with_name }\n end\n end", "def index\n @invoice_line_items = InvoiceLineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invoice_line_items }\n end\n end", "def index\n respond_with(invoices)\n end", "def envia_taxones_query\n end", "def set_incoming_service_tax\n @incoming_service_tax = IncomingServiceTax.find(params[:id])\n end", "def index\n @invoice_types = InvoiceType.all\n end", "def index\n @guide_taxa = GuideTaxon.includes(:guide_photos => [:photo]).page(params[:page]).per_page(200)\n @guide_taxa = @guide_taxa.where(:guide_id => params[:guide_id]) unless params[:guide_id].blank?\n\n respond_to do |format|\n format.html # index.html.erb\n format.json do\n render :json => {:guide_taxa => @guide_taxa.as_json(\n :root => false, \n :methods => [:guide_photo_ids, :guide_section_ids, :guide_range_ids],\n :include => [:guide_photos => {:include => [{:photo => Photo.default_json_options}]}]\n )}\n end\n end\n end", "def get_tax(item_price, tax_rate)\n amt = compute_tax(item_price, tax_rate)\n round_tax(amt)\n end", "def query_tax_region_jurisdictions(options={})\n path = \"/api/v2/compliance/taxregionjurisdictions\"\n get(path, options)\n end", "def show\n @breadcrumb = 'read'\n @invoice_type = InvoiceType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoice_type }\n end\n end", "def invoice\n\t\trentaltype.amount\n\tend", "def get_invoices(options = {})\n\n request_params = {}\n\n request_params[:InvoiceID] = options[:invoice_id] if options[:invoice_id]\n request_params[:InvoiceNumber] = options[:invoice_number] if options[:invoice_number]\n request_params[:order] = options[:order] if options[:order]\n request_params[:ModifiedAfter] = options[:modified_since] if options[:modified_since]\n request_params[:IDs] = Array(options[:invoice_ids]).join(\",\") if options[:invoice_ids]\n request_params[:InvoiceNumbers] = Array(options[:invoice_numbers]).join(\",\") if options[:invoice_numbers]\n request_params[:ContactIDs] = Array(options[:contact_ids]).join(\",\") if options[:contact_ids]\n request_params[:page] = options[:page] if options[:page]\n\n request_params[:where] = options[:where] if options[:where]\n\n response_xml = http_get(@client, \"#{@xero_url}/Invoices\", request_params)\n\n parse_response(response_xml, {:request_params => request_params}, {:request_signature => 'GET/Invoices'})\n end" ]
[ "0.7912092", "0.7678965", "0.71768844", "0.70942634", "0.7087311", "0.7028914", "0.6826595", "0.66397685", "0.6548293", "0.65334576", "0.64224494", "0.6417056", "0.6417024", "0.64081514", "0.6370767", "0.635478", "0.63246125", "0.6302579", "0.62796366", "0.62261474", "0.6212978", "0.62074274", "0.61422175", "0.6128979", "0.61249024", "0.61131895", "0.60234094", "0.6010857", "0.59737724", "0.59714466", "0.59642994", "0.59392285", "0.5937581", "0.5919388", "0.5914747", "0.59143215", "0.588077", "0.58733517", "0.5867184", "0.58571666", "0.5854063", "0.5820572", "0.580336", "0.57956266", "0.5790536", "0.57802886", "0.57736725", "0.5765126", "0.57590187", "0.57584035", "0.57412", "0.57360166", "0.57291776", "0.57241005", "0.57188416", "0.571172", "0.5695174", "0.56862247", "0.56862247", "0.5682137", "0.56618303", "0.5660166", "0.56561244", "0.56551313", "0.5638756", "0.5637359", "0.5637359", "0.5635962", "0.562438", "0.56118", "0.56029224", "0.5602052", "0.5578434", "0.55685216", "0.5552463", "0.55512285", "0.55318004", "0.5522198", "0.5514871", "0.5514296", "0.55129486", "0.5507822", "0.54989916", "0.54915404", "0.54843605", "0.5479734", "0.54753953", "0.5468287", "0.54574484", "0.54558104", "0.5450912", "0.5435693", "0.5430915", "0.54294753", "0.5427375", "0.5426948", "0.54107887", "0.5408959", "0.5402899", "0.54028285" ]
0.67804927
7
GET /invoice_taxes/new GET /invoice_taxes/new.json
def new @invoice_tax = InvoiceTax.new respond_to do |format| format.html # new.html.erb format.json { render json: @invoice_tax } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @invoice_tax = InvoiceTax.new(params[:invoice_tax])\n\n respond_to do |format|\n if @invoice_tax.save\n format.html { redirect_to @invoice_tax, notice: 'Invoice tax was successfully created.' }\n format.json { render json: @invoice_tax, status: :created, location: @invoice_tax }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice_tax.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @taxon = Taxon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @taxon }\n end\n end", "def new\n @taxon = Taxon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @taxon }\n end\n end", "def new\n @taxirequest = Taxirequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @taxirequest }\n end\n end", "def new\n @tax_type = TaxType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tax_type }\n end\n end", "def new\n @taxi = Taxi.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @taxi }\n end\n end", "def new\n @breadcrumb = 'create'\n @invoice_type = InvoiceType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice_type }\n end\n end", "def new\n @taxinomy = Taxinomy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @taxinomy }\n end\n end", "def create\n @tax = Tax.new(tax_params)\n\n if @tax.save\n render json: @tax, status: :created, location: @tax\n else\n render json: @tax.errors, status: :unprocessable_entity\n end\n end", "def new\n @tax_rate = TaxRate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tax_rate }\n end\n end", "def new\n @tax = Tax.new\n end", "def new\n @invoice = Invoice.new\n @counter = InvoiceNumbers.first\n @items = Item.find_all_by_invoice_id(@invoice.invoice_id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice }\n end\n end", "def new\n @taxon_attribute = TaxonAttribute.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @taxon_attribute }\n end\n end", "def new\n # @invoice = Invoice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice }\n end\n end", "def new\n @invoice = Invoice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @invoice }\n end\n end", "def new\n @invoice_template = InvoiceTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice_template }\n end\n end", "def create\n @taxon = Taxon.new(params[:taxon])\n\n respond_to do |format|\n if @taxon.save\n format.html { redirect_to @taxon, notice: 'Taxon was successfully created.' }\n format.json { render json: @taxon, status: :created, location: @taxon }\n else\n format.html { render action: \"new\" }\n format.json { render json: @taxon.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @taxon = Taxon.new(params[:taxon])\n\n respond_to do |format|\n if @taxon.save\n format.html { redirect_to @taxon, notice: 'Taxon was successfully created.' }\n format.json { render json: @taxon, status: :created, location: @taxon }\n else\n format.html { render action: \"new\" }\n format.json { render json: @taxon.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tax = Tax.new(tax_params)\n if @tax.save\n redirect_to admin_taxes_path\n flash[:success] = \"Woohoo! tax created successfully.\"\n else\n render 'new'\n flash[:error] = \"Oops! Something went wrong!\"\n end\n end", "def new\n @invoice = Invoice.new\n @stores = Store.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice }\n end\n end", "def create\n @pagto_taxa = PagtoTaxa.new(pagto_taxa_params)\n\n respond_to do |format|\n if @pagto_taxa.save\n format.html { redirect_to @pagto_taxa, notice: 'Pagto taxa was successfully created.' }\n format.json { render action: 'show', status: :created, location: @pagto_taxa }\n else\n format.html { render action: 'new' }\n format.json { render json: @pagto_taxa.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tax_type = TaxType.new(params[:tax_type])\n\n respond_to do |format|\n if @tax_type.save\n format.html { redirect_to @tax_type, notice: 'Tax type was successfully created.' }\n format.json { render json: @tax_type, status: :created, location: @tax_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tax_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @user = current_user\n @patient = @user.patients.find(params[:patient_id])\n @invoice = @patient.invoices.find(params[:invoice_id])\n @cost_types = CostType.all\n @cost_item = CostItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cost_item }\n end\n end", "def create\n @incoming_service_tax = IncomingServiceTax.new(incoming_service_tax_params)\n\n respond_to do |format|\n if @incoming_service_tax.save\n format.html { redirect_to @incoming_service_tax, notice: 'Incoming service tax was successfully created.' }\n format.json { render action: 'show', status: :created, location: @incoming_service_tax }\n else\n format.html { render action: 'new' }\n format.json { render json: @incoming_service_tax.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @taxi = current_user.taxis.new(params[:taxi])\n\n respond_to do |format|\n if @taxi.save\n format.html { redirect_to @taxi, notice: 'Taxi was successfully created.' }\n format.json { render json: @taxi, status: :created, location: @taxi }\n else\n format.html { render action: \"new\" }\n format.json { render json: @taxi.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @taxon_rule = TaxonRule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @taxon_rule }\n end\n end", "def create\n @resource = Invoice.new(params[:invoice])\n\n respond_to do |format|\n if @resource.save\n format.html { redirect_to invoices_url, notice: 'invoice was successfully created.' }\n format.json { render json: @resource, status: :created, location: @resource }\n else\n format.html { render action: \"new\" }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @invoice = Invoice.new\n @invoice.products_invoice.build\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice }\n end\n end", "def create\n @invoice = current_user.invoices.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Uw factuur is opgeslagen.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { @invoice.build_company\n @invoice.items.build\n @invoice.build_relation\n render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @purchase_order = PurchaseOrder.new_order(params, @company)\n @purchase_order.purchase_order_line_items.each do |line_item|\n 2.times{ line_item.purchase_order_taxes.build }\n end\n @voucher_setting = VoucherSetting.find_by_company_id_and_voucher_type(@company.id, 6)\n @from_accounts = TransactionType.fetch_from_accounts(@company.id, 'purchases')\n @to_accounts = Product.get_purchase_products(@company.id)\n @tax_accounts = TransactionType.fetch_to_accounts(@company.id, 'tax')\n @other_charge_accounts = Account.get_other_expense_on_purchase_accounts(@company)\n @vendor_account_heads = AccountHead.get_customer_and_vendor_account_heads(@company.id)\n @projects = @company.projects.active\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @purchase_order }\n end\n end", "def create\n @sale = Sale.new(sale_params)\n\n respond_to do |format|\n if @sale.save && calculate_taxes(@sale)\n format.html { redirect_to @sale, notice: 'Sale was successfully created.' }\n format.json { render :show, status: :created, location: @sale }\n else\n format.html { render :new }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @invoice = Invoice.new\n $details = Array.new\n @customers = Customer.all\n @retire_notes = Array.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice }\n end\n end", "def create\n @taxfree = Taxfree.new(taxfree_params)\n\n respond_to do |format|\n if @taxfree.save\n format.html { redirect_to @taxfree, notice: 'Taxfree was successfully created.' }\n format.json { render :show, status: :created, location: @taxfree }\n else\n format.html { render :new }\n format.json { render json: @taxfree.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @taxinomy = Taxinomy.new(params[:taxinomy])\n\n respond_to do |format|\n if @taxinomy.save\n format.html { redirect_to @taxinomy, notice: 'Taxinomy was successfully created.' }\n format.json { render json: @taxinomy, status: :created, location: @taxinomy }\n else\n format.html { render action: \"new\" }\n format.json { render json: @taxinomy.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @invoice = Invoice.new(params[:invoice])\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, :notice => 'Invoice was successfully created.' }\n format.json { render :json => @invoice, :status => :created, :location => @invoice }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @invoice.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @invoice = Invoice.new(params[:invoice])\n @invoice.client_id = params[:clients]\n @invoice.discount_id = params[:discount_id]\n @invoice.tax_id = params[:tax_id]\n @invoice.status = Invoice::DRAFT\n @invoice.year = @counter.year\n @invoice.invoice_id = @counter.number\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render json: @invoice, status: :created, location: @invoice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @transaction_goods_taxis = Transaction::Goods::Taxe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @transaction_goods_taxis }\n end\n end", "def new\n @invoice = Invoice.new\n @invoice.itens.build\n default_data\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invoice }\n end\n end", "def new\n @invoice = @last_invoice ? Invoice.new(@last_invoice.attributes.except('number')) : Invoice.new\n respond_to do |format|\n format.html {}\n format.json { render json: @last_invoice, status: :ok, location: @last_invoice }\n end\n\n end", "def index\n @taxes = params['item_id'] ? Item.find(params['item_id']).taxes : Tax.all\n render json: @taxes\n end", "def create\n @tax_rate = TaxRate.new(params[:tax_rate])\n\n respond_to do |format|\n if @tax_rate.save\n format.html { redirect_to @tax_rate, notice: 'Tax rate was successfully created.' }\n format.json { render json: @tax_rate, status: :created, location: @tax_rate }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tax_rate.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @tax_rate = TaxRate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tax_rate }\n end\n end", "def create\n \n @invoice = Invoice.new(params[:invoice])\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Factura creada correctamente.' }\n format.json { render json: @invoice, status: :created, location: @invoice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # @invoice = Invoice.new(params[:invoice])\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render json: @invoice, status: :created, location: @invoice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @invoicedetail = Invoicedetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoicedetail }\n end\n end", "def new\n @invoice_status = InvoiceStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice_status }\n end\n end", "def create\n @invoice = Invoice.new(params[:invoice])\n\n respond_to do |format|\n if @invoice.save\n create_first_line_item unless @invoice.booking.pricing_structure.rate_per_person.nil?\n format.html { redirect_to invoice_path(@invoice.id), notice: 'Invoice was successfully created.' }\n format.json { render json: @invoice, status: :created, location: @invoice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @taxi_sevice = TaxiSevice.new(taxi_sevice_params)\n\n respond_to do |format|\n if @taxi_sevice.save\n format.html { redirect_to action: \"index\" }\n else\n format.html { render :new }\n format.json { render json: @taxi_sevice.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @taxi = Taxi.new(taxi_params)\n\n respond_to do |format|\n if @taxi.save\n format.html { redirect_to @taxi, notice: 'Taxi was successfully created.' }\n format.json { render :show, status: :created, location: @taxi }\n else\n format.html { render :new }\n format.json { render json: @taxi.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @tax_return = current_user.tax_returns.build(params[:tax_return])\n \n 1.times { @tax_return.employers.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tax_return }\n end\n end", "def index\n @taxes = Tax.all\n\n render json: @taxes\n end", "def set_taxes\n @taxes = Tax.find(params[:id])\n end", "def new\n @users = User.find(:all)\n @invoice = Invoice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invoice }\n end\n end", "def new\n @invoicefield = Invoicefield.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoicefield }\n end\n end", "def new\n @gstr_advance_receipt = GstrAdvanceReceipt.new_gstr_advance_receipt(params,@company,@current_user)\n @voucher_setting=VoucherSetting.find_by_voucher_type(25,@company.id)\n @customer_id= Customer.find_by_company_id(@company.id)\n @from_accounts = TransactionType.fetch_from_accounts(@company.id,'purchases')\n @deposit_to = TransactionType.fetch_to_accounts(@company.id,'receipts')\n @tax_accounts = TransactionType.fetch_from_accounts(@company.id, 'tax')\n @custom_field = CustomField.find_by_company_id_and_voucher_type(@company.id)\n @shipping_accounts = Account.get_other_expense_accounts(@company)\n @customer_account_heads = AccountHead.get_customer_and_vendor_account_heads(@company.id)\n @sales_account_heads = AccountHead.get_sales_account(@company.id)\n @tax_account_heads = AccountHead.get_duties_and_taxes_account(@company.id)\n @vendor_id= Vendor.find_by_company_id(@company.id)\n @products= Product.get_sales_products(@company.id)\n @states = State.where(country_id: 93)\n\n #@gstr_advance_receipt_voucher_sequence= VoucherSetting.next_gstr_advance_receipt_number(@company)\n @gstr_advance_receipt_line_item =@gstr_advance_receipt.gstr_advance_receipt_line_items\n #@gstn_id= Vendor.find(params[:id])\n @gstr_advance_receipt.gstr_advance_receipt_line_items.each do |line_item|\n 2.times{line_item.gstr_advance_receipt_taxes.build}\n end\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gstr_advance_receipt }\n end\n end", "def create\n @invoice = Invoice.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render action: 'show', status: :created, location: @invoice }\n else\n format.html { render action: 'new' }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @invoice = Invoice.find(cookies[:invoice_id])\n @bill = Bill.new\n run_docnumber\n default_cancel\n @bill.tax = @invoice.tax\n @bill.approve = false\n @bill.complete = false\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bill }\n format.json { render :json => @bill }\n end\n end", "def create\n @invoice = Invoice.new(invoice_params)\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @invoice = Invoice.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @invoice = Invoice.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @invoice = Invoice.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @invoice = Invoice.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @invoice = Invoice.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @invoice = Invoice.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @invoice_line_item = InvoiceLineItem.new\n prepFormVariables\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice_line_item }\n end\n end", "def new\n @breadcrumb = 'create'\n @supplier_invoice = SupplierInvoice.new\n $attachment_changed = false\n $attachment = Attachment.new\n destroy_attachment\n @projects = projects_dropdown\n # @search_projects = @projects.map{ |p| p.id }.map(&:inspect).join(',')\n @work_orders = work_orders_dropdown\n @charge_accounts = projects_charge_accounts(@projects)\n # @stores = stores_dropdown\n @suppliers = suppliers_dropdown\n @payment_methods = payment_methods_dropdown\n @receipt_notes = []\n @purchase_orders = []\n @note_items = []\n @order_items = []\n @products = []\n # Special to approvals\n @users = User.where('id = ?', current_user.id)\n @companies = companies_dropdown\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @supplier_invoice }\n end\n end", "def new\n @tipo_convenio = TipoConvenio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_convenio }\n end\n end", "def create\n @invoice_type = InvoiceType.new(invoice_type_params)\n\n if @invoice_type.save\n render :show, status: :created, location: @invoice_type\n else\n render json: @invoice_type.errors, status: :unprocessable_entity\n end\n end", "def create\n @invoice = Invoice.new(invoice_number_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to invoices_path, notice: 'Invoice number was successfully created.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @invoice = @website.invoices.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render action: 'show', status: :created, location: @invoice }\n else\n format.html { render action: 'new' }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @fax_typ = FaxTyp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fax_typ }\n end\n end", "def new\n respond_with(invoice)\n end", "def new\n add_breadcrumb \"Tramanta\", :bazar_path\n add_breadcrumb \"Solicitud de devolución\", :new_refund_request_path\n \n @refund_request = RefundRequest.new\n @user_id = current_user.id\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @refund_request }\n end\n end", "def create\n # Вызвать такси\n @order_number = Taxirequest.call_a_taxi(params[:taxirequest])\n # Разместить заявку на такси в таблице taxirequests\n @taxirequest = Taxirequest.add_request(params[:taxirequest], session[:employee_id], @order_number)\n #@taxirequest = Taxirequest.new(params[:taxirequest])\n\n respond_to do |format|\n if @taxirequest.save\n format.html { redirect_to @taxirequest, notice: 'Taxirequest was successfully created.'+@response }\n format.json { render json: @taxirequest, status: :created, location: @taxirequest }\n else\n format.html { render action: \"new\" }\n format.json { render json: taxirequest.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def create\n @transaction_goods_taxis = Transaction::Goods::Taxe.new(params[:transaction_goods_taxis])\n\n respond_to do |format|\n if @transaction_goods_taxis.save\n format.html { redirect_to(@transaction_goods_taxis, :notice => 'Taxe was successfully created.') }\n format.xml { render :xml => @transaction_goods_taxis, :status => :created, :location => @transaction_goods_taxis }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @transaction_goods_taxis.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @breadcrumb = 'create'\n @product = $product\n @supplier = $supplier\n @purchase_price = PurchasePrice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchase_price }\n end\n end", "def new\n @tipo_item = TipoItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_item }\n end\n end", "def create\n @tax_information = TaxInformation.new(tax_information_params)\n\n respond_to do |format|\n if @tax_information.save\n format.html { redirect_to @tax_information, notice: 'Tax information was successfully created.' }\n format.json { render :show, status: :created, location: @tax_information }\n else\n format.html { render :new }\n format.json { render json: @tax_information.errors, status: :unprocessable_entity }\n end\n end\n end", "def request_tax_invoice\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/request_tax_invoice\").body)\n @attributes = response['items']\n true\n end", "def new\n @project = Project.find(params[:project_id])\n @invoice = @project.invoices.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invoice }\n end\n end", "def create\n @invoice = Invoice.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @breadcrumb = 'create'\n @invoice_type = InvoiceType.new(params[:invoice_type])\n @invoice_type.created_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @invoice_type.save\n format.html { redirect_to @invoice_type, notice: t('activerecord.attributes.invoice_type.create') }\n format.json { render json: @invoice_type, status: :created, location: @invoice_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @invoice = Invoice.new(invoice_params)\r\n\r\n respond_to do |format|\r\n if @invoice.save\r\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\r\n format.json { render :show, status: :created, location: @invoice }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @invoice = Invoice.new(invoice_params)\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Fatura başarıyla oluşturuldu.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @invoice = Invoice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invoice }\n end\n end", "def new\n #@recurring_profile = RecurringProfile.new\n @recurring_profile = RecurringProfile.new({:invoice_number => RecurringProfile.get_next_profile_id, :payment_terms_id => (PaymentTerm.unscoped.present? && PaymentTerm.unscoped.first.id), :first_invoice_date => Date.today,:sent_invoices => 0})\n @invoice = Invoice.find_by_id params[:id] if params[:id].present?\n @client = @invoice.client if @invoice.present?\n @recurring_profile.currency = @client.currency if @client.present?\n @discount_types = @recurring_profile.currency.present? ? ['%', @recurring_profile.currency.unit] : DISCOUNT_TYPE\n 3.times { @recurring_profile.recurring_profile_line_items.build() }\n\n get_clients_and_items\n\n respond_to do |format|\n format.html # new.html.erb\n format.js\n #format.json { render :json => @recurring_profile }\n end\n end", "def create\n @invoice = Invoice.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: \"Invoice was successfully created.\" }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @taxe_value = Taxe::Value.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @taxe_value }\n end\n end", "def new\n @breadcrumb = 'create'\n @supplier_payment = SupplierPayment.new\n @suppliers = suppliers_dropdown\n invoices = invoices_dropdown\n @supplier_invoices = invoices\n @approvals = approvals_dropdown_on_model(invoices)\n #@approvals = approvals_dropdown(invoices)\n @users = User.all\n @payment_methods = payment_methods_dropdown\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @supplier_payment }\n end\n end", "def new\n @tier = Tier.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @tier }\n end\n end", "def create\n @invoice = Invoice.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'La factura fue creada correctamente.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @tax_computation = TaxComputation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tax_computation }\n end\n end", "def new\n @transcription = Transcription.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @transcription }\n end\n end", "def create\n @invoice = Invoice.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Devis cree.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invoice }\n end\n end", "def new\n @tipo_atendimento = TipoAtendimento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_atendimento }\n end\n end", "def new\n @xpto = Xpto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @xpto }\n end\n end", "def new\n @peso = Peso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @peso }\n end\n end", "def new\n @collection_invoice = CollectionInvoice.new\n @collection_invoice.space = current_space\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @collection_invoice }\n end\n end", "def new\n @expense = TblReceipt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expense }\n end\n end" ]
[ "0.72811353", "0.70327747", "0.70327747", "0.70283765", "0.70208365", "0.7017731", "0.6928569", "0.67786777", "0.6765665", "0.6748932", "0.66771334", "0.6674354", "0.6673623", "0.65672815", "0.6561808", "0.6487727", "0.64467657", "0.64467657", "0.6436855", "0.6417992", "0.6409019", "0.64055556", "0.6402946", "0.63978434", "0.63919926", "0.6375015", "0.6360901", "0.63459367", "0.633045", "0.6329123", "0.6319082", "0.63158536", "0.6290504", "0.62889296", "0.62670654", "0.6250735", "0.6238329", "0.62305015", "0.6228636", "0.62262636", "0.62243867", "0.62241286", "0.62139684", "0.62102324", "0.6198119", "0.6194518", "0.6187814", "0.6184937", "0.618262", "0.61777294", "0.61589617", "0.61538726", "0.6148222", "0.61344814", "0.61332595", "0.61293155", "0.611583", "0.60913026", "0.6085591", "0.6085591", "0.6085591", "0.6085591", "0.6085591", "0.6085591", "0.60808927", "0.60775477", "0.6068706", "0.60617983", "0.6054228", "0.60432", "0.6033696", "0.6025164", "0.60232735", "0.60193413", "0.6017355", "0.59977436", "0.5994829", "0.59930444", "0.59922165", "0.59899837", "0.59827226", "0.5982436", "0.59735143", "0.59699994", "0.5967676", "0.59676176", "0.59652245", "0.59521174", "0.5949684", "0.59454566", "0.59418154", "0.59411925", "0.5928965", "0.5928885", "0.5922385", "0.59067076", "0.5903855", "0.5893912", "0.58867615", "0.58831143" ]
0.7654911
0
POST /invoice_taxes POST /invoice_taxes.json
def create @invoice_tax = InvoiceTax.new(params[:invoice_tax]) respond_to do |format| if @invoice_tax.save format.html { redirect_to @invoice_tax, notice: 'Invoice tax was successfully created.' } format.json { render json: @invoice_tax, status: :created, location: @invoice_tax } else format.html { render action: "new" } format.json { render json: @invoice_tax.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_tax_invoice\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/send_tax_invoice\").body)\n @attributes = response['items']\n true\n end", "def request_tax_invoice\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/request_tax_invoice\").body)\n @attributes = response['items']\n true\n end", "def set_taxes\n @taxes = Tax.find(params[:id])\n end", "def add_taxes_with_http_info(tax, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TaxesApi.add_taxes ...\"\n end\n # verify the required parameter 'tax' is set\n if @api_client.config.client_side_validation && tax.nil?\n fail ArgumentError, \"Missing the required parameter 'tax' when calling TaxesApi.add_taxes\"\n end\n # resource path\n local_var_path = \"/taxes\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(tax)\n auth_names = ['APIKeyHeader']\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 => 'InlineResponse2012')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TaxesApi#add_taxes\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @sale = Sale.new(sale_params)\n\n respond_to do |format|\n if @sale.save && calculate_taxes(@sale)\n format.html { redirect_to @sale, notice: 'Sale was successfully created.' }\n format.json { render :show, status: :created, location: @sale }\n else\n format.html { render :new }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_all_taxes\n self.class.get(\"/aldebaran-taxes/v2/taxes\", :basic_auth => @auth)\n end", "def index\n @taxes = params['item_id'] ? Item.find(params['item_id']).taxes : Tax.all\n render json: @taxes\n end", "def create\n @tax = Tax.new(tax_params)\n\n if @tax.save\n render json: @tax, status: :created, location: @tax\n else\n render json: @tax.errors, status: :unprocessable_entity\n end\n end", "def addTaxes(accountProject, currency, totalAmount)\n\t\tprojectTaxes = accountProject.wk_acc_project_taxes\n\t\tprojectTaxes.each do |projtax|\n\t\t\tinvItem = @invoice.invoice_items.new()\n\t\t\tinvItem.name = projtax.tax.name\n\t\t\tinvItem.rate = projtax.tax.rate_pct.blank? ? 0 : projtax.tax.rate_pct\n\t\t\tinvItem.project_id = accountProject.project_id\n\t\t\tinvItem.currency = currency\n\t\t\tinvItem.quantity = nil\n\t\t\tinvItem.amount = (invItem.rate/100) * totalAmount\n\t\t\tinvItem.item_type = 't'\n\t\t\tinvItem.modifier_id = User.current.id\n\t\t\tinvItem.save()\n\t\tend\n\tend", "def taxes=(taxes)\n write_attribute(:taxes, taxes.gsub(/\\D/, ''))\n end", "def test_create_invoice_and_edit_taxes_should_copy_taxes_and_mark_edited\n context = \"with taxes enabled in profile and valid\"\n user = tax_user(:basic_user)\n user.enable_profile_taxes\n assert user.profile.tax_enabled\n\n user.login\n# puts \"do click new invoice\"\n user.clicks_create_new_invoice\n \n user.assert_select 'div#tax_container', true, \"new invoice screen was missing tax_container #{context}\"\n \n user.assert_select 'input#invoice_tax_1_enabled', true, \"new invoice failed to show tax_1_enabled #{context}\"\n user.assert_select 'input#invoice_tax_1_rate', true, \"new invoice failed to show tax_1_rate #{context}\"\n\n user.assert_select 'input#invoice_tax_2_enabled', true, \"new invoice failed to show tax_2_enabled #{context}\"\n user.assert_select 'input#invoice_tax_2_rate', true, \"new invoice failed to show tax_2_rate #{context}\"\n \n user.assert user.assigns(:invoice)\n user.deny user.assigns(:invoice).taxes.empty?\n\n user.assert_taxes(user.assigns(:invoice), context)\n# puts \"do save invoice\"\n user.saves_new_invoice(:tax_1_rate => '10.1')\n# puts user.assigns(:invoice).taxes.inspect\n\n user.assert_taxes(user.assigns(:invoice), context, {:tax_1_rate => 10.1, :tax_1_edited => true})\n end", "def create\n @taxi = current_user.taxis.new(params[:taxi])\n\n respond_to do |format|\n if @taxi.save\n format.html { redirect_to @taxi, notice: 'Taxi was successfully created.' }\n format.json { render json: @taxi, status: :created, location: @taxi }\n else\n format.html { render action: \"new\" }\n format.json { render json: @taxi.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @purchase_order = PurchaseOrder.create_order(params, @company.id, @current_user, @financial_year.year.name)\n # @purchase_order.build_tax\n respond_to do |format|\n if @purchase_order.save\n VoucherSetting.next_purchase_order_write(@company)\n @purchase_order.update_attributes(:total_amount=>@purchase_order.amount)\n @purchase_order.register_user_action(request.remote_ip, 'created')\n format.html { redirect_to(@purchase_order, :notice => 'Purchase order was successfully created.') }\n format.xml { render :xml => @purchase_order, :status => :created, :location => @purchase_order }\n else\n @purchase_order.purchase_order_number = VoucherSetting.next_purchase_order_number(@company)\n @purchase_order.purchase_order_line_items.each do |line_item|\n (2-line_item.purchase_order_taxes.size).times{ line_item.purchase_order_taxes.build }\n end\n @voucher_setting = VoucherSetting.find_by_company_id_and_voucher_type(@company.id, 6)\n @from_accounts = TransactionType.fetch_from_accounts(@company.id,'purchases')\n @to_accounts = Product.get_purchase_products(@company.id)\n @tax_accounts = TransactionType.fetch_to_accounts(@company.id, 'tax')\n @projects = @company.projects.active\n @other_charge_accounts = Account.get_other_expense_on_purchase_accounts(@company)\n @vendor_account_heads = AccountHead.get_customer_and_vendor_account_heads(@company.id)\n format.html { render :action => \"new\" }\n format.xml { render :xml => @purchase_order.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @tax = Tax.new(tax_params)\n if @tax.save\n redirect_to admin_taxes_path\n flash[:success] = \"Woohoo! tax created successfully.\"\n else\n render 'new'\n flash[:error] = \"Oops! Something went wrong!\"\n end\n end", "def tax_params\n params.require(:tax).permit(:tax_name, :description, :percentage, :tax_category, :tax_type_id, :organization_id, :child_tax=>[])\n end", "def build_estimate_tax\n estimate_line_items.each do |line|\n add_tax_line(line)\n end\n end", "def incoming_service_tax_params\n params.require(:incoming_service_tax).permit(:invoice_number, :invoice_date, :description, :event_total, :service_tax, :client_id, :cgst, :sgst)\n end", "def taxes\n wizard_step(STEPS)\n end", "def create_tax_charge!\n unless self.account.try(:is_tax_exempt?)\n Spree::TaxRate.adjust(self, line_items)\n Spree::TaxRate.adjust(self, shipments) if shipments.any?\n end\n end", "def update_item_taxes_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CatalogApi.update_item_taxes ...\"\n end\n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling CatalogApi.update_item_taxes\" if body.nil?\n # resource path\n local_var_path = \"/v2/catalog/update-item-taxes\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n \n header_params['Square-Version'] = \"2018-07-12\"\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 = ['oauth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'UpdateItemTaxesResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CatalogApi#update_item_taxes\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_taxes_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TaxesApi.get_taxes ...\"\n end\n # resource path\n local_var_path = \"/taxes\"\n\n # query parameters\n query_params = {}\n query_params[:'includes'] = @api_client.build_collection_param(opts[:'includes'], :csv) if !opts[:'includes'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'order_by'] = @api_client.build_collection_param(opts[:'order_by'], :multi) if !opts[:'order_by'].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 = ['APIKeyHeader']\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 => 'InlineResponse2002')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TaxesApi#get_taxes\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def tr_pq_taxes(pq)\n\t \tresponse = \"\"\n\t \titf = pq[:priced_itinerary][:air_itinerary_pricing_info][:itin_total_fare]\n\t \ttaxes = itf[:taxes][:tax_breakdown_code]\n\t \tcode_tax = itf[:taxes][:tax][:@tax_code]\n\t \tdiv_taxes = taxes.each_slice(4).to_a\n\t \tdiv_taxes.each {\n\t \t\t|ts|\n\t \t\tresponse += \"<tr>\"\n\t \t\tresponse += \"<td>#{code_tax}</td>\"\n\t \t\tts.each { |t| response += \"<td>#{t}</td>\" }\n\t \t\tresponse += \"</tr>\"\n\t \t\tcode_tax = \"\" #el codigo del impuesto solo va en la primer fila\n\t \t}\n\t \treturn response\n\t end", "def add_tax_as_line_item\n raise unless @fields['x_tax']\n add_line_item :name => 'Total Tax', :quantity => 1, :unit_price => @fields['x_tax'], :tax => 0, :line_title => 'Tax'\n end", "def apply(taxes)\n @order.line_items.each do |item|\n taxed_items = taxes.line_item_taxes.select { |i| i.item_id == item.id }\n update_adjustments(item, taxed_items)\n end\n\n @order.shipments.each do |item|\n taxed_items = taxes.shipment_taxes.select { |i| i.item_id == item.id }\n update_adjustments(item, taxed_items)\n end\n end", "def tax_index\n\n end", "def invoice_tax(taxable_sub_total)\n ZipCodeTax.invoice_tax(zip_code_5_digit, taxable_sub_total)\n end", "def add_taxes(amt, good_tax, import_tax)\n amt += good_tax + import_tax\n amt.round(2)\n end", "def import_tax_profile() path = \"/api/v2/taxprofile\"\n post(path) end", "def sales_tax(options = {})\n options = options.inject({}) { |memo,(k, v)| memo[k.to_sym] = v; memo }\n required_options = %w(from to tax_values)\n\n # Raise an error if the required option is not defined\n required_options.each { |val| raise ArgumentError, \"Missing option :#{val}\" if !options.include?(val.to_sym) }\n\n response = client.request(:get_sales_tax_value) do |soap|\n soap.body = {\n 'UserID' => configuration.user_id,\n 'Password' => configuration.password,\n 'ShipFrom' => options[:from].to_soap,\n 'ShipTo' => options[:to].to_soap,\n 'TaxValueRequests' => { 'TaxValueRequest' => options[:tax_values].map(&:to_soap) }\n }\n end\n\n response_code = response[:get_sales_tax_value_response][:get_sales_tax_value_result][:service_status][:status_nbr]\n\n # Raise exceptions if there was an error when calculating the tax\n case response_code.to_i\n when 401\n raise RuntimeError, 'Invalid From address.'\n when 402\n raise RuntimeError, 'Invalid To address.'\n when 403\n raise RuntimeError, 'Invalid Taxability category.'\n when 500\n raise RuntimeError, 'Internal Strikeiron server error.'\n end\n\n Strikeiron::TaxResult.from_soap(response[:get_sales_tax_value_response][:get_sales_tax_value_result][:service_result])\n end", "def create\n @taxi_sevice = TaxiSevice.new(taxi_sevice_params)\n\n respond_to do |format|\n if @taxi_sevice.save\n format.html { redirect_to action: \"index\" }\n else\n format.html { render :new }\n format.json { render json: @taxi_sevice.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @taxes = Tax.all\n\n render json: @taxes\n end", "def index\n @taxes = Tax.all\n end", "def create\n @incoming_service_tax = IncomingServiceTax.new(incoming_service_tax_params)\n\n respond_to do |format|\n if @incoming_service_tax.save\n format.html { redirect_to @incoming_service_tax, notice: 'Incoming service tax was successfully created.' }\n format.json { render action: 'show', status: :created, location: @incoming_service_tax }\n else\n format.html { render action: 'new' }\n format.json { render json: @incoming_service_tax.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pagto_taxa = PagtoTaxa.new(pagto_taxa_params)\n\n respond_to do |format|\n if @pagto_taxa.save\n format.html { redirect_to @pagto_taxa, notice: 'Pagto taxa was successfully created.' }\n format.json { render action: 'show', status: :created, location: @pagto_taxa }\n else\n format.html { render action: 'new' }\n format.json { render json: @pagto_taxa.errors, status: :unprocessable_entity }\n end\n end\n end", "def pay_taxes(keygap)\n raise \"The user #{@user.login} is not registered yet\" unless @item.exists?\n raise \"The account #{@user.login} is not confirmed yet\" unless @user.confirmed?\n if @user.fake?\n @log.info('It is a fake user, won\\'t pay taxes')\n return\n end\n start = Time.now\n id = @item.id\n unless @wallets.acq(id, &:exists?)\n return if ENV['RACK_ENV'] == 'test'\n raise 'There is no wallet file after PULL, can\\'t pay taxes'\n end\n Tempfile.open do |f|\n File.write(f, @item.key(keygap))\n @log.info(\"Paying taxes for #{id}...\")\n Zold::Taxes.new(wallets: @wallets, remotes: @remotes, log: @log).run(\n [\n 'taxes',\n 'pay',\n \"--network=#{@network}\",\n '--ignore-score-weakness',\n '--ignore-nodes-absence',\n '--ignore-score-size',\n '--private-key=' + f.path,\n id.to_s\n ]\n )\n end\n @log.info(\"Taxes paid for #{id} in #{Zold::Age.new(start)}\")\n end", "def taxi_params\n params.require(:taxi).permit(:nombreBase, :nombreTitular, :latitud, :longitud)\n end", "def create_tax_charge!\n #puts \"Adjustments #{adjustments} TAX #{tax_total}\"\n #puts \"CREATE TAX for #{ship_address} \"\n all_rates = Spree::TaxRate.all\n matching_rates = all_rates.select { |rate| rate.zone.include?(ship_address) }\n if matching_rates.empty?\n matching_rates = all_rates.select{|rate| # get all rates that apply to default country \n rate.zone.country_list.collect{|c| c.id}.include?(Spree::Config[:default_country_id])\n }\n end\n adjustments.where(:originator_type => \"TaxRate\").each do |old_charge|\n old_charge.destroy\n end\n matching_rates.each do |rate|\n #puts \"Creating rate #{rate.amount}\" \n rate.create_adjustment( rate.tax_category.description , self, self, true)\n end\n end", "def create\n # Вызвать такси\n @order_number = Taxirequest.call_a_taxi(params[:taxirequest])\n # Разместить заявку на такси в таблице taxirequests\n @taxirequest = Taxirequest.add_request(params[:taxirequest], session[:employee_id], @order_number)\n #@taxirequest = Taxirequest.new(params[:taxirequest])\n\n respond_to do |format|\n if @taxirequest.save\n format.html { redirect_to @taxirequest, notice: 'Taxirequest was successfully created.'+@response }\n format.json { render json: @taxirequest, status: :created, location: @taxirequest }\n else\n format.html { render action: \"new\" }\n format.json { render json: taxirequest.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def create\n @taxi = Taxi.new(taxi_params)\n\n respond_to do |format|\n if @taxi.save\n format.html { redirect_to @taxi, notice: 'Taxi was successfully created.' }\n format.json { render :show, status: :created, location: @taxi }\n else\n format.html { render :new }\n format.json { render json: @taxi.errors, status: :unprocessable_entity }\n end\n end\n end", "def tax\n unescape params['x_tax']\n end", "def index\n @form_excise_taxes = FormExciseTax.all\n end", "def create\n @transaction_goods_taxis = Transaction::Goods::Taxe.new(params[:transaction_goods_taxis])\n\n respond_to do |format|\n if @transaction_goods_taxis.save\n format.html { redirect_to(@transaction_goods_taxis, :notice => 'Taxe was successfully created.') }\n format.xml { render :xml => @transaction_goods_taxis, :status => :created, :location => @transaction_goods_taxis }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @transaction_goods_taxis.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @taxinomy = Taxinomy.new(params[:taxinomy])\n\n respond_to do |format|\n if @taxinomy.save\n format.html { redirect_to @taxinomy, notice: 'Taxinomy was successfully created.' }\n format.json { render json: @taxinomy, status: :created, location: @taxinomy }\n else\n format.html { render action: \"new\" }\n format.json { render json: @taxinomy.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_Tax(value)\n set_input(\"Tax\", value)\n end", "def ticket_tax(accounting_element)\n\t \taccounting_element[:taxes][:tax][:@amount]\n\t end", "def tax\n unescape params['x_tax']\n end", "def tax_1\n get_or_build_tax_for_key(\"tax_1\")\n end", "def delete_tax(id)\n @client.raw('delete', \"/ecommerce/taxes/#{id}\")\n end", "def index\n @incoming_service_taxes = IncomingServiceTax.new.index(params[:start_date], params[:end_date])\n end", "def test_check_tax_calculation_on_new_invoice_with_discount_before_tax\r\n @debug = false\r\n update_profile_taxes(\r\n :tax_enabled => true,\r\n :tax_1_rate => 7.0,\r\n :tax_2_rate => 6.0,\r\n :discount_before_tax => true)\r\n\r\n expected_before = {\r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.09,\r\n :tax_2_amount => 0.93,\r\n :discount_amount => 0.31,\r\n :total => 17.25} \r\n \r\n # uncheck_both_taxes \r\n expected_after = {\r\n :line_items_total => 15.54,\r\n :tax_1_amount => 0.00,\r\n :tax_2_amount => 0.00,\r\n :discount_amount => 0.31,\r\n :total => 15.23} \r\n \r\n \r\n add_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {uncheck_both_taxes}\r\n \r\n # uncheck_tax_1\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 0.00,\r\n :tax_2_amount => 0.93,\r\n :discount_amount => 0.31,\r\n :total => 16.16}\r\n \r\n add_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {uncheck_tax_1}\r\n \r\n # uncheck_tax_2\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.09,\r\n :tax_2_amount => 0.00,\r\n :discount_amount => 0.31,\r\n :total => 16.32}\r\n \r\n add_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {uncheck_tax_2}\r\n \r\n # change tax rate 1\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.55,\r\n :tax_2_amount => 0.93,\r\n :discount_amount => 0.31,\r\n :total => 17.71}\r\n \r\n add_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {change_tax_1_rate(10.00)}\r\n\r\n #change_tax_2_rate\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.09,\r\n :tax_2_amount => 1.73,\r\n :discount_amount => 0.31,\r\n :total => 18.05}\r\n \r\n add_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {change_tax_2_rate(11.11)}\r\n\r\n #change_discount_amount\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.09,\r\n :tax_2_amount => 0.93,\r\n :discount_amount => 5.55,\r\n :total => 12.01}\r\n \r\n add_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {change_discount_amount(5.55)}\r\n\r\n #change_discount_percent\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.09,\r\n :tax_2_amount => 0.93,\r\n :discount_amount => 0.86,\r\n :total => 16.70}\r\n \r\n add_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {change_discount_percent(5.55)}\r\n\r\n #change_discount_amount_and_rates(5.55, 10.0, 11.11)\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.55,\r\n :tax_2_amount => 1.73,\r\n :discount_amount => 5.55,\r\n :total => 13.27}\r\n \r\n add_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {change_discount_amount_and_rates(5.55, 10.0, 11.11)}\r\n\r\n #change_discount_percent_and_rates(5.55, 10.0, 11.11) \r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.55,\r\n :tax_2_amount => 1.73,\r\n :discount_amount => 0.86,\r\n :total => 17.96}\r\n \r\n add_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {change_discount_percent_and_rates(5.55, 10.0, 11.11)}\r\n\r\n\r\n b = @user.b\r\n\r\n #change_qty\r\n add_standard_invoice\r\n \r\n verify_invoice_view_fields(\r\n :line_items_total => expected_before[:line_items_total],\r\n :tax_1_amount => expected_before[:tax_1_amount],\r\n :tax_2_amount => expected_before[:tax_2_amount],\r\n :discount_amount => expected_before[:discount_amount],\r\n :total => expected_before[:total]) \r\n \r\n #get newly added last row in the table and change quantity\r\n trows = @user.line_items_rows\r\n assert_equal 3, trows.length\r\n tr = trows[::WatirBrowser.item_index(trows.length)]\r\n assert tr.exists?\r\n @user.expects_ajax(1) do\r\n @user.populate(tr.text_field(:name, \"invoice[line_items_attributes][][quantity]\"), '4')\r\n #tr.text_field(:name, \"invoice[line_items_attributes][][quantity]\").set('4')\r\n end\r\n \r\n @user.wait\r\n \r\n verify_invoice_view_fields(\r\n :line_items_total => 18.87,\r\n :tax_1_amount => 1.32,\r\n :tax_2_amount => 1.13,\r\n :discount_amount => 0.38,\r\n :total => 20.94) \r\n \r\n #change_price\r\n add_standard_invoice\r\n \r\n verify_invoice_view_fields(\r\n :line_items_total => expected_before[:line_items_total],\r\n :tax_1_amount => expected_before[:tax_1_amount],\r\n :tax_2_amount => expected_before[:tax_2_amount],\r\n :discount_amount => expected_before[:discount_amount],\r\n :total => expected_before[:total]) \r\n \r\n #get newly added last row in the table and change price\r\n trows = @user.line_items_rows\r\n assert_equal 3, trows.length\r\n tr = trows[::WatirBrowser.item_index(trows.length)]\r\n assert tr.exists?\r\n @user.expects_ajax(1) do\r\n @user.populate(tr.text_field(:name, \"invoice[line_items_attributes][][price]\"), '4.44')\r\n #tr.text_field(:name, \"invoice[line_items_attributes][][price]\").set('4.44')\r\n end\r\n \r\n @user.wait \r\n \r\n verify_invoice_view_fields(\r\n :line_items_total => 18.87,\r\n :tax_1_amount => 1.32,\r\n :tax_2_amount => 1.13,\r\n :discount_amount => 0.38,\r\n :total => 20.94) \r\n end", "def create\n @taxi = Taxi.new(taxi_params)\n @taxi.user_id = @user.id\n Taxi.set_taxi_id(Taxi::IDLIST, @taxi)\n if @taxi.save\n if current_user.taxi_count == nil\n current_user.taxi_count = 1\n else\n current_user.taxi_count += 1\n end\n current_user.save\n flash[:success] = \"Vehicle Added Successfully\"\n redirect_to user_taxis_path(current_user)\n else\n render 'new'\n end\n end", "def add_taxes(tax, opts = {})\n data, _status_code, _headers = add_taxes_with_http_info(tax, opts)\n return data\n end", "def tax_calc\n tax = @quantity * @price * @taxe\n end", "def create\n @taxon = Taxon.new(params[:taxon])\n\n respond_to do |format|\n if @taxon.save\n format.html { redirect_to @taxon, notice: 'Taxon was successfully created.' }\n format.json { render json: @taxon, status: :created, location: @taxon }\n else\n format.html { render action: \"new\" }\n format.json { render json: @taxon.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @taxon = Taxon.new(params[:taxon])\n\n respond_to do |format|\n if @taxon.save\n format.html { redirect_to @taxon, notice: 'Taxon was successfully created.' }\n format.json { render json: @taxon, status: :created, location: @taxon }\n else\n format.html { render action: \"new\" }\n format.json { render json: @taxon.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @taxfree = Taxfree.new(taxfree_params)\n\n respond_to do |format|\n if @taxfree.save\n format.html { redirect_to @taxfree, notice: 'Taxfree was successfully created.' }\n format.json { render :show, status: :created, location: @taxfree }\n else\n format.html { render :new }\n format.json { render json: @taxfree.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @gstr_advance_receipt = GstrAdvanceReceipt.new_gstr_advance_receipt(params,@company,@current_user)\n @voucher_setting=VoucherSetting.find_by_voucher_type(25,@company.id)\n @customer_id= Customer.find_by_company_id(@company.id)\n @from_accounts = TransactionType.fetch_from_accounts(@company.id,'purchases')\n @deposit_to = TransactionType.fetch_to_accounts(@company.id,'receipts')\n @tax_accounts = TransactionType.fetch_from_accounts(@company.id, 'tax')\n @custom_field = CustomField.find_by_company_id_and_voucher_type(@company.id)\n @shipping_accounts = Account.get_other_expense_accounts(@company)\n @customer_account_heads = AccountHead.get_customer_and_vendor_account_heads(@company.id)\n @sales_account_heads = AccountHead.get_sales_account(@company.id)\n @tax_account_heads = AccountHead.get_duties_and_taxes_account(@company.id)\n @vendor_id= Vendor.find_by_company_id(@company.id)\n @products= Product.get_sales_products(@company.id)\n @states = State.where(country_id: 93)\n\n #@gstr_advance_receipt_voucher_sequence= VoucherSetting.next_gstr_advance_receipt_number(@company)\n @gstr_advance_receipt_line_item =@gstr_advance_receipt.gstr_advance_receipt_line_items\n #@gstn_id= Vendor.find(params[:id])\n @gstr_advance_receipt.gstr_advance_receipt_line_items.each do |line_item|\n 2.times{line_item.gstr_advance_receipt_taxes.build}\n end\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gstr_advance_receipt }\n end\n end", "def create\n @recurring_profile = RecurringProfile.new(recurring_profile_params)\n @recurring_profile.sent_invoices = 0\n @recurring_profile.company_id = get_company_id()\n @recurring_profile.create_line_item_taxes()\n\n respond_to do |format|\n if @recurring_profile.save\n\n options = params.merge(user: current_user, profile: @recurring_profile)\n Services::RecurringService.new(options).set_invoice_schedule\n\n redirect_to(edit_recurring_profile_url(@recurring_profile), :notice => new_recurring_message(@recurring_profile.is_currently_sent?))\n return\n else\n format.html { render action: \"new\" }\n format.json { render json: @recurring_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def sync_tax_rates\n subscription = as_stripe_subscription\n\n subscription.default_tax_rates = user.tax_rates\n\n subscription.save\n\n items.each do |item|\n stripe_subscription_item = item.as_stripe_subscription_item\n\n stripe_subscription_item.tax_rates = get_plan_tax_rates_for_payload(item.stripe_plan)\n\n stripe_subscription_item.save\n end\n end", "def text_pq_taxes(pq)\n\t \titf = pq[:priced_itinerary][:air_itinerary_pricing_info][:itin_total_fare]\n\t \ttaxes = itf[:taxes][:tax_breakdown_code]\n\t \treturn \"#{itf[:taxes][:tax][:@tax_code]} #{taxes.join(\" \")}\"\n\t end", "def create\n @itinerary = Itinerary.find(params[:itinerary_id])\n @transaction = @itinerary.transactions.build\n authorize! :create, @transaction\n\n @unpaid_line_items = @itinerary.line_items.where(paid: false)\n @transaction.line_items = @unpaid_line_items\n @transaction.tax = @transaction.pre_tax_total * selected_conference.tax_rate\n @transaction.payment_method = params[:payment_method]\n\n if @transaction.save\n redirect_to itinerary_transaction_path(@itinerary, @transaction)\n else\n #TODO there isn't any user input that could cause this action to fail, so probably apologize and send the developer an email..\n end\n end", "def tax_breakdown\n global_tax_breakdown(purchase_order_items, true)\n end", "def calculate_taxes\n\t\ttax = 0\n\t\t\n\t\tif self.sku.contains_merch?\n\t\t\t# because paypal orders will not have billing addresses, just set \n\t\t\t# billing == to shipping if billing_address is nil\n\t\t\tself.billing_address ||= self.shipping_address \n\t\t\t\n\t\t\ttax = (self.sku.price * self.tax_rate * self.sku_quantity).round if self.billing_address.state == self.nexus\n\t\tend\n\t\t\n\t\tself.tax_amount = tax\n\t\t\n\tend", "def create\n @tax_type = TaxType.new(params[:tax_type])\n\n respond_to do |format|\n if @tax_type.save\n format.html { redirect_to @tax_type, notice: 'Tax type was successfully created.' }\n format.json { render json: @tax_type, status: :created, location: @tax_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tax_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_tax(tax)\n tax_breakdown(tax)[0]\n end", "def call\n add_fields(leeds_taxi: true)\n end", "def create\n subtotal = Product.find_by(id: params[:product_id]).price\n tax = subtotal * 0.09\n total = subtotal + tax\n\n order = Order.new( \n user_id: current_user.id,\n product_id: params[:product_id],\n quantity: params[:quantity],\n subtotal: subtotal,\n tax: tax,\n total: total \n )\n if order.save\n render json: {message: 'Order created successfully'}, status: :created\n else\n render json: {errors: order.errors.full_messages}, status: :bad_request\n end\n end", "def quarter_income_tax_params\n params.require(:quarter_income_tax).permit(:date, :quarter, :reciept_no, :paid_amount, :tax_amount_deducted, :tax_amount_deposited)\n end", "def taxfree_params\n params.require(:taxfree).permit(:user_id, :user_name, :nationality_id, :nationality_name, :name, :passport, :birthday, :sex_id, :visastatus_id, :landingdate, :taxfreeflg_id, :taxpaymentplace, :taxpaymentoffice, :note)\n end", "def taxi_sevice_params\n params.require(:taxi_sevice).permit(:name, :price)\n end", "def update_item_taxes(body, opts = {})\n data, _status_code, _headers = update_item_taxes_with_http_info(body, opts)\n return data\n end", "def add_taxons\n save_if_new\n chain_list = get_each_assoc\n chain_list.each do |chain|\n # Each chain can contain either a single Taxon,\n # or the tree like structure parent>child>child\n name_list = chain.split(/\\s*>\\s*/)\n taxonomy_name = name_list.shift\n taxonomy = @@taxonomy_klass.find_or_create_by_name(taxonomy_name)\n raise DataShift::DataProcessingError.new(\"Could not find or create Taxonomy #{taxonomy_name}\") unless taxonomy\n taxon = taxonomy.root\n name_list.each do |taxon_name|\n taxon = @@taxon_klass.find_or_create_by_name_and_parent_id_and_taxonomy_id(taxon_name, taxon.id, taxonomy.id)\n end\n\n if taxon\n @product.taxons << taxon\n puts \" Added to taxon #{taxon.pretty_name}\"\n else\n puts \" Taxon not found or created: #{name}\"\n end\n\n end\n end", "def new\n @invoice_tax = InvoiceTax.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice_tax }\n end\n end", "def tax_params\n res = ActiveModelSerializers::Deserialization.jsonapi_parse(params, {})\n end", "def taxon_params\n params.require(:taxon).permit(:name)\n end", "def set_taxi\n @taxi = Taxi.find(params[:id])\n end", "def set_taxi\n @taxi = Taxi.find(params[:id])\n end", "def set_tax\n @tax = Tax.find(params[:id])\n end", "def set_tax\n @tax = Tax.find(params[:id])\n end", "def apply_taxes(taxman)\n @taxes = BigDecimal.new(0)\n if @is_imported\n @taxes += taxman.apply_tax(@price, taxman.import_duty)\n end\n unless taxman.exempt_basic.include?(@type)\n @taxes += taxman.apply_tax(@price, taxman.sales_tax)\n end\n @price += @taxes\n end", "def create\n \n @tax_return = current_user.tax_returns.build(params[:tax_return])\n\n respond_to do |format|\n if @tax_return.save\n format.html { redirect_to @tax_return, notice: 'Tax return was successfully created.' }\n format.json { render json: @tax_return, status: :created, location: @tax_return }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tax_return.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_edit_invoice_with_unedited_enabled_taxes_with_profile_taxes_unchanged\n # show invoice.taxes\n context = \"when editing invoice with unedited taxes with profile taxes unchanged\"\n user = tax_user(:basic_user)\n user.enable_profile_taxes\n assert user.profile.tax_enabled\n\n\n user.login\n # puts \"do click new invoice\"\n user.clicks_create_new_invoice\n\n user.assert user.assigns(:invoice)\n user.assert_taxes(user.assigns(:invoice), \"after creating new invoice \" + context)\n\n # puts \"do save invoice\"\n user.saves_new_invoice(\n :customer_id => user.scratch.fixture_user.customers.first.id,\n :date => Time.now.to_date.to_s(:MMDDYYYY),\n :due_date => (Time.now + 1.week).to_date.to_s(:MMDDYYYY),\n :description => Babel.random_short.gsub( '&', 'and' )\n )\n\n new_invoice = user.assigns(:invoice)\n user.assert_taxes(new_invoice, \"after saving new invoice \" + context)\n\n new_invoice.reload\n# puts \"new_invoice: #{new_invoice.inspect}\"\n user.assert_taxes(new_invoice, \"after reloading invoice object \" + context)\n \n # puts \"do edit invoice with #{new_invoice.id} user.assigns(:invoice): #{user.assigns(:invoice).inspect}\"\n user.edits_invoice(new_invoice.id)\n\n # puts user.assigns(:invoice).taxes.inspect\n user.deny user.assigns(:invoice).taxes.empty?, \"edited invoice taxes was, empty #{context}\"\n user.assert_taxes(user.assigns(:invoice), \"after editing new invoice \" + context)\n\n end", "def as_json \n {\n id: id,\n tax: tax,\n subtotal: subtotal,\n total: total \n }\n end", "def pagto_taxa_params\n params.require(:pagto_taxa).permit(:interessado_id, :arquivo)\n end", "def create\n @invoice = Invoice.new(params[:invoice])\n\n respond_to do |format|\n if @invoice.save\n create_first_line_item unless @invoice.booking.pricing_structure.rate_per_person.nil?\n format.html { redirect_to invoice_path(@invoice.id), notice: 'Invoice was successfully created.' }\n format.json { render json: @invoice, status: :created, location: @invoice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tax_rate = TaxRate.new(params[:tax_rate])\n\n respond_to do |format|\n if @tax_rate.save\n format.html { redirect_to @tax_rate, notice: 'Tax rate was successfully created.' }\n format.json { render json: @tax_rate, status: :created, location: @tax_rate }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tax_rate.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_tax\n raise Error::CustomError.error(422, :TAX_01, \"tax\") unless Number.is_integer?(params[:tax_id])\n begin\n @tax = Tax.find(params[:tax_id])\n rescue ActiveRecord::RecordNotFound\n raise Error::CustomError.error(404, :TAX_02, \"tax\")\n rescue\n raise Error::CustomError.error(500, :ISE, \"tax\")\n end\n end", "def total_taxes\n @total_taxes = 0\n @list.each do |item, quantity|\n @total_taxes += quantity * item.taxes\n end\n puts \"Sales Taxes: #{MONEY_FORMAT % @total_taxes}\"\n end", "def envia_taxones_seleccionados\n end", "def create\n @tax_information = TaxInformation.new(tax_information_params)\n\n respond_to do |format|\n if @tax_information.save\n format.html { redirect_to @tax_information, notice: 'Tax information was successfully created.' }\n format.json { render :show, status: :created, location: @tax_information }\n else\n format.html { render :new }\n format.json { render json: @tax_information.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_edit_invoice_with_edited_enabled_taxes_with_profile_taxes_unchanged\n # show invoice.taxes. Include a link to use profile taxes.\n context = \"when editing invoice with edited taxes with profile taxes unchanged\"\n user = tax_user(:basic_user)\n user.enable_profile_taxes\n assert user.profile.tax_enabled\n\n user.login\n # puts \"do click new invoice\"\n user.clicks_create_new_invoice\n\n user.assert user.assigns(:invoice)\n user.assert_taxes(user.assigns(:invoice), \"after creating new invoice \" + context)\n\n # puts \"do save invoice\"\n user.saves_new_invoice(\n :customer_id => user.scratch.fixture_user.customers.first.id,\n :date => Time.now.to_date.to_s(:MMDDYYYY),\n :due_date => (Time.now + 1.week).to_date.to_s(:MMDDYYYY),\n :description => Babel.random_short.gsub( '&', 'and' ),\n :tax_1_name => 'custom',\n :tax_2_rate => 9\n )\n\n new_invoice = user.assigns(:invoice)\n user.assert_taxes(new_invoice, \"after saving new invoice \" + context, \n {:tax_2_rate => 9, :tax_2_edited => true, :tax_1_name => 'custom', :tax_1_edited => true})\n\n new_invoice.reload\n # puts \"new_invoice: #{new_invoice.inspect}\"\n user.assert_taxes(new_invoice, \"after reloading invoice object \" + context,\n {:tax_2_rate => 9, :tax_2_edited => true, :tax_1_name => 'custom', :tax_1_edited => true})\n\n # puts \"do edit invoice with #{new_invoice.id} user.assigns(:invoice): #{user.assigns(:invoice).inspect}\"\n user.edits_invoice(new_invoice.id)\n\n # puts user.assigns(:invoice).taxes.inspect\n user.deny user.assigns(:invoice).taxes.empty?, \"edited invoice taxes was, empty #{context}\"\n user.assert_taxes(user.assigns(:invoice), \"after editing new invoice \" + context,\n {:tax_2_rate => 9, :tax_2_edited => true, :tax_1_name => 'custom', :tax_1_edited => true}) \n\n end", "def show\n @company = Company.first\n @invoice = Invoice.find(params[:id])\n @invoice.client = Client.find(@invoice.client_id)\n @items = Item.find_all_by_invoice_id(@invoice.invoice_id)\n # @invoice.tax_value = Taxis.find(:all, :conditions => { :id => @invoice.tax_id })\n # tax_value = @invoice.tax.value\n #@tax_amount = @invoice.subtotal * (1 - @tax.value/100)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoice }\n format.pdf do\n render :pdf => \"file_name\"\n end\n end\n end", "def build_taxes_with_attributes(attrs, rejecting=false)\r\n raise Sage::BusinessLogic::Exception::IncorrectDataException, \r\n \"Tax attributes should be an array of taxes\" unless attrs.is_a?(Array)\r\n \r\n raise Sage::BusinessLogic::Exception::IncorrectDataException, \r\n \"Taxes Version One can handle only 2 taxes but received #{attrs.size} taxes\" if attrs.size > 2\r\n \r\n attrs.each_with_index do |attrs, index|\r\n # has_many proxy is not working with STI\r\n tax = Tax.new\r\n self.taxes << tax \r\n good_params = ( rejecting ? tax.reject_unknown_attributes(attrs) : attrs )\r\n tax.attributes = good_params\r\n tax.profile_key = ::Tax::TaxesVersionOne.tax_keys[index]\r\n end\r\n end", "def tax\n 0.0\n end", "def calcuate_tax\n @price * 0.12\n end", "def create\n @invoice = Invoice.new(params[:invoice])\n @invoice.client_id = params[:clients]\n @invoice.discount_id = params[:discount_id]\n @invoice.tax_id = params[:tax_id]\n @invoice.status = Invoice::DRAFT\n @invoice.year = @counter.year\n @invoice.invoice_id = @counter.number\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render json: @invoice, status: :created, location: @invoice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "def tax\n price_as_price.tax\n end", "def add_taxons\n # TODO smart column ordering to ensure always valid by time we get to associations\n product_load_object.save_if_new\n\n chain_list = value.to_s.split(multi_assoc_delim) # potentially multiple chains in single column (delimited by multi_assoc_delim)\n\n chain_list.each do |chain|\n\n # Each chain can contain either a single Taxon, or the tree like structure parent>child>child\n name_list = chain.split(/\\s*>\\s*/)\n\n parent_name = name_list.shift\n\n parent_taxonomy = taxonomy_klass.where(:name => parent_name).first_or_create\n\n raise DataShift::DataProcessingError.new(\"Could not find or create Taxonomy #{parent_name}\") unless parent_taxonomy\n\n parent = parent_taxonomy.root\n\n # Add the Taxons to Taxonomy from tree structure parent>child>child\n taxons = name_list.collect do |name|\n\n begin\n taxon = taxon_klass.where(:name => name, :parent_id => parent.id, :taxonomy_id => parent_taxonomy.id).first_or_create\n\n # pre Rails 4 - taxon = taxon_klass.find_or_create_by_name_and_parent_id_and_taxonomy_id(name, parent && parent.id, parent_taxonomy.id)\n\n unless(taxon)\n logger.warn(\"Missing Taxon - could not find or create #{name} for parent #{parent_taxonomy.inspect}\")\n end\n rescue => e\n logger.error(e.inspect)\n logger.error \"Cannot assign Taxon ['#{taxon}'] to Product ['#{product_load_object.name}']\"\n next\n end\n\n parent = taxon # current taxon becomes next parent\n taxon\n end\n\n taxons << parent_taxonomy.root\n\n unique_list = taxons.compact.uniq - (@product_load_object.taxons || [])\n\n logger.debug(\"Product assigned to Taxons : #{unique_list.collect(&:name).inspect}\")\n\n @product_load_object.taxons << unique_list unless(unique_list.empty?)\n # puts @product_load_object.taxons.inspect\n\n end\n\n end", "def set_incoming_service_tax\n @incoming_service_tax = IncomingServiceTax.find(params[:id])\n end", "def add_invoice(post, money, options)\n post[:total] = amount(money, options.include?(:refund))\n post[:currency] = (options[:currency] || currency(money))\n post[:authNum] ||= options[:authNum]\n end" ]
[ "0.69365966", "0.6842887", "0.6835824", "0.6663782", "0.65647054", "0.6395121", "0.63802034", "0.63196206", "0.6272765", "0.6166729", "0.61326724", "0.6128575", "0.61166453", "0.60869133", "0.6084017", "0.6083614", "0.6076662", "0.60597706", "0.6026695", "0.6007375", "0.598721", "0.59654397", "0.59611106", "0.5942814", "0.59208393", "0.5913351", "0.58742565", "0.58598846", "0.58386266", "0.5819635", "0.5819077", "0.5814098", "0.5812856", "0.5807903", "0.58067095", "0.5794021", "0.57937986", "0.57831794", "0.57754236", "0.5767195", "0.5766242", "0.57558244", "0.57212365", "0.5717578", "0.5711414", "0.57042116", "0.56918156", "0.56871563", "0.5671428", "0.56564593", "0.5648381", "0.5642768", "0.5642067", "0.5632013", "0.5632013", "0.56164837", "0.5595265", "0.55728734", "0.55680054", "0.55560917", "0.55545855", "0.5552883", "0.55456793", "0.5524831", "0.5524142", "0.55099803", "0.5507854", "0.5507326", "0.5500975", "0.5499034", "0.54890454", "0.54865646", "0.54651695", "0.5458123", "0.54473525", "0.54467833", "0.54467833", "0.54460156", "0.54460156", "0.5443438", "0.54430133", "0.5442691", "0.5438885", "0.5436594", "0.543247", "0.5426516", "0.5418519", "0.54037136", "0.53998405", "0.53984606", "0.5388932", "0.5385595", "0.53842294", "0.5374313", "0.53731805", "0.53673077", "0.5366104", "0.5363739", "0.53502417", "0.534016" ]
0.66672724
3
PUT /invoice_taxes/1 PUT /invoice_taxes/1.json
def update @invoice_tax = InvoiceTax.find(params[:id]) respond_to do |format| if @invoice_tax.update_attributes(params[:invoice_tax]) format.html { redirect_to @invoice_tax, notice: 'Invoice tax was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @invoice_tax.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_taxes\n @taxes = Tax.find(params[:id])\n end", "def send_tax_invoice\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/send_tax_invoice\").body)\n @attributes = response['items']\n true\n end", "def request_tax_invoice\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/request_tax_invoice\").body)\n @attributes = response['items']\n true\n end", "def update\n if @tax.update(tax_params)\n redirect_to admin_taxes_path\n flash[:success] = \"Woohoo! tax updated successfully.\"\n else\n render 'edit'\n flash[:error] = \"Oops! Something went wrong!\"\n end\n end", "def update_item_taxes_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CatalogApi.update_item_taxes ...\"\n end\n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling CatalogApi.update_item_taxes\" if body.nil?\n # resource path\n local_var_path = \"/v2/catalog/update-item-taxes\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n \n header_params['Square-Version'] = \"2018-07-12\"\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 = ['oauth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'UpdateItemTaxesResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CatalogApi#update_item_taxes\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n @tax = Tax.find(params[:id])\n\n if @tax.update(tax_params)\n head :no_content\n else\n render json: @tax.errors, status: :unprocessable_entity\n end\n end", "def update\n @variable_charge = VariableCharge.find(params[:id])\n\n respond_to do |format|\n if params[:taxes]\n params[:taxes].each do |t|\n\t tax = Taxrate.find_by_name t[0]\n\t # t is the key\n\t if t[1] == '1'\n\t @variable_charge.taxrates << tax unless @variable_charge.taxrates.exists?(tax)\n\t else\n\t @variable_charge.taxrates.delete(tax) if @variable_charge.taxrates.exists?(tax)\n\t end\n\tend\n end\n if @variable_charge.update_attributes(params[:variable_charge]) || params[:taxes]\n format.html { redirect_to(variable_charges_path, :notice => 'VariableCharge was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @variable_charge.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @quarter_income_tax.update(quarter_income_tax_params) \n @quarter_income_tax = QuarterIncomeTax.new\n @quarter_income_taxes = QuarterIncomeTax.all\n end", "def set_tax\n @tax = Tax.find(params[:id])\n end", "def set_tax\n @tax = Tax.find(params[:id])\n end", "def apply(taxes)\n @order.line_items.each do |item|\n taxed_items = taxes.line_item_taxes.select { |i| i.item_id == item.id }\n update_adjustments(item, taxed_items)\n end\n\n @order.shipments.each do |item|\n taxed_items = taxes.shipment_taxes.select { |i| i.item_id == item.id }\n update_adjustments(item, taxed_items)\n end\n end", "def update\n authorize @incoming_service_tax\n\n respond_to do |format|\n if @incoming_service_tax.update(incoming_service_tax_params)\n format.html { redirect_to @incoming_service_tax, notice: 'Incoming service tax was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @incoming_service_tax.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_create_invoice_and_edit_taxes_should_copy_taxes_and_mark_edited\n context = \"with taxes enabled in profile and valid\"\n user = tax_user(:basic_user)\n user.enable_profile_taxes\n assert user.profile.tax_enabled\n\n user.login\n# puts \"do click new invoice\"\n user.clicks_create_new_invoice\n \n user.assert_select 'div#tax_container', true, \"new invoice screen was missing tax_container #{context}\"\n \n user.assert_select 'input#invoice_tax_1_enabled', true, \"new invoice failed to show tax_1_enabled #{context}\"\n user.assert_select 'input#invoice_tax_1_rate', true, \"new invoice failed to show tax_1_rate #{context}\"\n\n user.assert_select 'input#invoice_tax_2_enabled', true, \"new invoice failed to show tax_2_enabled #{context}\"\n user.assert_select 'input#invoice_tax_2_rate', true, \"new invoice failed to show tax_2_rate #{context}\"\n \n user.assert user.assigns(:invoice)\n user.deny user.assigns(:invoice).taxes.empty?\n\n user.assert_taxes(user.assigns(:invoice), context)\n# puts \"do save invoice\"\n user.saves_new_invoice(:tax_1_rate => '10.1')\n# puts user.assigns(:invoice).taxes.inspect\n\n user.assert_taxes(user.assigns(:invoice), context, {:tax_1_rate => 10.1, :tax_1_edited => true})\n end", "def update\n #params[:sale][:existing_purchase_attributes] ||= {}\n respond_to do |format|\n if @sale.update(sale_params) && calculate_taxes(@sale)\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_edit_invoice_with_edited_enabled_taxes_with_profile_taxes_unchanged\n # show invoice.taxes. Include a link to use profile taxes.\n context = \"when editing invoice with edited taxes with profile taxes unchanged\"\n user = tax_user(:basic_user)\n user.enable_profile_taxes\n assert user.profile.tax_enabled\n\n user.login\n # puts \"do click new invoice\"\n user.clicks_create_new_invoice\n\n user.assert user.assigns(:invoice)\n user.assert_taxes(user.assigns(:invoice), \"after creating new invoice \" + context)\n\n # puts \"do save invoice\"\n user.saves_new_invoice(\n :customer_id => user.scratch.fixture_user.customers.first.id,\n :date => Time.now.to_date.to_s(:MMDDYYYY),\n :due_date => (Time.now + 1.week).to_date.to_s(:MMDDYYYY),\n :description => Babel.random_short.gsub( '&', 'and' ),\n :tax_1_name => 'custom',\n :tax_2_rate => 9\n )\n\n new_invoice = user.assigns(:invoice)\n user.assert_taxes(new_invoice, \"after saving new invoice \" + context, \n {:tax_2_rate => 9, :tax_2_edited => true, :tax_1_name => 'custom', :tax_1_edited => true})\n\n new_invoice.reload\n # puts \"new_invoice: #{new_invoice.inspect}\"\n user.assert_taxes(new_invoice, \"after reloading invoice object \" + context,\n {:tax_2_rate => 9, :tax_2_edited => true, :tax_1_name => 'custom', :tax_1_edited => true})\n\n # puts \"do edit invoice with #{new_invoice.id} user.assigns(:invoice): #{user.assigns(:invoice).inspect}\"\n user.edits_invoice(new_invoice.id)\n\n # puts user.assigns(:invoice).taxes.inspect\n user.deny user.assigns(:invoice).taxes.empty?, \"edited invoice taxes was, empty #{context}\"\n user.assert_taxes(user.assigns(:invoice), \"after editing new invoice \" + context,\n {:tax_2_rate => 9, :tax_2_edited => true, :tax_1_name => 'custom', :tax_1_edited => true}) \n\n end", "def taxes=(taxes)\n write_attribute(:taxes, taxes.gsub(/\\D/, ''))\n end", "def add_taxes_with_http_info(tax, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TaxesApi.add_taxes ...\"\n end\n # verify the required parameter 'tax' is set\n if @api_client.config.client_side_validation && tax.nil?\n fail ArgumentError, \"Missing the required parameter 'tax' when calling TaxesApi.add_taxes\"\n end\n # resource path\n local_var_path = \"/taxes\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(tax)\n auth_names = ['APIKeyHeader']\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 => 'InlineResponse2012')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TaxesApi#add_taxes\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def delete_tax(id)\n @client.raw('delete', \"/ecommerce/taxes/#{id}\")\n end", "def test_edit_invoice_with_unedited_enabled_taxes_with_profile_taxes_unchanged\n # show invoice.taxes\n context = \"when editing invoice with unedited taxes with profile taxes unchanged\"\n user = tax_user(:basic_user)\n user.enable_profile_taxes\n assert user.profile.tax_enabled\n\n\n user.login\n # puts \"do click new invoice\"\n user.clicks_create_new_invoice\n\n user.assert user.assigns(:invoice)\n user.assert_taxes(user.assigns(:invoice), \"after creating new invoice \" + context)\n\n # puts \"do save invoice\"\n user.saves_new_invoice(\n :customer_id => user.scratch.fixture_user.customers.first.id,\n :date => Time.now.to_date.to_s(:MMDDYYYY),\n :due_date => (Time.now + 1.week).to_date.to_s(:MMDDYYYY),\n :description => Babel.random_short.gsub( '&', 'and' )\n )\n\n new_invoice = user.assigns(:invoice)\n user.assert_taxes(new_invoice, \"after saving new invoice \" + context)\n\n new_invoice.reload\n# puts \"new_invoice: #{new_invoice.inspect}\"\n user.assert_taxes(new_invoice, \"after reloading invoice object \" + context)\n \n # puts \"do edit invoice with #{new_invoice.id} user.assigns(:invoice): #{user.assigns(:invoice).inspect}\"\n user.edits_invoice(new_invoice.id)\n\n # puts user.assigns(:invoice).taxes.inspect\n user.deny user.assigns(:invoice).taxes.empty?, \"edited invoice taxes was, empty #{context}\"\n user.assert_taxes(user.assigns(:invoice), \"after editing new invoice \" + context)\n\n end", "def set_Tax(value)\n set_input(\"Tax\", value)\n end", "def set_tax\n raise Error::CustomError.error(422, :TAX_01, \"tax\") unless Number.is_integer?(params[:tax_id])\n begin\n @tax = Tax.find(params[:tax_id])\n rescue ActiveRecord::RecordNotFound\n raise Error::CustomError.error(404, :TAX_02, \"tax\")\n rescue\n raise Error::CustomError.error(500, :ISE, \"tax\")\n end\n end", "def update\n @taxon = Taxon.find(params[:id])\n\n respond_to do |format|\n if @taxon.update_attributes(params[:taxon])\n format.html { redirect_to @taxon, notice: 'Taxon was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @taxon.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @taxi_sevice.update(taxi_sevice_params)\n format.html { redirect_to action: \"index\" }\n format.json { render :show, status: :ok, location: @taxi_sevice }\n else\n format.html { render :edit }\n format.json { render json: @taxi_sevice.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_taxi\n @taxi = Taxi.find(params[:id])\n end", "def set_taxi\n @taxi = Taxi.find(params[:id])\n end", "def index\n @taxes = params['item_id'] ? Item.find(params['item_id']).taxes : Tax.all\n render json: @taxes\n end", "def taxon_update_point\n update_ammolist_taxon_caliber(params[:id])\n respond_to do |format|\n format.html\n format.js { render :json => \"Updated Successfully\" }\n end\n end", "def update_taxt_from_editable editable_taxt\n update_attributes taxt: Taxt.from_editable(editable_taxt)\n rescue Taxt::ReferenceNotFound => e\n errors.add :base, \"The reference '#{e}' could not be found. Was the ID changed?\"\n end", "def set_incoming_service_tax\n @incoming_service_tax = IncomingServiceTax.find(params[:id])\n end", "def update\n @taxon = Taxon.find(params[:id])\n\n respond_to do |format|\n if @taxon.update_attributes(params[:taxon])\n format.html { redirect_to @taxon, notice: 'Taxon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @taxon.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @invoice_tax = InvoiceTax.new(params[:invoice_tax])\n\n respond_to do |format|\n if @invoice_tax.save\n format.html { redirect_to @invoice_tax, notice: 'Invoice tax was successfully created.' }\n format.json { render json: @invoice_tax, status: :created, location: @invoice_tax }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice_tax.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @taxi = Taxi.find(params[:id])\n\n respond_to do |format|\n if @taxi.update_attributes(params[:taxi])\n format.html { redirect_to @taxi, notice: 'Taxi was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @taxi.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @taxi.update(taxi_params)\n format.html { redirect_to @taxi, notice: 'Taxi was successfully updated.' }\n format.json { render :show, status: :ok, location: @taxi }\n else\n format.html { render :edit }\n format.json { render json: @taxi.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @monthly_income_tax.update(monthly_income_tax_params)\n @monthly_income_tax = MonthlyIncomeTax.new\n @monthly_income_taxes = MonthlyIncomeTax.all\n end", "def update\n @taxirequest = Taxirequest.find(params[:id])\n\n respond_to do |format|\n if @taxirequest.update_attributes(params[:taxirequest])\n format.html { redirect_to @taxirequest, notice: 'Taxirequest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @taxirequest.errors, status: :unprocessable_entity }\n end\n end\n end", "def showinvoice\n\t\t@ptax = Ptax.find(params[:id])\n\t\[email protected] = @ptax.invoice\n\t\[email protected]_attributes(params[:ptax])\t\n\tend", "def update_item_taxes(body, opts = {})\n data, _status_code, _headers = update_item_taxes_with_http_info(body, opts)\n return data\n end", "def updateinvoice\n\t\t@ptax = Ptax.find(params[:id])\n\t\[email protected]_by = 1\n\t\tif @ptax.update_attributes(params[:ptax])\n\t\t\tflash[:notice] = 'Property Tax Calculation Suceesfully done.'\n\t\t\tredirect_to :action => 'showinvoice', :id => @ptax\n\t\telse\n\t\t@zone = Zone.find(:all)\n\t\t@ward = Ward.find(:all)\t\t\n\t\t@street = Street.find(:all)\n\t\t@ptaxregistration = Ptaxregistration.find(:all)\n\t\t@propertytype = Propertytype.find(:all)\n\t\t@taxcategory = Taxcategory.find(:all)\n\t\t@occupancyfactor = Occupancyfactor.find(:all)\n\t\t@structurefactor = Structurefactor.find(:all)\n\t\t@unitvalue = Unitvalue.find(:all)\t\t\n\t\t\n\t\t\trender :action => 'calculate'\n\t\tend\n\tend", "def update\n @invoice = Invoice.find(params[:id])\n @invoice.year = Date.today.year\n\n @invoice.client_id = params[:clients]\n @invoice.discount_id = params[:discount_id]\n @invoice.tax_id = params[:tax_id]\n\n\n respond_to do |format|\n if @invoice.update_attributes(params[:invoice])\n format.html { redirect_to @invoice, notice: 'Invoice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @tax_amount = args[:tax_amount] if args.key?(:tax_amount)\n @tax_name = args[:tax_name] if args.key?(:tax_name)\n @tax_type = args[:tax_type] if args.key?(:tax_type)\n end", "def update\n @transaction_goods_taxis = Transaction::Goods::Taxe.find(params[:id])\n\n respond_to do |format|\n if @transaction_goods_taxis.update_attributes(params[:transaction_goods_taxis])\n format.html { redirect_to(@transaction_goods_taxis, :notice => 'Taxe was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @transaction_goods_taxis.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_tax_by_id_0_with_http_info(id, tax, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TaxesApi.update_tax_by_id_0 ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling TaxesApi.update_tax_by_id_0\"\n end\n # verify the required parameter 'tax' is set\n if @api_client.config.client_side_validation && tax.nil?\n fail ArgumentError, \"Missing the required parameter 'tax' when calling TaxesApi.update_tax_by_id_0\"\n end\n # resource path\n local_var_path = \"/taxes/{id}/\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(tax)\n auth_names = ['APIKeyHeader']\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 => 'InlineResponse2012')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TaxesApi#update_tax_by_id_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def set_quarter_income_tax\n @quarter_income_tax = QuarterIncomeTax.find(params[:id])\n end", "def update_tax_of_detailed_view\n\t\tif params[:tne_invoice][:view_by]=='Detailed'\n\t\t\tparams.each do |k,v|\n\t\t\t\tif k.match(/check_detailed_p_tax_/)\n\t\t\t\t\tid= k.split('check_detailed_p_tax_')[1].to_i\n\t\t\t\t\ttime= TneInvoiceTimeEntry.find_by_id(id)\n\t\t\t\t\ttime.primary_tax=params[\"check_detailed_p_tax_#{id}\"]\n\t\t\t\t\ttime.secondary_tax=params[\"check_detailed_s_tax_#{id}\"]\n\t\t\t\t\ttime.save!\n\t\t\t\telsif k.match(/check_detailed_expense_p_tax_/)\n\t\t\t\t\tid= k.split('check_detailed_expense_p_tax_')[1].to_i\n\t\t\t\t\texpense= TneInvoiceExpenseEntry.find_by_id(id)\n\t\t\t\t\texpense.primary_tax=params[\"check_detailed_expense_p_tax_#{id}\"]\n\t\t\t\t\texpense.secondary_tax=params[\"check_detailed_expense_s_tax_#{id}\"]\n\t\t\t\t\texpense.save!\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def update_tax_of_summary_view\n\t\tif params[:tne_invoice][:view_by]=='Summary'\n\t\t\tinvoice=params[:tne_invoice][:tne_invoice_details_attributes]\n\t\t\tinvoice.each do |k,v|\n\t\t\t\tif invoice[k][:tne_invoice_time_entries_attributes]\n\t\t\t\t\ttime_r_expense= TneInvoiceTimeEntry.find_by_id(invoice[k][:tne_invoice_time_entries_attributes][\"0\"][:id].to_i)\n\t\t\t\telsif invoice[k][:tne_invoice_expense_entries_attributes]\n\t\t\t\t\ttime_r_expense= TneInvoiceExpenseEntry.find_by_id(invoice[k][:tne_invoice_expense_entries_attributes][\"0\"][:id].to_i)\n\t\t\t\telse\n\t\t\t\t\ttime_r_expense = nil\n\t\t\t\tend\n\t\t\t\tunless time_r_expense.nil?\n\t\t\t\t\ttime_r_expense.primary_tax =invoice[k][:primary_tax]\n\t\t\t\t\ttime_r_expense.secondary_tax = invoice[k][:secondary_tax]\n\t\t\t\t\ttime_r_expense.save!\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def tax_1\n get_or_build_tax_for_key(\"tax_1\")\n end", "def destroy\n @invoice_tax = InvoiceTax.find(params[:id])\n @invoice_tax.destroy\n\n respond_to do |format|\n format.html { redirect_to invoice_taxes_url }\n format.json { head :no_content }\n end\n end", "def update_invoice\n if invoice.registrations.any?\n invoice.update_paid\n else\n invoice.destroy\n end\n end", "def update\n @invoice = Invoice.find(params[:id])\n title=params['q_param']['title']\n total=params['q_param']['total']\n tax_rate=params['q_param']['tax_rate']\n l=params['q_param']['list']\n comment=params['q_param']['comment']\n list=Array.new\n l.keys.each do |j|\n list << [l[j][0],l[j][1],l[j][2],l[j][3]]\n end\n invoice={:title=>title,:total=>total,:list=>list,:tax_rate=>tax_rate,:comment=>comment}\n @invoice.update(invoice)\n format.json { head :no_content }\n end", "def set_tax_information\n @tax_information = TaxInformation.find(params[:id])\n end", "def sync_tax_rates\n subscription = as_stripe_subscription\n\n subscription.default_tax_rates = user.tax_rates\n\n subscription.save\n\n items.each do |item|\n stripe_subscription_item = item.as_stripe_subscription_item\n\n stripe_subscription_item.tax_rates = get_plan_tax_rates_for_payload(item.stripe_plan)\n\n stripe_subscription_item.save\n end\n end", "def update\n @tax_type = TaxType.find(params[:id])\n\n respond_to do |format|\n if @tax_type.update_attributes(params[:tax_type])\n format.html { redirect_to @tax_type, notice: 'Tax type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tax_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @taxinomy = Taxinomy.find(params[:id])\n\n respond_to do |format|\n if @taxinomy.update_attributes(params[:taxinomy])\n format.html { redirect_to @taxinomy, notice: 'Taxinomy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @taxinomy.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_check_tax_calculation_on_new_invoice_with_discount_before_tax\r\n @debug = false\r\n update_profile_taxes(\r\n :tax_enabled => true,\r\n :tax_1_rate => 7.0,\r\n :tax_2_rate => 6.0,\r\n :discount_before_tax => true)\r\n\r\n expected_before = {\r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.09,\r\n :tax_2_amount => 0.93,\r\n :discount_amount => 0.31,\r\n :total => 17.25} \r\n \r\n # uncheck_both_taxes \r\n expected_after = {\r\n :line_items_total => 15.54,\r\n :tax_1_amount => 0.00,\r\n :tax_2_amount => 0.00,\r\n :discount_amount => 0.31,\r\n :total => 15.23} \r\n \r\n \r\n add_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {uncheck_both_taxes}\r\n \r\n # uncheck_tax_1\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 0.00,\r\n :tax_2_amount => 0.93,\r\n :discount_amount => 0.31,\r\n :total => 16.16}\r\n \r\n add_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {uncheck_tax_1}\r\n \r\n # uncheck_tax_2\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.09,\r\n :tax_2_amount => 0.00,\r\n :discount_amount => 0.31,\r\n :total => 16.32}\r\n \r\n add_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {uncheck_tax_2}\r\n \r\n # change tax rate 1\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.55,\r\n :tax_2_amount => 0.93,\r\n :discount_amount => 0.31,\r\n :total => 17.71}\r\n \r\n add_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {change_tax_1_rate(10.00)}\r\n\r\n #change_tax_2_rate\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.09,\r\n :tax_2_amount => 1.73,\r\n :discount_amount => 0.31,\r\n :total => 18.05}\r\n \r\n add_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {change_tax_2_rate(11.11)}\r\n\r\n #change_discount_amount\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.09,\r\n :tax_2_amount => 0.93,\r\n :discount_amount => 5.55,\r\n :total => 12.01}\r\n \r\n add_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {change_discount_amount(5.55)}\r\n\r\n #change_discount_percent\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.09,\r\n :tax_2_amount => 0.93,\r\n :discount_amount => 0.86,\r\n :total => 16.70}\r\n \r\n add_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {change_discount_percent(5.55)}\r\n\r\n #change_discount_amount_and_rates(5.55, 10.0, 11.11)\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.55,\r\n :tax_2_amount => 1.73,\r\n :discount_amount => 5.55,\r\n :total => 13.27}\r\n \r\n add_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {change_discount_amount_and_rates(5.55, 10.0, 11.11)}\r\n\r\n #change_discount_percent_and_rates(5.55, 10.0, 11.11) \r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.55,\r\n :tax_2_amount => 1.73,\r\n :discount_amount => 0.86,\r\n :total => 17.96}\r\n \r\n add_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {change_discount_percent_and_rates(5.55, 10.0, 11.11)}\r\n\r\n\r\n b = @user.b\r\n\r\n #change_qty\r\n add_standard_invoice\r\n \r\n verify_invoice_view_fields(\r\n :line_items_total => expected_before[:line_items_total],\r\n :tax_1_amount => expected_before[:tax_1_amount],\r\n :tax_2_amount => expected_before[:tax_2_amount],\r\n :discount_amount => expected_before[:discount_amount],\r\n :total => expected_before[:total]) \r\n \r\n #get newly added last row in the table and change quantity\r\n trows = @user.line_items_rows\r\n assert_equal 3, trows.length\r\n tr = trows[::WatirBrowser.item_index(trows.length)]\r\n assert tr.exists?\r\n @user.expects_ajax(1) do\r\n @user.populate(tr.text_field(:name, \"invoice[line_items_attributes][][quantity]\"), '4')\r\n #tr.text_field(:name, \"invoice[line_items_attributes][][quantity]\").set('4')\r\n end\r\n \r\n @user.wait\r\n \r\n verify_invoice_view_fields(\r\n :line_items_total => 18.87,\r\n :tax_1_amount => 1.32,\r\n :tax_2_amount => 1.13,\r\n :discount_amount => 0.38,\r\n :total => 20.94) \r\n \r\n #change_price\r\n add_standard_invoice\r\n \r\n verify_invoice_view_fields(\r\n :line_items_total => expected_before[:line_items_total],\r\n :tax_1_amount => expected_before[:tax_1_amount],\r\n :tax_2_amount => expected_before[:tax_2_amount],\r\n :discount_amount => expected_before[:discount_amount],\r\n :total => expected_before[:total]) \r\n \r\n #get newly added last row in the table and change price\r\n trows = @user.line_items_rows\r\n assert_equal 3, trows.length\r\n tr = trows[::WatirBrowser.item_index(trows.length)]\r\n assert tr.exists?\r\n @user.expects_ajax(1) do\r\n @user.populate(tr.text_field(:name, \"invoice[line_items_attributes][][price]\"), '4.44')\r\n #tr.text_field(:name, \"invoice[line_items_attributes][][price]\").set('4.44')\r\n end\r\n \r\n @user.wait \r\n \r\n verify_invoice_view_fields(\r\n :line_items_total => 18.87,\r\n :tax_1_amount => 1.32,\r\n :tax_2_amount => 1.13,\r\n :discount_amount => 0.38,\r\n :total => 20.94) \r\n end", "def tax_change\n owner = correct_owner_id\n tax ={\n :tax1_enabled => 1,\n :tax2_enabled => Confline.get_value2(\"Tax_2\", owner).to_i,\n :tax3_enabled => Confline.get_value2(\"Tax_3\", owner).to_i,\n :tax4_enabled => Confline.get_value2(\"Tax_4\", owner).to_i,\n :tax1_name => Confline.get_value(\"Tax_1\", owner),\n :tax2_name => Confline.get_value(\"Tax_2\", owner),\n :tax3_name => Confline.get_value(\"Tax_3\", owner),\n :tax4_name => Confline.get_value(\"Tax_4\", owner),\n :total_tax_name => Confline.get_value(\"Total_tax_name\", owner),\n :tax1_value => Confline.get_value(\"Tax_1_Value\", owner).to_d,\n :tax2_value => Confline.get_value(\"Tax_2_Value\", owner).to_d,\n :tax3_value => Confline.get_value(\"Tax_3_Value\", owner).to_d,\n :tax4_value => Confline.get_value(\"Tax_4_Value\", owner).to_d,\n :compound_tax => Confline.get_value(\"Tax_compound\", owner).to_i\n }\n\n tax[:total_tax_name] = \"TAX\" if tax[:total_tax_name].blank?\n tax[:tax1_name] = tax[:total_tax_name].to_s if tax[:tax1_name].blank?\n\n case params[:u].to_i\n when 1\n users = User.find(:all, :include => [:tax], :conditions => [\"owner_id = ?\", owner])\n for user in users do\n user.assign_default_tax(tax, {:save => true})\n end\n Confline.set_default_object(Tax, owner, tax)\n flash[:status] = _('User_taxes_set_successfully')\n when 2\n Cardgroup.set_tax(tax, session[:user_id])\n flash[:status] = _('Cardgroup_taxes_set_successfully')\n when 3\n Voucher.set_tax(tax)\n flash[:status] = _('voucher_taxes_set_successfully')\n else\n dont_be_so_smart\n end\n\n if owner == 0\n redirect_to :action => 'settings' and return false\n else\n redirect_to :action => 'reseller_settings' and return false\n end\n end", "def update!(**args)\n @pretax = args[:pretax] if args.key?(:pretax)\n @tax = args[:tax] if args.key?(:tax)\n end", "def update\n @invoice = CsInvoice.where(:id => params[:invoice_id]).first\n @user = @invoice.user\n\n if params[:increase] && params[:increase] != \"true\"\n params[:invoice][:balance] = 0 if @invoice.balance - params[:invoice][:balance].to_d <= 0 # so it won't get negative\n end\n\n if params[:add_with_tax].to_i == 1 and @invoice.tax\n params[:invoice][:balance_with_tax] = params[:invoice][:balance].to_d\n params[:invoice][:balance] = @invoice.tax.count_amount_without_tax(params[:invoice][:balance]).to_d\n else\n if @invoice.tax\n params[:invoice][:balance_with_tax] = @invoice.tax.apply_tax(params[:invoice][:balance]).to_d\n end\n end\n\n @invoice.update_attributes(params[:invoice])\n\n if params[:invoice][:balance]\n @user.update_attributes({:balance => params[:invoice][:balance].to_d})\n end\n store_invoice_in_session(@user, @invoice)\n\n respond_to do |format|\n format.json { render :json => \"OK\".to_json }\n end\n end", "def index\n @taxes = Tax.all\n end", "def create\n @sale = Sale.new(sale_params)\n\n respond_to do |format|\n if @sale.save && calculate_taxes(@sale)\n format.html { redirect_to @sale, notice: 'Sale was successfully created.' }\n format.json { render :show, status: :created, location: @sale }\n else\n format.html { render :new }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end", "def ship_address_tax_update\n if ship_address and (ship_address_id_changed? or ship_address.changed?)\n create_avalara_tax_adjustment\n end\n end", "def update\n \n @invoice_item.update(@invoice_item)\n respond_with(@invoice)\n \n end", "def update\n @tax_rate = TaxRate.find(params[:id])\n\n respond_to do |format|\n if @tax_rate.update_attributes(params[:tax_rate])\n format.html { redirect_to @tax_rate, notice: 'Tax rate was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tax_rate.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_tax_by_id_with_http_info(id, tax, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TaxesApi.update_tax_by_id ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling TaxesApi.update_tax_by_id\"\n end\n # verify the required parameter 'tax' is set\n if @api_client.config.client_side_validation && tax.nil?\n fail ArgumentError, \"Missing the required parameter 'tax' when calling TaxesApi.update_tax_by_id\"\n end\n # resource path\n local_var_path = \"/taxes/{id}/\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(tax)\n auth_names = ['APIKeyHeader']\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 => 'InlineResponse2012')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TaxesApi#update_tax_by_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n respond_to do |format|\n if @taxfree.update(taxfree_params)\n format.html { redirect_to @taxfree, notice: 'Taxfree was successfully updated.' }\n format.json { render :show, status: :ok, location: @taxfree }\n else\n format.html { render :edit }\n format.json { render json: @taxfree.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_vat_rate\n subscriptions = Stripe::Subscription.list({\n customer: customer.id,\n limit: 100\n })\n\n vat_rate = calculate_vat_rate\n\n subscriptions.each do |subscription|\n Stripe::Subscription.update(\n subscription.id,\n {\n tax_percent: vat_rate\n }\n )\n end\n end", "def add_taxes(amt, good_tax, import_tax)\n amt += good_tax + import_tax\n amt.round(2)\n end", "def update\n ActiveRecord::Base.transaction do\n @invoice.update invoice_params\n @invoice.invoice_details.destroy_all\n Item.all.each do |item|\n if params[\"amount_#{item.id}\"].to_i > 0\n InvoiceDetail.create!(invoice: @invoice, item: item, price: item.price,\n amount: params[\"amount_#{item.id}\"].to_i)\n end\n end\n end\n @invoice.reload\n respond_to do |format|\n if @invoice.calculate_total!\n format.html { redirect_to @invoice, notice: 'Invoice was successfully updated.' }\n format.json { render :show, status: :ok, location: @invoice }\n else\n format.html { render :edit }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_taxi_sevice\n @taxi_sevice = TaxiSevice.find(params[:id])\n end", "def update\n @pagetitle = \"Edit invoice\"\n @action_txt = \"Update\"\n \n items = params[:items].split(\",\")\n \n @invoice = Factura.find(params[:id])\n @company = @invoice.company\n @payments = @company.get_payments() \n @medios = @company.get_medios()\n\n if(params[:ac_customer] and params[:ac_customer] != \"\")\n @ac_customer = params[:ac_customer]\n else\n @ac_customer = @invoice.customer.name\n end\n \n @products_lines = @invoice.products_lines\n \n @locations = @company.get_locations()\n @divisions = @company.get_divisions()\n \n @invoice[:subtotal] = @invoice.get_subtotal(items)\n @invoice[:tax] = @invoice.get_tax(items, @invoice[:medio_id])\n @invoice[:total] = @invoice[:subtotal] + @invoice[:tax]\n\n respond_to do |format|\n if @invoice.update_attributes(factura_params)\n # Create products for kit\n @invoice.delete_products()\n @invoice.add_products(items)\n @invoice.correlativo\n # Check if we gotta process the invoice\n @invoice.process()\n \n format.html { redirect_to(@invoice, :notice => 'Invoice was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invoice.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tax_information.update(tax_information_params)\n format.html { redirect_to @tax_information, notice: 'Tax information was successfully updated.' }\n format.json { render :show, status: :ok, location: @tax_information }\n else\n format.html { render :edit }\n format.json { render json: @tax_information.errors, status: :unprocessable_entity }\n end\n end\n end", "def incoming_service_tax_params\n params.require(:incoming_service_tax).permit(:invoice_number, :invoice_date, :description, :event_total, :service_tax, :client_id, :cgst, :sgst)\n end", "def update(organisation_id, name, type, display_rate, effective_rate, options = {})\n body = options.has_key?(:body) ? options[:body] : {}\n body[:organisation_id] = organisation_id\n body[:name] = name\n body[:type] = type\n body[:display_rate] = display_rate\n body[:effective_rate] = effective_rate\n\n response = @client.post \"/core.tax/update/#{@tax_id}\", body, options\n\n return response\n end", "def get_all_taxes\n self.class.get(\"/aldebaran-taxes/v2/taxes\", :basic_auth => @auth)\n end", "def update_item\n order = current_user.init_cart.order\n line_item = order.line_items.find(params[:id])\n line_item.attributes = params[:item]\n image = line_item.image\n line_item.price = Product.find(line_item.product_id).price_for_tier(image.tier_id, image.owner?(current_user))\n line_item.tax = line_item.price * PER_TAX\n\n if line_item.save\n render json: line_item, status: :created\n else\n render json: { msg: line_item.errors.full_messages.to_sentence }, status: :bad_request\n end\n end", "def put(invoice_number, invoice_sequence)\n #xml = order_update_template % { status: status.to_i }\n #put_request(t_url(:order, order_id), xml)\n end", "def update\n @tax_rate = TaxRate.find(params[:id])\n\n respond_to do |format|\n if @tax_rate.update_attributes(params[:tax_rate])\n format.html { redirect_to(@tax_rate, :notice => 'Tax rate was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tax_rate.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n # too many issues trying to do strong parametesr.\n # TODO: implement strong params in the future\n params = request.parameters\n\n if !params.has_key?(:invoice_items) then\n flash[:error] = \"No items to update in invoice #{invoice.id}\"\n head status: :precondition_failed\n return\n end\n\n invoice = Invoice.find(params[:id])\n\n #just try to update the damn thing\n params[:invoice_items].each_pair do |key,value|\n InvoiceItem.find(key).update_attributes(value)\n end\n\n invoice.update_attribute(:total_billing, invoice.generate_total_billing)\n # update status\n if invoice.total_billing.zero? then\n invoice.update_attribute(:status, Invoice.statuses[\"settled\"])\n else\n invoice.update_attribute(:status, Invoice.statuses[\"outstanding\"])\n end\n\n flash[:notice] = \"Invoice #{invoice.id} updated\"\n render json: {message:\"Invoice #{invoice.id} updated\", invoice:invoice}, status: :ok\n end", "def add_tax_as_line_item\n raise unless @fields['x_tax']\n add_line_item :name => 'Total Tax', :quantity => 1, :unit_price => @fields['x_tax'], :tax => 0, :line_title => 'Tax'\n end", "def tax_index\n\n end", "def update\n @purchase_order = PurchaseOrder.update_order(params, @company.id, @current_user, @financial_year.year.name)\n respond_to do |format|\n if @purchase_order.save\n @purchase_order.register_user_action(request.remote_ip, 'updated')\n format.html { redirect_to(@purchase_order, :notice => 'Purchase order was successfully updated.') }\n format.xml { head :ok }\n else\n @purchase_order.purchase_order_line_items.each do |line_item|\n (2-line_item.purchase_order_taxes.size).times{ line_item.purchase_order_taxes.build }\n end\n @voucher_setting = VoucherSetting.find_by_company_id_and_voucher_type(@company.id, 6)\n @from_accounts = TransactionType.fetch_from_accounts(@company.id,'purchases')\n @to_accounts = Product.get_purchase_products(@company.id)\n @projects = @company.projects.active\n @tax_accounts = TransactionType.fetch_to_accounts(@company.id, 'tax')\n @other_charge_accounts = Account.get_other_expense_on_purchase_accounts(@company)\n @vendor_account_heads = AccountHead.get_customer_and_vendor_account_heads(@company.id)\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @purchase_order.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_check_tax_calculation_on_edited_invoice_with_discount_before_tax\r\n @debug = false\r\n expected_before = {\r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.09,\r\n :tax_2_amount => 0.93,\r\n :discount_amount => 0.31,\r\n :total => 17.25} \r\n \r\n # uncheck_both_taxes \r\n expected_after = {\r\n :line_items_total => 15.54,\r\n :tax_1_amount => 0.00,\r\n :tax_2_amount => 0.00,\r\n :discount_amount => 0.31,\r\n :total => 15.23} \r\n \r\n edit_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {uncheck_both_taxes}\r\n \r\n # uncheck_tax_1\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 0.00,\r\n :tax_2_amount => 0.93,\r\n :discount_amount => 0.31,\r\n :total => 16.16}\r\n \r\n edit_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {uncheck_tax_1}\r\n \r\n # uncheck_tax_2\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.09,\r\n :tax_2_amount => 0.00,\r\n :discount_amount => 0.31,\r\n :total => 16.32}\r\n \r\n edit_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {uncheck_tax_2}\r\n \r\n # change tax rate 1\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.55,\r\n :tax_2_amount => 0.93,\r\n :discount_amount => 0.31,\r\n :total => 17.71}\r\n \r\n edit_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {change_tax_1_rate(10.00)}\r\n\r\n #change_tax_2_rate\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.09,\r\n :tax_2_amount => 1.73,\r\n :discount_amount => 0.31,\r\n :total => 18.05}\r\n \r\n edit_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {change_tax_2_rate(11.11)}\r\n\r\n #change_discount_amount\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.09,\r\n :tax_2_amount => 0.93,\r\n :discount_amount => 5.55,\r\n :total => 12.01}\r\n \r\n edit_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {change_discount_amount(5.55)}\r\n\r\n #change_discount_percent\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.09,\r\n :tax_2_amount => 0.93,\r\n :discount_amount => 0.86,\r\n :total => 16.70}\r\n \r\n edit_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {change_discount_percent(5.55)}\r\n\r\n #change_discount_amount_and_rates(5.55, 10.0, 11.11)\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.55,\r\n :tax_2_amount => 1.73,\r\n :discount_amount => 5.55,\r\n :total => 13.27}\r\n \r\n edit_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {change_discount_amount_and_rates(5.55, 10.0, 11.11)}\r\n\r\n #change_discount_percent_and_rates(5.55, 10.0, 11.11) \r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.55,\r\n :tax_2_amount => 1.73,\r\n :discount_amount => 0.86,\r\n :total => 17.96}\r\n \r\n edit_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {change_discount_percent_and_rates(5.55, 10.0, 11.11)}\r\n\r\n\r\n b = @user.b\r\n\r\n #change_qty\r\n @user.edits_invoice(invoices(:discount_before_tax_invoice).id)\r\n \r\n verify_invoice_view_fields(\r\n :line_items_total => expected_before[:line_items_total],\r\n :tax_1_amount => expected_before[:tax_1_amount],\r\n :tax_2_amount => expected_before[:tax_2_amount],\r\n :discount_amount => expected_before[:discount_amount],\r\n :total => expected_before[:total]) \r\n \r\n #get newly added last row in the table and change quantity\r\n trows = @user.line_items_rows\r\n assert_equal 3, trows.length\r\n tr = trows[::WatirBrowser.item_index(trows.length)]\r\n assert tr.exists?\r\n @user.expects_ajax(1) do\r\n @user.populate(tr.text_field(:name, \"invoice[line_items_attributes][][quantity]\"), '4')\r\n #tr.text_field(:name, \"invoice[line_items_attributes][][quantity]\").set('4')\r\n end\r\n \r\n @user.wait \r\n \r\n verify_invoice_view_fields(\r\n :line_items_total => 18.87,\r\n :tax_1_amount => 1.32,\r\n :tax_2_amount => 1.13,\r\n :discount_amount => 0.38,\r\n :total => 20.94) \r\n \r\n #change_price\r\n @user.edits_invoice(invoices(:discount_before_tax_invoice).id)\r\n \r\n verify_invoice_view_fields(\r\n :line_items_total => expected_before[:line_items_total],\r\n :tax_1_amount => expected_before[:tax_1_amount],\r\n :tax_2_amount => expected_before[:tax_2_amount],\r\n :discount_amount => expected_before[:discount_amount],\r\n :total => expected_before[:total]) \r\n \r\n #get newly added last row in the table and change price\r\n trows = @user.line_items_rows\r\n assert_equal 3, trows.length\r\n tr = trows[::WatirBrowser.item_index(trows.length)]\r\n assert tr.exists?\r\n @user.expects_ajax(1) do\r\n @user.populate(tr.text_field(:name, \"invoice[line_items_attributes][][price]\"), '4.44')\r\n #tr.text_field(:name, \"invoice[line_items_attributes][][price]\").set('4.44')\r\n end\r\n \r\n verify_invoice_view_fields(\r\n :line_items_total => 18.87,\r\n :tax_1_amount => 1.32,\r\n :tax_2_amount => 1.13,\r\n :discount_amount => 0.38,\r\n :total => 20.94) \r\n \r\n end", "def update_sales_invoice(id, options)\n put(\"sales_invoices/#{id}\", sales_invoice: options)\n end", "def show\n @company = Company.first\n @invoice = Invoice.find(params[:id])\n @invoice.client = Client.find(@invoice.client_id)\n @items = Item.find_all_by_invoice_id(@invoice.invoice_id)\n # @invoice.tax_value = Taxis.find(:all, :conditions => { :id => @invoice.tax_id })\n # tax_value = @invoice.tax.value\n #@tax_amount = @invoice.subtotal * (1 - @tax.value/100)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoice }\n format.pdf do\n render :pdf => \"file_name\"\n end\n end\n end", "def update\n respond_to do |format|\n if @pagto_taxa.update(pagto_taxa_params)\n format.html { redirect_to :back }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pagto_taxa.errors, status: :unprocessable_entity }\n end\n end\n end", "def tax_2\n get_or_build_tax_for_key(\"tax_2\")\n end", "def set_taxon\n @taxon = Taxon.find(params[:id])\n end", "def set_taxon\n @taxon = Taxon.find(params[:id])\n end", "def update\n @taxon_attribute = TaxonAttribute.find(params[:id])\n\n respond_to do |format|\n if @taxon_attribute.update_attributes(params[:taxon_attribute])\n format.html { redirect_to @taxon_attribute, notice: 'Taxon attribute was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @taxon_attribute.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_should_update_new_invoice_total_when_line_item_is_deleted\r\n update_profile_taxes(\r\n :tax_enabled => true,\r\n :tax_1_name => \"tax 1 name\",\r\n :tax_1_rate => \"5.0\",\r\n :tax_2_name => \"\",\r\n :discount_before_tax => false)\r\n \r\n @user.creates_new_invoice\r\n # the first line is created automatically, no need to click add line \r\n @user.edits_line_item(1,:unit => 'line one', :quantity => '1', :price => '1.23')\r\n @user.adds_line_item(:unit => 'line two', :quantity => '1', :price => '4.56')\r\n \r\n verify_invoice_view_fields(\r\n :line_items_total => 5.79,\r\n :tax_1_amount => 0.29,\r\n :discount_amount => 0,\r\n :total => 6.08)\r\n \r\n @user.removes_line_item(1)\r\n\r\n verify_invoice_view_fields(\r\n :line_items_total => 4.56,\r\n :tax_1_amount => 0.23,\r\n :discount_amount => 0,\r\n :total => 4.79)\r\n end", "def get_taxes_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TaxesApi.get_taxes ...\"\n end\n # resource path\n local_var_path = \"/taxes\"\n\n # query parameters\n query_params = {}\n query_params[:'includes'] = @api_client.build_collection_param(opts[:'includes'], :csv) if !opts[:'includes'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'order_by'] = @api_client.build_collection_param(opts[:'order_by'], :multi) if !opts[:'order_by'].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 = ['APIKeyHeader']\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 => 'InlineResponse2002')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TaxesApi#get_taxes\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def sync_tax_percentage\n subscription = as_stripe_subscription\n\n subscription.tax_percentage = user.tax_percentage\n\n subscription.save\n end", "def tax_calc\n tax = @quantity * @price * @taxe\n end", "def tax_params\n params.require(:tax).permit(:tax_name, :description, :percentage, :tax_category, :tax_type_id, :organization_id, :child_tax=>[])\n end", "def addTaxes(accountProject, currency, totalAmount)\n\t\tprojectTaxes = accountProject.wk_acc_project_taxes\n\t\tprojectTaxes.each do |projtax|\n\t\t\tinvItem = @invoice.invoice_items.new()\n\t\t\tinvItem.name = projtax.tax.name\n\t\t\tinvItem.rate = projtax.tax.rate_pct.blank? ? 0 : projtax.tax.rate_pct\n\t\t\tinvItem.project_id = accountProject.project_id\n\t\t\tinvItem.currency = currency\n\t\t\tinvItem.quantity = nil\n\t\t\tinvItem.amount = (invItem.rate/100) * totalAmount\n\t\t\tinvItem.item_type = 't'\n\t\t\tinvItem.modifier_id = User.current.id\n\t\t\tinvItem.save()\n\t\tend\n\tend", "def tax\n Tax.find(self.tax_id)\n end", "def create\n @tax = Tax.new(tax_params)\n if @tax.save\n redirect_to admin_taxes_path\n flash[:success] = \"Woohoo! tax created successfully.\"\n else\n render 'new'\n flash[:error] = \"Oops! Something went wrong!\"\n end\n end", "def update\n @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n if @invoice.update_attributes(invoice_params)\n format.html { redirect_to action: 'index', notice: I18n.t('commons.successfully_updated') }\n format.json { head :no_content }\n end\n end\n\n end", "def update_amounts\n @items = @items.each do |item|\n item[:good_tax] = set_tax(item[:good], item[:total], @good_tax_rate)\n item[:import_tax] = set_tax(item[:import], item[:total], @import_tax_rate)\n item[:sales_tax] = add_taxes(item[:sales_tax], item[:good_tax], item[:import_tax])\n item[:total] = add_taxes(item[:total], item[:good_tax], item[:import_tax])\n end\n end", "def create\n @tax = Tax.new(tax_params)\n\n if @tax.save\n render json: @tax, status: :created, location: @tax\n else\n render json: @tax.errors, status: :unprocessable_entity\n end\n end", "def set_tax(status, base_total, tax_rate)\n if status == true\n amt = compute_tax(base_total, tax_rate)\n round_tax(amt)\n else\n 0.0\n end\n end" ]
[ "0.72690123", "0.65473086", "0.65402716", "0.65395427", "0.6468368", "0.6318023", "0.62615436", "0.6212539", "0.61819965", "0.61819965", "0.61725813", "0.6153089", "0.61297953", "0.61141306", "0.60911906", "0.6081959", "0.60586464", "0.6055749", "0.6048677", "0.6023475", "0.6022178", "0.59963894", "0.5976957", "0.59712595", "0.59712595", "0.5967927", "0.5963677", "0.59619856", "0.59603953", "0.5949454", "0.5947903", "0.5935076", "0.5912641", "0.59065616", "0.5899383", "0.58817744", "0.5881126", "0.5880572", "0.5861152", "0.5860123", "0.58347785", "0.5832048", "0.5822293", "0.581482", "0.58065283", "0.57749313", "0.5733708", "0.5728181", "0.5721017", "0.5720118", "0.5704448", "0.568618", "0.56792873", "0.5679088", "0.56740737", "0.566778", "0.5662798", "0.56619966", "0.5661035", "0.5654396", "0.5626476", "0.562287", "0.56095535", "0.55906785", "0.55896795", "0.55848", "0.5579951", "0.5575808", "0.5569456", "0.55376977", "0.5532997", "0.5530287", "0.551667", "0.55081886", "0.5498493", "0.5497416", "0.5488853", "0.54870385", "0.5483052", "0.5477173", "0.5476897", "0.54684466", "0.5447229", "0.5443024", "0.5439624", "0.54322743", "0.54322743", "0.54302996", "0.5429753", "0.5414311", "0.5411322", "0.54061645", "0.54040354", "0.53994083", "0.5393616", "0.537873", "0.5376427", "0.53661877", "0.5362593", "0.5348802" ]
0.68349093
1
DELETE /invoice_taxes/1 DELETE /invoice_taxes/1.json
def destroy @invoice_tax = InvoiceTax.find(params[:id]) @invoice_tax.destroy respond_to do |format| format.html { redirect_to invoice_taxes_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_tax(id)\n @client.raw('delete', \"/ecommerce/taxes/#{id}\")\n end", "def destroy\n authorize @incoming_service_tax\n\n @incoming_service_tax.destroy\n respond_to do |format|\n format.html { redirect_to incoming_service_taxes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @taxirequest = Taxirequest.find(params[:id])\n @taxirequest.destroy\n\n respond_to do |format|\n format.html { redirect_to taxirequests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @taxi = Taxi.find(params[:id])\n @taxi.destroy\n\n respond_to do |format|\n format.html { redirect_to taxis_url }\n format.json { head :ok }\n end\n end", "def destroy\n @tax.destroy\n\n head :no_content\n end", "def destroy\n @transaction_goods_taxis = Transaction::Goods::Taxe.find(params[:id])\n @transaction_goods_taxis.destroy\n\n respond_to do |format|\n format.html { redirect_to(transaction_goods_taxes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n # @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pagto_taxa.destroy\n respond_to do |format|\n format.html { redirect_to pagto_taxas_url }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n record = TaxRule.find(params[:id])\n record.trash\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @taxinomy = Taxinomy.find(params[:id])\n @taxinomy.destroy\n\n respond_to do |format|\n format.html { redirect_to taxinomies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @taxon = Taxon.find(params[:id])\n @taxon.destroy\n\n respond_to do |format|\n format.html { redirect_to taxons_url }\n format.json { head :ok }\n end\n end", "def destroy\n @tax_rate = TaxRate.find(params[:id])\n @tax_rate.destroy\n\n respond_to do |format|\n format.html { redirect_to tax_rates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice_item.destroy\n respond_with(@invoice)\n \n end", "def destroy\n @taxi.destroy\n respond_to do |format|\n format.html { redirect_to taxis_url, notice: 'Taxi was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice=Invoice.find(params[:id])\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @taxon = Taxon.find(params[:id])\n @taxon.destroy\n\n respond_to do |format|\n format.html { redirect_to taxons_url }\n format.json { head :no_content }\n end\n end", "def deleteEntityInvoice_address( entity_id)\n params = Hash.new\n params['entity_id'] = entity_id\n return doCurl(\"delete\",\"/entity/invoice_address\",params)\n end", "def deleteEntityFax( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/fax\",params)\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @tax_type = TaxType.find(params[:id])\n @tax_type.destroy\n\n respond_to do |format|\n format.html { redirect_to tax_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice.destroy\n end", "def destroy\n @invoice.destroy\n\n Receipt.destroy_all(invoice_id: @invoice)\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Excluido com sucesso.' }\n sweetalert_success('Dados excluidos com sucesso!', 'Sucesso!', useRejections: false)\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Devis supprime.' }\n format.json { head :no_content }\n end\n end", "def destroy\n record = InvoiceLineItem.find(params[:id])\n record.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Uw factuur is verwijderd.' }\n format.json { head :no_content }\n end\n end", "def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end", "def destroy\n @az_invoice = AzInvoice.find(params[:id])\n @az_invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to(az_invoices_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @taxi_sevice.destroy\n respond_to do |format|\n format.html { redirect_to taxi_sevices_url, notice: 'Taxi sevice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice_row.destroy\n respond_to do |format|\n format.html { redirect_to invoice_rows_url }\n format.json { head :no_content }\n end\n end", "def delete\n authorize!(:delete,current_user) unless current_user.role?:lawfirm_admin or current_user.role?:livia_admin\n @invoice = Invoice.find(params[:id])\n if @invoice.payments.empty?\n InvoiceDetail.delete_all(:invoice_id=>params[:id])\n @invoice.delete\n flash[:notice] = \"#{t(:text_invoices)} \" \"#{t(:flash_was_successful)} \" \"#{t(:text_deleted)}\"\n else\n flash[:error] = t(:flash_invoice_cannot_deleted)\n end\n respond_to do |format|\n format.html { redirect_to :action=>'index'}\n format.xml { head :ok }\n end\n end", "def destroy\n id = @taxi_image.taxi_sevice_id\n @taxi_image.destroy\n respond_to do |format|\n format.html { redirect_to \"/taxi_sevices/\" + id.to_s, notice: 'Taxi image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tax_rate = TaxRate.find(params[:id])\n @tax_rate.destroy\n\n respond_to do |format|\n format.html { redirect_to(tax_rates_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @invoice.destroy\n respond_to do |format|\n format.html do\n redirect_to invoices_url, notice: 'Invoice was successfully destroyed.' unless htmx_request?\n end\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoices_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoices_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoices_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoices_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoices_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Fatura başarıyla silindi.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'invoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @taxfree.destroy\n respond_to do |format|\n format.html { redirect_to taxfrees_url, notice: 'Taxfree was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice_addon_line_item.destroy\n respond_to do |format|\n format.html { redirect_to invoice_addon_line_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Invoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Invoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Invoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Invoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Invoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Invoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Invoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Invoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Invoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Invoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Invoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @quarter_income_tax.destroy\n @quarter_income_taxes = QuarterIncomeTax.all\n end", "def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: \"Invoice was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n redirect_to invoices_url\n end", "def destroy\n @invoicedetail = Invoicedetail.find(params[:id])\n @invoicedetail.destroy\n\n respond_to do |format|\n format.html { redirect_to invoicedetails_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # @invoice.destroy\n @invoice.update_attributes(is_deleted: true,status_id: 4)\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Invoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @aliquotum = Aliquotum.find(params[:id])\n @aliquotum.destroy\n\n respond_to do |format|\n format.html { redirect_to aliquota_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice.destroy\n\n head :no_content\n end", "def destroy\n @tax_information.destroy\n respond_to do |format|\n format.html { redirect_to tax_informations_url, notice: 'Tax information was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @taxon_determination.destroy\n respond_to do |format|\n format.html { redirect_to taxon_determinations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @payment_invoice.destroy\n respond_to do |format|\n format.html { redirect_to payment_invoices_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @monthly_income_tax.destroy\n @monthly_income_taxes = MonthlyIncomeTax.all\n end", "def destroy\n @user = current_user\n @patient = @user.patients.find(params[:patient_id])\n @invoice = @patient.invoices.find(params[:invoice_id])\n @cost_item = CostItem.find(params[:id])\n @cost_item.destroy\n\n respond_to do |format|\n format.html { redirect_to user_patient_invoice_cost_items_url(@user,@patient,@invoice) }\n format.json { head :no_content }\n end\n calculate_costitem_amount(@cost_item)\n calculate_invoice_sum(@invoice)\n end", "def tenant_delete(tenant_id)\n\t\n\t\tdelete_call = Curl::Easy.http_delete(\"#{@ip_address}:#{@port_2}/v2.0/tenants/#{tenant_id}\"\n\t\t) do |curl|\n\t\t\tcurl.headers['x-auth-token'] = @token\n\t\t\tcurl.headers['userId'] = tenant_id\n\t\t end\n\t\t\n\t\tputs \"invoked tenant delete\"\n\tend", "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 @user_taxi_call.destroy\n respond_to do |format|\n format.html { redirect_to user_taxi_calls_url, notice: 'User taxi call was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n \n keystone.delete_tenant(keystone.get_tenant(params[:id])[:id])\n\n respond_to do |format|\n format.html { redirect_to tenants_url }\n format.json { head :ok }\n end\n end", "def destroy\n @invoice_status = InvoiceStatus.find(params[:id])\n @invoice_status.destroy\n\n respond_to do |format|\n format.html { redirect_to invoice_statuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice = current_organization.invoices.find(params[:id])\n @invoice.destroy\n \n redirect_to(invoices_url)\n end", "def delete_array_for_tenant(args = {}) \n delete(\"/tenants.json/#{args[:tenantId]}/arrays/#{args[:arrayId]}\", args)\nend", "def destroy\n @invoice_line_item.destroy\n respond_to do |format|\n format.html { redirect_to invoice_line_items_url, notice: 'Invoice line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sale_invoice = SaleInvoice.find(params[:id])\n @sale_invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to monthly_movement_sale_invoices_url }\n format.json { head :ok }\n end\n end", "def destroy\n @invoice_line_item = InvoiceLineItem.find(params[:id])\n @invoice_line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to invoice_line_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice_header = InvoiceHeader.find(params[:invoice_header_id])\n @payment = @invoice_header.payments.find(params[:id])\n @payment.destroy\n\n respond_to do |format|\n format.html { redirect_to invoice_payments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @taxon_attribute = TaxonAttribute.find(params[:id])\n @taxon_attribute.destroy\n\n respond_to do |format|\n format.html { redirect_to taxon_attributes_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @service_invoice.destroy\n respond_to do |format|\n format.html { redirect_to service_invoices_url, notice: 'Service invoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_index\n @customer = Customer.with_deleted.find(params[:id])\n if params[:type]=='normal'\n @customer.delete\n elsif params[:type]=='restore'\n @customer.restore\n @customer.update(deleted_at: nil)\n end\n\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_path, notice: 'Customer was successfully removed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice_type.destroy\n end", "def destroy\n @pln_invoice.destroy\n respond_to do |format|\n format.html { redirect_to pln_invoices_url, notice: 'pln_invoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def deleteEntityPayment_type( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/payment_type\",params)\n end", "def destroy\n @gstr_advance_receipts = GstrAdvanceReceipt.find_by_id_and_company_id(params[:id], @company.id)\n @gstr_advance_receipts.delete_gstr_one_entry \n @gstr_advance_receipts.delete\n respond_to do |format|\n @gstr_advance_receipts.register_delete_action(request.remote_ip, @current_user, 'deleted')\n format.html { redirect_to(gstr_advance_receipts_url, :notice =>\"Gstr Advance Receipt has been succesfully deleted\") }\n format.xml {head :ok}\n \n end\n end", "def delete_user_for_tenant(args = {}) \n delete(\"/tenants.json/#{args[:tenantId]}/users/#{args[:userId]}\", args)\nend", "def destroy_rest\n @item_usage = ItemUsage.find(params[:id])\n @item_usage.destroy\n\n respond_to do |format|\n format.html { redirect_to(item_usages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @collection_invoice = CollectionInvoice.find(params[:id])\n @collection_invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to collection_invoices_url }\n format.json { head :no_content }\n end\n end", "def destroy \n\n @user = current_user\n @invoice = @user.invoices.find(params[:id])\n @invoice.destroy \n\n redirect_to invoices_path \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 delete endpoint\n do_request :delete, endpoint\n end" ]
[ "0.78110135", "0.707769", "0.69402087", "0.6878605", "0.68302184", "0.6818329", "0.6697505", "0.6692188", "0.66610616", "0.6653193", "0.6630542", "0.6627586", "0.6627586", "0.6627586", "0.6627586", "0.66273725", "0.6596463", "0.6591103", "0.6579143", "0.6578022", "0.65642375", "0.65514004", "0.6547953", "0.6546843", "0.65452504", "0.6509236", "0.64985734", "0.6496442", "0.6488475", "0.64868426", "0.64510286", "0.64175", "0.64141613", "0.64113975", "0.6402057", "0.6398089", "0.63980085", "0.63924557", "0.6390302", "0.63856786", "0.63856786", "0.63856786", "0.63856786", "0.63856786", "0.6376791", "0.63717145", "0.63669676", "0.63563406", "0.63419783", "0.63325983", "0.63325983", "0.63325983", "0.63325983", "0.63325983", "0.63325983", "0.63325983", "0.63325983", "0.63325983", "0.63325983", "0.63325983", "0.6329015", "0.6322917", "0.6318397", "0.6313457", "0.630443", "0.62873673", "0.6278528", "0.6272976", "0.6233396", "0.6226037", "0.62168103", "0.6206268", "0.61996996", "0.6199503", "0.6199503", "0.6199503", "0.6199503", "0.61838406", "0.6171899", "0.61661226", "0.6163624", "0.61627334", "0.6161984", "0.6156789", "0.6150127", "0.6141255", "0.613259", "0.61276126", "0.61264277", "0.6125951", "0.61176324", "0.61121225", "0.61120534", "0.61005557", "0.60954344", "0.6093065", "0.6091203", "0.60895175", "0.6089032", "0.6084989" ]
0.7698269
1
def currency params['LMI_'] end def status params['LMI_'] end
def payer_purse params['LMI_PAYER_PURSE'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def currency\n\tparams['mc_currency']\n end", "def currency\n params['mc_currency']\n end", "def currency\n params['mc_currency']\n end", "def currency; end", "def currency; end", "def currency\n params[\"Currency\"]\n end", "def currency\n params['currency']\n end", "def currency\n params['list_currency']\n end", "def currency\n @ipn['mc_currency']\n end", "def ot_currency_code\n end", "def currency\n 'INR'\n end", "def currency\n 'INR'\n end", "def currency_code\n @currency_code\n end", "def status\n\tparams['payment_status']\n end", "def currency\n \"EUR\"\n end", "def currency_code\n h.e_system_currency\n end", "def currency\n \"USD\"\n end", "def view_liability\n @liabilities = Liability.find(:all, :conditions => 'is_deleted = 0')\n @currency_type = currency\n end", "def get_Currency()\n \t return @outputs[\"Currency\"]\n \tend", "def gross\n params['LMI_PAYMENT_AMOUNT']\n end", "def currency\n params['X-CURRENCY']\n end", "def get_CurrencyCode()\n \t return @outputs[\"CurrencyCode\"]\n \tend", "def currency\n\t\t\"USD\"\n\tend", "def currency\n nil\n end", "def currency\n nil\n end", "def price_by_status(status)\n case status\n when \"medic\"\n return 270\n when \"interne\"\n return 126\n when \"interim\"\n return 480\n else\n return 0\n end\nend", "def currency\n 'usd'\n end", "def currency=(currency)\n validator = EnumAttributeValidator.new('String', [\"UNKNOWN_CURRENCY\", \"AED\", \"AFN\", \"ALL\", \"AMD\", \"ANG\", \"AOA\", \"ARS\", \"AUD\", \"AWG\", \"AZN\", \"BAM\", \"BBD\", \"BDT\", \"BGN\", \"BHD\", \"BIF\", \"BMD\", \"BND\", \"BOB\", \"BOV\", \"BRL\", \"BSD\", \"BTN\", \"BWP\", \"BYR\", \"BZD\", \"CAD\", \"CDF\", \"CHE\", \"CHF\", \"CHW\", \"CLF\", \"CLP\", \"CNY\", \"COP\", \"COU\", \"CRC\", \"CUC\", \"CUP\", \"CVE\", \"CZK\", \"DJF\", \"DKK\", \"DOP\", \"DZD\", \"EGP\", \"ERN\", \"ETB\", \"EUR\", \"FJD\", \"FKP\", \"GBP\", \"GEL\", \"GHS\", \"GIP\", \"GMD\", \"GNF\", \"GTQ\", \"GYD\", \"HKD\", \"HNL\", \"HRK\", \"HTG\", \"HUF\", \"IDR\", \"ILS\", \"INR\", \"IQD\", \"IRR\", \"ISK\", \"JMD\", \"JOD\", \"JPY\", \"KES\", \"KGS\", \"KHR\", \"KMF\", \"KPW\", \"KRW\", \"KWD\", \"KYD\", \"KZT\", \"LAK\", \"LBP\", \"LKR\", \"LRD\", \"LSL\", \"LTL\", \"LVL\", \"LYD\", \"MAD\", \"MDL\", \"MGA\", \"MKD\", \"MMK\", \"MNT\", \"MOP\", \"MRO\", \"MUR\", \"MVR\", \"MWK\", \"MXN\", \"MXV\", \"MYR\", \"MZN\", \"NAD\", \"NGN\", \"NIO\", \"NOK\", \"NPR\", \"NZD\", \"OMR\", \"PAB\", \"PEN\", \"PGK\", \"PHP\", \"PKR\", \"PLN\", \"PYG\", \"QAR\", \"RON\", \"RSD\", \"RUB\", \"RWF\", \"SAR\", \"SBD\", \"SCR\", \"SDG\", \"SEK\", \"SGD\", \"SHP\", \"SLL\", \"SOS\", \"SRD\", \"SSP\", \"STD\", \"SVC\", \"SYP\", \"SZL\", \"THB\", \"TJS\", \"TMT\", \"TND\", \"TOP\", \"TRY\", \"TTD\", \"TWD\", \"TZS\", \"UAH\", \"UGX\", \"USD\", \"USN\", \"USS\", \"UYI\", \"UYU\", \"UZS\", \"VEF\", \"VND\", \"VUV\", \"WST\", \"XAF\", \"XAG\", \"XAU\", \"XBA\", \"XBB\", \"XBC\", \"XBD\", \"XCD\", \"XDR\", \"XOF\", \"XPD\", \"XPF\", \"XPT\", \"XTS\", \"XXX\", \"YER\", \"ZAR\", \"ZMK\", \"ZMW\", \"BTC\"])\n unless validator.valid?(currency)\n fail ArgumentError, \"invalid value for 'currency', must be one of #{validator.allowable_values}.\"\n end\n @currency = currency\n end", "def currency_unit\n @currency_unit\n end", "def amount\n params['amount_net']\n end", "def get_rate(currency_iso_from, currency_iso_to); 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 fetch_currency_rate(currency_type)\n if currency_type == \"EUR\"\n product_price_details\n else\n fetch_updated_currency_rate(currency_type)\n end\n end", "def payment_term; end", "def get_currency_name\n self.le_currency.nil? ? \"\" : self.le_currency.name\n end", "def currency_code\n data.currency_code\n end", "def currency\n @currency ||= 'AUD'\n end", "def currency_m_params\n params.require(:currency_m).permit(:currency_cd, :currency_sign, :currency_name, :currency_name_e, :currency_unit, :currency_unit_e)\n end", "def marital_status; end", "def set_currency\n self.currency = self.job.currency\n end", "def fetch_updated_currency_rate(currency_type)\n currency_rate = nil\n ApplicationController.new.fetch_currency_rates.select{ |currency| currency_rate = currency if currency[:currency] == currency_type }\n if currency_rate.present?\n actual_price = price.to_f * currency_rate[:rate].to_f\n currency_details = {:currency => currency_type, :price => actual_price.round(2)}\n else\n currency_details = product_price_details\n end\n currency_details\n end", "def gross\n params['mc_amount1'] || params['mc_amount2'] || params['mc_amount3']\n end", "def with_currency(new_currency); end", "def currency_code\n hash[\"CurrencyCode\"]\n end", "def stock_market; end", "def currency\n :TWD\n end", "def payment_currency\n\t\t\t\t\treturn \"cs\"\n\t\t\t\tend", "def transaction_status\n params['status']\n end", "def gross\n params['amount']\n end", "def gross\n params['amount']\n end", "def gross\n params['amount']\n end", "def get_current_currency\r\r\n $game_party.current_currency[:sym]\r\r\n end", "def add_level2_information(params)\r\n @PARAM_HASH['LV2_ITEM_TAX_RATE'] = params[:tax_rate] || ''\r\n @PARAM_HASH['LV2_ITEM_GOODS_TAX_RATE'] = params[:goods_tax_rate] || ''\r\n @PARAM_HASH['LV2_ITEM_GOODS_TAX_AMOUNT'] = params[:goods_tax_amount] || ''\r\n @PARAM_HASH['LV2_ITEM_SHIPPING_AMOUNT'] = params[:shipping_amount] || ''\r\n @PARAM_HASH['LV2_ITEM_DISCOUNT_AMOUNT'] = params[:discount_amount] || ''\r\n @PARAM_HASH['LV2_ITEM_CUST_PO'] = params[:cust_po] || ''\r\n @PARAM_HASH['LV2_ITEM_GOODS_TAX_ID'] = params[:goods_tax_id] || ''\r\n @PARAM_HASH['LV2_ITEM_TAX_ID'] = params[:tax_id] || ''\r\n @PARAM_HASH['LV2_ITEM_CUSTOMER_TAX_ID'] = params[:customer_tax_id] || ''\r\n @PARAM_HASH['LV2_ITEM_DUTY_AMOUNT'] = params[:duty_amount] || ''\r\n @PARAM_HASH['LV2_ITEM_SUPPLEMENTAL_DATA'] = params[:supplemental_data] || ''\r\n @PARAM_HASH['LV2_ITEM_CITY_TAX_RATE'] = params[:city_tax_rate] || ''\r\n @PARAM_HASH['LV2_ITEM_CITY_TAX_AMOUNT'] = params[:city_tax_amount] || ''\r\n @PARAM_HASH['LV2_ITEM_COUNTY_TAX_RATE'] = params[:county_tax_rate] || ''\r\n @PARAM_HASH['LV2_ITEM_COUNTY_TAX_AMOUNT'] = params[:county_tax_amount] || ''\r\n @PARAM_HASH['LV2_ITEM_STATE_TAX_RATE'] = params[:state_tax_rate] || ''\r\n @PARAM_HASH['LV2_ITEM_STATE_TAX_AMOUNT'] = params[:state_tax_amount] || ''\r\n @PARAM_HASH['LV2_ITEM_BUYER_NAME'] = params[:buyer_name] || ''\r\n @PARAM_HASH['LV2_ITEM_CUSTOMER_REFERENCE'] = params[:customer_reference] || ''\r\n @PARAM_HASH['LV2_ITEM_CUSTOMER_NUMBER'] = params[:customer_number] || ''\r\n @PARAM_HASH['LV2_ITEM_SHIP_NAME'] = params[:ship_name] || ''\r\n @PARAM_HASH['LV2_ITEM_SHIP_ADDR1'] = params[:ship_addr1] || ''\r\n @PARAM_HASH['LV2_ITEM_SHIP_ADDR2'] = params[:ship_addr2] || ''\r\n @PARAM_HASH['LV2_ITEM_SHIP_CITY'] = params[:ship_city] || ''\r\n @PARAM_HASH['LV2_ITEM_SHIP_STATE'] = params[:ship_state] || ''\r\n @PARAM_HASH['LV2_ITEM_SHIP_ZIP'] = params[:ship_zip] || ''\r\n @PARAM_HASH['LV2_ITEM_SHIP_COUNTRY'] = params[:ship_country] || ''\r\n end", "def get_price\n item_prc_1\n end", "def get_currency_name\n \"euro\"\n end", "def status\n params['payer_status']\n end", "def currency\n money.currency\n end", "def gross\n params['amount']\n end", "def gross\n params['amount']\n end", "def set_currency_m\n @currency_m = CurrencyM.find(params[:id])\n end", "def low_alrm; catdet.form(:name, 'rpcControlApsSettingForm').text_field(:name, 'ecThresholdLoAlmLN'); end", "def show\n @status = bill_status\n end", "def rates; end", "def rates; end", "def transaction_status\n params['status']\n end", "def gross\r\n params['Amt']\r\n end", "def currency\n raise 'Redefine this method in your billing model.'\n end", "def currency\n raise 'Redefine this method in your billing model.'\n end", "def convert_to_renmibi(amount, currency)\n conversion_rate = {\n baht: 4.96,\n rupiah: 2176.96,\n aud: 0.2,\n hkd: 1.24,\n vnd: 3598.63,\n }\n amount / conversion_rate[currency.to_sym]\nend", "def find_rate()\n uri_string = \"https://free.currconv.com/api/v7/convert?q=GBP_\"\\\n \"#{@currency}&compact=ultra&apiKey=2d46a9b5b650dca0dbb1\"\n uri = URI(uri_string)\n res = Net::HTTP.get_response(uri)\n return(JSON.parse(res.body)[\"GBP_#{@currency}\"]/100.0)\n end", "def get_merchant_status\n\t\tstatus = 'Pending'\n\t\tif self.paid?\n\t\t\tstatus = \"Paid\"\n\t\telsif self.fullfilled?\n\t\t\tstatus = \"Fullfilled\"\n\t\telsif self.cancelled?\n\t\t\tstatus = \"Cancelled\"\n\t\tend\n\t\tstatus\n\tend", "def credit_card_type; end", "def commission\n get 'commission'\n end", "def payment_status\n payment[\"status\"]\n end", "def online_special_ballot\n end", "def new\n @trade_log = TradeLog.new\n \n #TODO delete\n p \"--------------------tradelog new\"\n p params\n \n @ui_id = params[:ui_id]\n \n if params[:ui_baseCurrency] == \"JPY\" then\n @ui_baseCurrency = \"jpy\"\n else\n @ui_baseCurrency = \"fc\"\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @trade_log }\n end\n end", "def amount\n params['amount']\n end", "def get_vnic_lcp_status_by_moid_with_http_info(moid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VnicApi.get_vnic_lcp_status_by_moid ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling VnicApi.get_vnic_lcp_status_by_moid\"\n end\n # resource path\n local_var_path = '/api/v1/vnic/LcpStatuses/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.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', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\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] || 'VnicLcpStatus'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"VnicApi.get_vnic_lcp_status_by_moid\",\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: VnicApi#get_vnic_lcp_status_by_moid\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def gross\n params['p24_amount']\n end", "def preferred_currency\n Reji.configuration.currency\n end", "def status\n if params['payment_status'] == \"COMPLETE\"\n \"Completed\"\n else\n \"Failed\"\n end\n end", "def pay_status_paypal\n\n end", "def product_price_details\n {:currency => 'EUR', :price => price}\n end", "def gross\n params['Amt']\n end", "def value\r\r\n @currency[:amount]\r\r\n end", "def amount\n case mode\n when 'set', 'fixed' then money\n when 'percentage' then percentage\n end\n end", "def set_currency\n @currency = Currency.find(params[:id])\n end", "def in(arg)\n \t\tconcurrency = arg.to_s.gsub( /s$/, '')\n \t\t(concurrency.to_s == \"dollar\")?self.send(arg.to_s):self/@@currencies[concurrency]\n \tend", "def get_currency_symbol\n self.le_currency.nil? ? \"\" : self.le_currency.display_symbol\n end", "def get_currency_symbol\n self.le_currency.nil? ? \"\" : self.le_currency.display_symbol\n end", "def set_currency_m_excng_rate\n @currency_m_excng_rate = CurrencyMExcngRate.find(params[:id])\n end", "def rate_key_for(currency_iso_from, currency_iso_to); end", "def set_secured_constants\n @pur_balance = 500.0 #revolving purchase balance\n @cash_balance = 0.0 #cash balance balance\n @duration = 8.0 #number of months someone keeps the secured car, ad decimal so not integer \n end", "def [](currency)\n return moneys[currency]\n end", "def status\n if params['fraud_status'] == 'pass' || params['credit_card_processed'] == 'Y'\n 'Completed'\n elsif params['fraud_status'] == 'wait'\n 'Pending'\n else\n 'Failed'\n end\n end", "def support(ibel)\n return ibel.payment_mode unless ibel.payment_mode =~ /(bank|cash)_\\d+/\n vals = ibel.payment_mode.split('_')\n case vals[0]\n when 'bank' then BankAccount.find(vals[1]).nickname\n when 'cash' then 'Caisse ' + Cash.find(vals[1]).nickname\n else \n ''\n end\n end", "def contractual_labour_params\n params.require(:contractual_labour).permit(:date, :contract_name, :contractor_id, :site_id, :quantity, :unit, :rate, :amount, :gst_rate, :gst_cost, :tds_rate, :tds_cost, :created_by)\n end", "def invoice #TODO need to be improve and confirmation with Client\n\tconnectiontype.amount\nend", "def gross\n params['Amount']\n end", "def gross\n params['Amount']\n end", "def new\n @currency = params[:currency]\n @currency_value = params[:currency_value]\n @crypto_id = params[:crypto_id]\nend" ]
[ "0.6754048", "0.6479198", "0.6479198", "0.6449263", "0.6449263", "0.64375824", "0.6390127", "0.63760954", "0.62762517", "0.62701654", "0.626312", "0.6195843", "0.60416603", "0.6033001", "0.59466124", "0.5935416", "0.5933379", "0.5917889", "0.59104294", "0.58979976", "0.5859151", "0.5827161", "0.58194125", "0.57610416", "0.57610416", "0.5750092", "0.5731968", "0.57204586", "0.57162607", "0.5701476", "0.5693617", "0.563566", "0.56313765", "0.5609701", "0.5591027", "0.5588258", "0.5561464", "0.5560639", "0.553584", "0.5526632", "0.55262893", "0.55250967", "0.5488276", "0.54512185", "0.54391265", "0.5435509", "0.5423886", "0.5417602", "0.53945655", "0.53945655", "0.53945655", "0.5393799", "0.5383045", "0.5367172", "0.53668696", "0.53621936", "0.53537196", "0.5351916", "0.5351916", "0.5349376", "0.5336804", "0.5336526", "0.5335569", "0.5335569", "0.5326308", "0.5325557", "0.5321076", "0.5321076", "0.53203815", "0.5315235", "0.5302411", "0.5300039", "0.5299736", "0.52957785", "0.5294982", "0.52937543", "0.52925116", "0.5289617", "0.5282326", "0.52726865", "0.5270187", "0.52671957", "0.52570254", "0.52542865", "0.52537197", "0.52448815", "0.52407056", "0.52330065", "0.5230732", "0.5230732", "0.5222987", "0.5220791", "0.5217555", "0.5216965", "0.52066624", "0.5205879", "0.52056664", "0.52010345", "0.5200702", "0.5200702", "0.51986915" ]
0.0
-1
the money amount we received in X.2 decimal.
def gross params['LMI_PAYMENT_AMOUNT'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def amount\n\n @amount_bigdecimal.to_f.round(2)\n\n end", "def to_money amount\n\t\t\tamount.to_f.round(2) rescue 0.0\n\t\tend", "def net_amount\n ((transaction_value - 0.2) / 1.034).floor_with_two_decimal_places\n end", "def money\n Money.from_amount(amount.to_f)\n end", "def real_amount()\n Bankjob.string_to_float(amount, @decimal)\n end", "def payment\n number_with_precision(amount, :precision => 2 )\n end", "def money(amount)\n number_to_currency amount.to_s, {:unit => 'R ', :delimiter => ',', :seperator => '.'}\n end", "def money\n to_d.money.to_s\n end", "def money\n to_d.money.to_s\n end", "def money\n\t\tif @wallet.neg?\n\t\t\t@in_debt = true\n\t\tend\n\t\treturn @wallet.amount\n\tend", "def to_f\n return @amount.to_f\n end", "def to_f\n @amount.to_f\n end", "def amount\n data['amount'].to_f / 100\n end", "def amount_in_cents\r\n read_attribute(:amount) \r\n end", "def inspect\n\n \"#{'%.02f' % (@amount_bigdecimal)} #{@currency}\"\n\n end", "def activemerchant_amount\n (amount * 100).to_i\n end", "def to_f\n amount.to_f\n end", "def raised_amount\n raised_currency_code =~ /USD/i && raw_raised_amount || BigDecimal.new('0')\n end", "def prepare_amount amount\n BigDecimal.new(amount)/100\n end", "def loan_amt\n (self.buying_price*1000) * (1 - (self.deposit/100))\n end", "def price\n MoneyUtils.format(self.price_basis)\n end", "def amount_cents \n (self.amount.to_f * 100).round.to_i\n end", "def to_f\n @amount.to_f\n end", "def money(amount)\n Money.new((amount * 100).to_i)\n end", "def acc_balance\n @page.css(\"span[data-semantic = 'header-available-balance-amount']\").text.to_money.to_f\n end", "def show_decimal_budget()\n return Money.convert_to_decimal_string(@budget)\n end", "def eth_portfolio\n return @@client.accounts[1].balance.amount.to_f\n end", "def amount\n v = state[:amount] and BigDecimal(v.to_s)\n end", "def amount\n money.format(symbol: false)\n end", "def tobeamount(obj)\n\t\tif obj.to_s =~ /(\\d+)([.]\\d{1,2})?/\n\t\t\tamt = $1 + ($2 || '.00')\n\t\t\treturn amt.to_f\n\t\tend\n\t\treturn nil\n\tend", "def outstanding_payment_amount\n (total - amount_paid).round(2)\n end", "def balance_btc_ui\n balance_btc.to_f * 10 ** -8\n end", "def money(m)\n \"#{m.format(symbol: false)} #{m.currency.to_s}\"\n end", "def value\r\r\n @currency[:amount]\r\r\n end", "def money\n end", "def extract_amount(value)\n value.match(/[\\d.,]*\\d+[.,]\\d+/)[0].gsub(/[.,]/,'').to_f/100\n end", "def to_dollar(amount)\n # round_to(@balance)\n format('%.2f', amount)\n end", "def tip_amount (bill_amount)\n\treturn bill_amount * (0.2)\nend", "def get_vat_decimal\n case company_business_type\n when 'Rekisteröity yhdistys'\n BigDecimal.new('0')\n else\n BigDecimal.new('0.10') # 10 %\n end\n end", "def get_vat_decimal\n case company_business_type\n when 'Rekisteröity yhdistys'\n BigDecimal.new('0')\n else\n BigDecimal.new('0.10') # 10 %\n end\n end", "def format_balance\n format(\"%.2f\", balance.to_f)\n end", "def convert_money(currency)\n return currency.to_f / 100\n # if currency.to_s.include?(\".\")\n # return currency\n # else\n # return currency.to_f / 100\n # end\n end", "def net_total\n net_total_base.round(2)\n end", "def to_price(amount)\n amount.to_s.gsub(/[^\\d]/, \"\").gsub(/^(\\d+)(\\d{2})$/, '\\1.\\2').to_f\n end", "def to_price(amount)\n amount.to_s.gsub(/[^\\d]/, \"\").gsub(/^(\\d+)(\\d{2})$/, '\\1.\\2').to_f\n end", "def balance_inquiry\n \"$#{'%.2f' % @balance}\"\n end", "def money\n Spree::Money.new(amount, { currency: currency })\n end", "def price_in_cents\n\t\tInteger(price * 100 + 0.50)\n\tend", "def parse_amount_owed text_amount\n (parse_amount_cents text_amount).abs\n end", "def to_s\n s = sprintf(\"%0.#{@currency.decimal_places}f\", amount)\n s.gsub(\".\", decimal_mark)\n end", "def dollars\n to_f\n end", "def dollars\n to_f\n end", "def dollars\n to_f\n end", "def money(number)\n return number_to_currency(number, :format => \"%n\")\n end", "def price_in_cents\n\t\tInteger(@price*100 + 0.5)\n\tend", "def price\n b = read_attribute(:price)\n b.to_d * User.current.currency.exchange_rate.to_d\n end", "def to_d\n amount\n end", "def cents\n (amount * 100).to_i\n end", "def to_ps_money\n return nil if self.nil?\n return \"00\" if self.to_f == 0\n \n value = self.to_s\n\n # obtem a parte fracionaria e transforma em string.\n frac = value.to_f - value.to_i\n frac = frac.to_s + \"0\" \n frac = frac[2..3]\n # Se tiver parte inteira, concatena com a parte fracionaria\n inteiro = \"\"\n inteiro = value.to_i.to_s if value.to_f.truncate > 0\n inteiro + frac\n end", "def price\n BigDecimal('3.0')\n end", "def amount\n result = 0\n if gateway_mode === :test\n result = 1000\n else\n result = (@order.price * 100)\n end\n result.to_i\n end", "def cost_in_dollars\n self.cost / 100.to_f\n end", "def dollars\n cents.to_f / 100\n end", "def money; end", "def gross\n \"%.2f\" % params['amount'].to_f\n end", "def amount_in_cents(amount)\n (100 * amount).to_i\n end", "def conv_exchange_rate\n currency_exchange.exchange_rate\n end", "def amount_in_cents\n return 0 if amount.nil?\n (amount * 100).to_i\n end", "def donation_amount\n number_to_currency(self.value)\nend", "def pending_balance_display\n number_to_currency(pending_balance)\n end", "def currency\n money.currency\n end", "def acc_currency\n @page.css(\"span[data-semantic = 'header-available-balance-amount']\").text.to_money.currency.to_s\n end", "def price_in_cents\n\t\tInteger(price * 100 + 0.5)\n\tend", "def dollar_total\n total / 100.0\n end", "def total_amount_to_s\n \"%0.2f\" % total_amount\n end", "def prettymoney(amount)\n '$%.2f' % cents_to_dollars(amount).to_s\n end", "def price\n BigDecimal('5.0')\n end", "def transaction_amount(currency_and_amount)\n currency = parse(currency_and_amount).first\n if currency == 'USD'\n amount = parse(currency_and_amount).last.to_f\n else\n amount = currency.to_f unless amount == 0.0\n end\n# self.amount = amount \n end", "def price_in_cents\n Integer(price*100 + 0.5)\n end", "def host_fee\n (total - net_rate).round(2)\n end", "def total_in_dollars_and_cents\n total.to_f / 100\n end", "def converted_amount(other)\n (currency == other.currency ? other : other.convert_to(currency)).amount.to_f\n end", "def value\n BigDecimal.new(@value / 100.0, 2)\n end", "def merchant_amount_usd\n payload[:merchant_amount].to_d\n end", "def balance\n b = read_attribute(:balance)\n if User.current and User.current.currency\n b.to_d * User.current.currency.exchange_rate.to_d\n else\n b.to_d\n end\n end", "def cents; end", "def price_amount_micros\n @subscription_purchase.price_amount_micros\n end", "def to_amount(value, currency)\n to_bigdecimal(value).round(precision(currency))\n end", "def to_i\n @amount.to_i\n end", "def formatted_price\n price_in_dollars = price_in_cents.to_f / 100\n sprintf(\"%.2f\", price_in_dollars) # <= What's all this business?\n end", "def current_balance\n \"EUR. #{sprintf('%.2f', bankaccount.reload.balance)}\"\n end", "def amount_i\n @amount\n end", "def ToDonate (pay_amount)\n\tdecimal = pay_amount.modulo(1).round(2)\n\tif decimal < 0.50\n\t\tto_donate = 0.50-decimal\n\telsif decimal < 1.00\n\t\tto_donate = 1.00 - decimal\n\telse \n\t\tto_donate = 0;\n\tend\n\tto_donate = (to_donate).round(2)\nend", "def net_sales_as_decimal\n net_sales[1..-1].to_d\n end", "def to_btc(value)\n value.to_f\n end", "def inspect\n \"#{\"%0.02f\" % @amount} #{@base_currency}\"\n end", "def effective_total\n total = effective_total_money\n \"#{total.currency} #{total.format}\"\n end", "def actual_balance\n if previous.present?\n previous.balance_amount_with_sign\n else\n 0\n end\n end", "def get_amount\n\t\t@amount\n\tend", "def price_in_cents\n Integer( price * 100 + 0.5 ) # +0.5 Because floating-point numbers don’t always have an exact internal representation.\n end" ]
[ "0.78914285", "0.7725167", "0.7674643", "0.7433044", "0.74169904", "0.7289542", "0.7232396", "0.7205436", "0.7205436", "0.7170664", "0.7007064", "0.6989314", "0.6945581", "0.6920465", "0.6910944", "0.6903187", "0.6833638", "0.682911", "0.68197745", "0.68075484", "0.6800406", "0.679496", "0.67615753", "0.67571074", "0.6733424", "0.6731872", "0.67297894", "0.672399", "0.6715234", "0.6711396", "0.6701039", "0.6696044", "0.66881484", "0.6671487", "0.665865", "0.66441184", "0.66427565", "0.66415274", "0.6638994", "0.6638994", "0.6638172", "0.6625517", "0.6621533", "0.66203797", "0.66203797", "0.66186243", "0.66098017", "0.6609263", "0.6602081", "0.66006863", "0.65918094", "0.65918094", "0.65918094", "0.65914804", "0.6588089", "0.6586679", "0.6581862", "0.6580786", "0.65731883", "0.6568218", "0.65566725", "0.65536565", "0.65512484", "0.6537982", "0.6531201", "0.65307", "0.6524322", "0.65228164", "0.6512136", "0.6511816", "0.6504961", "0.6490189", "0.6487246", "0.6479618", "0.6472839", "0.64714724", "0.64706016", "0.64652365", "0.6455174", "0.6441893", "0.64338225", "0.64315856", "0.6429537", "0.6421806", "0.6407841", "0.6405234", "0.64038235", "0.6400574", "0.6396413", "0.63889605", "0.63881373", "0.63828963", "0.63811445", "0.6377775", "0.6375185", "0.6374518", "0.6371839", "0.6368199", "0.63679004", "0.6364315" ]
0.63956547
89
Notify all connection listeners, that a notice message was received.
def handle(context) # Notify all connection listeners by calling their on_server_response method. super(context) # Notify all connection listeners by calling their on_notice method. notify(context) do |connection_listener| connection_listener.on_notice(context, context.lookup_user(nick), message) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notify(context)\n \n context.connection_listeners.each do |connection_listener|\n yield connection_listener\n end\n \n end", "def notify_observers(*args)\n return unless changed?\n\n unwrap(connection).exec \"NOTIFY #{channel}, #{args}\"\n\n changed false\n end", "def on_notice(connection, user, message)\n end", "def notify\n @subscribers.each { |ident, (block,obj)| block.call(obj) }\n end", "def notify(notice)\n if @config.use_dogapi?\n notify_dogapi_event(notice) if @config.send_event\n notify_dogapi_metric(notice) if @config.send_metric\n end\n if @config.use_statsd?\n notify_statsd_event(notice) if @config.send_event\n notify_statsd_metric(notice) if @config.send_metric\n end\n end", "def notify_all(notifier_keys)\n Thread.start(notifier_keys) do |keys|\n sleep 1 # let the call to #listen occur\n keys.each do |key|\n DB.run DB[\"NOTIFY #{key.inspect}\"].sql\n end\n end\n end", "def inform(msg)\n @observers.each do |o|\n o.notify msg, self\n end\n end", "def notify_subscribers\n NotificationSubscription.notify(self)\n end", "def notify_listeners(event)\n @listeners.each { |listener| listener.handle_delivery(event) }\n end", "def notify\n puts 'Subject: Notifying observers...'\n @observers.each { |observer| observer.update(self) }\n end", "def notify\n socket.write('x')\n end", "def on_notice(&block)\n @notice_handler = block\n end", "def channel_notice(chan, notice)\n @connection.send(\"NOTICE #{chan} :#{notice}\")\n end", "def broadcast message\n @clients.keys.each do |key|\n notify key, message\n end\n end", "def notify\n changed(true)\n notify_observers(self)\n end", "def notify\n end", "def notify(message)\n client.register(nick)\n client.notify(message)\n client.quit\n\n puts \"New message has been notified on IRC: #{message}\"\n end", "def notify(players, notice = Notices::Notice.new)\n send @notice_order, players, notice do |player, notice|\n yield player, notice\n end\n end", "def notify_observers\n\t\[email protected] do |observer|\n\t\t\tobserver.update(self)\n\t\tend\n\tend", "def notify_all_players(command, args)\n client_socket.game.each_player do |player|\n player.send_command(command, *args)\n end\n end", "def handle(context)\n \n # Notify all connection listeners by calling their on_server_response method.\n super(context)\n \n # Notify all connection listeners by calling their on_ping method.\n notify(context) do |connection_listener| \n connection_listener.on_ping(context, servers)\n end\n\n end", "def notify(msg)\n\n waiters, observers = @services.select { |n, s|\n s.respond_to?(:on_msg)\n }.sort_by { |n, s|\n n\n }.partition { |n, s|\n s.respond_to?(:wait_for)\n }\n\n (observers + waiters).each { |n, s| s.on_msg(msg) }\n end", "def notify(new_user)\n self.users.each do |user|\n if user.id != new_user.id\n SocketController.user_joined(user, new_user)\n end\n end\n end", "def notify_clients\n http_post(body: {data: @pids.to_json})\n end", "def notify client_id, message\n if [email protected]_key? client_id\n App.log.warn \"(#{message.to_str.chomp}) ⎇ [Client not reachable] added to DLQ\"\n\n @dlq.add message, :client_not_reachable\n @clients.delete client_id\n else\n App.log.info \"(#{message.to_str.chomp}) ► [Notify] Success!\", :green\n @clients[client_id].puts message.to_str\n end\n end", "def notify\n KeySpace.times do |position|\n do_notify(position)\n end\n end", "def notify_game_change\n connection.execute \"NOTIFY #{channel}, #{connection.quote self.to_s}\"\n end", "def notify\n {\n }\n end", "def notify\n {\n }\n end", "def connection_completed\n ## start sending KEEP_ALIVE_MESSAGE\n puts 'sending keep_alive sending ...'\n EM::PeriodicTimer.new(KEEP_ALIVE_INTERVAL) { send_data KEEP_ALIVE_MESSAGE }\n end", "def do_NOTICE(u, msg)\n ircsend(\":#{@server.sid}AAAAAA NOTICE #{u.is_a?(User) ? u.uid : u} :#{msg}\", @conn)\n end", "def notify( event, *args )\n @subscribers.values.each { |b| b.call(event, *args) }\n end", "def notify(*args)\n subscribers.values.each { |subscriber| subscriber.call(*args) }\n end", "def broadcast( msg )\n @clients.each do |client|\n client.sock.puts \"Announce: #{msg}\"\n end\n log( \"[broadcast] #{msg}\" )\n end", "def notification\n request.websocket do |ws|\n ws.onopen do\n settings.sockets << ws\n end\n notifications\n ws.onclose do\n settings.sockets.delete(ws)\n end\n end\n end", "def on_connection_interruption(&block)\n self.redefine_callback(:after_connection_interruption, &block)\n end", "def notify\n raise NotImplementedError\n end", "def inform_obeservers\n\t\[email protected] { |observer| observer.update(self) }\n\tend", "def notify_ready\n notify(\"READY=1\")\n end", "def notify_all\n if @size > 0\n @report << \"#{@size} abonnement(s) à notifier\"\n do_notify_all\n @report << Registry.report_missed_notifications\n else\n @report << 'Pas de notification à faire'\n end\n @report\n end", "def notify\n {}\n end", "def notify\n {}\n end", "def notify\n {}\n end", "def notice(t, m)\n @socket << \"NOTICE #{t} :#{m}\"\n end", "def on_pong(connection, daemons)\n end", "def notify(&block)\n @notify_blocks << block\n end", "def notify_subscribers\n AdminMailer.notify_of_standard_change(self)\n end", "def send_notification(msg)\n $BLIX_NOTIFY.push(msg)\n puts \"[DummyServer] notify: message=#{msg}\" if $DEBUG\n end", "def on_ping(connection, servers)\n end", "def listen(monitored_paths)\n raise AbstractMethod\n end", "def onotify (channel, *args)\n\n do_notify(:all, channel, *args)\n do_notify(channel, channel, *args)\n end", "def notify_connector\n\t\tConnectionMailer.notify_connector(self).deliver if self.notify_connector_of_success\n\tend", "def on_disconnected\n end", "def on_connected(&block)\n @on_connected_procs << block\n end", "def notify_after_selenese_interpreter_started(interpreter)\r\n for listener in @after_selenese_interpreter_started_listeners\r\n listener.call(interpreter)\r\n end\r\n end", "def notify_listeners(event_name, *args)\n listeners.each_value { |listener|\n if listener.respond_to?(event_name)\n listener.__send__(event_name, *args)\n end\n }\n end", "def notice(to_nick, text)\n split_send(\"NOTICE #{to_nick} :\", text)\n end", "def notify!(mid, *args, **hargs)\n notify(mid, *args, **hargs, sync: true)\n end", "def on_notice\n if (sender.name.downcase == 'nickserv')\n matches = /^STATUS ([^ ]+) ([0-9])$/i.match(argline)\n return if matches.nil?\n username = matches[1]\n status = matches[2]\n if server.nickname.name.downcase == matches[1]\n server.instance_variable_set('@has_nickserv', true)\n server.instance_variable_set('@has_nickserv_status', true)\n else\n autologin(username)\n end\n end\n end", "def notify\n @observers.each { |observer| observer.update }\nend", "def notify_subscribers\n NotifierJob.perform_later(self)\n end", "def notify_observers(*args, &block)\n notify_to(observers, *args, &block)\n self\n end", "def notifier\n @loop_notify.promise\n end", "def notify_listeners(event, args={})\n @listeners.each do |listener|\n if listener.respond_to?(event) && listener.supports?(@name)\n $logger.info(\"Notifying #{listener.class.name} of #{event} event\")\n listener.send(event, args)\n end\n end\n end", "def notify!(mid, *args, **hargs)\n notify(mid, *args, **hargs, sync: true)\n end", "def subscribe_to_notifications(receive_data_srv)\n receive_data_srv.on_notification {|bytes|\n ary= bytes.scan(/../)\n bytes= ary.collect {|hex| hex.to_i(16)}\n cmd= Protocol.find_cmd_by_code(bytes.shift)\n list= @observers[cmd.code]\n unless list.nil?\n list.each { |observer|\n observer.observe(cmd, cmd.rs(bytes))\n }\n end\n }\n end", "def ping_all_sockets\n\t\treturn if self.connections.empty?\n\n\t\tself.log.debug \"Pinging %d connected sockets.\" % [ self.connections.length ]\n\t\tself.connections.each do |sender_id, conn_ids|\n\t\t\tframe = Mongrel2::WebSocket::Frame.new( sender_id, conn_id, '', {}, 'heartbeat' )\n\t\t\tframe.opcode = :ping\n\t\t\tframe.fin = true\n\n\t\t\tself.log.debug \" %s/%d: PING\" % [ sender_id, conn_id ]\n\t\t\tself.conn.reply( frame )\n\t\tend\n\n\t\tself.log.debug \" done with pings.\"\n\tend", "def replicate_notice\n users = case noticeable\n # Notify people who follow a topic\n when Post \n noticeable.topic.monitoring_users\n # Notify people who are the member of a group plus the creator's friends\n when GroupMembership\n (noticeable.group.members + creator.friends).uniq\n when Friendship\n creator.friends.reject {|u| u == noticeable.friend}\n # Notify the friends of the creator\n else\n creator.friends\n end\n self.notify_users(users) if users.size <= App.max_users_to_notify\n end", "def report_ready\n write_verbose_log(\"Notifier #{VERSION} ready to catch errors\", :info)\n end", "def notify_observers(*arg)\n __notify_observers(false, false, *arg)\n end", "def handle(context)\n \n # Notify all connection listeners by calling their on_server_response method.\n super(context)\n \n # Notify all connection listeners by calling their on_join method.\n notify(context) do |connection_listener| \n connection_listener.on_join(context, context.lookup_channel(channel), context.lookup_user(nick)) \n end\n \n end", "def bind_new_listeners!\n NEW_LISTENERS.each { |addr| listen(addr) }\n raise ArgumentError, \"no listeners\" if LISTENERS.empty?\n NEW_LISTENERS.clear\n end", "def notify(params)\n client.post('/notify', params)\n end", "def did_receive_notice(stem, sender, recipient, msg)\n end", "def on_reconnect(&callback)\n @reconnect_cb = callback\n end", "def notice(msg)\n @notices << msg\n blah @notices.last\n end", "def notify\n notify_unmentioned_reviewers\n notify_mentioned_event_staff if mention_names.any?\n end", "def send_notifications\n end", "def on_connected\n end", "def notify(mid, *args, **kwargs)\n @notification_name = mid\n do_notify(*args, **kwargs)\n end", "def send_ping\n @connections.each do |socket|\n begin\n socket << \":\\n\"\n rescue Reel::SocketError\n @connections.delete(socket)\n end\n end\n end", "def notify_observers(symbol, *args)\n @observers.each do |o|\n o.send(symbol, *args) if o.respond_to? symbol\n end\n end", "def notify(*args, **kwargs)\n new.notify(*args, **kwargs)\n end", "def notify_change(method, *args)\n changed\n notify_observers(method, self, *args)\n end", "def on_connection_listener_fetch_loop_received(event)\n listener = event[:caller]\n time = event[:time]\n messages_count = event[:messages_buffer].size\n\n message = \"[#{listener.id}] Polled #{messages_count} messages in #{time}ms\"\n\n # We don't want the \"polled 0\" in dev as it would spam the log\n # Instead we publish only info when there was anything we could poll and fail over to the\n # zero notifications when in debug mode\n messages_count.zero? ? debug(message) : info(message)\n end", "def listen_for_user_messages(username, client)\n loop {\n msg = client.gets.chomp\n # send a braodcast message, a message for all connected users, but not to self\n @connections[:clients].each do |other_name, other_client|\n unless other_name == username\n other_client.puts \"#{username}: #{msg}\"\n end\n end\n }\n end", "def wait_all_sent\n verify_not_closed\n @clients.each do |pub|\n pub.wait_all_sent\n end\n end", "def do_notify_all\n number = tiers_list.size\n @report << \"#{number} mail(s) à envoyer\"\n tiers_list.each do |tiers_id|\n subs = to_be_notified_for(tiers_id)\n done = Notifier.new(tiers_id, subs, @mode).notify\n next if done\n number -= 1\n @report << \"notification impossible pour le tiers #{tiers_id}\"\n end\n @report << \"#{number} mails(s) de notification envoyé(s)\"\n end", "def notify_change\n SpecificNodeMailer.notify_change\n end", "def on_tracker_accept(tracker)\n # Increase number of accepted messages\n @accepted = @accepted + 1\n # If all messages are accepted\n if @accepted == @count\n # Close connection\n tracker.sender.connection.close\n end # if\n end", "def trigger_callbacks_for(msg)\n case msg.message_type\n\n # ----- server messages\n when RPL_WELCOME\n notify :registered_with_server\n when CMD_PING\n notify :server_ping, msg.params[0] # server wants the params back\n when CMD_ERROR\n notify :server_error\n\n # ----- nick-related -----\n when CMD_NICK\n @state[:nick] = msg.params[0] if msg.prefix[:nick] == @state[:nick]\n threaded_notify :nick_changed, msg.prefix[:nick], msg.params[0]\n when ERR_NICKNAMEINUSE\n # nickname errors are deterministic, that is, the client keeps track of the \n # state of attempted nick changes in @state, and the server responds to them\n # in order, so no additional info needs to be sent in the callback.\n # (this is tested)\n notify :nick_in_use\n when ERR_ERRONEUSNICKNAME\n notify :nick_invalid\n\n # ----- channel-related -----\n when CMD_JOIN\n threaded_notify :joined_channel, msg.user, msg.params[0]\n when CMD_PART\n threaded_notify :left_channel, msg.user, msg.params[0], msg.params[1]\n when CMD_QUIT\n threaded_notify :quit_server, msg.user, msg.params[0]\n when RPL_TOPIC # negative indices handle rfc and non-rfc commands\n threaded_notify :topic_changed, msg.params[-2], msg.params[-1], nil\n when CMD_TOPIC\n threaded_notify :topic_changed, msg.params[0], msg.params[1], msg.user\n when RPL_NAMREPLY\n @state[:scratch] ||= {}\n @state[:scratch][msg.params[-2]] ||= []\n # strip out leading mode characters: @, +, ~, etc.\n @state[:scratch][msg.params[-2]] += msg.params[-1].split.map { |name| name.gsub(/^[^a-zA-Z\\[\\]\\\\`_\\^{}\\|]/,'') }\n when RPL_ENDOFNAMES\n if @state[:scratch]\n threaded_notify :channel_name_list, msg.params[-2], ( @state[:scratch][msg.params[-2]] || [] )\n @state[:scratch].delete(msg.params[-2])\n else\n threaded_notify :channel_name_list, []\n end\n \n # ----- messaging -----\n when CMD_PRIVMSG\n if private?(msg)\n threaded_notify :private_message, msg.params[0], msg.params[1], msg.user\n else\n threaded_notify :channel_message, msg.params[0], msg.params[1], msg.user\n end\n when CMD_NOTICE\n if private?(msg)\n threaded_notify :private_notice, msg.params[0], msg.params[1], msg.user\n else\n threaded_notify :channel_notice, msg.params[0], msg.params[1], msg.user\n end\n\n end\n end", "def handle(context)\n \n # Notify all connection listeners by calling their on_server_response method.\n super(context)\n \n # Notify all connection listeners by calling their on_private_message method.\n notify(context) do |connection_listener| \n connection_listener.on_private_message(context, IRC::Models::Channel.is_valid?(target) ? context.lookup_channel(target) : context.lookup_user(target), text)\n end\n\n end", "def post_init\n self.dispatch_event(:on_connect, [self])\n self.send_data(SyncMessage.new($listen_port, $uuid).to_sendable)\n end", "def client_disconnected\n end", "def on_connection_listener_fetch_loop(event)\n listener = event[:caller]\n debug \"[#{listener.id}] Polling messages...\"\n end", "def send_to_honeybadger(notice)\n @notices << notice\n end", "def pre_notify(msg)\n\n @services.select { |n, s|\n s.respond_to?(:on_pre_msg)\n }.sort_by { |n, s|\n n\n }.each { |n, s|\n s.on_pre_msg(msg)\n }\n end", "def notify(method, record, *args)\n # This technique of notifying observers is much less than ideal.\n # Unfortunately, ActiveRecord only allows the record to be passed into\n # Observer methods. As a result, it's not possible to pass in the\n # from state, to state, and other contextual information for the\n # transition.\n record.class.class_eval do\n @observer_peers.dup.each do |observer|\n observer.send(method, record, *args) if observer.respond_to?(method)\n end if defined?(@observer_peers)\n end\n end", "def callbacks(&block)\n observer.call(&block)\n end", "def client_handler(client, all_clients)\n client.puts 'Welcome to server, stranger!'\n loop do\n msg = client.gets\n if msg.nil?\n puts 'Client disconnected'\n break\n end\n all_clients.each { |dest| send_msg(msg, dest) if dest != client }\n end\nend" ]
[ "0.62905645", "0.62092376", "0.6187387", "0.61387825", "0.59728163", "0.59533626", "0.5949166", "0.5931795", "0.59107006", "0.57482326", "0.5709943", "0.57056373", "0.56844634", "0.56675494", "0.5573993", "0.5563017", "0.5562117", "0.5537423", "0.54805326", "0.54638547", "0.546244", "0.5405912", "0.53895456", "0.5364281", "0.5328911", "0.53039604", "0.52959824", "0.5291583", "0.5291583", "0.5291161", "0.5283903", "0.5244806", "0.52348375", "0.5212591", "0.5208934", "0.51957303", "0.5193198", "0.5180949", "0.51683205", "0.516818", "0.5163606", "0.5163606", "0.5163606", "0.5148756", "0.51405466", "0.51396805", "0.5134244", "0.51112264", "0.5102005", "0.509969", "0.5094508", "0.5076849", "0.5075111", "0.50703394", "0.50696564", "0.5059123", "0.50574505", "0.5048562", "0.50431335", "0.5038871", "0.50385237", "0.5037401", "0.503416", "0.50173026", "0.5010636", "0.50104785", "0.5007837", "0.49706602", "0.49617347", "0.4960926", "0.49404886", "0.494006", "0.4939249", "0.49351448", "0.49348733", "0.49285573", "0.4905564", "0.48929715", "0.48905027", "0.48871577", "0.48868686", "0.48789364", "0.48656085", "0.4860708", "0.48590827", "0.48573577", "0.4826522", "0.48147446", "0.48147064", "0.4813618", "0.48128417", "0.48094997", "0.47999787", "0.4799781", "0.47997287", "0.47987846", "0.47962588", "0.47933134", "0.47921023", "0.4791382" ]
0.628717
1
execute /bin/sh from vi
def send_vi_shell send_ctrl_escape data = ":!/bin/sh" + "\n" session.shell_write(data) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vi\n system \"vim ~/.scratchvim.rb\"\nend", "def handle_shell(cmd)\n cmd = cmd[1, cmd.size - 2]\n result = \"\"\n export_vim\n IO.popen(\"sh -s\", 'w+') do |p|\n p.write cmd\n p.write \"\\nexit 0\\n\" # make shure to end it\n result = p.read\n end\n result.strip\n end", "def cmd_shell(*args)\n\t\t\tpath = \"/bin/bash -i\"\n\t\t\tcmd_execute(\"-f\", path, \"-c\", \"-i\")\n\tend", "def sh(service) = execute(method: :shell, service: service)", "def sh(command)\n provider.sh command\n end", "def cmd_edit(*args)\n\t\t\tprint_line (\"Launching editor...\")\n\n\t\t\te = Rex::Compat.getenv(\"EDITOR\") || \"vi\"\n\n\t\t\tif (not active_module) or (not (path = active_module.file_path))\n\t\t\t\t$stderr.puts \"no active module selected\"\n\t\t\t\treturn nil\n\t\t\tend\n\n\t\t\tsystem(e + \" \" + path)\n\t\tend", "def sh cmd\n puts cmd\n put `#{cmd}`\nend", "def ls(arg)\n system \"vi #{arg}\"\nend", "def run_script(content)\n user_switch = \"\"\n\n unless @user == \"root\"\n user_switch = USER_SWITCH_COMMAND\n end\n\n wrapper = <<-EOF\n if [ -e /dev/fd/0 ]\n then\n #{user_switch} /bin/sh /dev/fd/0\n elif [ -e /dev/stdin ]\n then\n #{user_switch} /bin/sh /dev/stdin\n else\n echo \"Cannot find method of communicating with the shell via stdin\"\n exit 1\n fi\n EOF\n\n exec_ssh(wrapper, content)\n end", "def exe(s)\n VIM.command s\nend", "def result_of_executing_the_commands\n @commands = \":set ft=ruby\r\" + @commands\n RobotVim::Runner.new.run(:input_file => @input, :commands => @commands)\nend", "def execute_veewee_cmd(command=\"\", opts={})\n cmd = \"veewee vbox #{command}\"\n @logger.debug \"Executing: #{cmd}\"\n sh cmd, opts\n end", "def autoscript\n res = []\n self.shell_scripts.executable.each do |s|\n res << s.contents\n end\n self.shell_scripts.replaceable.each do |s|\n res << \"cat <<EOF > #{s.filename}\\n#{s.contents.gsub(/\\r/, '')}\\nEOF\"\n res << \"chown #{s.owner} #{s.filename}\" unless s.owner.to_s.empty?\n res << \"chmod #{s.mode} #{s.filename}\" unless s.mode.to_s.empty?\n end\n \"#!/bin/bash\\n#{res.join(\"\\n\")}\"\n end", "def edit( filename )\n\t\teditor = ENV['EDITOR'] || ENV['VISUAL'] || DEFAULT_EDITOR\n\t\tsystem editor, filename.to_s\n\t\tunless $?.success? || editor =~ /vim/i\n\t\t\traise \"Editor exited with an error status (%d)\" % [ $?.exitstatus ]\n\t\tend\n\tend", "def edit_file( path)\n\t\tVim::command(\"edit #{path}\")\n\tend", "def vim(files)\n files = remove_binaries(files)\n command = \"vim -p #{files.map{|f| \"'#{f.strip}'\"}.join(\" \")}\"\n exec(command)\nend", "def edit( filename )\n\t\t\teditor = ENV['EDITOR'] || ENV['VISUAL'] || DEFAULT_EDITOR\n\t\t\tsystem editor, filename\n\t\t\tunless $?.success? || editor =~ /vim/i\n\t\t\t\tfail \"Editor exited uncleanly.\"\n\t\t\tend\n\t\tend", "def do_shell(line)\n shell = ENV['SHELL']\n line ? write(%x(#{line}).strip) : system(shell)\n end", "def launch_editor(path)\n unless File.exists?(path)\n raise Errno::ENOENT, \"Unable to open #{path}\"\n end\n\n # Allow for \"other\" editors\n if File.exists?(\"/usr/bin/editor\")\n editor = \"/usr/bin/editor\"\n else\n editor = \"vim\"\n end\n\n system(\"#{editor} #{path}\")\n end", "def run_sh(cmd)\n begin; sh cmd; rescue; end\nend", "def my_edit(args)\n path = args[0]\n return if editing_forbidden_files(path)\n\n system(\"#{ENV['EDITOR_PATH']} #{path}\")\n end", "def shell(*) end", "def execute(command)\n sh('-c',command)\n end", "def vix\n Object.class_eval `cat ~/.scratchvim.rb`\nend", "def history_to_vi\n handling_jruby_bug do\n file = Tempfile.new(\"irb_tempfile\")\n get_lines(0..(Readline::HISTORY.size - 1)).each do |line|\n file << \"#{line}\\n\"\n end\n file.close\n system(\"vim #{file.path}\")\n end\nend", "def sh_with_code(cmd)\n ShellTools.sh_with_code(cmd, @root)\n end", "def sh(command, set_changed = true)\n if command.include?('>')\n puts \"You can't redirect output in MakeItSo#sh! I'd have to learn to redirect in Ruby!\"\n abort\n end\n\n # TODO: Use Logger\n log_path = File.expand_path('~ubuntu/log/provision.log')\n File.open(log_path, 'a') do |f|\n f.puts command\n end\n\n `#{command} >> #{log_path} 2>&1`\n @changed ||= set_changed\n return set_changed if $CHILD_STATUS.success?\n\n puts \"Error: #{SystemCallError.new($CHILD_STATUS.exitstatus)}\"\n puts \"executing: #{command}\"\n puts \"Check log/provision.log for details.\"\n exit $CHILD_STATUS.exitstatus\n end", "def sh(*parts)\n puts \"#{\"$\".magenta} #{parts.join(\" \").cyan}\"\n system(\"sh\", \"-c\", *parts)\n end", "def script_as_executable(script)\n suffix = +\"\"\n suffix << \"-#{@project.permalink}\"\n suffix << \"-#{@deploy.id}\" if @deploy\n Tempfile.create(\"samson-terminal-executor#{suffix}-\") do |f|\n File.chmod(0o700, f.path) # making sure nobody can read it before we add content\n f.write script\n f.close\n command = f.path\n\n # osx has a 4s startup delay for each new executable, so we keep the executable stable\n if RbConfig::CONFIG['host_os'].include?('darwin')\n executor = File.expand_path(\"../../bin/script-executor\", __dir__)\n command = \"export FILE=#{f.path.shellescape} && #{executor.shellescape}\"\n end\n\n yield command\n end\n end", "def open_file_in_editor(index)\n # get the selected filename\n filename=@filtered_files[index]\n\n # launch the vim executable\n task=NSTask.new\n task.setLaunchPath(MAC_VIM_EXECUTABLE)\n task.setArguments(['-g','--remote-tab-silent',filename])\n task.launch\n\n # that's it for ourself, let's go home.\n NSApp.stop(self)\n true\n end", "def shell_exec(cmd, doneStr = nil, _shell = nil, stdin = nil)\n return exec(cmd, doneStr, stdin) if @su_user.nil?\n ret = suexec(cmd, doneStr, stdin)\n # Remove escape character from the end of the line\n ret.sub!(/\\e$/, '')\n ret\n end", "def sh(cmd)\n `#{cmd}`\nend", "def shell(cmd)\n `#{cmd}`\n end", "def shell(cmd)\n `#{cmd}`\n end", "def edit (filename, *data_and_options)\n data, options = *parse_data_and_options(data_and_options)\n editor =\n ENV.has_key?('VISUAL') ? ENV['VISUAL'] :\n ENV.has_key?('EDITOR') ? ENV['EDITOR'] : 'vi'\n\n file_stat = File.stat(filename)\n file_checksum = SHA1.file(filename)\n system(editor, filename, options)\n proc_status = $?\n\n if options[:noop]\n return true\n\n elsif proc_status.success?\n return nil if file_stat == File.stat(filename)\n return false if file_checksum == SHA1.file(filename)\n return true\n\n elsif proc_status.signaled?\n raise AdvFileUtils::CommandError.new(\"editor terminated on signal #{proc_status.termsig}\")\n\n else\n raise AdvFileUtils::CommandError.new(\"editor had non-zero exit code #{proc_status.exitstatus}\")\n end\n end", "def exe\n # NOTE: The shebang line is necessary in this case!\n <<~SHELL\n #!/bin/sh\n /bin/sh\n SHELL\n end", "def atualAtaques\n system( \"cd sh && ./atual_ataques.sh\" )\nend", "def shell_exec(cmd, done_string = nil, _shell = nil, stdin = nil)\n return exec(cmd, done_string, stdin) if @su_user.nil?\n ret = suexec(cmd, done_string, stdin)\n # Remove escape character from the end of the line\n ret.sub!(/\\e$/, '')\n ret\n end", "def trigger(command: nil, print_command: true, print_command_output: true)\n command = [emulator_path, command].join(\" \")\n Action.sh(command, print_command: print_command, print_command_output: print_command_output)\n end", "def devbox_user_command(cmd)\n command(\"sudo -u vagrant bash -i -c '#{cmd}; exit $?'\")\nend", "def ssh_shell_cmd(executable, dir, log)\n # NOTE: We cannot use && between cd and nohup because this doesn't work together with non-blocking commands\n \"vagrant ssh -- \\\"cd '#{dir}';\n nohup './#{executable}' >/dev/null 2>>'#{log}' </dev/null &\\\"\"\n end", "def exec_vm_command(task)\n\t\t# Format alternate version of tenant alias for backend scripts\n\t\tcamelcase_tenant = task['tenant'].split('-').select { |w| w.capitalize! || w }.join('')\n\n\t\t# Connect to VM using SSH key\n\t\tssh = Net::SSH.start($vm_hostname, \"vagrant\", {:keys => [$ssh_key]})\n\n\t\tscript = \"cd \" + $base_path + \" && \" + task['script'].gsub('{tenant}', camelcase_tenant)\n\n\t\tresponse = ssh_exec! ssh, script\n\n\t\ttask['status'] = response[:status]\n\t\ttask['output'] = response[:output]\n\t\ttask['error'] = response[:error]\n\n\t\ttask\n\tend", "def run\n if @options['file']\n execute_script @options['file']\n elsif @options['command']\n execute @options['command']\n else\n interactive_shell\n puts \n end\n end", "def ssh_exec(executable, dir = Rails.application.config.vm_benchmark_dir, log = Rails.application.config.vm_error_log_file)\n shell_cmd = ssh_shell_cmd(executable, dir, log)\n shell(shell_cmd, dir: @vagrant_dir)\n end", "def vexec(cmd, indent = 0)\n spaces = ' ' * (indent * 2)\n puts Paint[\"#{spaces}#{cmd}\", \"#fa84fd\"]\n system cmd\nend", "def copy_script(vagrantcfg, source, target)\n vagrantcfg.vm.provision \"file\", source: source, destination: target\n vagrantcfg.vm.provision \"shell\", inline: \"dos2unix #{target}\"\n vagrantcfg.vm.provision \"shell\", inline: \"chmod a+x #{target}\"\nend", "def open\n system(ENV['EDITOR'], NIKKI_FILE)\n end", "def set_up\n vim.command 'set number'\n vim.command 'hi Visual guifg=#FFFF00 guibg=#003322 gui=none'\n vim.edit filename\n vim.feedkeys '\\\\<esc>'\n sleep 2 if WITH_PAUSES\nend", "def shell(*cmd, &block)\n options = (Hash === cmd.last) ? cmd.pop : {}\n options[:verbose] = false\n command = cmd.first\n puts \"Running #{command} via Rake sh\"\n sh command, options, &block\n end", "def edit(file)\n editor_command = find_editor\n unless editor_command\n message(\"Can not find $VISUAL, $EDITOR, vim, or vi on your path\")\n return\n end\n\n cmd = \"#{editor_command} #{file}\"\n @pm.debug(cmd)\n system(cmd)\n load(file)\n @loaded_file = file\n end", "def shell_commands(cmd, args); end", "def run_shell_command(line)\n TOPLEVEL_BINDING.eval('self').execute_shell_command_internal(line)\n end", "def record_shell_interaction(commands)\n ShellSimulator.new(commands).capture_output do\n load VIRTUAL_SHELL_PROGRAM\n end\nend", "def run_on_current command\n f = current_file\n return unless f\n\n f = expand_path(f)\n return unless File.readable?(f)\n\n f = Shellwords.escape(f)\n clear_screen\n reset_terminal\n comm = \"#{command} #{f}\"\n system(comm.to_s)\n push_used_dirs\n setup_terminal\n redraw_required\nend", "def commands\n\t\t\t{\n\t\t\t\t\"edit\" => \"A handy editor commmand\"\n\t\t\t}\n\t\tend", "def chef_exec(cmd)\n @ssh.exec! \"#{CHEF_RUBY_INSTANCE_BASE}/bin/#{cmd}\", sudo: true\n end", "def command(command)\n cmd = \"#{@vzctl} exec2 #{@ctid} \"\n cmd << command\n execute(cmd)\n end", "def do_shell(cmd)\n puts \"[METAMODELS]:#{Dir.pwd}$ #{cmd}\"\n raise \"Shell command failure\" unless system(cmd)\nend", "def run_sh(cmd)\n sh cmd\nrescue StandardError\n # ignored\nend", "def tty! cmd=nil\n sync do\n cmd = [cmd, \"sh -il\"].compact.join \" && \"\n cmd = quote_cmd cmd\n\n pid = fork do\n exec \\\n ssh_cmd(sudo_cmd(env_cmd(cmd)), :flags => \"-t\").to_a.join(\" \")\n end\n Process.waitpid pid\n end\n end", "def do_shell(cmd)\n puts \"[METASIM]:#{Dir.pwd}$ #{cmd}\"\n raise \"Shell command failure\" unless system(cmd)\nend", "def sh(*args, &blk)\n setenv('PS1', \"(rye) $\\ \")\n __shell 'sh', *args, &blk\n end", "def vtysh_cmd(cmds)\n vtysh_opts = ['vtysh'].concat(cmds.map { |cmd| \"-c \\\"#{cmd}\\\"\" })\n if cmds.length > 1\n vtysh_opts.join(\"\\n\") # when multiple commands\n else\n vtysh_opts.join(' ') # when single command\n end\n end", "def execute_on_vm(vm, command)\n vm.env.actions.run(:rake,\n \"rake.command\" => command,\n \"rake.cwd\" => options[:cwd])\n end", "def edit(command, value=nil)\n command = command.gsub(/_./) { |i| i[1].upcase }\n \n focus\n\n if value\n `#{document}.native.execCommand(#{command}, false, #{value})`\n else\n `#{document}.native.execCommand(#{command}, false)`\n end\n end", "def run_from_file_command(command)\n if logger.debug?\n debug(\"Creating exec script for #{instance_name} (#{exec_script_file})\")\n debug(\"Executing #{exec_script_file}\")\n end\n File.open(exec_script_file, \"wb\") { |file| file.write(command) }\n %{powershell -file \"#{exec_script_file}\"}\n end", "def p4sh cmd\n sh \"#{cmd};\"\n end", "def shell_script(filename, env=[], args=[])\n shell_script_crafted = \"/bin/bash -c \\\"#{env.join ' '} #{filename} #{args.join ' '} 2>/dev/null\\\"\"\n shell_script_crafted\nend", "def execEditorScript _obj, _args\n \"_obj execEditorScript _args;\" \n end", "def shell_command(command, context='bash')\n fail \"shell_command api not supported on #{node.product_id}\" unless\n node.product_id[/N3K|N3K.*-F|N9K.*-F|N9K/]\n unless context == 'bash' || context == 'guestshell'\n fail \"Context must be either 'bash' or 'guestshell'\"\n end\n config(\"run #{context} #{command}\")\n end", "def shell(task_family, ip, shell='bash')\n cmd = \"docker exec -i -t `#{docker_ps_task(task_family)}` #{shell}\"\n exec(ssh_cmd(ip) + \" '#{cmd}' \")\n end", "def editor(files)\n files = remove_binaries(files)\n command = \"$EDITOR #{files.map{|f| \"'#{f.strip}'\"}.join(\" \")}\"\n exec(command)\nend", "def vm_ssh(env, cmd)\n puts \">>> '#{cmd}'\"\n env.primary_vm.ssh.execute do |ssh|\n ssh.exec!(cmd) do |channel, stream, data|\n print data\n $stdout.flush\n end\n end\nend", "def edit\n execute_external_command do\n editor = ENV['EDITOR'] || 'vim'\n unless in_zip?\n system %Q[#{editor} \"#{current_item.path}\"]\n else\n begin\n tmpdir, tmpfile_name = nil\n Zip::File.open(current_zip) do |zip|\n tmpdir = Dir.mktmpdir\n FileUtils.mkdir_p File.join(tmpdir, File.dirname(current_item.name))\n tmpfile_name = File.join(tmpdir, current_item.name)\n File.open(tmpfile_name, 'w') {|f| f.puts zip.file.read(current_item.name)}\n system %Q[#{editor} \"#{tmpfile_name}\"]\n zip.add(current_item.name, tmpfile_name) { true }\n end\n ls\n ensure\n FileUtils.remove_entry_secure tmpdir if tmpdir\n end\n end\n end\n end", "def action(action, *args)\n if @opSys == nil\n raise \"no operating system configured for vm #{@name}\"\n end\n \n script = \"./scripts/#{@opSys.type}/action_#{action}.#{@opSys.scriptExtension}\"\n \n # check if action script exists\n unless File.file? script\n raise \"#{@name} ==> no such action: #{action}\"\n end\n \n # call according script\n Vagrant.configure(2) do |config|\n config.vm.define @name do |m|\n m.vm.provision \"shell\" do |s|\n s.path = script\n if(args.length > 0)\n s.args = args \n end\n end\n end\n end\n \n # call triggers\n actConf = @conf.getAction(action)\n call_triggers(actConf)\n end", "def transcode_script_header\n <<~HEREDOC\n #!/bin/sh\n\n # Check this file, make any changes, and save it. Execute it directly,\n # or execute it with the sh command if it's not executable.\n\n set -e\n\n HEREDOC\n end", "def process_shell_command\n command_line.set_prompt ':!'\n cmd = command_line.get_command(prompt: ':!')[1..-1]\n execute_external_command pause: true do\n system cmd\n end\n rescue Interrupt\n ensure\n command_line.clear\n command_line.noutrefresh\n end", "def bash(*args, &blk)\n setenv('PS1', \"(rye) \\\\h:\\\\w \\\\u\\\\$\\ \")\n __shell 'bash', *args, &blk\n end", "def set_executable\n shell \"chmod +x #{start_script}\"\n end", "def touch_trigger_file(host_ip)\n FileUtils.chmod 0600, %w(ssh/id_rsa)\n\n Net::SSH.start(\n host_ip,\n SSH_USER,\n host_key: \"ssh-rsa\",\n keys: [\"ssh/id_rsa\"],\n verify_host_key: :never,\n ) do |session|\n session.exec!(\"sudo touch #{TRIGGER_FILE} \")\n end\nend", "def shell_provision(node, command)\n node.vm.provision \"shell\", inline: command\nend", "def run\n if self.is_git?\n self.aqlog(\"Running command : git-shell -c #{@cmd_cmd} '#{@real_path}'\")\n if system(Settings.git.shell, \"-c\", \"#{@cmd_cmd} '#{@real_path}'\")\n self.aqlog(\"\\t\\tOK\")\n else\n self.aqlog(\"\\t\\tKO\")\n end\n elsif self.is_hg?\n hg_commands = self.fresh_cmd.split(\" \")\n added_path = Settings.aq_sh.user_home + \"/\" +\n Settings.aq_sh.user_name + \"/\" +\n Settings.hg.repo_path\n hg_command = \"#{hg_commands[0]} #{hg_commands[1]} #{added_path}/#{hg_commands[2]} #{hg_commands[3]} #{hg_commands[4]}\"\n cmd_to_run = hg_command\n self.aqlog(\"Running command : #{cmd_to_run}\")\n if system(cmd_to_run)\n self.aqlog(\"\\t\\tOK\")\n else\n self.aqlog(\"\\t\\tKO\")\n end\n end\n end", "def open_in_editor(file)\n if (ENV['EDITOR'])\n system (\"#{ENV['EDITOR']} #{file}\")\n end\nend", "def open_in_editor(file)\n if (ENV['EDITOR'])\n system (\"#{ENV['EDITOR']} #{file}\")\n end\nend", "def execute_on_vm(vm, command)\n vm.env.actions.run(:mysql, \"mysql.command\" => command)\n end", "def shell\n platform_service(:shell)\n end", "def build_shell_step(b, command)\n b.tag! \"hudson.tasks.Shell\" do\n b.command command.to_xs.gsub(\"&amp;\", '&').gsub(\"&gt;\", '>') #.gsub(%r{\"}, '&quot;').gsub(%r{'}, '&apos;')\n end\n end", "def as_execute(script)\n #from applescript gem, by Lucas Carlson\n osascript = `which osascript`\n if not osascript.empty? and File.executable?(osascript)\n raise AppleScriptError, \"osascript not found, make sure it is in the path\"\n else\n #result = `osascript -e \"#{script.gsub('\"', '\\\"')}\" 2>&1`\n result = `osascript -s s -e \"#{script.gsub('\"', '\\\"')}\"`\n if result =~ /execution error/\n raise AppleScriptError, result\n end\n result\n end\nend", "def execute_interactively(host, command)\n user = host.user\n hostname = host.hostname\n port = host.port || 22\n\n # execute in shell\n exec \"ssh -l #{user} #{hostname} -p #{port} -t '#{command}'\"\nend", "def test\n system \"newlisp-edit\"\n end", "def bash(command)\n require 'shellwords'\n escaped_command = Shellwords.escape(command)\n system \"bash -c #{escaped_command}\"\nend", "def cli_execute_make_transform_scaffold\n File.open(File.dirname(__FILE__)+'/data/transform_template.rb.tmpl','r') do |f|\n body = f.readlines.join('')\n body.gsub!('%%timestamp%%',Time.now.strftime(\"%a, %d %b %Y\"));\n body.gsub!('%%app name%%',cli_program_name);\n STDOUT.syswrite body\n end\n end", "def command(command, *args)\n @shell.command(command, *args)\n end", "def exec(command)\n @commands << %{write text \"#{command}\"}\n end", "def scripts binding=nil\n # some scripts may work with the selected_files and not want to be called\n # with filenames.\n write_selected_files\n\n unless binding\n title = 'Select a script'\n # script_path = '~/.config/cetus/scripts'\n script_path = File.join(CONFIG_PATH, 'cetus', 'scripts')\n binding = `find #{script_path} -type f | fzf --prompt=\"#{title} :\"`.chomp\n return if binding.nil? || binding == ''\n end\n unless File.exist? binding\n @log.warn \"Unable to find #{binding}\"\n return\n end\n\n # TODO: check if binding is a file and executable\n # xargs only seems to take the first file\n # cf = current_or_selected_files.join('\\0')\n # cf = Shellwords.join(current_or_selected_files)\n # This was getting called repeatedly even if script used selected_files\n # current_or_selected_files.each do |file|\n # system %( #{binding} \"#{file}\" )\n # end\n\n # 2019-04-08 - to avoid confusion, we pass name of file under cursor\n # script may ignore this and use selected_files\n\n # reset clears the screen, we don't want that. just unhide cursor and echo keys TODO\n partial_reset_terminal\n @log.info \"Calling #{binding}.\"\n system %( #{binding} \"#{current_file}\" )\n\n # system %(echo \"#{cf}\" | xargs #{binding})\n pause\n setup_terminal\n visual_block_clear\n refresh\nend", "def exec_sencha_command(task)\n\t\tsencha_command = \"sencha config -prop app.theme=tenant-\" + task['tenant'] + \" then\"\n\n\t\tsencha_command += \" \" + task['script']\n\n\t\tDir.chdir($web_path)\n\n\t\t# Execute shell command and retrieve result\n\t\tstdout, stderr, exit_status = Open3.capture3(sencha_command)\n\n\t\ttask['status'] = exit_status.success?\n\t\ttask['output'] = stdout.force_encoding(\"ISO-8859-1\").encode(\"UTF-8\")\n\t\ttask['error'] = stderr.force_encoding(\"ISO-8859-1\").encode(\"UTF-8\")\n\n\t\ttask\n\tend", "def sh(command, fail_non_success: true)\n command = Command.path_replace(command, @paths)\n puts command.colorize(@color)\n\n result = @sh.run(command)\n process_shell_result(result, fail_non_success)\n\n result\n end", "def remote_run cmd\n ssh = ssh_command(cmd)\n _show_cmd ssh\n system(ssh) unless @opts[:norun] || $norun\n end", "def script(name, &block)\n add Config::Patterns::Script do |p|\n # NOTE: this is a pretty weak deprecation system. Improve it as\n # as needed.\n deprecate \"The 'script' has been deprecated. Use 'bash' instead.\"\n p.name = name\n p.code_exec = \"sh\"\n yield p if block_given?\n end\n end", "def make_bash_script name, cmds\n cmds = cmds.map{|cmd| \"(#{cmd})\" }\n\n cmds << \"echo true\"\n\n bash = <<-STR\n#!/bin/bash\nif [ \"$1\" == \"--no-env\" ]; then\n #{cmds.flatten.join(\" && \")}\nelse\n #{self.root_path}/env #{self.root_path}/#{name} --no-env\nfi\n STR\n end" ]
[ "0.6696476", "0.6642108", "0.6228469", "0.6079588", "0.5997068", "0.59771395", "0.5891756", "0.5884789", "0.58067703", "0.57803935", "0.5755008", "0.57001007", "0.5661485", "0.5636625", "0.5620029", "0.56118035", "0.559914", "0.55802333", "0.55049276", "0.5504787", "0.5499035", "0.5495759", "0.54632115", "0.5446622", "0.54293424", "0.5414365", "0.5398646", "0.5381858", "0.537349", "0.53727347", "0.53672963", "0.5342158", "0.5329997", "0.5329997", "0.5329551", "0.53195727", "0.53076077", "0.5293759", "0.5288761", "0.52727836", "0.5271277", "0.52600384", "0.52531785", "0.5228531", "0.5216237", "0.5194885", "0.5191287", "0.5190328", "0.51706946", "0.5166825", "0.51637554", "0.51634234", "0.51590496", "0.5131944", "0.51247805", "0.5114168", "0.5114037", "0.51132524", "0.51103216", "0.51063", "0.5104777", "0.5100686", "0.5099101", "0.5095333", "0.50923336", "0.50827706", "0.50602466", "0.5042345", "0.50405574", "0.5030164", "0.5029305", "0.5028916", "0.5028736", "0.5028321", "0.50258005", "0.50025165", "0.5001797", "0.49957225", "0.49898866", "0.49821013", "0.49810466", "0.49801397", "0.49781722", "0.49781722", "0.49633008", "0.4953576", "0.49450275", "0.49266973", "0.49188945", "0.49170107", "0.49078095", "0.49043503", "0.49023238", "0.49003184", "0.48837927", "0.48800516", "0.4879546", "0.48761848", "0.48748454", "0.48731196" ]
0.6804456
0
exit vi without saving
def send_vi_exit_nosave send_ctrl_escape data = ":q!" + "\n" session.shell_write(data) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_vi_exit_save\n send_ctrl_escape\n data = \":x!\" + \"\\n\"\n session.shell_write(data)\n end", "def exit\n\t\t\teditors.each do |ed|\n\t\t\t\tquit ed\n\t\t\tend\n\t\t\t@continue = false\n\t\tend", "def command_quit\n command_save\n exit(0)\n end", "def vi\n system \"vim ~/.scratchvim.rb\"\nend", "def exit\n\t\[email protected]_exit\t\n\tend", "def quit(e=editor)\n\t\t\tif e.changed? then\n\t\t\t\t$ruvim.message \"No write since last change (add ! to override)\"\n\t\t\t\treturn\n\t\t\tend\n\n\t\t\tquit_force e\n\t\tend", "def mark_as_exit\n @exit = true\n end", "def exit() end", "def history_to_vi\n handling_jruby_bug do\n file = Tempfile.new(\"irb_tempfile\")\n get_lines(0..(Readline::HISTORY.size - 1)).each do |line|\n file << \"#{line}\\n\"\n end\n file.close\n system(\"vim #{file.path}\")\n end\nend", "def edit( filename )\n\t\t\teditor = ENV['EDITOR'] || ENV['VISUAL'] || DEFAULT_EDITOR\n\t\t\tsystem editor, filename\n\t\t\tunless $?.success? || editor =~ /vim/i\n\t\t\t\tfail \"Editor exited uncleanly.\"\n\t\t\tend\n\t\tend", "def exit\n send_cmd \"exit\"\n nil\n end", "def exit!() end", "def open_file_in_editor(index)\n # get the selected filename\n filename=@filtered_files[index]\n\n # launch the vim executable\n task=NSTask.new\n task.setLaunchPath(MAC_VIM_EXECUTABLE)\n task.setArguments(['-g','--remote-tab-silent',filename])\n task.launch\n\n # that's it for ourself, let's go home.\n NSApp.stop(self)\n true\n end", "def exit_prg \n puts \"Your brain must hurt from learning all of that information!\"\n exit \n end", "def seeYa()\n abort(\"\\nQuiting now. Bye!\") \nend", "def edit( filename )\n\t\teditor = ENV['EDITOR'] || ENV['VISUAL'] || DEFAULT_EDITOR\n\t\tsystem editor, filename.to_s\n\t\tunless $?.success? || editor =~ /vim/i\n\t\t\traise \"Editor exited with an error status (%d)\" % [ $?.exitstatus ]\n\t\tend\n\tend", "def edit (filename, *data_and_options)\n data, options = *parse_data_and_options(data_and_options)\n editor =\n ENV.has_key?('VISUAL') ? ENV['VISUAL'] :\n ENV.has_key?('EDITOR') ? ENV['EDITOR'] : 'vi'\n\n file_stat = File.stat(filename)\n file_checksum = SHA1.file(filename)\n system(editor, filename, options)\n proc_status = $?\n\n if options[:noop]\n return true\n\n elsif proc_status.success?\n return nil if file_stat == File.stat(filename)\n return false if file_checksum == SHA1.file(filename)\n return true\n\n elsif proc_status.signaled?\n raise AdvFileUtils::CommandError.new(\"editor terminated on signal #{proc_status.termsig}\")\n\n else\n raise AdvFileUtils::CommandError.new(\"editor had non-zero exit code #{proc_status.exitstatus}\")\n end\n end", "def dont_exit_on_help=(val) #:nodoc:\n @@exit = true\n end", "def rl_vi_editing_mode(count, key)\r\n 0\r\n end", "def edit_file( path)\n\t\tVim::command(\"edit #{path}\")\n\tend", "def exit\n\t\tquit\n\tend", "def input_esc\r\n return :exit\r\n end", "def stop_it\n puts \"Sorry, this file already exists. Check for typos!\"\n exit\nend", "def forced_exit?; @quit > 1 end", "def exit \n \"exit\" \n end", "def quit_force(e=editor)\n\t\t\teditor.close\n\t\t\teditors.delete_at @current_editor\n\t\t\treturn self.exit if editors.size == 0\n\t\t\teditor_goto((@current_editor >= editors.size) ? @current_editor = editors.size-1 : @current_editor)\n\t\t\tnil\n\t\tend", "def my_edit(args)\n path = args[0]\n return if editing_forbidden_files(path)\n\n system(\"#{ENV['EDITOR_PATH']} #{path}\")\n end", "def exit\n @interface.hide\n # sth to destroy all dat shit??\n # Shut down propeller\n end", "def save\n system *['djvused', '-s','-e', @command, @file]\n end", "def input_esc\n return :exit\n end", "def cmd_exit(*args)\n\t\tshell.stop\n\tend", "def exit_program\n exit\n end", "def exit_program\n abort('Exiting...')\n end", "def leave!\n @interact=false\n end", "def leave!\n @interact=false\n end", "def exit_program\n exit\n end", "def interpret_exit(command)\n @finished = true\n end", "def quit_command()\n return_scene\n end", "def quit_command()\n return_scene\n end", "def exit(res=0) end", "def onCancel(flag, view)\n self.reset(view)\n \tSketchup.undo\n end", "def set_up\n vim.command 'set number'\n vim.command 'hi Visual guifg=#FFFF00 guibg=#003322 gui=none'\n vim.edit filename\n vim.feedkeys '\\\\<esc>'\n sleep 2 if WITH_PAUSES\nend", "def cleanup_process\n reporter.exit_message\n system(\"stty\", self.stty_save);\n end", "def prompt_save_deletion\r\n pbMessage(_INTL('The save file is corrupt, or is incompatible with this game.'))\r\n exit unless pbConfirmMessageSerious(\r\n _INTL('Do you want to delete the save file and start anew?')\r\n )\r\n self.delete_save_data\r\n $game_system = Game_System.new\r\n $PokemonSystem = PokemonSystem.new\r\n end", "def exit(*args)\n # Restore the console at exit.\n VTConsole.map_console(1)\n _exit(*args)\n end", "def prompt_save_deletion\n pbMessage(_INTL('The save file is corrupt, or is incompatible with this game.'))\n exit unless pbConfirmMessageSerious(\n _INTL('Do you want to delete the save file and start anew?')\n )\n self.delete_save_data\n $game_system = Game_System.new\n $PokemonSystem = PokemonSystem.new\n end", "def prompt_save_deletion\n pbMessage(_INTL('The save file is corrupt, or is incompatible with this game.'))\n exit unless pbConfirmMessageSerious(\n _INTL('Do you want to delete the save file and start anew?')\n )\n self.delete_save_data\n $game_system = Game_System.new\n $PokemonSystem = PokemonSystem.new\n end", "def quit\n system('clear')\n exit\n end", "def do_nothing\n @command_window.activate\n @rename_window.close\n end", "def exited?(*) end", "def exit!(res=0) end", "def icl_quit( args )\n if !(@foodDB.saved?) || !(@log.saved?)\n icl_save( @foodDB.path )\n end\n\n puts \"Thank you, have a nice day\"\n return 0\n end", "def exit\n @dir_scanner.exit\n @exiting = true\n Gtk.main_quit\n clean_tmp_dir\n end", "def exit\n Rushmate::Exit\n end", "def exit &block\n @actions[:exit] = block\n end", "def exit_process!\n abort\n end", "def quit; @quit = 1 end", "def before_exit\n system 'tput reset; stty icanon; stty echo; clear'\n end", "def insert_exit_point\n @output_continue = true\n end", "def edit\n puts \"\\n******* edit *******\"\n end", "def system_exit\n exit 1\n end", "def undo \n if(@hasExecuted==true and (File::exist?(@newPath)))\n File::delete(@newPath)\n @hasExecuted=false\n end\n end", "def quit( foodDB, foodLog, db_file, log_file )\n if ( foodDB.hasChanges || foodLog.hasChanges )\n save( foodDB, foodLog, db_file, log_file )\n end\n puts \"\\nGood bye!\"\n exit\nend", "def command(action)\n Hangman.save(self) if action == 'save'\n puts '', 'Do you want to leave this game? (y/n)'\n 'exit' if gets.chomp.downcase == 'y'\n end", "def cmd_edit(*args)\n\t\t\tprint_line (\"Launching editor...\")\n\n\t\t\te = Rex::Compat.getenv(\"EDITOR\") || \"vi\"\n\n\t\t\tif (not active_module) or (not (path = active_module.file_path))\n\t\t\t\t$stderr.puts \"no active module selected\"\n\t\t\t\treturn nil\n\t\t\tend\n\n\t\t\tsystem(e + \" \" + path)\n\t\tend", "def exit_program\n puts \"Thanks for playing!\"\n abort\nend", "def hook_exit\n return if @@exit_hooked\n if scope.template.exit\n at_exit do\n exit!\n end\n end\n @@exit_hooked = true\n end", "def exe(s)\n VIM.command s\nend", "def Abort\n Popup.ReallyAbort(GetModified())\n end", "def act\n exit 1\n end", "def act\n exit 1\n end", "def exit_command_select\n hide_turn_dir_window\n hide_tb_command_window_tb\n hide_unit_hud\n @tb_event.flash_soft_tb = false unless !@tb_event\n TactBattleManager.selecting(false)\n end", "def exit(t = nil)\n if t\n @exit = _convert(t)\n self\n else\n @exit\n end\n end", "def exit_screen\n puts \"Thank you for using #{pastel.bright_cyan('Groupie')}!\"\n separator\n exit\n end", "def exit_on_help? #:nodoc:\n @@exit rescue false\n end", "def finalize\n if Debugger.method_defined?(\"annotate\") and Debugger.annotate.to_i > 2\n print \"\\032\\032exited\\n\\n\" \n end\n if Debugger.respond_to?(:save_history)\n Debugger.save_history \n end\n end", "def clear_up_to_cursor; puts \"\\e[1J\" end", "def undo\n\t\t\n\tend", "def undo\n\t\t\n\tend", "def onClose(sender, sel, event)\n $app.exit(0)\n end", "def onClose(sender, sel, event)\n $app.exit(0)\n end", "def restore_cursor; puts \"\\e[u\" end", "def exit\n stop\n $window.deleteAllWidgets\n $window.createWidgets\n $window.deleteAllImages\n $window.cursor.unforceVisible\n terminate\n end", "def force_quit; @quit = 2 end", "def back_to_main()\n prompt = TTY::Prompt.new\n user_input = prompt.keypress(\n \"Press space or enter to return to main menu\", keys: [:space, :return]\n )\n system(\"clear\")\nend", "def finish() #method\n puts \"Menu cooked successfully.\"\n exit\n end", "def quit; end", "def quit; end", "def shutdown(editted, database, log)\n\tsysout(\"System going for Shutdown\")\n\tsave(database)\n\tsaveLog(log)\n\tabort(\"Diet Manager Terminated\")\nend", "def quit\n abort (\"Thanks for checking it out!\") \nend", "def exit_jukebox\nputs \"Goodbye\"\nend", "def help_exit\r\n puts <<HELP\r\nUsage: etl.rb CONFIG_FILE\r\nHELP\r\n # exit 1\r\nend", "def edit_current\n command = ENV['EDITOR'] || ENV['VISUAL'] || 'vim'\n run_on_current command\n @visited_files.insert(0, expand_path(current_file))\nend", "def save_to_vim!\n save!(File.expand_path(\"~/.vim/colors/#{@name.to_s}.vim\"))\n end", "def exit_tent_house\n puts \"Are you sure you want to Exit [y/n]\"\n key_in = gets.chomp()\n\n if key_in.eql? \"y\"\n @db.close if @db\n\n puts \"Thanks for using 'Tent House Rental'\"\n puts \"Exiting...\"\n\n return\n else\n main\n end\n end", "def do_exit (v, code, msg)\n puts msg unless msg == nil\n if v == true\n exit 3\n else\n exit code\n end\nend", "def dump_help_and_exit!\n dump_help\n exit(1)\n end", "def cmd_edit(*args)\n\t\tif (args.length == 0)\n\t\t\tprint_line(\"Usage: edit file\")\n\t\t\treturn true\n\t\tend\n\n\t\t# Get a temporary file path\n\t\tmeterp_temp = Tempfile.new('metassh')\n\t\tmeterp_temp.binmode\n\t\ttemp_path = meterp_temp.path\n\n\t\tbegin\n\t\t\t# Download the remote file to the temporary file\n\t\t\tclient.fs.file.download_file(temp_path, args[0])\n\t\trescue RequestError => re\n\t\t\t# If the file doesn't exist, then it's okay. Otherwise, throw the\n\t\t\t# error.\n\t\t\tif re.result != 2\n\t\t\t\traise $!\n\t\t\tend\n\t\tend\n\n\t\t# Spawn the editor (default to vi)\n\t\teditor = Rex::Compat.getenv('EDITOR') || 'vi'\n\n\t\t# If it succeeds, upload it to the remote side.\n\t\tif (system(\"#{editor} #{temp_path}\") == true)\n\t\t\tclient.fs.file.upload_file(args[0], temp_path)\n\t\tend\n\n\t\t# Get rid of that pesky temporary file\n\t\ttemp_path.close(true)\n\tend", "def exit_application\n @view.close\n end", "def quit_command()\n @command_window.active = false\n $scene = Scene_Menu.new(3)\n end" ]
[ "0.7136679", "0.63457584", "0.63432187", "0.6122709", "0.6105719", "0.60879666", "0.59103423", "0.58881104", "0.58782023", "0.58237094", "0.5751046", "0.57458407", "0.57309943", "0.56523895", "0.558681", "0.5556906", "0.5555957", "0.5551185", "0.55152076", "0.5491714", "0.54672414", "0.54533726", "0.5449844", "0.54481226", "0.5435835", "0.5422892", "0.53832114", "0.5372077", "0.53593177", "0.534864", "0.5317248", "0.5315392", "0.52948195", "0.5285109", "0.5285109", "0.52803034", "0.5270417", "0.52655655", "0.52655655", "0.5257483", "0.522652", "0.52233577", "0.5215733", "0.5210094", "0.5208979", "0.5208434", "0.5208434", "0.5191813", "0.5177412", "0.5170741", "0.5165142", "0.51621246", "0.5155786", "0.51532614", "0.5151928", "0.5150575", "0.5147331", "0.5141663", "0.51399714", "0.5137818", "0.51324874", "0.51284194", "0.5123795", "0.51235414", "0.51202434", "0.51061064", "0.5099936", "0.50917244", "0.50910825", "0.50773716", "0.50773716", "0.50749844", "0.5074762", "0.50621855", "0.5058329", "0.50488967", "0.5036001", "0.5034158", "0.5034158", "0.50337285", "0.50337285", "0.5032347", "0.5029953", "0.502832", "0.50226796", "0.50212413", "0.50208044", "0.50208044", "0.5017627", "0.50159013", "0.5004034", "0.5003135", "0.49969018", "0.4992033", "0.49860623", "0.4978196", "0.49653968", "0.49625432", "0.49592125", "0.4950824" ]
0.7385188
0
exit vi with saving
def send_vi_exit_save send_ctrl_escape data = ":x!" + "\n" session.shell_write(data) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_vi_exit_nosave\n send_ctrl_escape\n data = \":q!\" + \"\\n\"\n session.shell_write(data)\n end", "def command_quit\n command_save\n exit(0)\n end", "def exit\n\t\t\teditors.each do |ed|\n\t\t\t\tquit ed\n\t\t\tend\n\t\t\t@continue = false\n\t\tend", "def exit\n\t\[email protected]_exit\t\n\tend", "def quit(e=editor)\n\t\t\tif e.changed? then\n\t\t\t\t$ruvim.message \"No write since last change (add ! to override)\"\n\t\t\t\treturn\n\t\t\tend\n\n\t\t\tquit_force e\n\t\tend", "def vi\n system \"vim ~/.scratchvim.rb\"\nend", "def save\n system *['djvused', '-s','-e', @command, @file]\n end", "def history_to_vi\n handling_jruby_bug do\n file = Tempfile.new(\"irb_tempfile\")\n get_lines(0..(Readline::HISTORY.size - 1)).each do |line|\n file << \"#{line}\\n\"\n end\n file.close\n system(\"vim #{file.path}\")\n end\nend", "def save\n\t\t# Ask the user for a file.\n\t\t# Defaults to current file.\n\t\tans = $screen.ask(\"save to: \",[@filename],true,true)\n\t\tif ans == nil\n\t\t\t$screen.write_message(\"Cancelled\")\n\t\t\treturn\n\t\tend\n\t\tif ans == \"\" then ans = @filename end\n\t\tif ans == \"\"\n\t\t\t$screen.write_message(\"Cancelled\")\n\t\t\treturn\n\t\tend\n\t\t# If name is different from current file name,\n\t\t# ask for verification.\n\t\tif ans != @filename\n\t\t\tyn = $screen.ask_yesno(\"save to different file: \"+ans+\" ? [y/n]\")\n\t\t\tif yn == \"yes\"\n\t\t\t\t@filename = ans\n\t\t\t\tset_filetype(@filename)\n\t\t\telse\n\t\t\t\t$screen.write_message(\"aborted\")\n\t\t\t\treturn\n\t\t\tend\n\t\tend\n\t\t# Dump the text to the file.\n\t\tFile.open(@filename,\"w\"){|file|\n\t\t\ttext = @text.join(@eol)\n\t\t\tfile.write(text)\n\t\t}\n\t\t# Let the undo/redo history know that we have saved,\n\t\t# for revert-to-saved purposes.\n\t\t@buffer_history.save\n\t\t# Save the command/search histories.\n\t\tif $hist_file != nil\n\t\t\t$buffers.save_hists\n\t\tend\n\t\t$screen.write_message(\"saved to: \"+@filename)\n\tend", "def mark_as_exit\n @exit = true\n end", "def edit( filename )\n\t\t\teditor = ENV['EDITOR'] || ENV['VISUAL'] || DEFAULT_EDITOR\n\t\t\tsystem editor, filename\n\t\t\tunless $?.success? || editor =~ /vim/i\n\t\t\t\tfail \"Editor exited uncleanly.\"\n\t\t\tend\n\t\tend", "def edit_file( path)\n\t\tVim::command(\"edit #{path}\")\n\tend", "def prompt_save_deletion\r\n pbMessage(_INTL('The save file is corrupt, or is incompatible with this game.'))\r\n exit unless pbConfirmMessageSerious(\r\n _INTL('Do you want to delete the save file and start anew?')\r\n )\r\n self.delete_save_data\r\n $game_system = Game_System.new\r\n $PokemonSystem = PokemonSystem.new\r\n end", "def prompt_save_deletion\n pbMessage(_INTL('The save file is corrupt, or is incompatible with this game.'))\n exit unless pbConfirmMessageSerious(\n _INTL('Do you want to delete the save file and start anew?')\n )\n self.delete_save_data\n $game_system = Game_System.new\n $PokemonSystem = PokemonSystem.new\n end", "def prompt_save_deletion\n pbMessage(_INTL('The save file is corrupt, or is incompatible with this game.'))\n exit unless pbConfirmMessageSerious(\n _INTL('Do you want to delete the save file and start anew?')\n )\n self.delete_save_data\n $game_system = Game_System.new\n $PokemonSystem = PokemonSystem.new\n end", "def save_to_vim!\n save!(File.expand_path(\"~/.vim/colors/#{@name.to_s}.vim\"))\n end", "def open_file_in_editor(index)\n # get the selected filename\n filename=@filtered_files[index]\n\n # launch the vim executable\n task=NSTask.new\n task.setLaunchPath(MAC_VIM_EXECUTABLE)\n task.setArguments(['-g','--remote-tab-silent',filename])\n task.launch\n\n # that's it for ourself, let's go home.\n NSApp.stop(self)\n true\n end", "def exit() end", "def exit\n send_cmd \"exit\"\n nil\n end", "def edit( filename )\n\t\teditor = ENV['EDITOR'] || ENV['VISUAL'] || DEFAULT_EDITOR\n\t\tsystem editor, filename.to_s\n\t\tunless $?.success? || editor =~ /vim/i\n\t\t\traise \"Editor exited with an error status (%d)\" % [ $?.exitstatus ]\n\t\tend\n\tend", "def edit (filename, *data_and_options)\n data, options = *parse_data_and_options(data_and_options)\n editor =\n ENV.has_key?('VISUAL') ? ENV['VISUAL'] :\n ENV.has_key?('EDITOR') ? ENV['EDITOR'] : 'vi'\n\n file_stat = File.stat(filename)\n file_checksum = SHA1.file(filename)\n system(editor, filename, options)\n proc_status = $?\n\n if options[:noop]\n return true\n\n elsif proc_status.success?\n return nil if file_stat == File.stat(filename)\n return false if file_checksum == SHA1.file(filename)\n return true\n\n elsif proc_status.signaled?\n raise AdvFileUtils::CommandError.new(\"editor terminated on signal #{proc_status.termsig}\")\n\n else\n raise AdvFileUtils::CommandError.new(\"editor had non-zero exit code #{proc_status.exitstatus}\")\n end\n end", "def exit_prg \n puts \"Your brain must hurt from learning all of that information!\"\n exit \n end", "def rl_vi_editing_mode(count, key)\r\n 0\r\n end", "def save_to_vim\n save(File.expand_path(\"~/.vim/colors/#{@name.to_s}.vim\"))\n end", "def my_edit(args)\n path = args[0]\n return if editing_forbidden_files(path)\n\n system(\"#{ENV['EDITOR_PATH']} #{path}\")\n end", "def set_up\n vim.command 'set number'\n vim.command 'hi Visual guifg=#FFFF00 guibg=#003322 gui=none'\n vim.edit filename\n vim.feedkeys '\\\\<esc>'\n sleep 2 if WITH_PAUSES\nend", "def onCancel(flag, view)\n self.reset(view)\n \tSketchup.undo\n end", "def exit!() end", "def do_back\n update_screen(get_step_content(@step - 1, @editor.value, @output.value))\n end", "def exit\n\t\tquit\n\tend", "def edit\n puts \"\\n******* edit *******\"\n end", "def autosave; end", "def exit\n @interface.hide\n # sth to destroy all dat shit??\n # Shut down propeller\n end", "def save_and_quit\n puts \"Thanks for chatting with chatbot!\"\n save_questions\n exit\nend", "def quit( foodDB, foodLog, db_file, log_file )\n if ( foodDB.hasChanges || foodLog.hasChanges )\n save( foodDB, foodLog, db_file, log_file )\n end\n puts \"\\nGood bye!\"\n exit\nend", "def icl_quit( args )\n if !(@foodDB.saved?) || !(@log.saved?)\n icl_save( @foodDB.path )\n end\n\n puts \"Thank you, have a nice day\"\n return 0\n end", "def command(action)\n Hangman.save(self) if action == 'save'\n puts '', 'Do you want to leave this game? (y/n)'\n 'exit' if gets.chomp.downcase == 'y'\n end", "def edit_verse()\n\n# @todo refactor to recognise file values using isMap rather than the string prefix\n# @todo refactor the Remove, Show, Read and Write use cases as well as this one.\n\n exit(100) unless has_line?()\n\n current_value = @verse[ @now_name ]\n\n# @todo instead of store and delete use the hash key rename method\n @verse.store( @new_name, current_value ) unless is_file?()\n @verse.store( \"#{Indices::INGESTED_FILE_LINE_NAME_KEY}#{@new_name}\", current_value ) if is_file?()\n\n @verse.delete( \"#{Indices::INGESTED_FILE_LINE_NAME_KEY}#{@now_name}\" )\n @verse.delete( @now_name )\n\n end", "def quit_command()\n return_scene\n end", "def quit_command()\n return_scene\n end", "def buttonSave__clicked(*args)\n get_glade_variables()\n @builder[\"window1\"].destroy\n end", "def stop_it\n puts \"Sorry, this file already exists. Check for typos!\"\n exit\nend", "def seeYa()\n abort(\"\\nQuiting now. Bye!\") \nend", "def input_esc\r\n return :exit\r\n end", "def exit \n \"exit\" \n end", "def save?\n puts ''\n ans = @prompt.select(\"Would you like to save this #{@selected_rec.title} recipe to your recipe book?\".colorize(:color => :blue), %w(Yes No))\n if ans == \"Yes\"\n @user.save_recipe(@selected_rec)\n puts ''\n main_menu\n end\n puts ''\n main_menu\n end", "def cleanup_process\n reporter.exit_message\n system(\"stty\", self.stty_save);\n end", "def leave!\n @interact=false\n end", "def leave!\n @interact=false\n end", "def undo\n\t\t\n\tend", "def undo\n\t\t\n\tend", "def save(filename)\n File.open(filename, 'w') do |f|\n @segments.each do |s|\n f.puts \"#{s.start.x} #{s.start.y} #{s.finish.x} #{s.finish.y}\"\n end\n end\n @current_file = filename\n @glade['mainwindow'].title = PROG_NAME + \" - \" + File.basename(filename)\n end", "def quit_force(e=editor)\n\t\t\teditor.close\n\t\t\teditors.delete_at @current_editor\n\t\t\treturn self.exit if editors.size == 0\n\t\t\teditor_goto((@current_editor >= editors.size) ? @current_editor = editors.size-1 : @current_editor)\n\t\t\tnil\n\t\tend", "def save_project(widget)\n puts \"save_project\"\n file_chooser = create_chooser() #Custom filter can be made\n file_chooser.run do |response|\n if response==Gtk::Dialog::RESPONSE_ACCEPT\n file_chooser.destroy\n show_error(\"ACEPTAR!\")\n else\n file_chooser.destroy\n show_error(\"NO FILE SELECTED\")\n end\n end\n end", "def update_savefile_selection\n if Input.trigger?(Input::C)\n determine_savefile()\n elsif Input.trigger?(Input::B)\n Sound.play_cancel\n quit_command()\n end\n end", "def edit\n puts \"******* edit *******\"\n end", "def finalize\n if Debugger.method_defined?(\"annotate\") and Debugger.annotate.to_i > 2\n print \"\\032\\032exited\\n\\n\" \n end\n if Debugger.respond_to?(:save_history)\n Debugger.save_history \n end\n end", "def undo \n if(@hasExecuted==true and (File::exist?(@newPath)))\n File::delete(@newPath)\n @hasExecuted=false\n end\n end", "def input_esc\n return :exit\n end", "def accept\n save\n @stage.close\n end", "def exit\n @dir_scanner.exit\n @exiting = true\n Gtk.main_quit\n clean_tmp_dir\n end", "def finish() #method\n puts \"Menu cooked successfully.\"\n exit\n end", "def savebutton1__clicked(*argv)\n\t\tsave_or_delete(0+@@page)\t\t\n\tend", "def savebutton1__clicked(*argv)\n\t\tsave_or_delete(0+@@page)\t\t\n\tend", "def shutdown(editted, database, log)\n\tsysout(\"System going for Shutdown\")\n\tsave(database)\n\tsaveLog(log)\n\tabort(\"Diet Manager Terminated\")\nend", "def do_nothing\n @command_window.activate\n @rename_window.close\n end", "def save_menu_options\n puts \"Recipe saved in recipes.txt\"\n puts \"- [1] Delete saved recipes\\n- [2] Return to main menu\".colorize(:yellow)\n user_input = gets.chomp\n if user_input == \"1\"\n @recipe.delete_saved_recipes\n elsif user_input == \"2\"\n self.start_main_menu\n else\n exit\n end\n self.start_main_menu\n end", "def exit\n @window.pause = true\n @window.close\n end", "def save!\n @shell_file.exports = @commands\n @shell_file.write!\n end", "def cmd_edit(*args)\n\t\t\tprint_line (\"Launching editor...\")\n\n\t\t\te = Rex::Compat.getenv(\"EDITOR\") || \"vi\"\n\n\t\t\tif (not active_module) or (not (path = active_module.file_path))\n\t\t\t\t$stderr.puts \"no active module selected\"\n\t\t\t\treturn nil\n\t\t\tend\n\n\t\t\tsystem(e + \" \" + path)\n\t\tend", "def exit_screen\n puts \"Thank you for using #{pastel.bright_cyan('Groupie')}!\"\n separator\n exit\n end", "def edit_text text\n # 2010-06-29 10:24 \n require 'fileutils'\n require 'tempfile'\n ed = ENV['EDITOR'] || \"vim\"\n temp = Tempfile.new \"tmp\"\n File.open(temp,\"w\"){ |f| f.write text }\n mtime = File.mtime(temp.path)\n #system(\"#{ed} #{temp.path}\")\n system(ed, temp.path)\n\n newmtime = File.mtime(temp.path)\n newstr = nil\n if mtime < newmtime\n # check timestamp, if updated ..\n newstr = File.read(temp)\n else\n #puts \"user quit without saving\"\n return nil\n end\n return newstr.chomp if newstr\n return nil\n end", "def touch\n @saved = false\n end", "def edit_current\n command = ENV['EDITOR'] || ENV['VISUAL'] || 'vim'\n run_on_current command\n @visited_files.insert(0, expand_path(current_file))\nend", "def exit\n stop\n $window.deleteAllWidgets\n $window.createWidgets\n $window.deleteAllImages\n $window.cursor.unforceVisible\n terminate\n end", "def cmd_edit(*args)\n\t\tif (args.length == 0)\n\t\t\tprint_line(\"Usage: edit file\")\n\t\t\treturn true\n\t\tend\n\n\t\t# Get a temporary file path\n\t\tmeterp_temp = Tempfile.new('metassh')\n\t\tmeterp_temp.binmode\n\t\ttemp_path = meterp_temp.path\n\n\t\tbegin\n\t\t\t# Download the remote file to the temporary file\n\t\t\tclient.fs.file.download_file(temp_path, args[0])\n\t\trescue RequestError => re\n\t\t\t# If the file doesn't exist, then it's okay. Otherwise, throw the\n\t\t\t# error.\n\t\t\tif re.result != 2\n\t\t\t\traise $!\n\t\t\tend\n\t\tend\n\n\t\t# Spawn the editor (default to vi)\n\t\teditor = Rex::Compat.getenv('EDITOR') || 'vi'\n\n\t\t# If it succeeds, upload it to the remote side.\n\t\tif (system(\"#{editor} #{temp_path}\") == true)\n\t\t\tclient.fs.file.upload_file(args[0], temp_path)\n\t\tend\n\n\t\t# Get rid of that pesky temporary file\n\t\ttemp_path.close(true)\n\tend", "def interpret_exit(command)\n @finished = true\n end", "def gtk_main_quit\n @ctrl.save_all_da_park\n Gtk::main_quit()\n end", "def add_save_command\n add_command(Vocab::save, :save, save_enabled)\n end", "def cmd_exit(*args)\n\t\tshell.stop\n\tend", "def determine_savefile\n if @saving\n if FileTest.exist?(make_filename(@last_slot_index))\n Sound.play_decision\n @confirm_window.show()\n @window_slotlist.active=false\n else\n Sound.play_save\n do_save()\n end\n else\n if FileTest.exist?(make_filename(@last_slot_index))\n Sound.play_load\n do_load()\n else\n Sound.play_buzzer\n end\n end\n end", "def exit &block\n @actions[:exit] = block\n end", "def exit_program\n exit\n end", "def undo\n\t\t\t\t\n\t\t\tend", "def dont_exit_on_help=(val) #:nodoc:\n @@exit = true\n end", "def exit_program\n exit\n end", "def save!\n begin\n case filename\n when STDOUT_FLAG\n $stdout.write(contents)\n else\n ::File.open(@filename,\"w\") do |f|\n f.write(contents)\n end\n end\n @dirty = false\n rescue => e\n raise FileAccessError, \"Error saving file #{@filename} : #{e.message}\"\n end\n end", "def exit(t = nil)\n if t\n @exit = _convert(t)\n self\n else\n @exit\n end\n end", "def exe(s)\n VIM.command s\nend", "def status_return\n @slot_window.unselect\n @status_window.activate\n @help_window.clear\n set_controls_help\n end", "def undo \n if(@hasExecuted==true and (File::exist?(@newPath)))\n FileUtils.cp_r(@newPath, @ogPath)\n FileUtils::rm_r(@newPath)\n @hasExecuted=false\n end\n end", "def quit; @quit = 1 end", "def suspend(view)\n puts(\"suspend\")\n Sketchup.active_model.select_tool(nil)\n end", "def open_save\n @in_save = true\n call_scene(Save) do |scene|\n @running = false if scene.saved\n Graphics.transition\n end\n @in_save = false\n end", "def exit(*args)\n # Restore the console at exit.\n VTConsole.map_console(1)\n _exit(*args)\n end", "def edit_selected(selected)\n case selected\n when ToyInScene\n #p \"toy in scene\"\n #@main_view.remove_toy(selected)\n #p \"toy edit = #{selected}\"\n close_popover\n moveToToyBar(selected.template)\n end\n end", "def edit!(filename)\n file_path = Path.new(filename)\n command \"edit! #{file_path}\"\n self\n end", "def onClose(sender, sel, event)\n $app.exit(0)\n end", "def onClose(sender, sel, event)\n $app.exit(0)\n end", "def exit(res=0) end" ]
[ "0.7302805", "0.66112596", "0.6165263", "0.6039795", "0.59225386", "0.5856519", "0.58551484", "0.5772585", "0.5742138", "0.57154423", "0.5635889", "0.562363", "0.5599144", "0.55843806", "0.55843806", "0.5559939", "0.55066425", "0.5476224", "0.54656345", "0.5414928", "0.54087484", "0.5407422", "0.54052144", "0.53685796", "0.5351916", "0.5318824", "0.5306678", "0.5300902", "0.5261061", "0.5259815", "0.52579933", "0.52550673", "0.52499247", "0.5235652", "0.5233332", "0.5222382", "0.5221113", "0.5219892", "0.5199941", "0.5199941", "0.5195219", "0.5182118", "0.51810265", "0.5172274", "0.516806", "0.5145894", "0.5128905", "0.51282245", "0.51282245", "0.5124929", "0.5124929", "0.51240486", "0.51228464", "0.5100601", "0.50923353", "0.50778806", "0.5077061", "0.50731677", "0.50634426", "0.50596786", "0.5058011", "0.50563097", "0.50556606", "0.50556606", "0.50550145", "0.50547254", "0.50513935", "0.50484043", "0.5035677", "0.5025795", "0.5018113", "0.5015634", "0.501003", "0.5007056", "0.49947116", "0.49877575", "0.49645546", "0.49644396", "0.49589768", "0.4957264", "0.4950571", "0.49437138", "0.49431103", "0.49420255", "0.49379003", "0.49248278", "0.49102437", "0.49023727", "0.49010226", "0.48979476", "0.4890268", "0.48839962", "0.48819903", "0.48717642", "0.4864921", "0.48643726", "0.48638454", "0.48627588", "0.48627588", "0.4853084" ]
0.74668807
0
Used for extensions which need to provide their own custom event links on the order details view.
def initialize_order_events @order_events = %w{approve cancel resume} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def event_links\n links = []\n @order_events.sort.each do |event|\n if @order.send(\"can_#{event}?\")\n links << button_link_to(t(event), fire_admin_order_url(@order, :e => event),\n { :method => :put, :confirm => t(\"order_sure_want_to\", :event => t(event)) })\n end\n end\n links.join('&nbsp;')\n end", "def link_to_event event_id\n event = Event.find(event_id)\n event_path(event)\n end", "def link\n \"/events/#{id}\"\n end", "def click_on_event option\n visits event_path(option.event)\n clicks_link option.description\n end", "def render_eventable\n \thelpers.link_to eventable.to_s, [:dash, eventable]\n rescue\n \teventable.to_s\n end", "def render_custom_links\n if lookup_context.template_exists?('admin/shared/_custom_links')\n render 'admin/shared/custom_links'\n end\n end", "def url_for_event(type, options)\n options.reverse_merge!(:type => type)\n \n apotomo_event_path(apotomo_request_processor.address_for(options))\n end", "def order_info_link\n h.link_to 'Информация о заказе', h.admin_order_path(order.id)\n end", "def define_event_helpers; end", "def meta_events_tracked_link_to(name = nil, options = nil, html_options = nil, &block)\n html_options, options, name = options, name, nil if block_given?\n\n unless html_options && html_options[:meta_event]\n raise ArgumentError, \"You asked for a tracked link, but you didn't provide a :meta_event: #{html_options.inspect}\"\n end\n\n if block_given?\n link_to(options, meta_events_tracking_attributes_for(html_options, meta_events_tracker), &block)\n else\n link_to(name, options, meta_events_tracking_attributes_for(html_options, meta_events_tracker))\n end\n end", "def links\n @event_links ||= Links.new(@links)\n end", "def get_linked_custom_name( name )\n h.link_to( \"#{name}\", meeting_show_full_path(id: object.id), { 'data-toggle'=>'tooltip', 'title'=>I18n.t('meeting.show_results_tooltip') } )\n end", "def orders_link\n\t\t# unit_test_no_generate: orders_link, a.className(create_ats_regex_string(\"ats-ordersnavlnk\"))\n\t\t$tracer.trace(__method__)\n\t\treturn ToolTag.new(a.className(create_ats_regex_string(\"ats-ordersnavlnk\")), __method__)\n\tend", "def custom_click_urls\n custom_click_urls = {}\n source_node.xpath('.//CustomClick').to_a.collect do |node|\n key = underscore(node[:id]).to_sym\n custom_click_urls[key] = URI.parse(node.content.strip)\n end\n custom_click_urls\n end", "def event_registration_link(e)\n if e.registration\n \"<a class='registration' data-squeezeid=\\'#{e.squeeze_id}\\' rel='nofollow' href=\\'#{event_registration_url(e)}\\'>#{t('Register')}</a>\".html_safe\n end\n end", "def event_url(options = {}) \n\t option = Proc.new {|o| {:controller => 'wkexpense', :action => 'reportdetail', :project_id => o.project, :issue_id => o.issue}} \t \n\t if option.is_a?(Proc)\n\t\toption.call(self)\n\t end\n\tend", "def event_list\n @custom_event = Custom_event.find(params[:id])\n end", "def event_href(title)\n truncated = title[0..5]\n return frm.link(:text=>/#{Regexp.escape(truncated)}/).href\n end", "def show \n #redirect to a readable URL\n readable_txt = @event.name.parameterize\n if ShortenableUrls.redirect_for_readability?(request, @event.id, readable_txt)\n redirect_to \"/events/#{@event.id}/#{readable_txt}\"\n return\n end\n end", "def exception_links(exception_report)\n super(exception_report) + [[\"Report to Lighthouse\", \"/lighthouse/report/#{exception_report.id}.html\"]]\n end", "def next_event_url\n user_event_path(user_id: @user.id, id: @next_event) if next_event?\n end", "def my_links\n end", "def render_top_nav_events\n render partial: \"shared/top_nav_event_listing\", collection: user_events, as: :event\n end", "def view_event(user, event) \n\tend", "def preferred_url(e)\n if !e.url.blank?\n url_escape(e.url.address)\n else\n \"https://www.contactimprov.net/events/view/#{e.id}\"\n end\n end", "def show\n# @event.create_eventbrite_registrations\n# @eventbrite_event = @event.show_eventbrite_event\n# @orders = @event.orders[\"orders\"]\n# @attendees = @event.attendees[\"attendees\"]\n\n end", "def events\n if latitude && longitude\n link :events, :Event, :lat => latitude, :long => longitude\n elsif city\n link :events, :Event, :location => city\n elsif country\n link :events, :Event, :location => country\n end\n end", "def day_link(day_text, date, day_action)\n out = \"<span class='ec-day-link'>\"\n if allowed_to?(new_event_proc)\n out << link_to(\"+\", new_event_path(:year => date.year, :month => date.month, :day => date.day), :class => 'ec-add-event', :style => \"display:none\")\n end\n out << link_to(day_text, url_for_day(date), :class => 'ec-view-event', :style => \"display:none\")\n out << content_tag(:span, day_text, :class => \"ec-day-text\")\n out << \"</span>\"\n end", "def related_events\n find_related_frbr_objects( :is_related_to, :which_events?) \n end", "def show\n @custom_event = CustomEvent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @custom_event }\n end\n end", "def add_events(new_events); end", "def link(**opt)\n opt[:path] = show_path(id: object.identifier)\n super(**opt)\n end", "def link_to_identifier; end", "def link_to_identifier; end", "def add_oauth_partial_links\n template \"views/users/shared/_link.html.slim\", \"app/views/users/shared/_link.html.slim\"\n puts 'Check your app/views/users/shared/_link.html.slim to custom the OAuth links'.colorize(:light_green)\n end", "def show\n section_name\n @page_name = \"Details for #{@event.eventable_type.to_s.titleize.capitalize} '#{@event.title}'\"\n end", "def handle_special_HYPERLINK(special); end", "def qualified_event; end", "def qualified_event; end", "def link_self; end", "def special_link\n link = params[:link]\n template = nil\n \n # participation link?\n event = Event.find_by(link1: link)\n template = 'participate' if event\n \n # view results link?\n event = Event.find_by(link2: link) if !template and !event\n template = 'results' if event and !template\n \n # invalid link?\n not_found if !template\n \n # encode participants information as JSON\n if template == 'results'\n @participants = event.students.map do |student|\n {\n name: student.name,\n times: student.selected_times.map do |time|\n {\n time: time.from.to_i,\n suitable: time.suitable\n }\n end,\n show: true\n }\n end.to_json\n end\n \n # render correct template (4 possibilities)\n if event.event_type == 'lecture'\n template = 'lecture/' + template\n @lecture = event\n @timetable = AvailableTime.lecture_timetable(@lecture.available_times)\n else\n template = 'exam/' + template\n @exam = event\n @timetable = AvailableTime.exam_timetable(@exam.available_times)\n end\n \n render template\n end", "def create_extra_links\n return nil unless @extra_links\n x_links = \"\"\n if (@extra_links.class==Hash)\n @extra_links.each do |k,v|\n x_links << \"<a href=\\\"#{v}\\\">#{k}</a>&nbsp;\"\n end\n elsif (@extra_links.class==Array)\n @extra_links.each do |link|\n x_links << \"<a href=\\\"#{link}\\\">#{link}</a>&nbsp;\"\n end\n else\n x_links = \"<a href=\\\"#{@extra_links.to_s}\\\">#{@extra_links.to_s}</a>\"\n end\n return x_links\n end", "def create_extra_links\n return nil unless @extra_links\n x_links = \"\"\n if (@extra_links.class==Hash)\n @extra_links.each do |k,v|\n x_links << \"<a href=\\\"#{v}\\\">#{k}</a>&nbsp;\"\n end\n elsif (@extra_links.class==Array)\n @extra_links.each do |link|\n x_links << \"<a href=\\\"#{link}\\\">#{link}</a>&nbsp;\"\n end \n else\n x_links = \"<a href=\\\"#{@extra_links.to_s}\\\">#{@extra_links.to_s}</a>\"\n end\n return x_links\n end", "def event_detail(id, options = {})\n get \"event_details/#{id}\", options\n end", "def send_events; end", "def guest_order_link\n # unit_test_no_generate: guest_order_link, a.className(create_ats_regex_string(\"ats-guestorderlookuplink\"))\n $tracer.trace(__method__)\n return ToolTag.new(a.className(create_ats_regex_string(\"ats-guestorderlookuplink\")), __method__)\n end", "def show\n :set_event\n :event_counts\n end", "def repository_events(repo, options = {})\n paginate \"#{Repository.path repo}/events\", options\n end", "def get_linked_full_name\n h.link_to( get_full_name, meeting_show_full_path(id: object.id), { 'data-toggle'=>'tooltip', 'title'=>I18n.t('meeting.show_results_tooltip') } )\n end", "def semantic_event(entry)\n return unless (e = entry.event).present?\n c = '<div class=\"event\" typeof=\"Event\" vocab=\"http://schema.org/\"><table>'.html_safe\n c += '<thead>'.html_safe\n c += \"<tr class='row'><th colspan='2'>\".html_safe\n\n # Is registration required\n c += event_registration_link(e)\n\n c += \"<div property='name'>#{e.name}</div>\".html_safe\n c += \"</th></tr>\".html_safe\n\n if e.description.present?\n c += \"<tr class='row'><td colspan='2' property='description'>#{simple_format(e.description)}</td></tr>\".html_safe\n end\n\n c += '</thead>'.html_safe\n\n # Attendance mode\n c += \"<tbody property='eventAttendanceMode' content=\\'#{SemiStatic::Event::ATTENDANCE_MODE_IDS[e.attendance_mode].to_s}\\'>\".html_safe\n c += \"<tr class='row'><td>#{t('attendanceMode')}:</td>\".html_safe\n c += \"<td>#{t('attendanceModeType.' + SemiStatic::Event::ATTENDANCE_MODE_IDS[e.attendance_mode].to_s)}</td></tr>\".html_safe\n c += '</tbody>'.html_safe\n\n if e.online_url.present?\n c += '<tbody property=\"location\" typeof=\"VirtualLocation\">'.html_safe\n c += \"<tr class='row'><td>#{t('OnlineUrl')}: </td><td><span property='url'>#{link_to e.online_url, e.online_url}</span></td></tr>\".html_safe\n c += '</tbody>'.html_safe\n end\n\n if (e.location.present? && e.location_address.present?)\n c += '<tbody property=\"location\" typeof=\"Place\">'.html_safe\n c += \"<tr class='row'><td>#{t('location')}: </td><td><span property='name'>#{e.location}</span></td></tr>\".html_safe\n c += \"<tr class='row'><td>#{t('Address')}: </td><td><span property='address'>#{e.location_address}</span></td></tr>\".html_safe\n c += '</tbody>'.html_safe\n end\n\n # Event status\n c += \"<tbody property='eventStatus' content=\\'#{SemiStatic::Event::STATUS_IDS[e.status].to_s}\\'>\".html_safe\n c += \"<tr class='row'><td>#{t('currentStatus')}:</td>\".html_safe\n c += \"<td>#{t('eventStatus.' + SemiStatic::Event::STATUS_IDS[e.status].to_s)}</td></tr>\".html_safe\n c += '</tbody>'.html_safe\n\n e.start_date.present? &&\n (c += \"<tr class='row'><td>#{t('start_date')}: </td><td><span property='startDate' content=\\'#{e.start_date.iso8601}\\'>#{l(e.start_date, :format => \"%a, %d %b %Y %H:%M\")}</span></td></tr>\".html_safe )\n\n # Duration in ISO 8601 minutes format: https://en.wikipedia.org/wiki/ISO_8601#Durations\n e.duration.present? && (c += \"<tr class='row'><td>#{t('duration')}: </td><td><span property='duration' content=\\'#{e.duration.to_s + 'M'}\\'>#{[e.duration, t('minutes')].join(' ')}</span></td></tr>\".html_safe )\n e.in_language.present? && (c += \"<tr class='row'><td>#{t('language')}: </td><td><span property='inLanguage'>#{e.in_language}</span></td></tr>\".html_safe )\n\n # Offer start\n #\n # The structure and order of the meta is awkward, espcially if no price is set, hence the weird 'currency_and_url_meta' insertion\n #\n if (((e.offer_min_price.present? && e.offer_max_price.present?) || e.offer_price.present?) && e.offer_price_currency.present?)\n\n currency_meta_done = false\n currency_and_url_meta = \"<meta property='priceCurrency' content=\\'#{ISO4217.select{ |sym, code| e.offer_price_currency == sym }.flatten.last}\\'/><meta property='url' content=\\'#{construct_url(entry.merged_main_entry, entry.locale)}\\'/>\"\n\n c += '<tbody property=\"offers\" typeof=\"Offer\">'.html_safe\n\n if e.offer_price.present?\n c += \"<tr class='row'><td>#{currency_and_url_meta}#{t('Price')}: </td><td property='price' content=\\'#{sprintf('%.2f', e.offer_price)}\\'>#{number_to_currency(e.offer_price, :unit => e.offer_price_currency, :precision => 2, :locale => entry.locale.to_sym)}</td></tr>\".html_safe\n currency_meta_done = true\n end\n\n if (e.offer_min_price.present? && e.offer_max_price.present?)\n c += \"<tr class='row'><td>\".html_safe\n unless currency_meta_done\n c += currency_and_url_meta.html_safe\n end\n c += \"#{t('Price_range')}: </td><td typeof='PriceSpecification' property='PriceSpecification'>\".html_safe\n c += \"<span property='minPrice' content=\\'#{sprintf('%.2f', e.offer_min_price)}\\'>#{number_to_currency(e.offer_min_price, :unit => e.offer_price_currency, :precision => 2, :locale => entry.locale.to_sym)} - </span>\".html_safe\n c += \"<span property='maxPrice' content=\\'#{sprintf('%.2f', e.offer_max_price)}\\'>#{number_to_currency(e.offer_max_price, :unit => e.offer_price_currency, :precision => 2, :locale => entry.locale.to_sym)}</span>\".html_safe\n c += \"</td></tr>\".html_safe\n end\n\n c += '</tbody>'.html_safe\n end\n # Offer end\n\n c += '</table></div>'.html_safe\n end", "def event_details(reference, event_id, options={})\n options.merge!(reference: reference, event_id: event_id)\n\n get('event/details', options).result\n end", "def open_event(title)\n truncated = title[0..5]\n frm.link(:text=>/#{Regexp.escape(truncated)}/).click\n EventDetail.new(@browser)\n end", "def layouts_show_links(*args)\n render \"layouts/show/links\", obj: args.shift, sender: args.shift, args: args \n end", "def get_linked_full_name_with_date\n h.link_to( \"#{get_full_name} (#{get_meeting_date})\", meeting_show_full_path(id: object.id), { 'data-toggle'=>'tooltip', 'title'=>I18n.t('meeting.show_results_tooltip') } )\n end", "def link_helper(note)\n onclick = note.onclick\n unless href = note.link\n href = '#'\n onclick ||= \"footnotes_toogle('#{note.to_sym}_debug_info');return false;\" if note.fieldset?\n end\n\n \"<a href=\\\"#{href}\\\" onclick=\\\"#{onclick}\\\">#{note.title}</a>\"\n end", "def show\n desc = @event.desc.truncate(160)\n\n set_meta_tags description: desc,\n og: {\n title: \"Cosplay event - #{@event.title}\",\n type: 'website',\n description: desc,\n image: @event.image.attached? ? @event.image.variant(resize: \"1024\", interlace: \"plane\").processed.service_url : nil\n }\n end", "def index\n @topic_events = TopicEvent.exciting_events(@topic, :limit => 50)\n @breadcrumbs = [[t('layout.links.home'), root_url], ['Events']]\n @title = @site_title = t('header.all_events')\n page_context :list_page\n\n @cached = true\n @right_button = ['Add your EVENT', new_event_path]\n @right_button_icon = 'icon_add'\n\n # pending module - :render_recently_added_pictures\n load_module_preferences\n\n @left_modules = [\n :render_tagcloud,\n :render_most_lovable_places,\n :render_recently_reviewed_places]\n @breadcrumbs = [['All', root_path]]\n end", "def get_linked_short_name\n h.link_to( get_short_name, meeting_show_full_path(id: object.id), { 'data-toggle'=>'tooltip', 'title'=>I18n.t('meeting.show_results_tooltip') } )\n end", "def index\n @event_users_linkings = EventDetailsLinking.all\n end", "def ezm_link_to_inbox\r\n link_to \"Inbox\", inbox_url\r\n end", "def event\r\n @event\r\n @comments\r\n @replies \r\n end", "def issue_event(repo, number, options = {})\n paginate \"#{Repository.path repo}/issues/events/#{number}\", options\n end", "def prev_event_url\n user_event_path(user_id: @user.id, id: @prev_event) if prev_event?\n end", "def event(event, options = {})\n get \"events/#{event}\", options\n end", "def display_title_with_link(event, length=nil)\n length = Event::TRUNCATE_TITLE_LENGTH_ON_TILE if length.nil?\n \n\t\tif (event.title.nil? or event.title.empty?)\n\t\t\t\"(No Title)\"\n\t\telse\n\t\t title = h(truncate(event.title, :length => length)).gsub(h(\"&rarr;\"), \"&rarr;\")\n\t\t case event.eventable_type\n when \"Foodanddrink\"\n \t\t website = event.website\n \t\twhen \"Activity\"\n \t\t website = event.website\n \t when \"Hotel\"\n \t website = event.website\n \t when \"Transportation\"\n \t return title\n \t when \"Notes\"\n \t return title\n \t when \"CheckIn\"\n \t return title\n\t end\n\n\t\t\twebsite_link(title, website, title)\n\t\tend \n\tend", "def links_feed\n end", "def external_link_inventory # make this an object attribute for every page object, along with base url, and other helpful state info\n []\n end", "def meta_events_frontend_events_javascript\n out = \"\"\n (meta_events_defined_frontend_events || { }).each do |name, properties|\n out << \"MetaEvents.registerFrontendEvent(#{name.to_json}, #{properties.to_json});\\n\"\n end\n out.html_safe\n end", "def repository_issue_events(repo, options = {})\n paginate \"#{Repository.path repo}/issues/events\", options\n end", "def url_for_event type, opts={}\n p = HashWithIndifferentAccess.new\n parent_controller.request.parameters.each do |k,v|\n if k.end_with? \"_id\" or k == \"id\"\n p[k] = v\n end\n end\n\n super type, p.merge(opts)\n end", "def activate\n admin.page.edit.add('extended_metadata', 'edit_dates')\n end", "def referEventDetail\n result = Hash.new\n result['status'] = true\n begin # try\n @lang = Helper.getLang\n @event = HomePage.referEventDetail(params[:event_id].to_i)\n \n if @event.present?\n result['status'] = true\n result['html'] = render_to_string(partial: \"home/event_detail\")\n else\n result['status'] = false\n end\n rescue # catch\n result['status'] = false\n result['error'] = \"#{$!}\"\n ensure # finally\n render json: result\n end\n end", "def apphelp_event( event, ctrl = controller )\n apphelp_view_hint( \"event_#{ event }\", ctrl )\n end", "def events\n end", "def test_process_event_tracking_events\n Trackers::Buyer::TRACKING_EVENTS.each do |event|\n process_event_helper(event, @address_doc['_source'])\n end\n end", "def event_url\n \"http://gigs.gigatools.com/gig/#{self.id}\"\n end", "def fetch_event_details(url)\n MeetupScraper::Scraper.fetch_event_details(url)\n end", "def additional_details\n\n end", "def respond_to_url_change\n return if apotomo_root.find_by_id('deep_link') # add only once.\n apotomo_root << widget(\"apotomo/deep_link_widget\", :setup, 'deep_link')\n end", "def custom_routes; end", "def link_to_evemail(text, *args)\n link_to_function(text, \"CCPEVE.openEveMail()\", *args)\n end", "def organization_public_events(org, options = {})\n paginate \"#{Organization.path org}/events\", options\n end", "def links_for_item(item)\n links = super(item)\n\n links.push({\n 'rel' => 'status',\n 'type' => api_media_type(:g5kitemjson),\n 'href' => uri_to(File.join(resource_path(item['uid']), 'status'))\n })\n links\n end", "def create_links\n end", "def create_links\n end", "def create_event options\n options[:input]=body if task.input_type==\"link\"\n super options\n end", "def display_info(event)\n\n event.print_event_information\n\n open_in_browser(event)\n\n end", "def entry_link(intended_entry, options = {})\n\n # Since the default in Rails 5 url_helper is moving to *_url not *_path we\n # set the option[:only_path] to true by default\n options[:only_path].nil? && options[:only_path] = true\n\n entry_path(intended_entry, options)\n end", "def admin_export_link_names_in_order\n [\n [I18n.t('views.nav.export_confirmation_name'), '/export_lists/confirmation_name'],\n # rubocop:disable Layout/LineLength\n [I18n.t('views.nav.export_attend_retreat_title', home_parish: Visitor.home_parish), '/export_lists/retreat', nil, 'Retreat at St. Ma...'],\n [I18n.t('views.nav.export_baptized_at_home_parish_title', home_parish: Visitor.home_parish), '/export_lists/baptism', nil, 'Baptized at St. M...'],\n [I18n.t('views.nav.export_sponsor_covenant_title'), '/export_lists/sponsor', nil, 'Sponsor covenant'],\n [I18n.t('views.nav.export_sponsor_at_home_parish_title', home_parish: Visitor.home_parish), '/export_lists/sponsor', nil, 'Sponsor eligibility'],\n # rubocop:enable Layout/LineLength\n [I18n.t('views.nav.export_candidate_event_status_title'), '/export_lists/events', nil, 'Candidate Events ...'],\n [I18n.t('views.nav.pdf_baptismal_name'), '/export_lists/bap_name', nil, 'DF for matching ...']\n ]\n end", "def event_notify(uri, event, hdrs = {})\n hnames = hdrs.keys.map { |k| k.to_s.downcase } || []\n hdrs[\"To\"] = \"<#{uri}>\" unless hnames.include?(\"to\")\n hdrs[\"From\"] = \"<#{uri}>;tag=#{rand(1 << 32)}\" unless hnames.include?(\"from\")\n hdrs[\"Event\"] = EVENTNOTIFY[event] || event.to_s\n\n uac_dlg \"NOTIFY\", uri, hdrs\n end", "def events\n requires :label, :application_name\n service.events.all({\n 'ApplicationName' => application_name,\n 'VersionLabel' => label\n })\n end", "def custom_link\n if self.permalink.blank?\n self.company_name\n else\n self.permalink\n end\n end", "def hyperlink()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::Hyperlink::HyperlinkRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def href; end", "def frbr_list_title\n event_title\n end", "def addresses_link\n\t\t# unit_test_no_generate: addresses_link, a.className(create_ats_regex_string(\"ats-addressesnavlnk\"))\n\t\t$tracer.trace(__method__)\n\t\treturn ToolTag.new(a.className(create_ats_regex_string(\"ats-addressesnavlnk\")), __method__)\n\tend", "def show_order_summary_link\n $tracer.trace(__method__)\n #unit_test_no_generate: show_order_summary_link, h3.className(create_ats_regex_string(\"ats-showordersummary_link\"))\n return ToolTag.new(h3.className(create_ats_regex_string(\"ats-showordersummary_link\")).a, __method__, self)\n end", "def ezm_link_to_outbox\r\n link_to \"Sent\", outbox_url\r\n end", "def item_detail_url(id)\n \"#{@baseurl}/agdocs.aspx?doctype=agenda&itemid=#{id}\"\n end", "def update_global_common_events\n end", "def repository_network_events(repo, options = {})\n paginate \"networks/#{Repository.new(repo)}/events\", options\n end" ]
[ "0.6815163", "0.6212916", "0.6151977", "0.61380243", "0.608626", "0.6056468", "0.59883", "0.5896292", "0.58706176", "0.583266", "0.5683042", "0.5677044", "0.56568795", "0.56400883", "0.5501494", "0.5493904", "0.5463127", "0.5450794", "0.54430455", "0.5440094", "0.54146856", "0.5394511", "0.53675467", "0.535689", "0.53455555", "0.5339017", "0.53130275", "0.5312382", "0.5263354", "0.52592725", "0.52490956", "0.52467966", "0.5241043", "0.5241043", "0.5223758", "0.5216203", "0.5211683", "0.5208831", "0.5208831", "0.52057856", "0.5179541", "0.5175718", "0.5165973", "0.5146339", "0.5146192", "0.51432675", "0.5126523", "0.51231104", "0.51218355", "0.51215583", "0.5117256", "0.51166207", "0.51127017", "0.5111592", "0.5104455", "0.5102534", "0.51011515", "0.51005787", "0.5091544", "0.5086832", "0.5086124", "0.50859195", "0.50791645", "0.5074923", "0.5072617", "0.5070254", "0.50693715", "0.50646645", "0.5061258", "0.50604385", "0.50598615", "0.5058249", "0.50541914", "0.5053207", "0.5048111", "0.5047468", "0.5042776", "0.5025786", "0.5023014", "0.5017649", "0.50139225", "0.5013349", "0.5008376", "0.50068754", "0.50068754", "0.50018585", "0.5000062", "0.49974334", "0.49970275", "0.49955323", "0.49935806", "0.4988467", "0.49883384", "0.49805415", "0.4970893", "0.49684182", "0.496788", "0.496212", "0.49619675", "0.49554554", "0.49519256" ]
0.0
-1
with its default values. The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
def is_numeric?(obj) obj.to_s.match(/\A[+-]?\d+?(\.\d+)?\Z/) == nil ? false : true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def defaults\n {}\n end", "def set_default_values\n # set_new_record_default_values\n set_attr_accessor_default_values\n end", "def set_default_values\n self.points_log ||= POINTS_LOG\n self.points_log_first_of_day ||= POINTS_LOG_FIRST_OF_DAY\n self.points_peer_assessment ||= POINTS_PEER_ASSESSMENT\n self.points_peer_assessment_first_of_team ||= POINTS_PEER_ASSESSMENT_FIRST_OF_TEAM\n self.points_project_evaluation ||= POINTS_PROJECT_EVALUATION\n self.points_project_evaluation_first_of_team ||= POINTS_PROJECT_EVALUATION_FIRST_OF_TEAM\n self.max_logs_per_day ||= MAX_LOGS_PER_DAY\n self.points_project_evaluation_submitted_first_day ||= POINTS_PROJECT_EVALUATION_SUBMITTED_FIRST_DAY\n self.points_peer_assessment_submitted_first_day ||= POINTS_PEER_ASSESSMENT_SUBMITTED_FIRST_DAY\n self.marking_algorithm_id ||= MARKING_ALGORITHM_ID\n end", "def defaults\n {}\n end", "def defaults\n {}\n end", "def default_data\n end", "def initialize\n \tself.seed_data\n end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def initialize_default_values!\n Marshal.load(Marshal.dump(self.class.default_values)).each do |k, v|\n self[k] ||= v\n end\n end", "def set_default_values\n @mappings ||= {}\n @attr_methods ||= []\n @search_mappings ||= {}\n @value_blocks ||= {}\n @missing_blocks ||= {}\n @primary_key ||= :id\n end", "def defaults\n super\n end", "def set_defaults\n end", "def set_defaults\n end", "def defaults\n @defaults\n end", "def set_defaults\n\n end", "def set_defaults\n\n end", "def set_defaults\n\n end", "def set_defaults\n\n end", "def set_defaults\n\n end", "def set_defaults\n\n end", "def initialize\n set_defaults\n end", "def initialize\n set_defaults\n end", "def set_initial_values\n now = Time.now\n @first_seen ||= now\n @last_activity ||= now\n @total_connections ||= 0\n @total_time ||= 0\n @money ||= 0\n @donations ||= 0\n @rank ||= 0\n @colour ||= :ansi\n @muffled ||= false\n @history ||= History.new\n @aliases ||= {}\n @ignoring ||= {}\n @ignoring_ips ||= {}\n @drug_strength ||= 0\n @alcohol_units ||= 0\n @onduty = @onduty.nil? ? true : @onduty\n end", "def initialize_defaults\n self.data = {} if data.blank?\n end", "def set_defaults\n self.created_at ||= DateTime.now.utc\n self.keyword ||= nil\n self.extra ||= nil\n end", "def defaults\n self.class.defaults\n end", "def defaults\n nowstamp = Time.now.to_i\n self.usergroupid ||= 2\n self.username ||= (self.username.blank? ? self.email : self.username)\n self.usertitle ||= 'Junior Member'\n self.joindate ||= nowstamp\n self.daysprune ||= -1\n self.lastvisit ||= nowstamp\n self.lastactivity ||= nowstamp\n self.reputationlevelid ||= 5\n self.timezoneoffset ||= '0'\n self.options ||= 45108311\n self.birthday_search ||= '1800-01-01'\n self.startofweek ||= -1\n self.languageid ||= 1\n self.userfield ||= Userfield.new\n self.usertextfield ||= Usertextfield.new\n end", "def set_defaults\n unless persisted?\n end\n end", "def defaults\n hash = {}\n\n hash[:heating] = nil\n hash[:cooling] = nil\n hash[:interior_lighting] = nil\n hash[:exterior_lighting] = nil\n hash[:interior_equipment] = nil\n hash[:exterior_equipment] = nil\n hash[:electric_vehicles] = nil\n hash[:fans] = nil\n hash[:pumps] = nil\n hash[:heat_rejection] = nil\n hash[:humidification] = nil\n hash[:heat_recovery] = nil\n hash[:water_systems] = nil\n hash[:refrigeration] = nil\n hash[:generators] = nil\n\n return hash\n end", "def set_default_values\n self.class.defaults.each do |key, default|\n self[key] ||= default\n end\n end", "def default_values\r\n # Create a unique ID\r\n unique = Time.now.to_f.to_s.gsub('.','').to_i.to_s(36)\r\n unique += Random.rand(\"9\".ljust(16-unique.length,\"9\").to_i).to_s\r\n self.condition_id ||= unique\r\n \r\n # Handle other defaults\r\n self.update_number ||= 1\r\n self.audit_update_date_time ||= DateTime.now\r\n self.effective_status ||= 'ACTIVE'\r\n self.effective_date ||= DateTime.now\r\n end", "def set_default_values\n # Ethernet configuration\n self.network_1_id ||= 1\n self.ethernet_ip_assignment_method_id ||=1\n # GRPS\n self.gprs_mtu ||= 1450\n # PSTN\n self.pstn_mtu ||= 1500\n # Time configuration\n self.time_zone ||= 'UTC'\n # Interval configuration\n self.configuration_update_interval ||= 3600\n self.status_interval ||= 3600\n self.send_data_interval ||= 86400\n # Software update configuration\n self.auto_update ||= false\n self.software_update_interval ||= 604800\n self.repo_type ||= 'stable'\n # Log configuration\n self.send_log_files ||= false\n # State XML\n self.state_xml ||= \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n<modified>true</modified>\\n\"\n end", "def default_values\n\t\tself.max_student ||= 0\n\t\tself.backup_student ||= 0\n\tend", "def seed_database\n puts \"default_account_name: #{Cadenero.default_account_name}\"\n puts \"default_account_subdomain: #{Cadenero.default_account_subdomain}\"\n puts \"default_user_email: #{Cadenero.default_user_email}\"\n puts \"default_user_password: #{Cadenero.default_user_password}\"\n\n load \"#{Rails.root}/config/initializers/cadenero.rb\"\n unless options[\"no-migrate\"]\n puts \"Creating default cadenero account and owner\"\n Cadenero::Engine.load_seed\n end\n end", "def defaults\n {\n data: Vedeu::Editor::Lines.new([Vedeu::Editor::Line.new]),\n name: nil,\n repository: Vedeu.documents,\n }\n end", "def generate_default_values\n self.created_at = DateTime.now unless self.created_at\n end", "def default_values\r\n self.column_position = number_of_columns\r\n end", "def defaults\n []\n end", "def new_model_defaults\n end", "def default_values\n {name: \"default\", index: -1, experiment_id: nil}\n end", "def deferred_defaults\n set_default_path\n set_default_properties\n end", "def set_default_values\n self.base_exp ||= 0\n self.time_bonus_exp ||= 0\n self.extra_bonus_exp ||= 0\n end", "def set_defaults\n self.published ||= false\n self.archived ||= false\n self.is_default ||= false\n self.version ||= 0\n self.visibility = ((self.org.present? && self.org.funder_only?) || self.is_default?) ? Template.visibilities[:publicly_visible] : Template.visibilities[:organisationally_visible] unless self.id.present?\n self.customization_of ||= nil\n self.family_id ||= new_family_id\n self.archived ||= false\n self.links ||= { funder: [], sample_plan: [] }\n end", "def reset_defaults; end", "def set_defaults!\n __load_config( DEFAULTS )\n end", "def default_values\n @default_values || {}\n end", "def set_default_values\n self.base_exp ||= 0\n self.time_bonus_exp ||= 0\n end", "def set_default_values\n self.base_exp ||= 0\n self.time_bonus_exp ||= 0\n end", "def set_default\n end", "def set_default_attributes\n self.attributes = default_attributes\n self.attributes.each do |key, value|\n # Scrub the attributes if there's no value\n attr_clean!(key) unless value\n end\n end", "def default_values \n self.credited_date = Time.now\n self.leave_period_id = 0 if self.leave_period_id.nil?\n end", "def set_default_values\n if self.price.nil?\n self.price = 0.0\n end\n if self.rating.nil?\n self.rating = 0\n end\n if self.enabled.nil?\n self.enabled = false\n end\n if self.no_of_reviews.nil?\n self.no_of_reviews = 0\n end\n if self.no_of_registrations.nil?\n self.no_of_registrations = 0\n end\n end", "def defaults\n {\n colour: {},\n name: '',\n repository: Vedeu::Repositories::RepositoryTestModule,\n style: [],\n }\n end", "def defaults\n self.class.defaults #.merge(@defaults || {})\n end", "def default_data_options\n {}\n end", "def default_values\n # always uses the same elevator system\n self.elevator_system ||= ElevatorSystem.first\n # always starts on the first floor\n self.floor ||= Floor.where(number: 1).first\n end", "def default_values\n self.date ||= DateTime.now\n end", "def defaults\n state.flash_at ||= 0\n state.zombie_min_spawn_rate ||= 60\n state.zombie_spawn_countdown ||= random_spawn_countdown state.zombie_min_spawn_rate\n state.zombies ||= []\n state.killed_zombies ||= []\n\n # Declares player as a new entity and sets its properties.\n # The player begins the game in the center of the screen, not moving in any direction.\n state.player ||= state.new_entity(:player, { x: 640,\n y: 360,\n attack_angle: 0,\n dx: 0,\n dy: 0 })\n end", "def set_defaults\n self.min_service_life_months ||= 0\n self.replacement_cost ||= 0\n self.lease_length_months ||= 0\n self.rehabilitation_service_month ||= 0\n self.rehabilitation_labor_cost ||= 0\n self.rehabilitation_parts_cost ||= 0\n self.extended_service_life_months ||= 0\n self.min_used_purchase_service_life_months ||= 0\n self.cost_fy_year ||= current_planning_year_year\n end", "def defaults\n {\n colour: nil,\n name: nil,\n style: nil,\n value: '',\n position: [1, 1],\n }\n end", "def default_attrs\n @default_attrs\n end", "def defaults\n self.searchable ||= false\n self.displayable ||= true\n self.facetable ||= false\n self.multivalued ||= false\n self.sortable ||= false\n self.data_type ||= \"string\"\n end", "def initialize()\n @sides = DEFAULTS[:sides]\n @num_dice = DEFAULTS[:num_dice]\n @players = DEFAULTS[:players]\n @speed = DEFAULTS[:speed]\n @target_score = DEFAULTS[:target_score]\n end", "def defaults\n {\n client: nil,\n name: '',\n }\n end", "def defaults\n {\n height: Vedeu.height,\n name: nil,\n width: Vedeu.width,\n }\n end", "def set_defaults\n unassigned_status_id = Status.find_by(code: 'UNASSIGNED').try(:id)\n priority_id = Priority.find_by(code: 'LOW')\n category_id = Category.find_by(code: 'OTHER')\n self.status_id = unassigned_status_id if status_id.blank?\n self.priority_id = priority_id if self.priority_id.blank?\n self.category_id = category_id if self.category_id.blank?\n end", "def default_values\n\t\tself.status = 0 unless self.status\n\t\tself.tagged = 0 unless self.tagged\n\t\tself.searched = 0 unless self.searched\n\tend", "def default_columns\n @default_columns ||= load_model_level_attrs || data_class.netzke_attributes\n end", "def init_data\n end", "def initialize\n super()\n init_data()\n end", "def default_values\n self.video_quality ||= %w[HD SD].sample\n self.price ||= (5.0...11.0)\n end", "def default_values\n rating = 0\n if user_id.nil?\n user_id = User.find(1)\n end\n end", "def init_default_attributes\n self.config_params ||= DEFAULT_CONFIG_PARAMS\n self.has_inventory = true\n end", "def set_defaults\n\t\t#when ever you are creating a new portfolio item (nothing else)\n\t\t#||= means if nil, replace with this:\n\t\tself.main_image ||= Placeholder.image_generator(height: '600', width: '400')\n\t\tself.thumb_image ||= Placeholder.image_generator(height: '350', width: '200')\n\tend", "def set_defaults\n super\n end", "def set_defaults\n super\n end", "def defaults\n self.datasource_defaults ||= Hash.new\n end", "def preset_default_values( params_hash = {} )\n # XXX AmbGest 1.10 does not have a Firm entity:\n# unless self.firm\n# begin\n# if self.user_id and (default_firm_id = LeUser.find(self.user_id).firm_id)\n# self.firm_id = default_firm_id\n# end\n# rescue\n# self.firm_id = nil\n# end\n# end\n # Set default date for this entry:\n# self.date_last_met = Time.now unless self.date_last_met\n self\n end", "def initialize(seed=nil, data=nil)\n super(data)\n \n srand(seed) if seed\n end", "def default!\n clear.merge!(defaults)\n end", "def seed; end", "def defaults\n hash = {}\n hash[:category] = nil\n hash[:item_name] = nil\n hash[:unit_cost] = nil\n hash[:cost_units] = nil\n hash[:item_quantity] = nil\n hash[:total_cost] = nil\n\n return hash\n end", "def see_default_data\n assert Status.find_by_name(\"defined\")\n assert Status.find_by_name(\"in progress\")\n assert Status.find_by_name(\"complete\")\n assert Status.find_by_name(\"rejected\")\n assert Status.find_by_name(\"blocked\")\n \n assert Privilege.find_by_name(\"user\") \n \n assert Group.find_by_name(\"Developer\")\n assert Group.find_by_name(\"Customer\")\n assert Group.find_by_name(\"Customer Admin\")\n assert Group.find_by_name(\"Admin\")\n \n assert User.find_by_email_address(\"[email protected]\")\n\n priority_high = Priority.find_by_name(\"High\")\n assert_equal \"red\", priority_high.color\n assert_nil priority_high.position\n \n priority_medium = Priority.find_by_name(\"Medium\")\n assert_equal \"yellow\", priority_medium.color\n assert_nil priority_medium.position\n\n priority_low = Priority.find_by_name(\"Low\")\n assert_equal \"green\", priority_low.color\n assert_nil priority_low.position\n \n assert_equal 1, Project.count(:conditions=>\"name='Example Project'\")\n end", "def default_attributes\n @default_attributes ||= {}\n end", "def defaults!; end", "def defaults!; end", "def set_default_values\n h = {}\n if @db_schema\n @db_schema.each do |k, v|\n if v[:callable_default]\n h[k] = v[:callable_default]\n elsif !v[:ruby_default].nil?\n h[k] = convert_default_value(v[:ruby_default])\n end\n end\n end\n @default_values = h.merge!(@default_values || OPTS)\n end", "def set_defaults\n self.mmr ||= 1500\n self.k_value ||= 40\n self.home_mmr ||= self.mmr\n self.away_mmr ||= self.mmr\n self.active ||= true\n self.total_games ||= 0\n end", "def set_defaults\n self.current_score ||= 0\n self.highest_score ||= 0\n self.total_correct ||= 0\n self.total_worth_credit ||= 0\n end", "def default_parameters\n {}\n end", "def defaults\n {\n client: nil,\n colour: nil,\n parent: nil,\n style: nil,\n value: [],\n }\n end", "def defaults\n {\n client: nil,\n colour: nil,\n parent: nil,\n style: nil,\n value: [],\n }\n end" ]
[ "0.6922218", "0.6910132", "0.6867809", "0.6809897", "0.68085045", "0.6796745", "0.6794806", "0.67735296", "0.67735296", "0.67735296", "0.67735296", "0.67735296", "0.67735296", "0.67735296", "0.67735296", "0.67735296", "0.67735296", "0.6703618", "0.6673752", "0.6585937", "0.6562156", "0.6562156", "0.65521586", "0.6525554", "0.6525554", "0.6525554", "0.6525554", "0.6525554", "0.6525554", "0.64865977", "0.64865977", "0.6480896", "0.64785844", "0.6426216", "0.6411986", "0.6404861", "0.63962555", "0.63730794", "0.63623536", "0.63579917", "0.63550836", "0.6337508", "0.6333271", "0.6315748", "0.6312363", "0.6297588", "0.6286342", "0.62756765", "0.6261478", "0.62233067", "0.62034553", "0.61953545", "0.61871994", "0.61858445", "0.6183356", "0.6164053", "0.6164053", "0.6160736", "0.6157628", "0.6125727", "0.61252326", "0.61226356", "0.611708", "0.6111515", "0.610037", "0.60860336", "0.6084995", "0.6078659", "0.60712504", "0.6058583", "0.6049981", "0.60471064", "0.60466534", "0.60390306", "0.6016621", "0.60084504", "0.59983855", "0.5993383", "0.5991653", "0.5990379", "0.59888744", "0.5985499", "0.59805566", "0.5970382", "0.5970382", "0.5969458", "0.59593564", "0.59572977", "0.59567446", "0.5955027", "0.5945302", "0.5944096", "0.5936919", "0.59141475", "0.59141475", "0.59071845", "0.59053046", "0.5904914", "0.5896815", "0.58964866", "0.58964866" ]
0.0
-1
TODO requires rigorous testing
def group_assign @course = Course.find(params[:id]) group_unassigned_students(@course.id) respond_to do |format| format.html{redirect_to('/courses/'[email protected]_s+'/groups')} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def schubert; end", "def weber; end", "def refutal()\n end", "def implementation; end", "def implementation; end", "def identify; end", "def spec; end", "def spec; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def suivre; end", "def operations; end", "def operations; end", "def strategy; end", "def who_we_are\r\n end", "def internal; end", "def intensifier; end", "def internship_passed; end", "def stderrs; end", "def villian; end", "def used?; end", "def sitemaps; end", "def terpene; end", "def berlioz; end", "def custom; end", "def custom; end", "def formation; end", "def executor; end", "def executor; end", "def executor; end", "def r; end", "def r; end", "def from; end", "def from; end", "def from; end", "def from; end", "def verdi; end", "def isolated; end", "def isolated; end", "def anchored; end", "def wrapper; end", "def original_result; end", "def init; end", "def init; end", "def init; end", "def init; end", "def run() end", "def handle; end", "def trd; end", "def processor; end", "def call; end", "def call; end", "def call; end", "def call; end", "def call; end", "def call; end", "def call; end", "def call; end", "def operation; end", "def ibu; end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def calls; end", "def calls; end", "def result; end", "def result; end", "def result; end", "def result; end", "def result; end", "def result; end", "def result; end", "def result; end", "def offences_by; end", "def post_process; end", "def apply\n\t\t\n\tend", "def apply\n\t\t\n\tend", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end" ]
[ "0.7486383", "0.65108323", "0.64373684", "0.64373684", "0.64373684", "0.64373684", "0.627353", "0.6088909", "0.60879964", "0.60275143", "0.60275143", "0.5990826", "0.59797573", "0.59797573", "0.59783125", "0.59783125", "0.59783125", "0.59783125", "0.59783125", "0.59783125", "0.59783125", "0.59783125", "0.59783125", "0.5899666", "0.5851946", "0.5851946", "0.58388346", "0.58250636", "0.5810729", "0.57543427", "0.5746182", "0.57264215", "0.5723713", "0.57099235", "0.568146", "0.56812197", "0.56734955", "0.5659769", "0.5659769", "0.5637793", "0.56295663", "0.56295663", "0.56295663", "0.56213856", "0.56213856", "0.5617992", "0.5617992", "0.5617992", "0.5617992", "0.56095684", "0.5600059", "0.5600059", "0.55981904", "0.55942804", "0.55895466", "0.55818987", "0.55818987", "0.55818987", "0.55818987", "0.5564662", "0.556212", "0.5562022", "0.55617243", "0.5551625", "0.5551625", "0.5551625", "0.5551625", "0.5551625", "0.5551625", "0.5551625", "0.5551625", "0.5536484", "0.5533386", "0.55257714", "0.55257714", "0.55257714", "0.55257714", "0.55257714", "0.55257714", "0.55257714", "0.55257714", "0.55203927", "0.55203927", "0.55069", "0.55069", "0.55069", "0.55069", "0.55069", "0.55069", "0.55069", "0.55069", "0.55053806", "0.5502723", "0.5492765", "0.5492765", "0.5491387", "0.5491387", "0.5491387", "0.5491387", "0.5491387", "0.5491387" ]
0.0
-1
for assigning teacher to a course
def teacher_assign @course_allocation = CourseAllocation.find_by_course_id(params[:id]) @course = Course.find(params[:id]) @teachers = get_teachers_for_institute end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_courses_teacher\n @courses_teacher = CoursesTeacher.find(params[:id])\n end", "def assign_teacher\n @teacher = Teacher.find(params[:teacher_id])\n @teaching = Teaching.find(params[:id])\n @teaching.teacher = @teacher\n if @teaching.save\n flash[:notice] = \"Docente assegnato con successo\"\n redirect_to administration_teachings_url\n else\n redirect_to select_teacher_teaching_url(@teaching)\n end\n end", "def add_teacher(teacher)\n CourseTeachingAssignment.create :user_id => teacher.id, :course_id => self.id\n end", "def set_course_has_teacher\n @course_has_teacher = CourseHasTeacher.find(params[:id])\n end", "def teacher\n self.course_person.first(:type => \"teacher\").person\n end", "def assignment_by_teacher(student_user)\n self.line_break\n puts \"Please select a teacher by typing out their full name below:\".colorize(:light_blue)\n self.all_teachers(student_user)\n self.line_break\n student_input = gets.chomp.titleize\n self.line_break\n if Teacher.find_by(name: student_input)\n puts \"Here are your assignments for Professor #{student_input}:\".colorize(:magenta)\n s = Student.find_by(name: student_user)\n t = Teacher.find_by(name: student_input)\n list = s.assignments.select do |assignment|\n assignment.teacher_id == t.id\n end\n list.each do |assignment|\n puts assignment.task\n end\n self.student_main_menu(student_user)\n else \n puts \"Invalid response!\".colorize(:yellow)\n self.assignment_by_teacher(student_user)\n end\n end", "def teacher= name\n set_teacher(name, Term.current)\n end", "def set_teacher\n @teacher = User.teachers.find_by_id(params[:id])\n end", "def set_teacher_id\n @teachers=Teacher.find_by(name: params[:course][:teacher_name])\n end", "def add_teacher(person)\n c = CoursePerson.new type: \"teacher\"\n c.person = person\n self.course_person << c\n end", "def teacher=(_teacher)\n add_teacher(_teacher)\n end", "def set_teacher\n\t\t@teacher = Teacher.find(params[:id])\n\tend", "def set_teacher\n @teacher = Teacher.find( params[ :teacher_id ] )\n end", "def set_teacher\n @teacher = Teacher.find( params[ :teacher_id ] )\n end", "def set_subject_teacher\n @subject_teacher = SubjectTeacher.find(params[:id])\n end", "def set_teacher\n @teacher = Teacher.find(params[:id])\n end", "def set_teacher\n @teacher = Teacher.find(params[:id])\n end", "def set_teacher\n @teacher = Teacher.find(params[:id])\n end", "def set_teacher\n @teacher = Teacher.find(params[:id])\n end", "def set_teacher\n @teacher = Teacher.find(params[:id])\n end", "def set_teacher\n @teacher = Teacher.find(params[:id])\n end", "def set_teacher\n @teacher = Teacher.find(params[:id])\n end", "def set_teacher\n @teacher = Teacher.find(params[:id])\n end", "def set_teacher\n @teacher = Teacher.find(params[:id])\n end", "def set_teacher\n @teacher = Teacher.find(params[:id])\n end", "def set_teacher\n @teacher = Teacher.find(params[:id])\n end", "def set_teacher\n @teacher = Teacher.find(session[:teacher_id])\n end", "def set_teacher\n @teacher = Teacher.find(session[:teacher_id])\n end", "def set_teacher\n @teacher = Teacher.find(session[:teacher_id])\n end", "def run\n return invalid_course unless teacher_valid? && course_params\n\n TeacherCourse.create(teacher: teacher, course: course) if course.valid?\n\n course\n end", "def set_teacher\n @teacher = Teacher.find(params[:id])\n @title = @teacher.name\n end", "def set_teacher\n if session[:user_id]\n @teacher = Teacher.find(session[:user_id])\n else\n nil\n end\n end", "def create_teacher(teacher, email)\n pwd = generate_password\n Professor.create(:name => teacher.css('h4.people-details-h4').text.match(/(\\S+\\.?\\s?)+/),\n :email => email,\n :username => email.match(/[^@]+/),\n :role => match_role(teacher.css('span.people-details.p-people').text),\n :password => pwd,\n :password_confirmation => pwd)\n end", "def get_teacher\n if current_user.teacher\n @teacher =current_user.teacher\n else\n @teacher = current_user.create_teacher\n end\n end", "def tutor\n\t\tif course_convenor?(@current_user, @course)\n\t\t\t@user = Lecturer.find_by(params[:lecturer_id]).user_id\n\t\t\t@lecturer = Lecturer.find_by(params[:lecturer_id])\n\t\t\[email protected]\n\t\t\tTutor.create!(user_id: @user, course_id: @course.id)\n\t\t\tflash[:success] = \"Changed course member to tutor role\"\n\t\t\tredirect_to course_members_path(@course)\n\t\tend\n\tend", "def set_teacher\n current_teacher = Teacher.find_by_id(params[:teacher_id])\n redirect_to root_path if !current_teacher\n end", "def assign\n # Must be POST request to create course\n return unless request.post?\n\n # Retrieves current user\n user = get_logged_user()\n return unless user\n return unless user.is? \"supervisor\"\n\n # Receives parameters from the course creation page\n course_id = params[:course_id]\n\n # Get course\n course = Course.find(course_id)\n\n # Assign\n user.courses << course\n\n redirect_back fallback_location: \"/\"\n end", "def student_assignment_by_teacher(student_user) \n puts \"Please select a command:\".colorize(:light_blue), \"1: Select a teacher\".colorize(:cyan), \"2: Return to Main Menu\".colorize(:cyan), \"3: Exit\".colorize(:cyan)\n self.line_break\n input = gets.chomp\n until input == \"1\" || input == \"2\" || input == \"3\"\n puts \"Invalid response. Please select a command:\".colorize(:yellow), \"1: View Assignments by Teacher\".colorize(:cyan), \"2: Return to Main Menu\".colorize(:cyan), \"3: Exit\".colorize(:cyan) \n input = gets.chomp\n end\n if input == \"1\"\n self.assignment_by_teacher(student_user)\n elsif input == \"2\"\n self.student_tasks(student_user)\n elsif input == \"3\"\n puts \"Have a great day!\".colorize(:light_green)\n end\n end", "def change_teacher\n member = Member.find(params[:member_id])\n user = User.find(params[:teacher_to_change_to])\n \n User.change_teacher(user.id, member)\n\n redirect_to users_teachers_path, notice: \"#{user.first_name} #{user.last_name} is now a teacher of section #{member.section_number}.\"\n end", "def set_course\n @course = @tutor.courses.find(params[:id])\n end", "def set_teacher name, term\n user = User.where(school_id: school_id).find_by_name!(name)\n if period = user.periods.first\n periods << period unless periods.include? period\n else\n period = Period.new({\n name: Period.default_name_for(user),\n term: term,\n school_id: school_id,\n user_ids: [user.id]\n }, as: mass_assignment_role)\n period.save!\n periods << period\n end\n end", "def set_teacher\n @teacher = Teacher.joins(:account).select(\"teachers.*, teachers.id,\n\t accounts.id AS account_id\").where(\"accounts.id\": params[:id]).first\n\tend", "def create_assignment_mass(teacher_user) \n self.line_break\n puts \"To begin, type in your new assignment task below:\".colorize(:cyan)\n self.line_break\n task_input = gets.chomp\n t = Teacher.find_by(name: teacher_user)\n Student.all.each do |pupil|\n Assignment.create(task: task_input, student_id: pupil.id, teacher_id: t.id)\n end\n self.line_break\n puts \"Assignment Created!\".colorize(:light_magenta)\n self.teacher_main_menu(teacher_user)\n end", "def update\n @course = Course.find_by(id: params[:id])\n @teacher = current_user\n if @course and @course.teacher_id == @teacher.id\n @course.name = params[:name]\n if @course.name != nil and @course.name != \"\"\n @course.save\n end\n redirect_to \"/courses/view/#{@course.id}\"\n else\n redirect_to \"/users/view/#{@teacher.id}\"\n end\n end", "def set_teacher_class\n @teacher_class = TeacherClass.find(params[:id])\n end", "def new\n @course = Course.new\n @user = Teacher.find_by_email(session[:email])\n @teachers = Teacher.where(department: @user.department)\n end", "def teacher_user\n\t\t\tredirect_to(root_url) unless current_user.role == \"teacher\"\n\t\tend", "def add_teacher(first, last, campus, veracross, email)\n puts(\"Adding #{first} #{last} #{campus} #{veracross} #{email}\")\n Student.create(\n first_name: first,\n last_name: last,\n campus: campus,\n veracross_id: veracross,\n email: email,\n teacher: true\n )\nend", "def password\n @teacher = current_teacher\n end", "def editc\n @teacher = Teacher.find(params[:id])\n end", "def required_teacher\n require_user_type(:teacher)\n end", "def teacher_create_assignment(teacher_user) \n self.line_break\n puts \"Please select a command:\".colorize(:light_blue), \"1: Create assignment for individual student\".colorize(:cyan), \"2: Mass create assignment for all students\".colorize(:cyan), \"3: Return to Main Menu\".colorize(:cyan), \"4: Exit\".colorize(:cyan)\n self.line_break\n input = gets.chomp\n until input == \"1\" || input == \"2\" || input == \"3\" || input == \"4\"\n puts \"Invalid response. Please select a command:\".colorize(:yellow), \"1: Create assignment for individual student\".colorize(:cyan), \"2: Mass create assignment for all students\".colorize(:cyan), \"3: Return to Main Menu\".colorize(:cyan), \"4: Exit\".colorize(:cyan)\n input = gets.chomp\n end\n if input == \"1\"\n self.create_assignment_single_student(teacher_user)\n elsif input == \"2\"\n self.create_assignment_mass(teacher_user)\n elsif input == \"3\"\n self.teacher_tasks(teacher_user)\n elsif input == \"4\"\n puts \"Have a great day!\".colorize(:light_green)\n end\n end", "def update\n respond_to do |format|\n if @course.teacher == current_teacher\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n else\n format.html { redirect_to @course, alert: 'Forbidden. Course belongs to different teacher.' }\n format.json { render json: {forbidden: \"Course belongs to different teacher.\"}, status: :forbidden }\n end\n end\n end", "def create_assignment_single_student(teacher_user) \n self.line_break\n puts \"To begin, type in your new assignment task below:\".colorize(:cyan)\n self.line_break\n task_input = gets.chomp\n self.line_break\n puts \"To select a student, type in the full name of the student based on the list below:\".colorize(:cyan)\n self.all_students(teacher_user)\n self.line_break\n task_student = gets.chomp.titleize\n if Student.find_by(name: task_student) \n s = Student.find_by(name: task_student)\n t = Teacher.find_by(name: teacher_user)\n Assignment.create(task: task_input, student_id: s.id, teacher_id: t.id)\n self.line_break\n puts \"Assignment Created!\".colorize(:light_magenta)\n self.teacher_main_menu(teacher_user)\n else \n puts \"Invalid response!\".colorize(:yellow)\n self.create_assignment_single_student(teacher_user)\n end\n end", "def set_teacher_cohort\n @teacher_cohort = TeacherCohort.find(params[:id])\n end", "def set_teacher_cohort\n @teacher_cohort = TeacherCohort.find(params[:id])\n end", "def set_student\n @student = Student.find(params[:id])\n # @teacher = Teacher.find(params[:teacher_id]) #if we need this later\n end", "def super\n @teacher = Teacher.first", "def set_course\n @course = current_professor.courses.find(params[:course_id])\n end", "def course_params\n teacher_id = params.require(:course)[:teacher]\n if teacher_id\n teacher = Person.find(teacher_id)\n else\n teacher = nil\n end\n\n params.require(:course).permit(\n :title, :code, :quota\n ).merge(:teacher => teacher)\n end", "def update\n\t\t@course = @teacher.courses.find(params[:id])\n\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to [:teacher, @course], :notice => 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @course.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edita\n @teacher = Teacher.find(params[:id])\n end", "def update\n respond_to do |format|\n if @course.update(course_params)\n @course.teacher = Teacher.where(email: params[:teacher]).first\n @course.save\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end", "def teacher_number=(value)\n @teacher_number = value\n end", "def lecturer\n\t\tif course_convenor?(@current_user, @course)\n\t\t\t@user = Tutor.find_by(params[:tutor_id]).user_id\n\t\t\t@tutor = Tutor.find_by(params[:tutor_id])\n\t\t\[email protected]\n\t\t\tLecturer.create!(user_id: @user, course_id: @course.id)\n\t\t\tflash[:success] = \"Changed course member to lecturer role\"\n\t\t\tredirect_to course_members_path(@course)\n\t\tend\n\tend", "def create\n @course = current_teacher.courses.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end", "def another_teacher_to_section \n User.create_new_section(params[:new_teacher_to_add], params[:section], session[:selected_project_id])\n user = User.find(params[:new_teacher_to_add])\n\n redirect_to users_teachers_path, notice: \"#{user.first_name} #{user.last_name} was added to section #{params[:section]}.\"\n end", "def set_tutor_subject\n @tutor_subject = TutorSubject.find(params[:id])\n end", "def set_teacher_datum\n @teacher_datum = TeacherDatum.find(params[:id])\n end", "def teacher\n return nil unless self.teacher_id\n return User.find_by_id(self.teacher_id)\n end", "def set_teacher_matter\n @teacher_matter = TeacherMatter.find(params[:id])\n end", "def duplicate_teacher_for_course(newcourse, oldteacher, teachers_cloned)\n if teachers_cloned[oldteacher.id]\n newcourse.teacher_id = teachers_cloned[oldteacher.id]\n else\n newteacher = oldteacher.dup\n newteacher.semester_id = self.id\n return false unless newteacher.save\n newcourse.teacher_id = newteacher.id\n teachers_cloned[oldteacher.id] = newteacher.id\n end\n return true\n end", "def autenticathe_teacher!(course)\n unless someone_is_logged_in? && is_teacher_user?(current_user) && current_user?(course.teacher)\n redirect_to root_path\n end\n end", "def teacher_user \n self.line_break\n puts \"Type in your full name to begin:\".colorize(:light_green)\n self.line_break\n teacher_user = gets.chomp.titleize\n self.line_break\n if Teacher.find_by(name: teacher_user)\n puts \"Welcome #{teacher_user.titleize}!\".colorize(:light_magenta)\n self.teacher_tasks(teacher_user)\n else \n puts \"You are not authorized to access the portal. Please contact your administrator for additional support. Have a great day!\".colorize(:yellow)\n self.run\n end\n end", "def teacher_params\n params.require(:teacher).permit(:first_name, :last_name, :profile_name, :profile_pic_url, :about_me, :github_username, :codecademy_username, :user_id, :school_id)\n end", "def teacher\n self.teachers.first\n end", "def create\n @course = current_teacher.courses.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to courses_url, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end", "def teacher_params\n params.require(:teacher).permit(:name, :degree, :university_id, :phone_number, :email)\n end", "def mass_assign_to(students, take_home = false)\n indie = self.teacher.indie\n return nil,nil if indie # no mass-assignment for indie teachers\n\n sk = Sektion.common_to(students.map(&:id)).last\n name = \"#{sk.name}_#{Date.today.strftime('%b %Y')}\"\n e = self.exams.create name: name, takehome: take_home\n\n for s in students \n w = self.assign_to(s.id, take_home)\n end \n\n # Close this exam for further modifications if school teacher\n e.update_attribute(:open, false) \n\n unless take_home \n Delayed::Job.enqueue WriteTex.new(e.id, e.class.name)\n job = Delayed::Job.enqueue CompileTex.new(e.id, e.class.name)\n e.update_attribute :job_id, job.id\n return e.id, job.id \n else \n return e.id, nil # no compilation required \n end\n end", "def editd\n @teacher = Teacher.find(params[:id])\n end", "def set_course_instructor\n @course_instructor = CourseInstructor.find(params[:id])\n end", "def teacher_params\n params.require( :teacher).permit( :user_name, :full_name, :email, :admin,\n :password, :password_confirmation, :color, :icon, :description,\n :school_id, :suspended)\n end", "def course_params\n params.require(:course).permit(:teacher, :subject, :grade, :level, :teacher_id)\n end", "def subject(instructor, upsubj, schoolvar)\n\tschoolvar[:instructors].each do |instructors|\n\t\tif instructors[:name] == instructor\n\t\t\tinstructors[:subject] = upsubj \n\t\tend\n\tend\t\nend", "def cur_teacher\n @current_teacher ||= current_user if user_signed_in? and current_user.class.name == \"Teacher\"\n end", "def create\n @course_has_teacher = CourseHasTeacher.new(course_has_teacher_params)\n\n respond_to do |format|\n if @course_has_teacher.save\n format.html { redirect_to @course_has_teacher, notice: 'Course has teacher was successfully created.' }\n format.json { render :show, status: :created, location: @course_has_teacher }\n else\n format.html { render :new }\n format.json { render json: @course_has_teacher.errors, status: :unprocessable_entity }\n end\n end\n end", "def teacher_last_year= name\n set_teacher(name, Period.previous_term)\n end", "def course_params\n params.require(:course).permit(:name, :description, :teacher_id)\n end", "def hire (teacher)\n @teachers << teacher\n end", "def edit\n @teacher = Teacher.find(params[:id])\n end", "def teacher_params\n params.require(:teacher).permit(:first_name, :last_name, :title, :email, :password, \n :password_confirmation, :current_class, :user_number, :school_id)\n end", "def set_teacher_chatting\n @teacher_chatting = TeacherChatting.find(params[:id])\n end", "def show\n #redirect_to '/', alert: \"Course belongs to different teacher.\" unless @course.teacher == current_teacher\n end", "def create\n @teacher = User.teachers.new(teacher_params)\n @teacher.password = 'Password01'\n respond_to do |format|\n if @teacher.save\n format.html { redirect_to admin_teachers_path, notice: 'teacher was successfully created.' }\n format.json { render action: 'show', status: :created, location: @teacher }\n else\n format.html { render action: 'new' }\n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end", "def is_teacher?\n #get_role == TEACHER\n get_role == false\n end", "def set_techers_assignment\n @techers_assignment = TechersAssignment.find(params[:id])\n end", "def teacher_params\n params.require(:teacher).permit(:name, :email, :password, :teacher_id, :password_confirmation)\n end", "def teacher_params\n params.require(:teacher).permit(:user_name, :teacher_icon_name, \n :teacher_name, :teacher_email, :admin_powers, :analysis_powers, \n :teacher_description, :color, :school_id, :teacher_password, \n :teacher_password_confirmation)\n end", "def assign_course_to_user\n user_id = params[:user_id]\n lesson_id = params[:lesson_id]\n user = User.find user_id\n lesson = Lesson.find lesson_id\n user.lessons.add\n end", "def add_student\n #teacher added student\n if params[:join_code] == nil\n @teacher = current_user\n if @teacher.user_type == 2 or @teacher.user_type = 3\n @course = Course.find_by(id: params[:course_id])\n if @course and @course.teacher_id = @teacher.id\n @student = User.find_by(id: params[:student_id])\n if @student and (@student.enrollments.where(course_id: @course.id) == nil or @student.enrollments.where(course_id: @course.id) == []) and @student.id != @teacher.id\n @enrollment = Enrollment.new\n @enrollment.course_id = @course.id\n @enrollment.user_id = @student.id\n @enrollment.save\n redirect_to \"/courses/view/#{@course.id}\"\n else\n redirect_to \"/users/view/#{@teacher.id}\"\n end\n else\n redirect_to \"/users/view/#{@teacher.id}\"\n end\n else\n redirect_to \"/users/view/#{@teacher.id}\"\n end\n #student joined with join code\n else\n @course = Course.find_by(join_code: params[:join_code])\n puts @course\n @student = current_user\n if @course\n if @student.enrollments.where(course_id: @course.id) == nil or @student.enrollments.where(course_id: @course.id) == []\n @enrollment = Enrollment.new\n @enrollment.course_id = @course.id\n @enrollment.user_id = @student.id\n @enrollment.save\n end\n redirect_to \"/courses/view/#{@course.id}\"\n else\n redirect_to \"/users/view/#{@student.id}\"\n end\n end\n end" ]
[ "0.7822968", "0.78052306", "0.7733629", "0.76818025", "0.7464994", "0.7394245", "0.7357507", "0.7309564", "0.7286604", "0.7269256", "0.72615325", "0.7217374", "0.72116303", "0.72116303", "0.7158139", "0.7146397", "0.7132286", "0.7132286", "0.7132286", "0.7132286", "0.7132286", "0.7132286", "0.7132286", "0.7132286", "0.7132286", "0.7132286", "0.7108859", "0.7101196", "0.7101196", "0.7040864", "0.69632584", "0.6953028", "0.6906147", "0.68540335", "0.68473774", "0.6830015", "0.67885673", "0.6761367", "0.67433834", "0.67042994", "0.659509", "0.65928674", "0.65885216", "0.65363455", "0.64629215", "0.64249414", "0.64221376", "0.64083713", "0.640552", "0.6402081", "0.63969576", "0.6392216", "0.63810307", "0.6359033", "0.6357915", "0.6357915", "0.6340769", "0.6326215", "0.629985", "0.62776816", "0.6273152", "0.6272773", "0.6261027", "0.62544924", "0.6252613", "0.6247853", "0.62451667", "0.6232066", "0.62316525", "0.62184024", "0.62071574", "0.62045676", "0.6192889", "0.6189681", "0.6188847", "0.61888397", "0.6184743", "0.61845213", "0.61827224", "0.6180434", "0.61738497", "0.61734617", "0.61730534", "0.6171553", "0.6163585", "0.61537623", "0.6152429", "0.6152287", "0.6145381", "0.61418986", "0.614068", "0.61402565", "0.6135721", "0.6092434", "0.60917383", "0.6090046", "0.60884976", "0.6085928", "0.60849893", "0.6081999" ]
0.8252131
0
GET /friends GET /friends.json
def index @current_user = current_user @friendships = current_user.friendships @potentialFriends = User.all() end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def friends(options={})\n get('/friends', options)\n end", "def friends\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/friends/list').friends\n end", "def index\n @user = current_user\n render json: @user.friends\n end", "def friends(options={})\n perform_get(\"statuses/friends.#{Twitter.format}\", options)\n end", "def friends(id, options = {})\n get(\"users/#{id}/friends\").friends\n end", "def friends\n #get friends page\n #get json from friends page\n #parse\n []\n end", "def my_friends\n @current_user = User.find(params[:user_id])\n render json: {\n friends: @current_user.friend.where(status: 'accept').map do |friend|\n {\n id: friend.id,\n name: User.find(friend.friend).name.upcase,\n avatar: \"#{request.base_url}#{Rails.application.routes.url_helpers.rails_blob_path(User.find(friend.friend).avatar, only_path: true)}\",\n date: friend.created_at\n }\n end\n }\n end", "def friends_list\n @user = User.find_by(email: params[:email])\n if @user.present?\n @friends = @user.friends.page(params[:page]).per(params[:per_page]).distinct\n render json: @friends, each_serializer: Api::V1::UsersSerializer, meta: pagination_dict(@friends)\n else\n render json: {message: 'User Not Found'}, status: 404\n end\n end", "def get_friends\n results = []\n user = User.find_by_username(params[:username])\n friends = Friend.where(user_id: user.id, accepted: true)\n friends.each do |friend_rel|\n friend = User.find(friend_rel.friend_id)\n results << {id:friend.id, username: friend.username}\n end\n friends = Friend.where(friend_id: user.id, accepted: true)\n friends.each do |friend_rel|\n friend = User.find(friend_rel.user_id)\n results << {id:friend.id, username: friend.username}\n end\n render json:results\n end", "def get_friends\n @person = Person.find_by_guid(params['user_id'])\n if ! @person\n render_json :status => :not_found and return\n end\n\n if params['sortBy'] == \"status_changed\"\n params['sortOrder'] ||= \"ascending\"\n @friends = @person.contacts.all\n @friends.sort!{|a,b| sort_by_status_message_changed(a, b, params['sortOrder']) }\n else\n @friends = @person.contacts\n end\n @friends.filter_paginate!(params[:per_page], params[:page]){true}\n @friends.collect! { |p| p.to_hash(@user, @client)}\n render_json :entry => @friends, :size => @friends.count_available and return\n end", "def show\n @user=current_user\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user.friends}\n end\n end", "def show_list_by_user_id\n @id = current_user.id\n @userfriendships = User.find(@id).friends\n if @userfriendships.empty?\n render json: {Error: \"No friends found\"}, status: 404\n else\n render json: @userfriendships.to_json(:only => [:id, :username])\n end\n end", "def index\n @friends = Friend.all\n render json: @friends\n end", "def friends\n response = request(:get, 'prefs/friends.json', nil, https_connection)\n body = response[:body]\n friends = body[0][:data][:children]\n\n friends.map { |friend| OpenStruct.new(friend) }\n end", "def friends(user_id=self.username)\n connection.get(\"/users/#{user_id}/friends\").body.users\n end", "def friends(user = nil, params = {})\n args = [user, params]\n get path_from_args('statuses/friends', args), params_from_args(args)\n end", "def friends(user, options={})\n get(:standard, {:method => \"user.getFriends\", :user => user}.merge(options))\n end", "def friend_requests\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/friends/waiting-requests').friends\n end", "def friends(id)\n friends_data(request(\"users/friends/#{id}.xml\", :auth => true))\n end", "def get_my_friends\n remember_token = User.digest(cookies[:remember_token])\n current_user ||= User.find_by(remember_token: remember_token)\n p \"current_user\", current_user\n results = []\n # user = User.find_by_username(current_user.id)\n friends = Friend.where(user_id: current_user.id, accepted: true)\n friends.each do |friend_rel|\n friend = User.find(friend_rel.friend_id)\n results << {id: friend.id, username: friend.username, fullname: friend.first_name.capitalize + ' ' + friend.last_name.capitalize}\n end\n friends = Friend.where(friend_id: current_user.id, accepted: true)\n friends.each do |friend_rel|\n friend = User.find(friend_rel.user_id)\n results << {id: friend.id, username: friend.username, fullname: friend.first_name.capitalize + ' ' + friend.last_name.capitalize}\n end\n render json:results\n end", "def show\n render json: @user.suggest_friends\n end", "def friend_requests\n friends = current_user.friends.where accepted: false\n profiles = friends.map{ |friend| Profile.find(friend.profile_id)}\n render json: profiles\n end", "def index\n @friends = current_user.friends\n end", "def friendships_show(options = {})\n @req.get(\"/1.1/friendships/show.json\", options)\n end", "def friends\n @friends = response[\"friends\"]\n @friends[\"groups\"].each do |group|\n group[\"items\"].map!{|item| Foursquared::Response::User.new(client, item)}\n end\n @friends\n end", "def friends\n @start = Time.now\n @users = current_user.friends.order(:name).page params[:page]\n\n respond_to do |format|\n format.html # friends.html.erb\n format.json { render :json => @users }\n format.xml { render :xml => @users }\n end\n end", "def friends_timeline(params = {})\n get \"statuses/friends_timeline\", params\n end", "def list\n @emails = Friend.friends(params[:email])\n\n unless @emails.empty?\n render json:{\n success: true,\n friends: @emails,\n count: @emails.count\n }\n else\n render json: {\n success: false,\n friends: [],\n count: 0\n }\n end\n end", "def list\n oauth_check_authorization\n \n @friends = facebook_client.friends_with_pictures\n end", "def index\n current_user = get_current_user\n @users = current_user.friends_list\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def get\n\t\tif request.post?\n\t\t\tuser = User.find_by_id(params[:user_id])\n\t\t\tunless user\n\t\t\t\trender json: {error: \"user not fonud\"} and return\n\t\t\tend\n\t\t\t\n\t\t\trender json: {friends: user.friends.each {|f| f.password = nil}}\n\t\tend\n\tend", "def index\n @relationships = current_user.friends\n end", "def friends(user=nil)\n\t\tself.twitagent.friends(user)\n\trescue => err\n\t\tRAILS_DEFAULT_LOGGER.error \"Failed to get friends via OAuth for #{current_user.inspect}\"\n\t\tflash[:error] = \"Twitter API failure (getting friends)\"\n\t\treturn\n\tend", "def index\n @friends = current_user.friend\n end", "def get_friends\n friends = get(\"friends\")\n\n # [id, name, phone_number, klass]\n if @starred_contacts.length == 0\n Logger.d(\"Starred contacts length was found to be 0, initiating a fetch\")\n t = Thread.start do\n @starred_contacts = ContactsSync.find_all_starred_contacts(@context)\n Logger.d(\"#{@starred_contacts.length} starred contacts are available. Requesting a UI refresh\")\n request_ui_refresh\n end # Thread ends\n end\n\n return friends + @starred_contacts\n end", "def friends\n @friends = []\n if current_user\n @friends = current_user.friends(graph).order(\"room_id ASC \")\n end\n respond_to do |format|\n format.js { render :partial => \"friends\", :locals => { :friends => @friends } }\n end\n end", "def get_friends\n graph = Koala::Facebook::API.new(@access_token)\n\n # Get friends from Facebook and convert them into a Friend object\n friends = graph.get_connections(\"me\", \"friends\").collect do |friend|\n Friend.new(:id => friend[\"id\"], :name => friend[\"name\"])\n end\n\n # Batch request friend pictures with respect to BATCH_API_LIMIT\n pictures = Array.new\n friends.each_slice(BATCH_API_LIMIT) do |friends_slice|\n batch_pictures = graph.batch do |batch|\n friends_slice.each { |friend| batch.get_picture(friend.id, :type => \"large\") }\n end\n pictures.concat(batch_pictures)\n end\n\n # Zip through the friends and pictures to produce updated Friend\n # objects.\n friends.zip(pictures).collect do |pair|\n friend = pair.first\n picture = pair.last\n\n friend.picture = pair.last\n\n friend\n end\n end", "def friends\n\t\t@user = User.includes(:owned_friendships => :friend, :sent_requests => :requestee,\n\t\t\t\t\t\t\t :received_requests => :requestor).find(params[:id])\n\tend", "def get_friends(cookie)\n \n # rescue is commented out to spot the error cases more clearly\n \n # begin\n friend_hash = PersonConnection.get_friends(self.id, cookie)\n # rescue RestClient::ResourceNotFound => e\n # #Could not find person with that id in COS Database!\n # return nil\n # end\n \n return friend_hash\n end", "def index\n @friends = @member.friends\n end", "def full_friends options={}\n client.user_friends(id, options)\n end", "def get_friends(auth = auth_http())\n TwBot.friends_of(auth)\n end", "def get_other_friends(fbid)\n graph_url = \"https://graph.facebook.com/#{fbid}/friends?access_token=TOKEN\"\n parsed_resp = query_graph(graph_url)\n friends = parsed_resp[\"data\"]\n return friends\nend", "def index\n @friendships = @user.friendships\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @friendships }\n end\n end", "def show\n @friend = Friend.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @friend }\n end\n end", "def index\n @friends = @user.friends.paginate(:page => params[:page],\n :per_page => RASTER_PER_PAGE)\n end", "def get_a_page_of_friends(req, opts)\n\tfriends_got = JSON.parse(Net::HTTP.get(URI(\"#{req}&access_token=#{opts[:token]}\")))\n\tunless friends_got[\"error\"].nil?\n\t\thandle_error friends_got[\"error\"]\n\tend\n\tif opts[:verbose]\n\t\tfriends_got[\"data\"].each do |f|\n\t\t\tprint \"#{f[\"display_name\"]}, \"\n\t\tend\n\tend\n\tfriends_got\nend", "def mutual_friends\n if @user and @friend\n @mutual_friends = User.mutual_friends_list(@user, @friend).page(params[:page]).per(params[:per_page]).distinct\n render json: @mutual_friends, each_serializer: Api::V1::UsersSerializer, meta: pagination_dict(@mutual_friends)\n else\n render json: {message: 'No Common Friends Exists'}, status: 404\n end\n end", "def get_friends\n if current_user.friends.count == 0\n\t return\n\t end\n\t if session[:selected_category] == \"all\"\n\t @friends = current_user.friends\n\t else\n category = Category.includes(:users).find(session[:selected_category])\n @friends = category.users.where(\"users.id IN (?)\", current_user.friends)\n end\n end", "def list\n user = User.find_by_email params[:email]\n if user\n friendship = Friendship.where user: user\n render json: {success: true, friends: friendship.map {|f| f.friend.email}, count: friendship.count}\n else\n render json: {message: \"email not found\"}\n end\n end", "def index\n @girlfriends = Girlfriend.all\n render json: @girlfriends, status: 200 \n end", "def friends_timeline(options={})\n perform_get(\"statuses/friends_timeline.#{Twitter.format}\", options)\n end", "def fetch_facebook_friends\n\t\treturn fetch_facebook_friends_or_subscribers_or_subscribedto(\"friends\")\n\tend", "def get_friends_list(user_id, *friend_ids)\n user_id = user_id.to_s\n validate_identifier(:user_id, user_id)\n friend_ids.each do |friend_id|\n friend_id = friend_id.to_s\n validate_identifier(:friend_ids, friend_id)\n end\n call_myspace_api(:friends_list, :user_id => user_id, :friend_ids => friend_ids.join(';'), :v1_json => true)\n end", "def friends\n begin\n if @@friends.size == 25 then @@friends.clear end # clear cache at 25 users\n unless @@friends[uid]\n @@friends[uid] = Set.new\n url = GRAPH_API[0] + uid + GRAPH_API[1] + oauth_token\n data = JSON.parse(open(url).read)\n data[\"friends\"][\"data\"].each { |h| @@friends[uid].add h[\"id\"] }\n @@friends[uid]\n else\n @@friends[uid]\n end\n rescue => e\n p e\n end\n end", "def get_friends( id, page=0, type='json', login=@login, password=@password )\n http = Net::HTTP.new('twitter.com', 80)\n json_data = http.start do |http_inst|\n path = \"/statuses/friends/#{id}.#{type}?page=#{page}\"\n req = Net::HTTP::Get.new(path)\n \n # we make an HTTP basic auth by passing the\n # username and password\n req.basic_auth login, password\n \n resp, data = http_inst.request(req)\n data\n end\n hash_data = JSON.parse( json_data )\n \n end", "def fb_friends\n graph = facebook()\n facebook().get_connection('me','friends') if graph\n end", "def get_friends_list(user_id, *friend_ids)\r\n user_id = user_id.to_s\r\n @context.validate_identifier(:user_id, user_id)\r\n friend_ids.each do |friend_id|\r\n friend_id = friend_id.to_s\r\n @context.validate_identifier(:friend_ids, friend_id)\r\n end\r\n @context.call_myspace_api(:friends_list, :user_id => user_id, :friend_ids => friend_ids.join(';'), :v1_json => true)\r\n end", "def requests_received\n friends = Friend.where(friend_id: params[:user_id], accepted: false)\n\t render json:friends\n end", "def friendships_incoming(options = {})\n @req.get(\"/1.1/friendships/incoming.json\", options)\n end", "def index\n @friends = Friend.all\n end", "def index\n @friends = Friend.all\n end", "def index\n @friends = Friend.all\n end", "def index\n @friends = Friend.all\n end", "def index\n @friends = Friend.all\n end", "def index\n @friends = Friend.all\n end", "def get_friends(id)\n facebook_cookies = Koala::Facebook::OAuth.new(Facebooker2.app_id, Facebooker2.secret).get_user_info_from_cookie(cookies)\n access_token = facebook_cookies[\"access_token\"]\n graph = Koala::Facebook::GraphAPI.new(access_token)\n friends = graph.get_connections(\"me\", \"friends\")\n\n user = User.find(id)\n\n friends.each do |friend|\n friend = User.find_by_host_id(friend[\"id\"])\n if (friend != nil && !user.friends.include?(friend))\n user.friends << friend\n end\n end\n\n user.last_update_friends = Date.today\n user.save\n end", "def find_friend\n\n \t\tif params[:email].blank?\n \t\t\tlogger.info(\"[FriendUserController]find_friend == email is blank !!!\")\n \t\t\treturn render :json => {:success => false}\n \t\tend\n\t\n \t\temail = params[:email]\n\n \t\t#get a list of friends\n \t\tfriend_emails = get_friend_email(email)\n\n \t\t#get a list of block friends by email\n \t\tblock_mails = BlockUser.where(:email=>email).map(&:block_email)\n\n \t\tfriend_emails = friend_emails - block_mails\n \t\t\n \t\tlogger.info(\"[FriendUserController]find_friend == friends list =======>#{friend_emails}\")\n\n \t\treturn render :json => {:success => true,:friends=>friend_emails,:count=>friend_emails.size}.to_json\n \t\t\n \tend", "def friend_requests\n get(\"users/requests\").requests\n end", "def get_friends(req, opts)\n\tpages_of_friends = Array.new\n\ta_page_of_friends = get_a_page_of_friends(req, opts)\n\tpages_of_friends = Marshal.load(Marshal.dump(a_page_of_friends[\"data\"]))\t# Deep copy\n\twhile true do\n\t\tnext_page = a_page_of_friends[\"pagination\"][\"next\"]\n\t\tif next_page.nil?\n\t\t\tbreak\n\t\telse\n\t\t\ta_page_of_friends = get_a_page_of_friends(next_page, opts)\n\t\t\tpages_of_friends += Marshal.load(Marshal.dump(a_page_of_friends[\"data\"]))\n\t\tend\n\tend\n\tpages_of_friends\nend", "def fb_friends\n fb_user = FbGraph::User.new('me', :access_token => self.access_token)\n fb_user.friends\n end", "def index\n render json: set_photo(current_user.friends), status: :ok\n end", "def show\n @friendsofuser = Friendsofuser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @friendsofuser }\n end\n end", "def friends\n @_friends ||=\n Rails.cache.fetch(\"accounts/#{self.id}/friends\", expires_in: Settings.cache.friends) do\n Set.new client.friend_ids\n end\n end", "def pref_friends\n render :nothing => true and return unless request.post?\n\n @friends = []\n\n current_user.all_friends.each do |user|\n user_js = { :url => user.url, :fs => user.friendship_status, :href => user_url(user), :count => nil }\n\n lve = user.last_viewed_entries_count.to_i\n uec = user.entries_count_for(current_user)\n user_js[:count] = (uec - lve).abs if lve != uec\n @friends << user_js\n end\n\n render :json => @friends.to_json\n end", "def show\n user = User.find(params[:id])\n friendships = user.followers + user.followees\n render json: {user: user, friendships: friendships}\n end", "def twitter_friends(cursor=-1)\n tparams = { :cursor => cursor }\n url = \"http://twitter.com/statuses/friends.json?#{tparams.to_query}\"\n json = twitter_request_authenticated(url)\n nextc = json['next_cursor']\n users = json['users']\n if nextc != 0\n users = users + twitter_friends(nextc)\n end\n users\n end", "def friends(options={})\n options = {\n :count => 5000,\n :offset => 0,\n :fields => \"domain\"\n }.merge(options)\n\n fetch_all_method_items(:fetch_friends, options)\n end", "def friends(cookie)\n Person.find_kassi_users_by_ids(get_friend_ids(cookie))\n end", "def show\n @friendship = @user.friendships.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @friendship }\n end\n end", "def index\n if current_user\n @friends = []\n current_user.friends.each do |friend|\n @friends.push(friend)\n end\n else\n @friends = []\n end\n render \"_index\"\n end", "def match_friends\n me = User.find params[:id]\n respond_to do |format|\n format.json { \n friends = me.match_friends(params[:q], params[:channel]).collect { |friend|\n name = friend.handle\n name << \" (#{friend.email})\" unless params[:channel]\n { id: friend.id.to_s, name: name }\n }\n if friends.empty? \n if params[:q].match(Devise::email_regexp)\n # A \"valid\" address goes back paired with itself\n friends = [ { id: params[:q], name: params[:q] } ]\n end\n end\n render :json => friends\n }\n end\n end", "def show\n @friendrequest = Friendrequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @friendrequest }\n end\n end", "def index\n retrieve_and_develop_all_friendships\n end", "def friends\n @person = Person.find(params[:id]) \n @project = Project.find(params[:project_id]) \n @persons = @person.get_all_friends\n \n respond_to do |format|\n format.html # friends.html.erb\n format.xml { render :xml => @persons }\n end\n \n end", "def friend_ids(query={})\n perform_get(\"/friends/ids.json\", :query => query)\nend", "def get_friend_count\n response = twitter_user.request(:get, configatron.api_call_url + \"account/totals.json\")\n \n if response.is_a?(Net::HTTPSuccess)\n body = JSON.parse(response.body)\n body[\"friends\"]\n end\n end", "def list_pending_friend_request\n @current_user = User.find(params[:user_id])\n render json: {\n pending_friend: @current_user.friend.where(status: :pending).map do |friend|\n {\n id: friend.friend,\n name: User.find(friend.friend).name,\n avatar: \"#{request.base_url}#{Rails.application.routes.url_helpers.rails_blob_path(User.find(friend.friend).avatar, only_path: true)}\",\n status: friend.status\n }\n end\n }, status: :ok\n end", "def new\n @friendslist = Friendslist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @friendslist }\n end\n end", "def friend_feed(options={})\n get('/feed', options)\n end", "def index\n @friendships = Friendship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @friendships }\n end\n end", "def index\n @friendships = Friendship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @friendships }\n end\n end", "def friends(options={})\n limit = options[:limit] || 5000\n user.friends(:limit => limit)\n end", "def set_friends\n # FIXME type: OAuthException, code: 2500, message: An active access token must be used to query information about the current user. [HTTP 400]\n begin\n @friends = $graph.get_connections(\"me\", \"friends\") unless $graph.nil?\n rescue Koala::Facebook::AuthenticationError => e\n logger.error e\n redirect_to signin_url\n# @friends = [{'name' => 'ERROR', 'id' => 0}]\n end\n end", "def get_my_friends(token)\n @graph = Koala::Facebook::API.new(token)\n @friends = @graph.get_connections('me', 'friends')\n @ids = []\n @friends.each {|f| @ids << f['id']}\n @users = []\n User.all.each {|u| @users << u if @ids.include?(u.uid) }\n return @users\n end", "def friends\n @_friends ||= Friendable.resource_class.where(:id => friend_ids)\n end", "def index\n @friendsofusers = Friendsofuser.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @friendsofusers }\n end\n end", "def leaderboard\n get(\"/user/#{@user_id}/friends/leaderboard.json\")\n end", "def show\n# @friendslist = Friendslist.find(params[:id])\n\n \n\n @friendslist = Array.new \n # if session[\"fb_access_token\"].present?\n\n @user = User.find(params[:id])\n\n graph = Koala::Facebook::GraphAPI.new(session[\"fb_access_token\"])\n @friendslist = graph.get_connections('me', \"friends\",:fields =>\"name,gender,email,relationship_status\")\n \n# graph.put_connections(\"me\", \"notes\", :subject => \"eShopVite\", :message => \"Message from eShopVite to register\")\n\n\n # if current_user\n # graph = Koala::Facebook::GraphAPI.new(@token)\n # @friendslist = graph.get_connections(\"me\", \"friends\")\n # end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @friendslist }\n end\n end", "def friendslist()\n hash_list = SQLQuery.new.get('friends', ['user_id', 'user2_id']).where.open_.if('user_id', @id).or.if('user2_id', @id).close_.and.if('status', 0).send\n list = []\n hash_list.each do |hash|\n if hash['user_id'] == @id\n list << Friend.get(@id, hash['user2_id'])\n else\n list << Friend.get(@id, hash['user_id'])\n end\n end\n return Sorter.last_interaction(list)\n end", "def all_friends\n friends friendships\n end" ]
[ "0.828671", "0.82809955", "0.7791224", "0.7685159", "0.7616414", "0.75592315", "0.7551979", "0.7451434", "0.7443884", "0.74000996", "0.7363765", "0.73304665", "0.7291144", "0.7290434", "0.7278924", "0.7238541", "0.7212576", "0.71354884", "0.71054906", "0.70882964", "0.70522666", "0.70486766", "0.70273566", "0.69996387", "0.6998896", "0.69516504", "0.6915678", "0.691355", "0.6894071", "0.68918246", "0.68877053", "0.6886685", "0.6879798", "0.6874106", "0.6873637", "0.6870803", "0.6868439", "0.68543845", "0.68331444", "0.68154305", "0.6813424", "0.67849433", "0.6782162", "0.67748046", "0.6751379", "0.6737926", "0.67336035", "0.6724644", "0.67006284", "0.6688188", "0.667817", "0.6660422", "0.66592693", "0.6655171", "0.6616157", "0.6614311", "0.6594304", "0.6583738", "0.6582968", "0.6582414", "0.6577974", "0.6577974", "0.6577974", "0.6577974", "0.6577974", "0.6577974", "0.65447795", "0.6542963", "0.65414685", "0.65301526", "0.6519964", "0.6517649", "0.64967287", "0.6492321", "0.64759445", "0.64709264", "0.6470723", "0.6457084", "0.6440841", "0.64134943", "0.6411854", "0.6407809", "0.6405924", "0.6399581", "0.63977176", "0.63956046", "0.6380618", "0.63731444", "0.63725585", "0.63626814", "0.635799", "0.635799", "0.63545865", "0.63474005", "0.63380706", "0.63339275", "0.63336426", "0.6321962", "0.63182765", "0.6293743", "0.62914604" ]
0.0
-1
GET /friends/1 GET /friends/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def friends(options={})\n get('/friends', options)\n end", "def index\n @user = current_user\n render json: @user.friends\n end", "def friends\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/friends/list').friends\n end", "def friends\n #get friends page\n #get json from friends page\n #parse\n []\n end", "def get_friends\n results = []\n user = User.find_by_username(params[:username])\n friends = Friend.where(user_id: user.id, accepted: true)\n friends.each do |friend_rel|\n friend = User.find(friend_rel.friend_id)\n results << {id:friend.id, username: friend.username}\n end\n friends = Friend.where(friend_id: user.id, accepted: true)\n friends.each do |friend_rel|\n friend = User.find(friend_rel.user_id)\n results << {id:friend.id, username: friend.username}\n end\n render json:results\n end", "def friends(id, options = {})\n get(\"users/#{id}/friends\").friends\n end", "def my_friends\n @current_user = User.find(params[:user_id])\n render json: {\n friends: @current_user.friend.where(status: 'accept').map do |friend|\n {\n id: friend.id,\n name: User.find(friend.friend).name.upcase,\n avatar: \"#{request.base_url}#{Rails.application.routes.url_helpers.rails_blob_path(User.find(friend.friend).avatar, only_path: true)}\",\n date: friend.created_at\n }\n end\n }\n end", "def show\n @user=current_user\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user.friends}\n end\n end", "def show_list_by_user_id\n @id = current_user.id\n @userfriendships = User.find(@id).friends\n if @userfriendships.empty?\n render json: {Error: \"No friends found\"}, status: 404\n else\n render json: @userfriendships.to_json(:only => [:id, :username])\n end\n end", "def index\n @friends = Friend.all\n render json: @friends\n end", "def friends(id)\n friends_data(request(\"users/friends/#{id}.xml\", :auth => true))\n end", "def friends(options={})\n perform_get(\"statuses/friends.#{Twitter.format}\", options)\n end", "def get_friends\n @person = Person.find_by_guid(params['user_id'])\n if ! @person\n render_json :status => :not_found and return\n end\n\n if params['sortBy'] == \"status_changed\"\n params['sortOrder'] ||= \"ascending\"\n @friends = @person.contacts.all\n @friends.sort!{|a,b| sort_by_status_message_changed(a, b, params['sortOrder']) }\n else\n @friends = @person.contacts\n end\n @friends.filter_paginate!(params[:per_page], params[:page]){true}\n @friends.collect! { |p| p.to_hash(@user, @client)}\n render_json :entry => @friends, :size => @friends.count_available and return\n end", "def friends_list\n @user = User.find_by(email: params[:email])\n if @user.present?\n @friends = @user.friends.page(params[:page]).per(params[:per_page]).distinct\n render json: @friends, each_serializer: Api::V1::UsersSerializer, meta: pagination_dict(@friends)\n else\n render json: {message: 'User Not Found'}, status: 404\n end\n end", "def show\n @friend = Friend.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @friend }\n end\n end", "def friends(user_id=self.username)\n connection.get(\"/users/#{user_id}/friends\").body.users\n end", "def get_my_friends\n remember_token = User.digest(cookies[:remember_token])\n current_user ||= User.find_by(remember_token: remember_token)\n p \"current_user\", current_user\n results = []\n # user = User.find_by_username(current_user.id)\n friends = Friend.where(user_id: current_user.id, accepted: true)\n friends.each do |friend_rel|\n friend = User.find(friend_rel.friend_id)\n results << {id: friend.id, username: friend.username, fullname: friend.first_name.capitalize + ' ' + friend.last_name.capitalize}\n end\n friends = Friend.where(friend_id: current_user.id, accepted: true)\n friends.each do |friend_rel|\n friend = User.find(friend_rel.user_id)\n results << {id: friend.id, username: friend.username, fullname: friend.first_name.capitalize + ' ' + friend.last_name.capitalize}\n end\n render json:results\n end", "def index\n @friends = @member.friends\n end", "def show\n render json: @user.suggest_friends\n end", "def friends\n\t\t@user = User.includes(:owned_friendships => :friend, :sent_requests => :requestee,\n\t\t\t\t\t\t\t :received_requests => :requestor).find(params[:id])\n\tend", "def friends\n @start = Time.now\n @users = current_user.friends.order(:name).page params[:page]\n\n respond_to do |format|\n format.html # friends.html.erb\n format.json { render :json => @users }\n format.xml { render :xml => @users }\n end\n end", "def index\n @friendships = @user.friendships\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @friendships }\n end\n end", "def friends(user = nil, params = {})\n args = [user, params]\n get path_from_args('statuses/friends', args), params_from_args(args)\n end", "def friends\n response = request(:get, 'prefs/friends.json', nil, https_connection)\n body = response[:body]\n friends = body[0][:data][:children]\n\n friends.map { |friend| OpenStruct.new(friend) }\n end", "def friend_requests\n friends = current_user.friends.where accepted: false\n profiles = friends.map{ |friend| Profile.find(friend.profile_id)}\n render json: profiles\n end", "def index\n @friends = current_user.friends\n end", "def friendships_show(options = {})\n @req.get(\"/1.1/friendships/show.json\", options)\n end", "def get_friends(cookie)\n \n # rescue is commented out to spot the error cases more clearly\n \n # begin\n friend_hash = PersonConnection.get_friends(self.id, cookie)\n # rescue RestClient::ResourceNotFound => e\n # #Could not find person with that id in COS Database!\n # return nil\n # end\n \n return friend_hash\n end", "def show\n @friendship = @user.friendships.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @friendship }\n end\n end", "def friends(user, options={})\n get(:standard, {:method => \"user.getFriends\", :user => user}.merge(options))\n end", "def index\n @friends = current_user.friend\n end", "def show\n @friendrequest = Friendrequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @friendrequest }\n end\n end", "def index\n current_user = get_current_user\n @users = current_user.friends_list\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @girlfriends = Girlfriend.all\n render json: @girlfriends, status: 200 \n end", "def index\n @friends = @user.friends.paginate(:page => params[:page],\n :per_page => RASTER_PER_PAGE)\n end", "def show\n @friendsofuser = Friendsofuser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @friendsofuser }\n end\n end", "def list\n @emails = Friend.friends(params[:email])\n\n unless @emails.empty?\n render json:{\n success: true,\n friends: @emails,\n count: @emails.count\n }\n else\n render json: {\n success: false,\n friends: [],\n count: 0\n }\n end\n end", "def friends\n @friends = response[\"friends\"]\n @friends[\"groups\"].each do |group|\n group[\"items\"].map!{|item| Foursquared::Response::User.new(client, item)}\n end\n @friends\n end", "def index\n @relationships = current_user.friends\n end", "def get_other_friends(fbid)\n graph_url = \"https://graph.facebook.com/#{fbid}/friends?access_token=TOKEN\"\n parsed_resp = query_graph(graph_url)\n friends = parsed_resp[\"data\"]\n return friends\nend", "def get\n\t\tif request.post?\n\t\t\tuser = User.find_by_id(params[:user_id])\n\t\t\tunless user\n\t\t\t\trender json: {error: \"user not fonud\"} and return\n\t\t\tend\n\t\t\t\n\t\t\trender json: {friends: user.friends.each {|f| f.password = nil}}\n\t\tend\n\tend", "def friends_timeline(params = {})\n get \"statuses/friends_timeline\", params\n end", "def mutual_friends\n if @user and @friend\n @mutual_friends = User.mutual_friends_list(@user, @friend).page(params[:page]).per(params[:per_page]).distinct\n render json: @mutual_friends, each_serializer: Api::V1::UsersSerializer, meta: pagination_dict(@mutual_friends)\n else\n render json: {message: 'No Common Friends Exists'}, status: 404\n end\n end", "def full_friends options={}\n client.user_friends(id, options)\n end", "def get_friends( id, page=0, type='json', login=@login, password=@password )\n http = Net::HTTP.new('twitter.com', 80)\n json_data = http.start do |http_inst|\n path = \"/statuses/friends/#{id}.#{type}?page=#{page}\"\n req = Net::HTTP::Get.new(path)\n \n # we make an HTTP basic auth by passing the\n # username and password\n req.basic_auth login, password\n \n resp, data = http_inst.request(req)\n data\n end\n hash_data = JSON.parse( json_data )\n \n end", "def friend_requests\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/friends/waiting-requests').friends\n end", "def friends\n @person = Person.find(params[:id]) \n @project = Project.find(params[:project_id]) \n @persons = @person.get_all_friends\n \n respond_to do |format|\n format.html # friends.html.erb\n format.xml { render :xml => @persons }\n end\n \n end", "def get_a_page_of_friends(req, opts)\n\tfriends_got = JSON.parse(Net::HTTP.get(URI(\"#{req}&access_token=#{opts[:token]}\")))\n\tunless friends_got[\"error\"].nil?\n\t\thandle_error friends_got[\"error\"]\n\tend\n\tif opts[:verbose]\n\t\tfriends_got[\"data\"].each do |f|\n\t\t\tprint \"#{f[\"display_name\"]}, \"\n\t\tend\n\tend\n\tfriends_got\nend", "def index\n render json: set_photo(current_user.friends), status: :ok\n end", "def index\n @friends = Friend.all\n end", "def index\n @friends = Friend.all\n end", "def index\n @friends = Friend.all\n end", "def index\n @friends = Friend.all\n end", "def index\n @friends = Friend.all\n end", "def index\n @friends = Friend.all\n end", "def new\n @friendslist = Friendslist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @friendslist }\n end\n end", "def show\n user = User.find(params[:id])\n friendships = user.followers + user.followees\n render json: {user: user, friendships: friendships}\n end", "def friends\n begin\n if @@friends.size == 25 then @@friends.clear end # clear cache at 25 users\n unless @@friends[uid]\n @@friends[uid] = Set.new\n url = GRAPH_API[0] + uid + GRAPH_API[1] + oauth_token\n data = JSON.parse(open(url).read)\n data[\"friends\"][\"data\"].each { |h| @@friends[uid].add h[\"id\"] }\n @@friends[uid]\n else\n @@friends[uid]\n end\n rescue => e\n p e\n end\n end", "def find_friend_by_username\n begin\n @friend_id = User.find_by(username: params[:username]).id\n rescue\n render json: {error: \"Friend not found\"}, status: 404\n end\n end", "def show\n @friend = Friend.find(params[:id])\n respond_with(@friend)\n end", "def friends\n @friends = []\n if current_user\n @friends = current_user.friends(graph).order(\"room_id ASC \")\n end\n respond_to do |format|\n format.js { render :partial => \"friends\", :locals => { :friends => @friends } }\n end\n end", "def get_friend_id \n uri = \"https://api.twitter.com/1/friends/ids.json\" \n \n #http request for friend search start\n req = Typhoeus::Request.new(uri,\n :method =>\"get\",\n :params =>{:cursor=>\"-1\", :screen_name=>crt_user.handler}) \n #sign_request(req,uri)\n hydra = Typhoeus::Hydra.new\n hydra.queue(req)\n hydra.run\n JSON.parse(req.response.body)[\"ids\"]\n end", "def get_friends\n friends = get(\"friends\")\n\n # [id, name, phone_number, klass]\n if @starred_contacts.length == 0\n Logger.d(\"Starred contacts length was found to be 0, initiating a fetch\")\n t = Thread.start do\n @starred_contacts = ContactsSync.find_all_starred_contacts(@context)\n Logger.d(\"#{@starred_contacts.length} starred contacts are available. Requesting a UI refresh\")\n request_ui_refresh\n end # Thread ends\n end\n\n return friends + @starred_contacts\n end", "def find_friend\n\n \t\tif params[:email].blank?\n \t\t\tlogger.info(\"[FriendUserController]find_friend == email is blank !!!\")\n \t\t\treturn render :json => {:success => false}\n \t\tend\n\t\n \t\temail = params[:email]\n\n \t\t#get a list of friends\n \t\tfriend_emails = get_friend_email(email)\n\n \t\t#get a list of block friends by email\n \t\tblock_mails = BlockUser.where(:email=>email).map(&:block_email)\n\n \t\tfriend_emails = friend_emails - block_mails\n \t\t\n \t\tlogger.info(\"[FriendUserController]find_friend == friends list =======>#{friend_emails}\")\n\n \t\treturn render :json => {:success => true,:friends=>friend_emails,:count=>friend_emails.size}.to_json\n \t\t\n \tend", "def get_friends(id)\n facebook_cookies = Koala::Facebook::OAuth.new(Facebooker2.app_id, Facebooker2.secret).get_user_info_from_cookie(cookies)\n access_token = facebook_cookies[\"access_token\"]\n graph = Koala::Facebook::GraphAPI.new(access_token)\n friends = graph.get_connections(\"me\", \"friends\")\n\n user = User.find(id)\n\n friends.each do |friend|\n friend = User.find_by_host_id(friend[\"id\"])\n if (friend != nil && !user.friends.include?(friend))\n user.friends << friend\n end\n end\n\n user.last_update_friends = Date.today\n user.save\n end", "def get_friends\n graph = Koala::Facebook::API.new(@access_token)\n\n # Get friends from Facebook and convert them into a Friend object\n friends = graph.get_connections(\"me\", \"friends\").collect do |friend|\n Friend.new(:id => friend[\"id\"], :name => friend[\"name\"])\n end\n\n # Batch request friend pictures with respect to BATCH_API_LIMIT\n pictures = Array.new\n friends.each_slice(BATCH_API_LIMIT) do |friends_slice|\n batch_pictures = graph.batch do |batch|\n friends_slice.each { |friend| batch.get_picture(friend.id, :type => \"large\") }\n end\n pictures.concat(batch_pictures)\n end\n\n # Zip through the friends and pictures to produce updated Friend\n # objects.\n friends.zip(pictures).collect do |pair|\n friend = pair.first\n picture = pair.last\n\n friend.picture = pair.last\n\n friend\n end\n end", "def index\n @friendships = Friendship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @friendships }\n end\n end", "def index\n @friendships = Friendship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @friendships }\n end\n end", "def friends(user=nil)\n\t\tself.twitagent.friends(user)\n\trescue => err\n\t\tRAILS_DEFAULT_LOGGER.error \"Failed to get friends via OAuth for #{current_user.inspect}\"\n\t\tflash[:error] = \"Twitter API failure (getting friends)\"\n\t\treturn\n\tend", "def get_friends_list(user_id, *friend_ids)\n user_id = user_id.to_s\n validate_identifier(:user_id, user_id)\n friend_ids.each do |friend_id|\n friend_id = friend_id.to_s\n validate_identifier(:friend_ids, friend_id)\n end\n call_myspace_api(:friends_list, :user_id => user_id, :friend_ids => friend_ids.join(';'), :v1_json => true)\n end", "def list\n user = User.find_by_email params[:email]\n if user\n friendship = Friendship.where user: user\n render json: {success: true, friends: friendship.map {|f| f.friend.email}, count: friendship.count}\n else\n render json: {message: \"email not found\"}\n end\n end", "def friend_ids(query={})\n perform_get(\"/friends/ids.json\", :query => query)\nend", "def index\n @friends1s = Friends1.all\n end", "def show\n @friendship = Friendship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @friendship }\n end\n end", "def show\n @friendship = Friendship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @friendship }\n end\n end", "def friends(cookie)\n Person.find_kassi_users_by_ids(get_friend_ids(cookie))\n end", "def leaderboard\n get(\"/user/#{@user_id}/friends/leaderboard.json\")\n end", "def index\n retrieve_and_develop_all_friendships\n end", "def get_friends_list(user_id, *friend_ids)\r\n user_id = user_id.to_s\r\n @context.validate_identifier(:user_id, user_id)\r\n friend_ids.each do |friend_id|\r\n friend_id = friend_id.to_s\r\n @context.validate_identifier(:friend_ids, friend_id)\r\n end\r\n @context.call_myspace_api(:friends_list, :user_id => user_id, :friend_ids => friend_ids.join(';'), :v1_json => true)\r\n end", "def index\n if current_user\n @friends = []\n current_user.friends.each do |friend|\n @friends.push(friend)\n end\n else\n @friends = []\n end\n render \"_index\"\n end", "def friend\n UserRepository.find(friend_id)\n end", "def list\n oauth_check_authorization\n \n @friends = facebook_client.friends_with_pictures\n end", "def new\n @friend = current_user_or_guest.friends.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @friend }\n format.json { render json: @friend }\n end\n end", "def index\n render_index @user.friends\n end", "def requests_received\n friends = Friend.where(friend_id: params[:user_id], accepted: false)\n\t render json:friends\n end", "def friend(note = nil)\n name = read_attribute(:name)\n body = JSON.generate(note ? { name: name, note: note } : { name: name })\n client.request(:put, \"/api/v1/me/friends/#{name}\", body: body)\n end", "def match_friends\n me = User.find params[:id]\n respond_to do |format|\n format.json { \n friends = me.match_friends(params[:q], params[:channel]).collect { |friend|\n name = friend.handle\n name << \" (#{friend.email})\" unless params[:channel]\n { id: friend.id.to_s, name: name }\n }\n if friends.empty? \n if params[:q].match(Devise::email_regexp)\n # A \"valid\" address goes back paired with itself\n friends = [ { id: params[:q], name: params[:q] } ]\n end\n end\n render :json => friends\n }\n end\n end", "def friends\n @_friends ||=\n Rails.cache.fetch(\"accounts/#{self.id}/friends\", expires_in: Settings.cache.friends) do\n Set.new client.friend_ids\n end\n end", "def index\n @friendships = @user.friendships\n\n respond_to do |format|\n format.html # index.rhtml\n end\n end", "def index\n @friendsofusers = Friendsofuser.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @friendsofusers }\n end\n end", "def friend(note = nil)\n name = get_attribute(:name)\n body = JSON.generate(note ? { name: name, note: note } : { name: name })\n @client.request(:put, \"/api/v1/me/friends/#{name}\", body: body)\n end", "def friend(note = nil)\n name = get_attribute(:name)\n body = JSON.generate(note ? { name: name, note: note } : { name: name })\n @client.request(:put, \"/api/v1/me/friends/#{name}\", body: body)\n end", "def friends_timeline(options={})\n perform_get(\"statuses/friends_timeline.#{Twitter.format}\", options)\n end", "def index\n @friends = Friend.all(:conditions=>{:created_by=>current_user.id})\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @friends }\n end\n end", "def get_friend_count\n response = twitter_user.request(:get, configatron.api_call_url + \"account/totals.json\")\n \n if response.is_a?(Net::HTTPSuccess)\n body = JSON.parse(response.body)\n body[\"friends\"]\n end\n end", "def friend\n if params.include?(:id)\n @user.friends += [User.find(params[:id])]\n elsif params.include?(:username)\n @user.friends += [User.find_by(username: params[:username])]\n end\n redirect_to root_path\n end", "def get_friends\n if current_user.friends.count == 0\n\t return\n\t end\n\t if session[:selected_category] == \"all\"\n\t @friends = current_user.friends\n\t else\n category = Category.includes(:users).find(session[:selected_category])\n @friends = category.users.where(\"users.id IN (?)\", current_user.friends)\n end\n end", "def send_friend_request(id)\n get(\"users/#{id}\").user\n end", "def show\n @user = User.find(params[:id])\n if @user.phone_number != nil\n\n @user = getUserFriends(@user)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n else\n redirect_to :action=>:edit, :id => @user.id\n end\n end", "def fetch_facebook_friends\n\t\treturn fetch_facebook_friends_or_subscribers_or_subscribedto(\"friends\")\n\tend", "def get_friends(auth = auth_http())\n TwBot.friends_of(auth)\n end" ]
[ "0.76709884", "0.7604071", "0.7600863", "0.74548936", "0.7365434", "0.73384774", "0.73283494", "0.73141056", "0.73036456", "0.7235156", "0.7219719", "0.7216787", "0.7163809", "0.7131452", "0.70871836", "0.70085126", "0.69397676", "0.6919202", "0.6908836", "0.69050354", "0.69024783", "0.689683", "0.6877914", "0.686014", "0.68587494", "0.685429", "0.6837924", "0.6833314", "0.6816438", "0.68109286", "0.679779", "0.6789358", "0.6784481", "0.6753627", "0.6751614", "0.67162794", "0.66923016", "0.66875905", "0.66726255", "0.6671342", "0.6660217", "0.66468585", "0.6634872", "0.66298693", "0.66103065", "0.6582316", "0.6569546", "0.6562083", "0.65608156", "0.6555007", "0.6555007", "0.6555007", "0.6555007", "0.6555007", "0.6555007", "0.6549548", "0.6548707", "0.65481365", "0.65341413", "0.6532755", "0.65296566", "0.6514302", "0.6495987", "0.6491891", "0.6491775", "0.6491584", "0.64884716", "0.64884716", "0.6486362", "0.6483502", "0.64766157", "0.647569", "0.6470767", "0.64497054", "0.64497054", "0.64235663", "0.64035195", "0.6393819", "0.63914496", "0.6384649", "0.63833743", "0.63733107", "0.6373049", "0.6367752", "0.6356849", "0.635445", "0.63521194", "0.6351413", "0.63295233", "0.632108", "0.63201314", "0.63201314", "0.6317478", "0.6306462", "0.62937045", "0.6286829", "0.62828755", "0.6277072", "0.62691754", "0.62670827", "0.6264578" ]
0.0
-1
POST /friends POST /friends.json
def create logger.debug('In the create method afterall') logger.debug( friend_params ) current_user.friendships.create!(:friend_id => params[:friend_id]) redirect_to friendship_index_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def friend\n @user.friendships.build(friend_id: @friend.id)\n if @user.save\n render json: { success: true }\n else\n render json: {message: @user.errors&.messages || 'Unable add as friend, please try again'}, status: 202\n end\n end", "def add_friend\n\n current_user.friends_list.push(define_friend)\n # binding.pry\n if current_user.save\n render json: current_user \n else\n render json: @user.errors, status: 422\n end\n\n end", "def create\n # @friend = Friend.new(friend_params)\n @friend = current_user.friends.build(friend_params)\n respond_to do |format|\n if @friend.save\n format.html { redirect_to @friend, notice: I18n.t('friend.create') }\n format.json { render :show, status: :created, location: @friend }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @friend.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_friend\n # byebug\n #we get user_id from jwt!\n user = User.find(decode_jwt(cookies.signed[:jwt])[\"user_id\"])\n #we get friend_id from frontend\n if !Block.where(blocker_id: user.id, blockee_id:follow_params[:user2]).empty?\n return render json: {error: \"There was a problem! (Ya been blocked!)\"}\n end\n\n followee = User.find(follow_params[:user2])\n #insert the one way relation in db!\n friend_request = Follow.new(follower_id: user.id, followee_id: followee.id)\n if friend_request.save\n render json: {friend_request: followee} \n else\n render json: {error: \"There was a problem!\"}\n end\n end", "def friendships_create(options = {})\n @req.post(\"/1.1/friendships/create.json\", options)\n end", "def create\n Friendship.request(@user, @friend)\n @friend = Friendship.find_by_user_id_and_friend_id(@user, @friend)\n render :json => { :success => true, :new_friend => @friend }\n end", "def create\n #@friend = Friend.new(friend_params)\n @friend = current_user.friends.build(friend_params)\n respond_to do |format|\n if @friend.save\n format.html { redirect_to @friend, notice: \"Friend was successfully created.\" }\n format.json { render :show, status: :created, location: @friend }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @friend.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #@friendrequest = Friendrequest.new(params[:friendrequest])\n \n @user = User.find(params[:user_id])\n #@friend = Friend.new(params[:friend])\n @friendreq = @user.friendrequests.create(params[:friendrequest].permit(:futurefriend))\n\n respond_to do |format|\n if @friendrequest.save\n format.html { redirect_to @friendrequest, notice: 'Friendrequest was successfully created.' }\n format.json { render json: @friendrequest, status: :created, location: @friendrequest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @friendrequest.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @friend = Friend.new(user_id: params[:user_id], friend_id: params[:friend_id])\n\n respond_to do |format|\n if @friend.save\n format.html { redirect_to @friend, notice: \"Friend was successfully created.\" }\n format.json { render :show, status: :created, location: @friend }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @friend.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @friend = Friend.new(params[:friend])\n\n respond_to do |format|\n if @friend.save\n format.html { redirect_to @friend, notice: 'Friend was successfully created.' }\n format.json { render json: @friend, status: :created, location: @friend }\n else\n format.html { render action: \"new\" }\n format.json { render json: @friend.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # prevent user from adding friends who are already on friends list.\n if @friendship\n render json: { Message: \"You're already friends!\" }, status: :unprocessable_entity\n else\n @friend = current_user.friendships.create(:friend_id => @friend_id)\n render json: @friend, status: 201\n end\n end", "def create\n current_user.friends.create(\n friend_id: @user.id\n )\n redirect_to root_path\nend", "def create\n @user = User.new(user_params)\n\n if @user.save\n @users = User.friends_by_name(user_params[:name])\n render json: {me: @user, users: @users, rooms: []}, status: :ok\n else\n render json: {error: @user.errors.full_messages.first}, status: :unprocessable_entity\n end\n end", "def create\n @friend = Friend.new(friend_params)\n\n respond_to do |format|\n if @friend.save\n format.html { redirect_to @friend, notice: 'Friend was successfully created.' }\n format.json { render :show, status: :created, location: @friend }\n else\n format.html { render :new }\n format.json { render json: @friend.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @friend = Friend.new(friend_params)\n\n respond_to do |format|\n if @friend.save\n format.html { redirect_to @friend, notice: 'Friend was successfully created.' }\n format.json { render :show, status: :created, location: @friend }\n else\n format.html { render :new }\n format.json { render json: @friend.errors, status: :unprocessable_entity }\n end\n end\n end", "def add\n params[:friends].each do |email|\n friend = User.find_by_email(email)\n next unless friend.present?\n\n # Check the inverse friendship and add if necessary\n friendship = Friendship.find_by_user_id_and_friend_id(friend.id, current_user.id)\n unless friendship.present?\n inverse_friendship = friend.friendships.build(friend_id: current_user.id)\n if inverse_friendship.save\n puts \"Added friendship for #{friend.name} (#{friend.id}) and #{current_user.name} (#{current_user.id})\"\n end\n end\n end\n\n render json: { success: true }\n end", "def create\n @friend = Friend.new(friend_params)\n\n if @friend.save\n render :show, status: :created, location: @friend\n else\n render json: @friend.errors, status: :unprocessable_entity\n end\n end", "def add_friend\n # check if this friend isnt't to our list friend\n if params[:user_id].to_i == params[:friend_id].to_i \n render json: {\n message: \"Not yourself\"\n }, status: 400\n else\n @current_user = User.find(params[:user_id])\n if @current_user.friend.find_by(friend: params[:friend_id])\n render json: {\n message: \"#{User.find(params[:user_id]).name} can't be added, You are friend with this user\",\n errors: {\n error_code: \"\",\n error_description: \"\"\n }\n }, status: 401\n else\n # add friend\n puts \"Starting adding friend ...\"\n @new = @current_user.friend.new(friend: params[:friend_id], status: :pending)\n if @new.save\n render json: {\n message: \"#{User.find(params[:user_id]).name} added as friend\"\n }, status: 201\n else\n render json: {\n message: @new.errors.messages\n }, status: 401\n end\n end\n end\n\n end", "def create\n @friend = Friend.new(friend_params)\n\n respond_to do |format|\n if @friend.save\n format.html { redirect_to request.referrer }\n format.json { render :show, status: :created, location: @friend }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @friend.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n if safe_create_friend\n format.html { redirect_to member_friends_path(@member), notice: 'Friend was successfully created.' }\n format.json { render :show, status: :created, location: @member }\n else\n format.html { render :new }\n format.json { render json: @friend.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @friends1 = Friends1.new(friends1_params)\n\n respond_to do |format|\n if @friends1.save\n format.html { redirect_to @friends1, notice: \"Friend was successfully created.\" }\n format.json { render :show, status: :created, location: @friends1 }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @friends1.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @friend = Friend.new(params[:friend])\n @friend.save\n respond_with(@friend)\n end", "def create\n @friendslist = Friendslist.new(params[:friendslist])\n\n respond_to do |format|\n if @friendslist.save\n format.html { redirect_to @friendslist, notice: 'Friendslist was successfully created.' }\n format.json { render json: @friendslist, status: :created, location: @friendslist }\n else\n format.html { render action: \"new\" }\n format.json { render json: @friendslist.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_friend\n # If there is no pending connection between persons,\n # add pendind/requested connections between them.\n # If there is already a pending connection requested from the other direction,\n # change friendship status to accepted.\n\n if (params['user_id'] == params['friend_id'])\n render_json :messages => \"Cannot add yourself to your friend.\", :status => :bad_request and return\n end\n\n if ! ensure_same_as_logged_person(params['user_id'])\n render_json :status => :forbidden and return\n end\n\n @person = Person.find_by_guid(params['user_id'])\n if ! @person\n render_json :status => :not_found and return\n end\n @friend = Person.find_by_guid(params['friend_id'])\n if ! @friend\n render_json :status => :not_found and return\n end\n\n if @person.association? or @friend.association?\n render_json :messages => \"Association users cannot have friends.\", :status => :bad_request and return\n end\n\n if @person.pending_contacts.include?(@friend) #accept if pending\n Connection.accept(@person, @friend)\n else\n unless @person.requested_contacts.include?(@friend) || @person.contacts.include?(@friend)\n Connection.request(@person, @friend) #request if didn't exist\n end\n end\n\n render_json :status => :ok\n end", "def create\n #friends_list = FriendsList.new(friends_list_params)\n @friends_list = current_user.friends_list.build(friends_list_params)\n\n respond_to do |format|\n if @friends_list.save\n format.html { redirect_to @friends_list, notice: \"Friend was successfully added.\" }\n format.json { render :show, status: :created, location: @friends_list }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @friends_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def make_friend_with(username)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_post_call('/friends/%s/request' % [username]).status == \"OK\"\n end", "def create\n @friends_list = FriendsList.new(friends_list_params)\n\n respond_to do |format|\n if @friends_list.save\n format.html { redirect_to @friends_list, notice: 'Friends list was successfully created.' }\n format.json { render :show, status: :created, location: @friends_list }\n else\n format.html { render :new }\n format.json { render json: @friends_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n #Find the current user and the requested friend\n @user=current_user\n friend=User.find_by_email(params[:email])\n #make sure the friend exists\n if(friend)\n #Check to see if the friendship already exists\n friendCheck=Friendship.find_by_user_id_and_friend_id(@user.id, friend.id)\n if(!friendCheck)\n #If there is no friendship between the two users, continue as normal\n @friendship = @user.friendships.build(:friend_id => friend.id)\n\n respond_to do |format|\n #Do it again for the reverse relationship (a friends with b and b friends with a are two separate relationships)\n if @friendship.save\n @friendship=friend.friendships.build(:friend_id => @user.id)\n if @friendship.save\n #Send an email to the friend so they can confirm that they want to be friends\n UserMailer.confirmation_email(@user,friend).deliver\n format.html { redirect_to @friendship, notice: 'Friendship was successfully created.' }\n format.json { render json: {:created => 'true', :exists => 'true', :friends => 'false'}}\n else\n format.html { render action: \"new\" }\n format.json { render json: {:created => 'false', :friends => 'false', :exists => 'true'}}\n end\n else\n render json: {:created => 'false', :friends => 'false', :exists => 'true'}\n end\n end\n else\n #If the friendship exist, return this fact to the app. It will notify the user.\n render json: {:friends => 'true', :exists => 'true', :created => 'false'}\n end\n else\n #If the user does not exist, let the app know.\n render json: {:friends => 'false', :exists => 'false', :created => 'false'}\n end\n end", "def add_future_friend(friend_id)\n add_future_params(:add_friends, [friend_id])\n end", "def friend_params\n params.require(:friend).permit(:user_id, :name)\n end", "def friends(options={})\n get('/friends', options)\n end", "def friend(note = nil)\n name = get_attribute(:name)\n body = JSON.generate(note ? { name: name, note: note } : { name: name })\n @client.request(:put, \"/api/v1/me/friends/#{name}\", body: body)\n end", "def friend(note = nil)\n name = get_attribute(:name)\n body = JSON.generate(note ? { name: name, note: note } : { name: name })\n @client.request(:put, \"/api/v1/me/friends/#{name}\", body: body)\n end", "def friend_params\n params.require(:friend).permit(:name, :address, :user_id)\n end", "def friend_params\r\n params.require(:friend).permit(:user_id, :friend_id)\r\n end", "def friend_params\n params.require(:friend).permit(:friend_name)\n end", "def friend(action, value)\n raise ArgumentError, \"Invalid friend action provided: #{action}\" unless @@FRIENDSHIP_URIS.keys.member?(action)\n value = value.to_i unless value.is_a?(String)\n uri = \"#{@@FRIENDSHIP_URIS[action]}/#{value}.json\"\n response = http_connect {|conn| create_http_post_request(uri) }\n bless_model(Twitter::User.unmarshal(response.body))\n end", "def friend_params\n params.require(:friend).permit(:user_id, :friend_id)\n end", "def create\n @friendsofuser = Friendsofuser.new(params[:friendsofuser])\n\n respond_to do |format|\n if @friendsofuser.save\n flash[:notice] = 'Friendsofuser was successfully created.'\n format.html { redirect_to(@friendsofuser) }\n format.xml { render :xml => @friendsofuser, :status => :created, :location => @friendsofuser }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @friendsofuser.errors, :status => :unprocessable_entity }\n end\n end\n end", "def add_buddies_to_friends_list\n if user_id.blank?\n render :status=>401,\n :json=>{:Message=>\"The user id cannot be blank for this api.\",\n :Response => \"Fail\",\n :Data => nil} \n end\n friend = User.find_by_id(user_id)\n friend.follow(requested_user)\n render :status=>200,\n :json=>{:Message=>\"Added #{friend.name} to buddy list!\",\n :Response => \"Success\",\n :Data => nil} \n end", "def create\n @friendship = current_user.friendships.build(:friend_id => params[:friend_id])\n @friendship.status = \"SENT\"\n if @friendship.save\n flash[:notice] = \"Added friend.\"\n redirect_to root_url\n else\n flash[:error] = \"Unable to add friend.\"\n redirect_to root_url\n end\n end", "def add\n id = params.require(:friend_id)\n current_user.friendships.create friend_id: id\n\n respond_to do |format|\n format.html { redirect_to friends_path, alert: \"#{User.find(id).name} is now your friend\" }\n format.json { render :json => {success: 'OK'} }\n end\n end", "def create\n @friendlist = Friendlist.new(friendlist_params)\n\n respond_to do |format|\n if @friendlist.save\n format.html { redirect_to @friendlist, notice: 'Friendlist was successfully created.' }\n format.json { render :show, status: :created, location: @friendlist }\n else\n format.html { render :new }\n format.json { render json: @friendlist.errors, status: :unprocessable_entity }\n end\n end\n end", "def friend(note = nil)\n name = read_attribute(:name)\n body = JSON.generate(note ? { name: name, note: note } : { name: name })\n client.request(:put, \"/api/v1/me/friends/#{name}\", body: body)\n end", "def create\n @friend = Friend.new(params[:friend])\n case @friend.profile_url\n when %r!facebook\\.com/profile\\.php\\?id=(\\d+)!\n friend_info = rest_graph.get($1)\n @friend.user_id = friend_info[\"id\"]\n @friend.user_name = friend_info[\"name\"]\n when %r!facebook\\.com/([^?]+)!\n friend_info = rest_graph.get($1)\n @friend.user_id = friend_info[\"id\"]\n @friend.user_name = friend_info[\"name\"]\n end\n\n respond_to do |format|\n if @friend.save\n format.html { redirect_to(@friend, :notice => 'Friend was successfully created.') }\n format.xml { render :xml => @friend, :status => :created, :location => @friend }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @friend.errors, :status => :unprocessable_entity }\n end\n end\n end", "def friend_params\n params.require(:friend).permit(:name, :email, :phone, :instagram, :user_id)\n end", "def create\n if current_user.friends.exists?(params[:friend_request][:receiver_id])\n redirect_to users_show_path(current_user), flash: {notice: \"You are already friend\"}\n else\n @friend_request = FriendRequest.new(friend_request_params.merge(sender_id: current_user.id))\n respond_to do |format|\n if @friend_request.save\n format.html { redirect_to @friend_request, notice: 'Friend request was successfully created.' }\n format.json { render :show, status: :created, location: @friend_request }\n else\n format.html { render :new }\n format.json { render json: @friend_request.errors, status: :unprocessable_entity }\n end\n end\n\n end\n\n\n end", "def create\n user = User.find(params[:user_id])\n friend_request = user.incoming_requests.build(sender_id: current_user.id)\n if friend_request.save\n if friend_request.sender == current_user\n respond_to do |format|\n format.html { redirect_back(fallback_location: root_path, notice: \"Friend request sent to #{user.name}.\") }\n format.json do\n render json: {\n request: {\n id: friend_request.id,\n name: friend_request.sender.name\n },\n message: \"Friend request sent to #{user.name}.\"\n }\n end\n end\n else\n redirect_back(fallback_location: root_path, notice: \"Friend request sent to #{user.name}.\")\n end\n else\n redirect_back(fallback_location: root_path, alert: 'Friend request could not be sent.')\n end\n end", "def friend_params\n params.require(:friend).permit(:user_id, :friend_id, :status)\n end", "def my_friends\n @current_user = User.find(params[:user_id])\n render json: {\n friends: @current_user.friend.where(status: 'accept').map do |friend|\n {\n id: friend.id,\n name: User.find(friend.friend).name.upcase,\n avatar: \"#{request.base_url}#{Rails.application.routes.url_helpers.rails_blob_path(User.find(friend.friend).avatar, only_path: true)}\",\n date: friend.created_at\n }\n end\n }\n end", "def friend_params\n params.permit(:user_id, :friend_id)\n end", "def friend_params\n params.permit(:user_id, :friend_id)\n end", "def friend_params\n params.require(:friend).permit(:id, :name)\n end", "def follow!(new_friend)\n\t\tresponse = access_token.post(\"/friendships/create/#{new_friend}.json\")\n\t\tcase response\n\t\twhen Net::HTTPSuccess\n\t\t\tfriend=JSON.parse(response.body)\n\t\t\traise TwitterOauth::UnexpectedResponse unless friend.is_a? Hash\n\t\t\tfriend\n\t\telse\n\t\t\traise TwitterOauth::APIError\n\t\tend\n\trescue => err\n\t\tputs \"Exception in follow!: #{err}\"\n\t\traise err\n\tend", "def friend_params\n params.require(:friend).permit(:user_id, :friend_id, :facebook_id, :friend_confirm)\n end", "def create\n @friend = Friend.new(params[:friend])\n\[email protected]_id = flash[:user_id]\n @friend.image_url = \"http://128.100.195.55:3000/content/friendphoto2.jpg\";\n @user = User.find(@friend.user_id);\n @user.friends << @friend;\n \n respond_to do |format|\n if @friend.save\n flash[:notice] = 'Friend was successfully created.'\n format.html { redirect_to(@friend) }\n format.xml { render :xml => @friend, :status => :created, :location => @friend }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @friend.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_friend\n\n \t\tif params[:friends].blank? || params[:friends].size != 2\n \t\t\tlogger.info(\"[FriendUserController]create_friend == params is error ,params ==#{params[:friends]}\")\n \t\t\treturn render :json => {:success => false}\n \t\tend\n \t\temail = params[:friends][0]\n \t\tfriend_email = params[:friends][1]\n\n \t\t# block updates from an email address,if they are not connected as friends, then no new friends connection can be added\n \t\tif BlockUser.exists?(:email=>email,:block_email=>friend_email) || BlockUser.exists?(:email=>friend_email,:block_email=>email)\n \t\t return render :json => {:success => false}\n \t\tend\n \t\t#if they are connected as friends,retrun success is true\n \t\tif FriendUser.exists?(:email=>email,:friend_email=>friend_email) || FriendUser.exists?(:email=>friend_email,:friend_email=>email)\n \t\t\treturn render :json => {:success => true}\n \t\tend\n\n \t\t#create a friend connection between two email addresses.\n \t\tfriend_user = FriendUser.create(:email=>email,:friend_email=>friend_email)\n\n \t\tif friend_user.save\n \t\t\tlogger.info(\"[FriendUserController]create_friend == create a friend connection between two email addresses ,params ==#{params[:friends]}\")\n \t\t\treturn render :json => {:success => true}\n \t\telse\n \t\t\tlogger.info(\"[FriendUserController]create_friend == can not create a friend connection between two email addresses,error=#{friend_user.errors.full_messages} ,params ==#{params[:friends]}\")\n \t\t\treturn render :json => {:success => false}\n \t\tend\n \t\t\n \tend", "def friend_params\n params.require(:friend).permit(:requester_id, :destiny_id, :status)\n end", "def create\n @user = User.find_by(:email => friendship_params[:email])\n if @user.nil?\n render json: { error: \"Cannot find user with specified email\"}, status: 400\n else\n id = @user.firstName\n if Friendship.exists?(:user_id => @current_user.id, :friend_id => @user.id)\n render json: { error: 'Already Friends'}, status: 400\n else\n @friendship = @current_user.friendships.build(:friend_id => @user.id)\n if @friendship.save\n @friend_user = @friendship.friend\n @inverse_friendship = @friend_user.friendships.build(:friend_id => @current_user.id)\n if @inverse_friendship.save\n render json: @friendship, status: :created\n else\n render json: @inverse_friendship.errors, status: :unprocessable_entity\n end\n else\n render json: @friendship.errors, status: :unprocessable_entity\n end\n end\n end\n end", "def create\n\t\t@profile_friend = Friendship.new(profile_friend_params)\n\t\t@profile_friend.friend_a = current_user\n\n\t\trespond_to do |format|\n\t\t\tif @profile_friend.save\n\t\t\t\tback_page = profile_friends_path\n\t\t\t\tback_page = URI(request.referer).path if params[:back]\n\t\t\t\tformat.html { redirect_to back_page, notice: 'Friend was successfully created.' }\n\t\t\t\tformat.json { render :show, status: :created, location: back_page }\n\t\t\telse\n\t\t\t\tformat.html { broadcast_errors @profile_friend, profile_friend_params }\n\t\t\t\tformat.json { render json: @profile_friend.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n @user.make_friend_with! params[:id]\n render_created\n end", "def friends_list_params\n params.require(:friends_list).permit(:first_name, :last_name, :phone, :email, :notes, :user_id)\n end", "def friendlist_params\n params.require(:friendlist).permit(:first_name, :last_name, :email, :phone, :twitter)\n end", "def create\n user = User.find(params[:user_id])\n friendship = current_user.friendships.build(friend: user)\n if friendship.save\n reciprocal_friendship = user.friendships.build(friend: current_user)\n if reciprocal_friendship.save\n request_1 = FriendshipRequest.find_by(sender: current_user, recipient: user)\n request_2 = FriendshipRequest.find_by(sender: user, recipient: current_user)\n request_1.destroy if request_1\n request_2.destroy if request_2\n respond_to do |format|\n format.html { redirect_back(fallback_location: root_path, notice: \"You and #{user.name} are now friends!\") }\n format.json do\n render json: {\n friendship: {\n name: current_user.name,\n id: current_user.id\n },\n message: \"You and #{user.name} are now friends!\"\n }\n end\n end\n else\n friendship.destroy\n redirect_back(fallback_location: root_path, notice: \"There was an error creating the friendship\")\n end\n else\n redirect_back(fallback_location: root_path, notice: \"There was an error creating the friendship\")\n end\n end", "def add_friend\n\t\t# unless @current_user.friends.include? params[:id] \n\t\t@current_user.push(friends: params[:id])\n\t\t# push to friends array id number of friend\n\n\t\tredirect_to \"/profile/#{@current_user.id}\"\n\t\t# show the new friend\n\tend", "def friends_list_params\n params.require(:friends_list).permit(:first_name, :last_name, :email, :phone, :twitter)\n end", "def friend_params\n params.require(:friend).permit(:first_name, :last_name, :email, :phone, :twitter,:user_id)\n end", "def index\n @user = current_user\n render json: @user.friends\n end", "def new\n @friendslist = Friendslist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @friendslist }\n end\n end", "def friends\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/friends/list').friends\n end", "def create\n user = User.find(params[:friend_id])\n if current_user == user\n redirect_to root_path, notice: \"You can't send request to yourself\"\n return\n elsif Friendship.where(friend_id: user.id, user_id: current_user, confirm: false).exists?\n redirect_to root_path, notice: \"Friend request already sent\"\n return\n elsif Friendship.where(friend_id: current_user, user_id: user.id, confirm: false).exists?\n redirect_to root_path, notice: \"This user already sent friend request to you. Respond to it!\"\n return\n end\n @friendship = current_user.friendships.build(friend_id: user.id)\n\n respond_to do |format|\n if @friendship.save\n format.html { redirect_to root_path, notice: \"Friends request sent\" }\n format.json { render :show, status: :created, location: @friendship }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @friendship.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pending_friend_request = PendingFriendRequest.new(pending_friend_request_params)\n\n respond_to do |format|\n if @pending_friend_request.save\n format.html { redirect_to '/profile', notice: 'Friend request sent!' }\n format.json { render action: 'show', status: :created, location: @pending_friend_request }\n else\n format.html { render action: 'new' }\n format.json { render json: @pending_friend_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user=User.find(params[:uid])\n friend=User.find(params[:fid])\n #make sure the friend and user exist\n if(friend && @user)\n #Check to see if the friendship already exists\n friendShip=Friendship.find_by_user_id_and_friend_id(@user.id, friend.id)\n if(friendShip)\n #If there is a friendship between the two users, continue as normal\n #Change the type of friendship to Confirmed.\n #The users will then show up on each others maps.\n #The logic for this is in the users model\n friendShip.type='ConfirmedFriendship'\n respond_to do |format|\n if friendShip.save\n #Then do it again for the inverse relationship (see the new method for an explanation of why this is necessary)\n friendShip=Friendship.find_by_user_id_and_friend_id(friend.id, @user.id)\n #Change the type of friendship to Confirmed.\n #The users will then show up on each others maps.\n #The logic for this is in the users model\n friendShip.type='ConfirmedFriendship'\n session[:user_id][email protected]\n if friendShip.save\n format.html { redirect_to \"http://54.235.20.117:3000/users/#{@user.id}.html\", notice: 'Friendship was successfully created.' }\n format.json { render json: {:created => 'true', :exists => 'true', :friends => 'false'}}\n else\n format.html { redirect_to @user, notice: 'Something went wrong!'}\n format.json { render json: {:created => 'false', :friends => 'false', :exists => 'true'}}\n end\n else\n format.html { redirect_to @user, notice: 'Something went wrong!'}\n format.json {render json: {:friends => 'false', :exists => 'false', :created => 'false'}}\n end\n end\n else\n #If the friendship doesn't exist, don't create the friendship. This will never be sent to the app\n #So the important part is the html response.\n respond_to do |format|\n format.html { redirect_to @user, notice: 'Something went wrong! According to our records, this friendship was never requested!'}\n format.json {render json: {:friends => 'false', :exists => 'false', :created => 'false'}}\n end\n end\n else\n #If the user does not exist, inform the user that their link was incorrect.\n respond_to do |format|\n format.html { redirect_to @user, notice: 'Something went wrong! According to our records, you do not exist!'}\n format.json {render json: {:friends => 'false', :exists => 'false', :created => 'false'}}\n end\n end\n end", "def friend\n if params.include?(:id)\n @user.friends += [User.find(params[:id])]\n elsif params.include?(:username)\n @user.friends += [User.find_by(username: params[:username])]\n end\n redirect_to root_path\n end", "def create\n @friends = params[:friends] || []\n @hack = Hack.new(params[:hack])\n @hack.sort_rand = Random.rand\n @hack.event_id = @event.id\n\n if [email protected]\n respond_to do |format|\n format.html { render :action => \"new\" }\n format.json { render :json => @hack.errors, :status => :unprocessable_entity }\n end\n return\n end\n\n assoc = HackMembersAssoc.new\n assoc.hack = @hack\n assoc.user = @current_user\n assoc.confirmed = true\n assoc.save!\n @friends.each do |friend_id|\n friend = User.get_or_create_by_fbid(friend_id, @api);\n assoc = HackMembersAssoc.new\n assoc.hack = @hack\n assoc.user = friend\n assoc.confirmed = true\n assoc.save!\n end\n\n respond_to do |format|\n format.html { redirect_to @event, :notices => ['Hack was successfully created.'] }\n format.json { render :json => @hack, :status => :created, :location => [@event, @hack] }\n end\n end", "def new\n @friend = current_user_or_guest.friends.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @friend }\n format.json { render json: @friend }\n end\n end", "def get\n\t\tif request.post?\n\t\t\tuser = User.find_by_id(params[:user_id])\n\t\t\tunless user\n\t\t\t\trender json: {error: \"user not fonud\"} and return\n\t\t\tend\n\t\t\t\n\t\t\trender json: {friends: user.friends.each {|f| f.password = nil}}\n\t\tend\n\tend", "def friend_params\n params.permit(:friend_id)\n end", "def friendships_update(options = {})\n @req.post(\"/1.1/friendships/update.json\", options)\n end", "def friend_requests\n friends = current_user.friends.where accepted: false\n profiles = friends.map{ |friend| Profile.find(friend.profile_id)}\n render json: profiles\n end", "def add_friends\n @params[:friend_ids].each do |id|\n @plan.users_plans.new(user_id: id)\n end\n end", "def friends1_params\n params.require(:friends1).permit(:first_name, :last_name, :email, :phone, :instagram, :user_id)\n end", "def create\n @friendship = current_user.friendships.build(friend_id: params[:friend_id])\n if @friendship.save\n flash[:notice] = \"Added friend.\"\n redirect_to root_url\n else\n flash[:alert] = \"Unable to add friend.\"\n redirect_to root_url\n end\n end", "def requests_sent\n friends = Friend.where(user_id: params[:user_id], accepted: false)\n\t render json:friends\n end", "def create\n\n if current_user.friends.include?(params[:friend_id])\n flash[:notice] = \"It's polite to ask once.\"\n else\n\n\n @friendship = current_user.friendships.build(:friend_id => params[:friend_id], approved: \"false\")\n\n if @friendship.save\n\n\n\n log_activity\n\n flash[:notice] = \"Friend requested.\"\n\n\n\n redirect_to :back\n else\n flash[:error] = \"Unable to request friendship.\"\n redirect_to :back\n end\n end\n end", "def create\n friend = Friend.create user_id: current_user.id, other_id: params[:id]\n o = friend.other\n datum = {id: friend.id, email: o.email, own: true}\n reciprocal = friend.mutual\n if reciprocal\n datum[:subscribed_to_me] = reciprocal.subscribed\n datum[:mutual] = true\n datum[:other_id] = reciprocal.id\n end\n notify friend, 1\n render json: datum\n end", "def friend_params\n params.require(:friend).permit(:user_id)\n end", "def create_friendship(user = nil, params = {})\n args = [user, params]\n post path_from_args('friendships/create', args), {:follow => true}.merge(params_from_args(args))\n end", "def create\n\t\tFriendship::request(@user, @friend)\n\t\tUserMailer::friend_request(\n\t\t\t:user => @user,\n\t\t\t:friend => @friend,\n\t\t\t:user_url => profile_for(@user),\n\t\t\t:accept_url => url_for(:action => \"accept\", :id => @user.screen_name),\n\t\t\t:decline_url => url_for(:action => \"decline\", :id => @user.screen_name)\n\t\t).deliver_now\n\t\tflash[:notice] = \"Friend request sent.\"\n\t\tredirect_to profile_for(@friend)\n\tend", "def friend_params\n params.require(:friend).permit(:friend_account_id)\n end", "def add_friend_request(user_id)\n friend_suggestions.where(user_id: user_id).delete_all\n req = pending_friends.where(id: user_id).first\n if req.present?\n req.accept!\n else\n req = UserFriendRelationship.between(user_id, id).first || user_friend_relationships.create(user_to_id: user_id)\n PubSub::Publisher.new.publish_for([req.user_to], 'friend_request', {source: self.as_basic_json}, {title: full_name(false), body: 'wants to be your friend'})\n end\n # reset_cache('suggested_friends')\n end", "def befriend new_friend\n run_callbacks :befriend do\n friendships.create friend: new_friend\n end\n end", "def accept\n\t\tuser.friends << friend\n\t\tdestroy\n\tend", "def create\n @friend_request = current_user.friend_requests_as_requester.build(create_friend_request_params)\n\n respond_to do |format|\n if @friend_request.save\n format.html { redirect_to @friend_request, notice: 'Friend request was successfully created.' }\n format.json { render :show, status: :created, location: @friend_request }\n else\n format.html { render :new }\n format.json { render json: @friend_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @plant = Plant.find(params[:plant])\n @friendship = @plant.friendships.build(:friend_id => params[:friend])\n if @friendship.save\n flash[:notice] = \"added friend\"\n redirect_to request.referrer\n else\n flash[:error] = \"Unable to add friend.\"\n redirect_to request.referer\n end\n end", "def create\n relationship = Relationship.between(current_user.id, params[:user_two_id]).first\n unless relationship\n current_user.add_friend(User.find(params[:user_two_id]))\n relationship = Relationship.between(current_user.id, params[:user_two_id]).first\n relationship.status = 1\n relationship.save\n end\n friend = User.find_friend(current_user, relationship)\n redirect_to friendlist_path\n end", "def destroy\n @friend.destroy\n render json: {}\n end", "def create\n @friendship = current_user.friendships.build(:friend_id => params[:id])\n \n if @friendship.save\n flash[:notice] = \"Added friend.\"\n redirect_to root_path\n else\n flash[:error] = \"Unable to add friend.\"\n redirect_to root_path\n end\n end", "def get_friends\n results = []\n user = User.find_by_username(params[:username])\n friends = Friend.where(user_id: user.id, accepted: true)\n friends.each do |friend_rel|\n friend = User.find(friend_rel.friend_id)\n results << {id:friend.id, username: friend.username}\n end\n friends = Friend.where(friend_id: user.id, accepted: true)\n friends.each do |friend_rel|\n friend = User.find(friend_rel.user_id)\n results << {id:friend.id, username: friend.username}\n end\n render json:results\n end", "def user_params\n params.require(:user).permit(:nickname, :email, :friends)\n end" ]
[ "0.6929615", "0.68731165", "0.6859937", "0.6829343", "0.6796485", "0.67732674", "0.67154217", "0.6699764", "0.6698836", "0.66881865", "0.66756314", "0.6651872", "0.6623602", "0.6607566", "0.6607566", "0.65965533", "0.659456", "0.65587676", "0.6517505", "0.64976156", "0.64935964", "0.6487597", "0.6442475", "0.64190537", "0.6389306", "0.63759893", "0.6366423", "0.6351339", "0.6345823", "0.630866", "0.629167", "0.6267289", "0.6267289", "0.62657195", "0.62488586", "0.62485087", "0.62460905", "0.624575", "0.6235479", "0.62329006", "0.6227453", "0.6226064", "0.62090844", "0.6204869", "0.6203183", "0.62006086", "0.6191161", "0.61875105", "0.6184152", "0.6182963", "0.6175148", "0.6175148", "0.6173666", "0.61647105", "0.6154726", "0.61530364", "0.6148089", "0.6143578", "0.6116846", "0.61164004", "0.6080995", "0.607544", "0.6060177", "0.60574955", "0.60574377", "0.60404134", "0.60384107", "0.60226464", "0.6020239", "0.6013883", "0.60082996", "0.5999325", "0.59944904", "0.5989902", "0.59852725", "0.59826887", "0.59769946", "0.5973701", "0.5973369", "0.59687126", "0.59648633", "0.5964367", "0.595207", "0.5937846", "0.59329194", "0.59308857", "0.5929278", "0.5929094", "0.59273404", "0.59263784", "0.5915185", "0.5906602", "0.59043485", "0.5903885", "0.5889415", "0.58836997", "0.58788985", "0.5861908", "0.58598316", "0.5851949" ]
0.6168415
53
Use callbacks to share common setup or constraints between actions.
def set_friend @friend = Friend.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def set_actions\n actions :all\n end", "def define_action_helpers?; end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\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 setup_handler\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def 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 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 matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def after_set_callback; end", "def initialize(*args)\n super\n @action = :set\nend", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def 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 setup(easy)\n super\n easy.customrequest = @verb\n end", "def save_action; end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def 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 _handle_action_missing(*args); 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", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def call\n setup_context\n super\n end" ]
[ "0.61642385", "0.60448", "0.5945487", "0.5915654", "0.58890367", "0.58330417", "0.5776098", "0.5703048", "0.5703048", "0.5654613", "0.5620029", "0.5423114", "0.540998", "0.540998", "0.540998", "0.5393666", "0.53783023", "0.53568405", "0.53391176", "0.5339061", "0.53310865", "0.5312988", "0.529798", "0.52968603", "0.52962637", "0.52577317", "0.5244704", "0.5236856", "0.5236856", "0.5236856", "0.5236856", "0.5236856", "0.5233461", "0.52322435", "0.5227552", "0.52224743", "0.5217851", "0.521241", "0.52069896", "0.5206555", "0.5176617", "0.51738507", "0.51725876", "0.51660734", "0.51605034", "0.51571786", "0.5152762", "0.5152164", "0.5151477", "0.5145819", "0.51408994", "0.5134412", "0.5114031", "0.5113695", "0.5113695", "0.5108603", "0.5107358", "0.5090405", "0.50889385", "0.50817686", "0.5081617", "0.50658226", "0.50551206", "0.5051746", "0.5049091", "0.5049091", "0.5034681", "0.5024972", "0.5021291", "0.5016024", "0.50134826", "0.50008893", "0.50000244", "0.4999155", "0.49907947", "0.49907947", "0.49853387", "0.49796683", "0.4979596", "0.49778128", "0.49673793", "0.49662578", "0.49587822", "0.4956063", "0.49550167", "0.49523485", "0.4951614", "0.49452996", "0.49442068", "0.49336892", "0.49306205", "0.49264124", "0.49259305", "0.4925823", "0.49229056", "0.4918999", "0.49171805", "0.49167436", "0.4916559", "0.49153692", "0.49148256" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def friend_params params.permit(:friend_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \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 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 filtering_params\n params.permit(:email)\n end", "def active_code_params\n params[:active_code].permit\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 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 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 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 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 maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\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 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 droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\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.6981606", "0.6784227", "0.6746523", "0.67439264", "0.67361516", "0.6593381", "0.6506166", "0.64994407", "0.6483518", "0.64797056", "0.64578557", "0.6441216", "0.63811713", "0.63773805", "0.6366333", "0.63217646", "0.6301816", "0.63009787", "0.6294436", "0.62940663", "0.6292164", "0.62917984", "0.62836355", "0.6242686", "0.6241917", "0.62210834", "0.6214862", "0.62125784", "0.619428", "0.617912", "0.617705", "0.61735916", "0.6163706", "0.61532795", "0.6152666", "0.6148062", "0.6123372", "0.61180484", "0.61088324", "0.6106139", "0.60925204", "0.608326", "0.60711503", "0.606551", "0.60216546", "0.6018924", "0.6015004", "0.60106766", "0.6008301", "0.6008301", "0.60028726", "0.60020626", "0.5999236", "0.59931505", "0.5993037", "0.59917194", "0.5982164", "0.5968051", "0.5960277", "0.5960268", "0.5960012", "0.59594494", "0.5954652", "0.5954304", "0.59440255", "0.59404963", "0.59404963", "0.59401006", "0.593522", "0.5932182", "0.5925528", "0.5924541", "0.5918796", "0.59123147", "0.5910144", "0.5909186", "0.5907257", "0.5899382", "0.5897783", "0.58972496", "0.58958495", "0.58948576", "0.5892734", "0.5888056", "0.58843875", "0.58818483", "0.5873746", "0.58700997", "0.5870056", "0.5869255", "0.58668107", "0.58662325", "0.5865003", "0.5862908", "0.5862406", "0.58614665", "0.5859661", "0.585562", "0.5855185", "0.58523446", "0.58504915" ]
0.0
-1
Function for displaying customer message used for deleting parents that contain children
def confirmation_message(value, value_hash) if(value_hash[value.id] == nil) return 'Are you sure?' else return 'This node has children. If you delete this node the children will also be deleted. Are you sure?' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def confirm_delete_message\n <<-TEXT\n Are you sure you want to delete this page,\n all its children and all its slices and other content?\n TEXT\n end", "def confirmation_message\n title_message(\"Forks Deleted\")\n end", "def parent_message\n end", "def parent_confirmation_notification(order)\n @order = order\n @student = order.student\n @parent = @student.parent\n @admin = order.admin_user\n @greeting = \" #{@parent.name} y #{@student.name}\"\n\n\n mail(to: @parent.email, subject: \"Orden de Tutorias Confirmada\", \n cc: [@admin.email,\"[email protected]\", \"[email protected]\"] )\n end", "def remove_relationship_above\n authorize! :edit, form_params[:parent_id]\n if form.remove\n notice = I18n.t('removed_relationship', scope: 'hyrax.dashboard.nest_collections_form', child_title: form.child.title.first, parent_title: form.parent.title.first)\n redirect_to redirect_path(item: form.child), notice: notice\n else\n redirect_to redirect_path(item: form.child), flash: { error: form.errors.full_messages }\n end\n end", "def destroy\n @called_from = params[:called_from] || \"product\"\n @parent_product.destroy\n respond_to do |format|\n format.html { redirect_to(admin_parent_products_url) }\n format.xml { head :ok }\n format.js\n end\n website.add_log(user: current_user, action: \"Deleted parent product relationship #{@parent_product.product.name}\")\n end", "def destroy\n @cparent.destroy\n respond_to do |format|\n format.html { redirect_to cparents_url, notice: 'Cparent was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def reply_to_parent(workitem, delete=true)\n\n do_reply_to_parent(workitem, delete)\n end", "def parent_reserved_notification(order)\n\n @order = order\n @student = order.student\n @parent = @student.parent\n @admin = order.admin_user\n @greeting = \" #{@parent.name} y #{@student.name}\"\n\n mail(to: @parent.email, subject: \"Orden de Tutorias Reservada\", \n cc: [@admin.email,\"[email protected]\", \"[email protected]\"])\n end", "def destroy\n @parent.destroy\n respond_to do |format|\n format.html { redirect_to partners_url, notice: 'Parent was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n family = @child.family\n @child.destroy\n respond_to do |format|\n format.html { redirect_to family, notice: tr(\"child_deleted\") }\n end\n end", "def destroy\n\t\t@parent_child.destroy\n\t\trespond_to do |format|\n\t \t\tformat.html { redirect_to parent_children_url, notice: 'Parent child was successfully destroyed.' }\n\t \t\tformat.json { head :no_content }\n\t\tend\n \tend", "def remove_relationship_under\n authorize! :edit, form_params[:parent_id]\n\n if form.remove\n notice = I18n.t('removed_relationship', scope: 'hyrax.dashboard.nest_collections_form', child_title: form.child.title.first, parent_title: form.parent.title.first)\n redirect_to redirect_path(item: form.parent), notice: notice\n else\n redirect_to redirect_path(item: form.parent), flash: { error: form.errors.full_messages }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n \n \n if @comment.has_children?\n @comment.children.each do |child|\n child.destroy\n end\n end\n @comment.destroy\n\n respond_with do |format|\n flash.now[:notice] = 'Comment was successfully deleted.'\n end\n end", "def destroy\n @parent_info.destroy\n respond_to do |format|\n format.html { redirect_to parent_infos_url, notice: 'Parent info was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @parent_of.destroy\n respond_to do |format|\n format.html { redirect_to parent_ofs_url }\n format.json { head :no_content }\n end\n end", "def delete\n questionnaire = Questionnaire.find(params[:id])\n \n if questionnaire\n begin\n name = questionnaire.name\n questionnaire.delete\n flash[:note] = \"Questionnaire <B>#{name}</B> was deleted.\"\n rescue\n flash[:error] = $!\n end\n end\n \n redirect_to :action => 'list', :controller => 'tree_display' \n end", "def parent_registration_alert(user)\n\t\t@user = user\n\t\tsendgrid_category 'Parent Registration Alert'\n\t\tmail subject: \"Parent \\\"#{user.email}\\\" has registered\", to: ADMIN_EMAIL\n\tend", "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n @children = Question.find_all_by_parentid(params[:id])\n if @children != nil\n \tfor child in @children\n \t\tchild.destroy\n \tend\n end\n respond_to do |format|\n flash[:notice] = 'Question was successfully deleted.'\n format.html { redirect_to(:back) }\n format.xml { head :ok }\n end\n end", "def destroy\n @parent_infomation.destroy\n respond_to do |format|\n format.html { redirect_to parent_infomations_url, notice: 'Parent infomation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @parent.destroy\n respond_to do |format|\n format.html { redirect_to parents_url, notice: 'Parent was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @parent.destroy\n respond_to do |format|\n format.html { redirect_to parents_url, notice: 'Parent was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @parent.destroy\n respond_to do |format|\n format.html { redirect_to parents_url, notice: 'Parent was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @parent.destroy\n respond_to do |format|\n format.html { redirect_to parents_url, notice: 'Parent was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @parent.destroy\n respond_to do |format|\n format.html { redirect_to parents_url, notice: 'Parent was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @parent.destroy\n respond_to do |format|\n format.html { redirect_to parents_url, notice: 'Parent was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @parent.destroy\n respond_to do |format|\n format.html { redirect_to parents_url, notice: 'Parent was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n bef_delete = Before::Delete.new\n respond_to do |format|\n if bef_delete.child_of_relation(@cliente, :lotes)\n format.json { render json: \"Algunos lotes dependen de este cliente. No se puede eliminar.\", status: :conflict }\n else\n @cliente.destroy\n format.json { render json: {message: \"Cliente eliminado con éxito\"} }\n end\n end\n end", "def destroy\n\t\t@parent = Parent.find(params[:id])\n @parent.destroy\n respond_to do |format|\n format.html { redirect_to '/parent', notice: 'Parent was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def presence_of_parent\n errors.add(:base, 'Parent message does not exist.') unless parent.present?\n end", "def destroy\n if @comment.sub_comments\n message = 'This comment cannot be deleted; there are sub comments associated.'\n else\n @comment.destroy\n message = 'Comment was successfully destroyed.'\n end\n respond_to do |format|\n format.html { redirect_to magazine_article_path(@magazine, @article), notice: message }\n format.json { head :no_content }\n end\n end", "def delete_node(xn, send_to_deleted_text, send_to_notes)\n @xn_context.process_children = false\n add_deleted_text(xn, xn.text) if send_to_deleted_text\n add_notes(xn, \"Deleted text: #{ xn.text }\") if send_to_notes\n end", "def destroy\n @parent_to_teacher_notification.destroy\n respond_to do |format|\n format.html { redirect_to parent_to_teacher_notifications_url, notice: 'Parent to teacher notification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @parent = Parent.find_by_id(params[:id])\n @parent.destroy\n\n respond_to do |format|\n format.html { redirect_to(parents_url) }\n format.xml { head :ok }\n end\n end", "def print_child_categories_table(parent)\n child = []\n c = \"<table><tr><th>Child Categories</th></tr>\"\n #creates an array of children\n for cat in @all_categories\n if(cat.parent_id.eql?(parent.id))\n child.push(cat)\n end\n end\n #Checks if array is empty\n if(!child.empty?)\n #Creates a table row and data for each child\n for ch in child.sort!{|x,y| x.name <=> y.name}\n c += \"<tr><td class=\\\"td_two_col\\\">#{link_to ch.name, ch}</td></tr>\"\n end\n else\n c += \"<tr><td>No Child Categories Available</td></tr>\"\n end\n c += \"<tr><td>#{my_button_to(\"New Child Category\", new_category_path, [parent])}</td></tr></table>\"\n c\n end", "def destroy\n @comment = Comment.find(params[:id])\n bid = @comment.blog_id\n\n @comment.deleted_parent = true\n @comment.save\n @comment = Comment.find(params[:id])\n @comment.content = '<-deleted->'\n @comment.save\n c1 = @comment\n while !c1.nil? and c1.leaf? do\n cp = c1.parent if !c1.parent.nil?\n cp = cp.nil? ? nil : cp.deleted_parent ? cp : nil\n c1.destroy\n c1 = (cp.nil?)? nil : Comment.find_by_id(cp.id)\n end\n #end while @com_par.deleted_parent == false and @com_par.leaf?\n\n respond_to do |format|\n format.html { redirect_to(Blog.find_by_id(bid)) }\n format.xml { head :ok }\n end\n end", "def remove_child_link(name, f)\n # name = delete_no_alt_icon + \" \" + name\n # deprecated _delete, use _destroy instead\n # f.hidden_field(:_delete) + link_to_function(name, \"remove_fields(this)\")\n f.hidden_field(:_destroy) + link_to_function(name, \"remove_fields(this)\")\n end", "def destroy\n @parent = Parent.find(params[:id])\n @other_user = get_other_user(@parent.userid)\n @parent.destroy\n\n respond_to do |format|\n format.html { redirect_to(@other_user) }\n format.xml { head :ok }\n end\n end", "def destroy\n @child.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Child was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @student_parent.destroy\n respond_to do |format|\n format.html { redirect_to student_parents_url, notice: 'Student parent was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def trash\n cur_emp = get_logged_employee\n @messages = Message.where(\"sent_to = ?\", cur_emp).where(\"is_deleted = ?\", 1 )\n render \"resumes/message_show\"\n end", "def destroy\n begin\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: t('messages.deleted', model:Customer.model_name.human) }\n format.json { head :no_content }\n end\n rescue ActiveRecord::InvalidForeignKey => e\n flash[:error] = t 'errors.messages.delete_fail.being_used', model:@customer.name\n flash[:error_details] = e\n redirect_to [:admin, @customer]\n rescue ActiveRecord::StatementInvalid => e\n flash[:error] = t 'errors.messages.ops'\n flash[:error_details] = e\n redirect_to [:admin, @customer]\n end\n end", "def destroy\n @child_fatality.destroy\n respond_to do |format|\n format.html { redirect_to child_fatalities_url, notice: 'Child fatality was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_message(data); end", "def delete_message(data); end", "def delete_tree\n tree = Tree.find(params[:id])\n tree.update_attribute(:hidden, true)\n flash[:notice] = \n %Q{You have just deleted the tree called `#{tree.name}'. This is your last chance to undo this.}\n flash[:undo_delete_id] = tree.id\n redirect_to :action => 'index'\n end", "def remove\n @fieldset_child = DynamicFieldsets::FieldsetChild.find(params[:id])\n root = @fieldset_child.root_fieldset\n\n respond_to do |format| \n if @fieldset_child.destroy\n notice_text = \"Successfully removed the child\"\n else\n notice_text = \"Child was not able to be removed\"\n end\n format.html { redirect_to(dynamic_fieldsets_children_dynamic_fieldsets_fieldset_path(root), :notice => notice_text)}\n end\n end", "def delete_msg()\n MsgUtil.delete_msg(params[:ch])\n end", "def destroy\n @toyota_epc_part_number_application_to_models_parent = ToyotaEpc::PartNumberApplicationToModelsParent.find(params[:id])\n @toyota_epc_part_number_application_to_models_parent.destroy\n\n respond_to do |format|\n format.html { redirect_to toyota_epc_part_number_application_to_models_parents_url }\n format.json { head :ok }\n end\n end", "def destroy\n @athletes_parent = AthletesParent.find(params[:id])\n @athletes_parent.destroy\n\n respond_to do |format|\n format.html { redirect_to(athletes_parents_url) }\n format.xml { head :ok }\n end\n end", "def perform_remove_parent(batch_client, parent_id)\n self.class.make_request(client, batch_client, :remove_parent, scope_parameters.merge(\n self.class.primary_key_name => primary_key,\n parent_id: parent_id\n ))\n end", "def display_parent_child_test_cases\n \n end", "def destroy\n @pharmacy_payment_child = PharmacyPaymentChild.find(params[:id])\n @pharmacy_payment_child.destroy\n\n respond_to do |format|\n format.html { redirect_to(pharmacy_payment_children_url) }\n format.xml { head :ok }\n end\n end", "def msg\n 'Are you sure? All your changes will be lost.'\n end", "def to_s\n if (altered_files + status[:deleted]).any?\n then parents.first.to_s + \"+\"\n else parents.first.to_s\n end\n end", "def destroy\n @parent = Parent.find(params[:id])\n @parent.destroy\n\n respond_to do |format|\n format.html { redirect_to parents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n child = @enrollment.child\n @enrollment.destroy\n respond_to do |format|\n format.html { redirect_to child, notice: tr(\"enrollment_destroyed\") }\n end\n end", "def remove_entity\n #traversal all the parent node\n #and remove all the entity of them\n msg = Message.new\n msg.result = true\n ActiveRecord::Base.transaction do\n entity = Entity.find_by_id(params[:entity_id])\n\n #previous_dept = entity.department\n\n #entity.department_id = nil\n #if entity.update_attribute(\"department_id\",nil)\n #if entity_group_item = EntityGroupItem.find_by_entity_id_and_entity_group_id(entity.id,previous_dept.entity_group.id)\n #entity_group_item.destroy\n #end\n\n #previous_dept.ancestors.each do |d|\n # if entity_group_item = EntityGroupItem.find_by_entity_id_and_entity_group_id(entity.id,d.entity_group.id)\n # entity_group_item.destroy\n # end\n #end\n #end\n msg.result = entity.update_attribute(\"department_id\",nil)\n end\n render :json=>msg\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { \n if @post.parent_id != 0 then\n redirect_to post_path(@post.parent_id), notice: 'Comment was successfully deleted.'\n else \n redirect_to posts_path, notice: \"Post was successfully deleted\"\n end\n }\n format.json { head :no_content }\n end\n end", "def help_message()\n return 'I\\'ll remove you from the line to get on deck. (I\\'ll automatically remove you if you leave the room.)'\n end", "def destroy\n @descendant.destroy\n respond_to do |format|\n format.html { redirect_to descendants_url, notice: 'Descendant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n \n @parent_path = set_parent_path\n \n @tarifa.destroy\n respond_to do |format|\n format.html { redirect_to @parent_path, notice: 'Tarifa eliminada exitosamente.' }\n format.json { head :no_content }\n end\n \n end", "def delete(message_text)\n self.span(:class=>\"discussion_post_message\", :text=>message_text).parent.parent.button(:text=>\"Delete\").click\n end", "def destroy\n @child.destroy\n respond_to do |format|\n format.html { redirect_to children_url, notice: 'Child was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @child.destroy\n respond_to do |format|\n format.html { redirect_to children_url, notice: 'Child was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n noticeText = @admin_cost.label + \" was successfully removed.\"\n @admin_cost.destroy\n redirect_back(fallback_location: root_path,notice: noticeText)\n end", "def destroy\n @child.destroy\n respond_to do |format|\n format.html { redirect_to children_url, notice: \"Child was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @child.destroy\n respond_to do |format|\n format.html { redirect_to children_url, notice: \"Child was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @key_donor_child.destroy\n respond_to do |format|\n format.html { redirect_to key_donor_children_url, notice: 'Key donor child was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def link_to_remove_parent\n image = image_tag(\"cross_small.png\", :border => 0, :alt => \"#{ _(\"Remove\") }\")\n link_to_function(image, 'jQuery(this).parent().remove();')\n end", "def destroy\n @place = Place.find(params[:id])\n parent = @place.parent\n\n # შევამოწმოთ, არის თუ არა ეს თარო ცარიელი\n if @place.children.empty? and @place.books.empty?\n @place.destroy\n else\n flash[:notice] = 'ეს თარო არ არის ცარიელი.'\n end\n\n # გამოტანა იგივე გვერდის, სადაც ეს თარო იყო განთავსებული\n respond_to do |format|\n if parent\n format.html { redirect_to(:controller => :places, :action => :index, :parent_id => parent.id) }\n else\n format.html { redirect_to(:controller => :places, :action => :index) }\n end\n format.xml { head :ok }\n end\n end", "def destroy\n @ministry_child.destroy\n respond_to do |format|\n format.html { redirect_to ministry_children_url, notice: 'Ministry child was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tree.destroy\n redirect_to user_url(current_user), notice: '削除しました'\n end", "def destroy\n#find all subcategories where subname id is = to given subname id\n @subcategories = Subcategory.find_all(:conditions => [\":subname_id =?\", subname_id])\n#Go through each subcategory and see if it is removable\n for subcategory in @subcategories\n subcategory.destroy\n end\n#then see whether the subname has any associated subcategories. if it doesn't, destroy it.\n @subcategories = Subcategory.find_all(:conditions => [\":subname_id =?\", subname_id])\n if @subcategories.length>1\n @subname.destroy\n end\n#end\n flash[:notice] = 'Operation complete'\n\n respond_to do |format|\n format.html { redirect_to url_for(:controller =>\"cactus/admin\", :action => \"index\") }\n format.xml { head :ok }\n end\n end", "def destroy\n @rollup_parent.destroy\n respond_to do |format|\n format.html { redirect_to rollup_parents_url, notice: 'Rollup parent was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @child_record.destroy\n respond_to do |format|\n format.html { redirect_to child_records_url, notice: 'Child record was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @traumatized_child.destroy\n respond_to do |format|\n format.html { redirect_to traumatized_children_url, notice: \"Traumatized child was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n father_id = @procategory.procategory_id\n if check_empty?(@procategory.id)\n @procategory.destroy\n flash[:notice] = 'Procategory was successfully destroyed.'\n else\n flash[:notice] = 'You can only delete the empty project categories.'\n end\n\n father = Procategory.find(father_id)\n respond_to do |format|\n if father\n if father.level == 0\n format.html { redirect_to procategories_path}\n else\n format.html { redirect_to father}\n end \n else\n format.html { redirect_to procategories_path}\n end\n \n format.json { head :no_content }\n end\n\n end", "def registration_confirmation(parent)\n @parent = parent\n\n mail to: @parent.email, subject: \"Registration confirmation\"\n end", "def semplice\r\n puts \"senza parentesi\"\r\nend", "def destroy\n @child.destroy\n respond_to do |format|\n format.html { redirect_to children_url }\n format.json { head :no_content }\n end\n end", "def delete_master_rate_mappings_dialog_body(master_rate_mapping)\n body = content_tag(:p) do\n t('room_type_master_rate_mappings.delete.label.confirm', :room_type => master_rate_mapping.room_type.name)\n end\n body.html_safe\n end", "def destroy\n @order_item.destroy\n respond_to do |format|\n format.html { redirect_to @parent, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy_output_order\n\n if @order.destroy\n @msg = 'Ordine eliminato'\n else\n @msg = 'Errore'\n end\n # respond_to do |format|\n # format.js { render :js, :partial => 'orders/output_orders' }\n # end\n index\n end", "def deletion_request_instructions(record, deletion_request)\n MnoEnterprise::MailClient.deliver('deletion-request-instructions',\n default_sender,\n recipient(record),\n user_vars(record).merge(terminate_account_link: deletion_request_url(deletion_request))\n )\n end", "def destroy\n # delete a specific message\n end", "def ensure_parent_message\n self.parent_message = self if self.parent_message.nil?\n end", "def reply_to_parent (exp, workitem, remove=true)\n\n workitem.last_expression_id = exp.fei\n\n onotify(:reply_to_parent, exp, workitem)\n\n if remove\n\n remove(exp)\n #\n # remove the expression itself\n\n exp.clean_children\n #\n # remove all the children of the expression\n end\n\n #\n # manage tag, have to remove it so it can get 'redone' or 'undone'\n # (preventing abuse)\n #\n # do the same for the on_error handler if any\n\n tagname = exp.attributes['tag']\n exp.delete_variable(tagname) if tagname\n #exp.delete_variable(tagname) if tagname and not tagname.match(/^\\//)\n\n on_error = exp.attributes['on_error'] #if exp.attributes\n exp.delete_variable(on_error) if on_error\n\n #\n # has raw_expression been updated ?\n\n track_child_raw_representation(exp)\n\n #\n # flow terminated ?\n\n if (not exp.parent_id) and (exp.fei.expid == '0')\n\n ldebug { \"reply_to_parent() process #{exp.fei.wfid} terminated\" }\n\n onotify(:terminate, exp, workitem)\n\n return\n end\n\n #\n # else, gone parent ?\n\n #if (not exp.parent_id) or (exp.parent_id.expname == 'gone')\n # # this 'gone' is kept for some level of 'backward compatibility'\n\n if (not exp.parent_id)\n\n ldebug { \"reply_to_parent() parent is gone for #{exp.fei.to_debug_s}\"}\n return\n end\n\n #\n # parent still present, reply to it\n\n reply(exp.parent_id, workitem)\n end", "def delete_contact_button(parent, field, contact, options = {})\n options = {\n url: [parent, parent.contact],\n 'data-field' => field,\n 'data-contact' => contact\n }.merge(options)\n\n delete_button_for(parent.contact, options)\n end", "def destroy\n if @customer.delete\n redirect_to customers_path, notice: \"O Clinte #{@customer.name} foi apagado!\"\n else\n render :index\n end\n\n end", "def child_pre_delete_hook( index, parent_array = nil )\n \n # false means delete does not take place\n return true\n \n end", "def destroy\n # delete a specific message\n end", "def destroy\n @children = Children.find(params[:id])\n @children.destroy\n\n respond_to do |format|\n format.html { redirect_to(childrens_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n\t\tparent = @fallacyfolder.parent\n\t\[email protected]\n\n\t\trespond_to do |format|\n\t\t\tformat.html { }\n\t\t\tformat.json { render :json => {:parent => parent.id}.to_json }\n\t\tend\n\tend", "def destroy\n @admin_message.destroy \n respond_to do |format|\n format.html { redirect_to admin_messages_url, notice: \"#{ t 'activerecord.successful.messages.message_deleted' }\" }\n format.json { head :no_content }\n end\n end", "def destroy\n #@message = Message.find(params[:id])\n #@message.destroy\n #redirect_to projects_path\n current_user.delete_message(ActsAsMessageable::Message.find(params[:id]))\n redirect_to trash_url\n end", "def delete_confirmation\n requested_resource\n\n render :delete_confirmation,\n layout: 'admin/application',\n locals: {\n page: Administrate::Page::Form.new(dashboard, requested_resource)\n }\n end", "def delete_client\n begin\n if c_delete_params[:client]\n name=Client.find(c_delete_params[:client]).name\n Client.find(c_delete_params[:client]).destroy\n flash[:notice]='Deleted client: '+name\n return redirect_to '/admin/list_clients'\n elsif c_delete_params[:project]\n name=Project.find(c_delete_params[:project]).name\n Project.find(c_delete_params[:project]).destroy\n flash[:notice]='Deleted project: '+name\n return redirect_to :back\n elsif c_delete_params[:activity]\n project=Activity.find(c_delete_params[:activity]).project.id\n name=Activity.find(c_delete_params[:activity]).name\n Activity.find(c_delete_params[:activity]).destroy\n flash[:notice]='Deleted activity: '+name\n return redirect_to request.referer + '#project'+project.to_s\n elsif c_delete_params[:assignment]\n activity=Assignment.find(c_delete_params[:assignment]).activity.id\n Assignment.find(c_delete_params[:assignment]).destroy\n flash[:notice]='Deleted assignment'\n return redirect_to request.referer + '#activity'+activity.to_s\n end\n rescue\n flash[:error]='There was an error'\n redirect_to :back\n end\n end", "def destroy\n @father_commentary.destroy\n respond_to do |format|\n format.html { redirect_to father_commentaries_url, notice: 'Father commentary was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @toyota_epc_part_number_list_child = ToyotaEpc::PartNumberListChild.find(params[:id])\n @toyota_epc_part_number_list_child.destroy\n\n respond_to do |format|\n format.html { redirect_to toyota_epc_part_number_list_children_url }\n format.json { head :ok }\n end\n end" ]
[ "0.689444", "0.6863294", "0.6404561", "0.594251", "0.59316665", "0.5894985", "0.5755939", "0.5750507", "0.57063895", "0.5659003", "0.56585675", "0.5607167", "0.5583383", "0.55610216", "0.55318016", "0.5509244", "0.5502081", "0.5485347", "0.54288214", "0.5424708", "0.54237026", "0.54237026", "0.54237026", "0.54237026", "0.54237026", "0.54237026", "0.54237026", "0.54153425", "0.5401457", "0.53959274", "0.53929365", "0.5360953", "0.53495115", "0.5339248", "0.53372395", "0.53136486", "0.5312949", "0.5308975", "0.53082615", "0.52935964", "0.52913344", "0.52881116", "0.5253721", "0.52393425", "0.52393425", "0.5237564", "0.5227276", "0.5215286", "0.5211689", "0.5204575", "0.5197879", "0.51927674", "0.5178733", "0.5177036", "0.5173571", "0.51708513", "0.51648235", "0.51598865", "0.5158301", "0.51536393", "0.5135478", "0.51353544", "0.51353055", "0.51320565", "0.51320565", "0.5131129", "0.5121577", "0.5121577", "0.5118088", "0.51165694", "0.5112649", "0.5106844", "0.51056224", "0.51005495", "0.5089981", "0.50826246", "0.5079574", "0.50784516", "0.507626", "0.50755084", "0.50751", "0.5062702", "0.50574505", "0.50539815", "0.5048423", "0.5048089", "0.5046568", "0.50423455", "0.50419337", "0.504056", "0.50360644", "0.5029682", "0.50267625", "0.5021749", "0.5015561", "0.50100344", "0.5009446", "0.50041044", "0.50022525", "0.49990585" ]
0.6565435
2
creates a button and form with a hidden field in order to pass ids across to new objects
def my_button_to(text, path, objs) s = "<form method=\"get\" action=\"#{path}\" class=\"button_to\"> <div><input type=\"submit\" value=\"#{text}\"/></div>" for obj in objs if(!obj.nil?) s+= "<input type=\"hidden\" name=\"#{obj.class.to_s.downcase}_id\" value=\"#{obj.id}\" />" end end s+= "</form>" return s.html_safe end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def button_id(value)\n @submit_id = value\n end", "def add\n frm.button(:value=>\"Add\").click\n end", "def form_button_for(obj, name = nil)\n name ||= obj.object.new_record? ? 'Create' : 'Update'\n\n obj.button name, class: 'btn btn-theme', data: { disable_with: raw(\"<i class='fa fa-circle-o-notch fa-spin'></i> Saving...\") }\n end", "def create_hidden_input(args)\n\t\tid = args[\"id\"]\n\t\tform = args[\"form\"]\n\t\tvalue = args[\"value\"]\n\n\t\tif @@current_forms[form] == nil\n\t\t\t@@current_forms[form] = []\n\t\tend\n\n\t\t@@current_forms[form] << id\n\t\treturn \"<input id='#{id}' type='hidden' value='#{value}'>\"\n\tend", "def form_buttons(**opt)\n opt.reverse_merge!('data-manifest': object.id)\n buttons = super\n buttons << submission_button(**opt)\n buttons << export_button(**opt)\n buttons << import_button(**opt)\n buttons << comm_status(**opt)\n block_given? ? yield(buttons) : buttons\n end", "def button_up(id); end", "def create\n @button = Button.new(button_params)\n @button.family_id = @current_user.family_id\n\n respond_to do |format|\n if params[:commit] == \"作成する\"\n if @button.save\n format.html { redirect_to buttons_path, notice: 'ボタンを作成しました' }\n else\n format.html { render :new }\n end\n else params[:create_item] == \"作成 & 買い物リストに追加する\"\n if create_button_with_item\n format.html { redirect_to buttons_path, notice: \"#{@button.name}を買い物リストに追加しました\"}\n else\n format.html { render :new }\n end\n end\n end\n end", "def loginSubmitBtn\n @dr.button(:id,'loginSubmitBtn')\n end", "def submit_button \n\t\[email protected](id: @submit)\n\tend", "def add_button_to_query(button); end", "def new_page(obj, opts={})\n page do\n form_attr = form_attributes(:action=>url_for(\"create\"))\n Forme.form(obj, form_attr, form_opts(form_attr[:action])) do |f|\n model.columns_for(:new, request).each do |column|\n col_opts = column_options_for(:new, request, obj, column)\n if html = model.edit_html_for(obj, column, :new, request)\n col_opts = col_opts.merge(:html=>html)\n end\n f.input(column, col_opts)\n end\n f.button(:value=>'Create', :class=>'btn btn-primary')\n end\n end\n end", "def button_up(id)\n\n end", "def button_for_add_to_batch(document)\n render partial: '/batch_select/add_button', locals: { document: document }\n end", "def button_up(id)\n end", "def new_button\n begin\n $results.log_action(\"button(#{@params[0..-1].join(' ')})\")\n if @params[1].nil?\n @driver.find_element(:link_text, 'New').click\n else\n # If the New Button has multiple options, choose the right one from the dropdown menu.\n buttons = @driver.find_elements(:class, 'caret')\n buttons[2].click\n @driver.find_element(:link_text, @params[1].capitalize).click\n end\n $session.wait_for_stale\n $results.success\n rescue => ex\n $results.fail(\"button(#{@params.join(' ')})\", ex)\n end\n end", "def new\n @bookmark = Bookmark.new\n respond_to do |format|\n format.html\n format.js { \n @button_name = ts(\"Create\")\n @action = :create\n render :action => \"bookmark_form_dynamic\" \n }\n end\n end", "def scaffold_button_to_remote(text, action, options) \n \"#{scaffold_form_remote_tag(action, options)}\\n<input type='submit' value=#{text} />\\n</form>\"\n end", "def linkwizard_confirm_button\n $tracer.trace(__method__)\n return ToolTag.new(button.id(\"/btnSubmit/\") ,__method__)\n end", "def set_pds_button\n @current_object = model.find(params[:id])\n end", "def button(found, date_id, new_date)\n ret_btn = \"<a href='#{button_href(date_id)}' \"\n ret_btn += \"class='#{button_classes(found)}'>\"\n ret_btn += \"#{button_text(found, new_date)}</a>\"\n ret_btn\n end", "def fb_create_button(name, url)\n\t\t\t \t\"<fb:create-button href=\\\"#{url_for(url)}\\\">#{name}</fb:create-button>\"\n\t\t\tend", "def fb_create_button(name, url)\n\t\t\t \t\"<fb:create-button href=\\\"#{url_for(url)}\\\">#{name}</fb:create-button>\"\n\t\t\tend", "def html\n html = %{<div class=\"obj-form-frame\"><table class=\"obj-form\">}\n html = append_fields(html, @name, template, false)\n html << '</table>'\n html << %{<div class=\"btn\" id=\"#{@name}.save_button\"><span>Save</span></div>}\n html << %{<div class=\"btn\" style=\"float:right;\" id=\"#{@name}.cancel_button\"><span>Cancel</span></div>}\n html << '</div>'\n end", "def create\n self.done_add_button\n wait_for_ajax\n end", "def delete_button(object_or_url, contents=\"Delete\", attrs = {})\n url = object_or_url.is_a?(String) ? object_or_url : resource(object_or_url)\n button_text = (contents || 'Delete')\n tag :form, :class => 'delete-btn', :action => url, :method => :post do\n tag(:input, :type => :hidden, :name => \"_method\", :value => \"DELETE\") <<\n tag(:input, attrs.merge(:value => button_text, :type => :submit))\n end\n end", "def add_button_clicked\n\t\t\n\t\t\t# Eventually create browse form\n\t\t\tcreate_browse_form\n\t\t\n\t\t\t# Show and activate the child window\n\t\t\tshow_browse_form\n\t\tend", "def set_button\n @button = Button.find(params[:id])\n end", "def phx_button_for( model, captionSuffix, alternateCaptions, name, cssClass, disabled = false, remote = false, id = nil, overrideCaption = nil, tabindex = nil )\n\n buttonClass = \"btn btn-sm btn-default \" << cssClass\n if overrideCaption\n fullCaption = overrideCaption\n elsif !alternateCaptions.present?\n fullCaption = (model.object.persisted? ? \"Update \" : \"Create \") << captionSuffix\n else\n fullCaption = model.object.persisted? ? alternateCaptions[1] : alternateCaptions[0]\n end\n # let rails generate the html\n if tabindex\n button = capture do concat model.submit( fullCaption, name: name, class: buttonClass, disabled: disabled, remote: remote, id: id, tabindex: tabindex ) end\n else\n button = capture do concat model.submit( fullCaption, name: name, class: buttonClass, disabled: disabled, remote: remote, id: id ) end\n\n end\n\n button.html_safe\n\n end", "def rcpstsave; det.button(:id, 'Save'); end", "def build_get_pallet_number_form()\n\n#\t---------------------------------\n#\t Define fields to build form from\n#\t---------------------------------\n\tfield_configs = Array.new\n\n field_configs[0] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'pallet_number'}\n\n\n\n\tbuild_form(nil,field_configs,'submit_mixed_pallet_id','pallet_number','submit')\n\nend", "def show\n @submit_value = \"Show\"\n @hidden_submit = \"hidden\"\n end", "def show\n @submit_value = \"Show\"\n @hidden_submit = \"hidden\"\n end", "def show\n @submit_value = \"Show\"\n @hidden_submit = \"hidden\"\n end", "def create_line_item_button\n self.get_element(@browser, 'create')\n end", "def scaffold_button_to(text, url, options={})\n \"#{scaffold_form(url, options)}\\n<input type='submit' value='#{text}' />\\n</form>\"\n end", "def button(opts={})\n opts = {:value=>opts} if opts.is_a?(String)\n input = _input(:submit, opts)\n self << input\n input\n end", "def submit_button_for(builder, value=nil, options={})\n value ||= builder.send(:submit_default_value)\n content_tag(:button, value, options.reverse_merge(:class => 'button big', :id => \"#{builder.object_name}_submit\"))\n end", "def edit_button\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.input.id(\"/EditButton$/\"), format_method(__method__))\n end", "def edit_button\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.input.id(\"/EditButton$/\"), format_method(__method__))\n end", "def submit(value = nil, options = {})\n value = (@object.new_record?? \"Create\" : \"Update\") if value.nil?\n build_shell(value, options, 'submit_button') { super }\n end", "def buttons(f, cf0925)\n # content_tag :div, class: 'form-inline' do\n [f.submit(\"Save\", class: \"btn btn-primary\"),\n f.button(\"Reset\", type: \"reset\", class: \"btn btn-primary\"),\n print_button(cf0925),\n home_button].join(\" \").html_safe\n # end\n end", "def buttons; end", "def add_to\n add_to_button\n wait_for_ajax(2)\n end", "def create_submit_button(args)\n\n\t\tform = args[\"form\"]\n\t\tdestination = args[\"destination\"]\n\t\ttext = args[\"text\"] || \"Submit\"\n\n\t\tform_ids = @@current_forms[form]\n\t\tsubmit_script = \"\"\n\t\tif form_ids\n\t\t\tsubmit_script = \"<script>function submit_form_#{form}() {var form_args = \"\n\t\t\tform_args = []\n\t\t\t@@current_forms[form].each do |id|\n\t\t\t\tform_args << \"'#{id}=' + encodeURIComponent(document.getElementById('#{id}').value)\"\n\t\t\tend\n\t\t\t@@current_forms.delete(form)\n\t\t\tsubmit_script += \"#{form_args.join(\" + '&' + \")};\"\n\t\t\tsubmit_script += \"location.href = '#{destination}?' + form_args;}</script>\"\n\t\tend\n\t\treturn \"#{submit_script}<button onclick='submit_form_#{form}();'>#{text}</button>\"\n\tend", "def edit_submit_button\n # unit_test_no_generate: edit_submit_button, button.className(create_ats_regex_string(\"ats-editsubmitbtn\"))\n $tracer.trace(__method__)\n return ToolTag.new(button.className(create_ats_regex_string(\"ats-editsubmitbtn\")), __method__)\n end", "def add_link(name, form, obj_name)\n field = ''\n form.fields_for obj_name, obj_name.to_s.classify.constantize.new do |f|\n field = render :partial => 'people/' + obj_name.to_s.singularize, :object => f\n end\n link_to_function name, :class => 'add' do |page|\n page << %{\n var new_id = \"new_\" + new Date().getTime();\n $('fieldset_#{obj_name}').insert({ bottom: \"#{ escape_javascript field }\"\\.replace(/new_\\\\d+/g, new_id) });\n }\n end\n end", "def render\n _button.btn.btn_primary request, onClick: self.click, disabled: @disabled\n end", "def button(contents, attrs = {})\n current_form_context.button(contents, attrs)\n end", "def create_button value\n\n button = Gtk::Button.new(value)\n\n # handle keyboard input, which uses \"active\" event on button\n button.signal_connect(\"activate\") do |widget|\n handle_input widget.label\n end\n\n # handle mouse-click event, which uses \"pressed\" event\n button.signal_connect(\"pressed\") do |widget|\n handle_input widget.label\n end\n\n button.set_can_focus false\n\n button\n\n end", "def remove\n frm.button(:value=>\"Remove\").click\n end", "def create\n builder_or_text = frm.radio(:value=>\"1\", :name=>\"authorIndexForm:_id29\").set?\n\n frm.button(:value=>\"Create\").click\n\n if builder_or_text == true\n EditAssessment.new(@browser)\n else\n # Need to add Markup page class, then add the reference here.\n end\n\n end", "def create_form\n code = \"{{message}}\\n\"\n code += \"<form ng-submit='action(#{@doc['name'].downcase})' ng-show='!message'>\\n\"\n @doc['fields'].each{ |field|\n if field['name'] == 'id' then\n code += \"\\t<span ng-show=\\\"location.indexOf('/#{@doc['name'].downcase}/edit') < 0 \\\">\\n\\t\"\n end\n code = code + \"\\t#{field['name'].capitalize}:<br/><input ng-model='#{@doc['name'].downcase}.#{field['name']}' name='#{field['name']}' type='text'/><br/>\\n\"\n \n if field['name'] == 'id' then\n code += \"\\t</span>\\n\"\n end\n }\n code = code + \"<input type='submit' value='Submit'/>\\n\"\n code = code + \"</form>\"\n return code\n end", "def linkwizard_startover_button\n $tracer.trace(__method__)\n return ToolTag.new(form.id(\"StartOver\").button.className(\"/btn/\") ,__method__)\n end", "def submit_button_template(l = {})\n <<-END\n <div class=\"button\">#{l[:element]}</div>\n\t END\n end", "def save\n frm.button(:name=>\"modifyPartForm:_id89\").click\n EditAssessment.new(@browser)\n end", "def add_fields_link(name, f, association)\n if (name == nil or name == \"\" or f == nil or association == nil or association == \"\")\n return false\n end\n \n new_object = f.object.send(association).klass.new\n id = new_object.object_id\n metarows = 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-primary\", data: {id: id, metarows: metarows.gsub(\"\\n\", \"\")})\n \n #return true #gets displayed in view\n end", "def api_form_actions(object_name, options = {})\n \" <li><div class=\\\"form_actions\\\">\\n \" +\n submit_button(object_name, options[:submit_text]) + \"\\n \" + cancel_link +\n \"\\n </div></li>\"\n end", "def button_down id\n end", "def build_hidden_field_for_checkbox; end", "def createNewHypothesisButton()\n\t\treturn ButtonCreator.new(\n\t\t\t:assetName => 'plus.png', \n\t\t\t:assetSize => 40, \n\t\t\t:parent => self,\n\t\t\t:clicked => :btn_new_clicked\n\t\t)\n\tend", "def real_button_to(name, options = {}, html_options = {})\n html_options = html_options.stringify_keys\n convert_boolean_attributes!(html_options, %w( disabled ))\n\n method_tag = ''\n if (method = html_options.delete('method')) && %w{put delete}.include?(method.to_s)\n method_tag = tag('input', :type => 'hidden', :name => '_method', :value => method.to_s)\n end\n\n form_method = method.to_s == 'get' ? 'get' : 'post'\n\n remote = html_options.delete('remote')\n\n request_token_tag = ''\n if form_method == 'post' && protect_against_forgery?\n request_token_tag = tag(:input, :type => \"hidden\", :name => request_forgery_protection_token.to_s, :value => form_authenticity_token)\n end\n\n url = options.is_a?(String) ? options : self.url_for(options)\n name ||= url\n\n html_options = convert_options_to_data_attributes(options, html_options)\n\n html_options.merge!(\"type\" => \"submit\")\n\n (\"<form method=\\\"#{form_method}\\\" action=\\\"#{html_escape(url)}\\\" #{\"data-remote=\\\"true\\\"\" if remote} class=\\\"button_to\\\"><div>\" +\n method_tag + content_tag(\"button\", name, html_options) + request_token_tag + \"</div></form>\").html_safe\n end", "def buy_as_new_account_button\n $tracer.trace(__method__)\n return ToolTag.new(li.id('new_account_link').find.button, __method__, self)\n end", "def button_value\n if new_record?\n 'Добавить'\n else\n 'Изменить' \n end\n end", "def export_button(**opt)\n append_css!(opt, 'hidden') # TODO: remove after implementing Manifest export\n form_button(:export, **opt)\n end", "def submit_hash\n hash=Hash.new\n\n hash[:id]=\"test\"+self.id.to_s\n\n # this should add classes to be used by Javascript to the submit buttons\n # e.g. <input type=\"button\" ...=submit ... geoLocation=\"true\">\n self.dynamic_params.each do |param|\n hash[param.value]=\"true\"\n end\n return hash\n end", "def external_form_post_js( label = \"Submit\", action = '', params = {} )\n return \"<input type='button' value='#{label}' onClick='externalFormPost(\" + action.to_json + \",\" + params.to_json + \")'/>\"\n 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 show\n #THE FORM FOR THE NEW ORDER IS ON THE SHOW PAGE OF THE BOOK\n @order = Order.new()\n end", "def thelper_submit_with_named_button( n = 'commit' )\n thelper_find_input_by_name( n ).click\n end", "def button(button_text)\n element(damballa(button_text+\"_button\")) { |b| b.button(:value=>button_text) }\n action(damballa(button_text)) { |b| b.button(:value=>button_text).click }\n end", "def add\n active_content_div.button(:text=>\"Add\").click\n wait_for_ajax\n end", "def edit_page(obj)\n page do\n t = String.new\n form_attr = form_attributes(:action=>url_for(\"update/#{model.primary_key_value(obj)}\"))\n t << Forme.form(obj, form_attr, form_opts(form_attr[:action])) do |f|\n model.columns_for(:edit, request).each do |column|\n col_opts = column_options_for(:edit, request, obj, column)\n if html = model.edit_html_for(obj, column, :edit, request)\n col_opts = col_opts.merge(:html=>html)\n end\n f.input(column, col_opts)\n end\n f.button(:value=>'Update', :class=>'btn btn-primary')\n end\n if model.supported_action?(:delete, request)\n t << Forme.form(form_attributes(:action=>url_for(\"delete/#{model.primary_key_value(obj)}\")), form_opts) do |f|\n f.button(:value=>'Delete', :class=>'btn btn-danger')\n end\n end\n t << association_links(obj)\n end\n end", "def adm_create_acct_button\n $tracer.trace(__method__)\n return ToolTag.new(input.id(\"/ctl00_ctl00_ctl00_OuterTaskRegion_TaskRegion_TaskRegion_TaskRegion_createButton/\"), __method__)\n end", "def new\n @page_title = \"New Ingredeient\"\n @ingredient = Ingredient.new\n @btnText = \"Add Ingredient\"\n @obj = @ingredient\n render 'shared/form'\n end", "def create_action_buttons *labels\n @action_buttons = []\n _row = @height-3\n _col = (@width-(labels.count*8))/2\n _col = 5 if _col < 1\n\n labels.each_with_index do |l, ix|\n b = Button.new text: l, row: _row, col: _col\n _col += l.length+5\n @action_buttons << b\n @form.add_widget b\n b.command do\n @selected_index = ix\n throw(:close, ix)\n end\n end\n ## 2018-05-17 - associate RETURN ENTER key with first button (FIXME) should be Ok or Okay or user \n ## should have some say in this. Same for associating ESC with Cancel or Quit.\n @form.bind_key(10, \"Fire Ok button\") { @action_buttons.first.fire }\n end", "def order_lookup_button\n $tracer.trace(__method__)\n return ToolTag.new(input.id(create_ats_regex_string(\"/OrderLookup_SubmitButton/\")), __method__)\n end", "def build_add_bintip_station_form(action,caption)\n\n codes = BintipStation.find(:all).map {|g|[g.bintip_station_code,g.id]}\n field_configs = Array.new\n\tfield_configs[0] = {:field_type => 'DropDownField',\n\t\t\t\t\t\t:field_name => 'bintip_station_code',\n\t\t\t\t\t\t:settings => {:list => codes}}\n\n\n\tbuild_form(nil,field_configs,action,'bintip_station',caption)\n\n\n\n end", "def button_down(id); end", "def render\n remote_inject = @remote ? '-briefly' : ''\n id_str = @submit_id.nil? ? '' : %( id=\"#{@submit_id}\")\n hidden_str = @hidden_submit ? ' hidden' : ''\n if @view_only\n %(<input type=\"submit\" name=\"commit\"#{id_str} value=\"Close\" class=\"close-dialog white bg-green br2 dim pa3 ba b--near-white\"#{hidden_str}>)\n else\n %(<input type=\"submit\" name=\"commit\"#{id_str} value=\"#{@submit_caption}\" data#{remote_inject}-disable-with=\"#{@disable_caption}\" class=\"white bg-green br2 dim pa3 ba b--near-white\"#{hidden_str}>)\n end\n end", "def submit_button_text(model, resource_name)\n new_record = model.new_record?\n new_record ? \"Add #{resource_name}\" : \"Update #{resource_name}\"\n end", "def save\n #10.times {frm.button(:id=>\"questionpool:submit\").flash}\n frm.button(:id=>\"questionpool:submit\").click\n #sleep 180\n #frm.button(:value=>\"Create\").wait_until_present(120)\n QuestionPoolsList.new(@browser)\n end", "def button_up(id)\n Controllers::ControllerSupervisor.dispatch(:button_up, id)\n end", "def button_go_to\n h.link_to \"Order ##{object.id}\", h.order_path(object), class: \"btn btn-xs #{btn_type}\", target: :_blank\n end", "def js_for_has_many(class_string, &form_block)\n @btn_add ||= \"Добавить\"\n assoc_name = assoc_klass.model_name\n placeholder = \"NEW_#{assoc_name.to_s.underscore.upcase.gsub(/\\//, '_')}_RECORD\"\n opts = {\n for: [assoc, assoc_klass.new],\n class: class_string,\n for_options: { child_index: placeholder }\n }\n html = template.capture { __getobj__.send(:inputs_for_nested_attributes, opts, &form_block) }\n text = new_record.is_a?(String) ? new_record : \"<div class='icon_add'>+</div> #{@btn_add}\".html_safe\n doc = Nokogiri::HTML(html)\n html = doc.search('fieldset.inputs.has_many_fields').tap{ |ns| ns.add_class('new_record') }.to_html\n template.link_to text, '#', class: \"button has_many_add\", data: {\n html: CGI.escapeHTML(html).html_safe, placeholder: placeholder\n }\n end", "def buttonSave__clicked(*args)\n get_glade_variables()\n @builder[\"window1\"].destroy\n end", "def done\n frm.button(:name=>\"takeAssessmentForm:_id5\").click\n EditAssessment.new(@browser)\n end", "def add_another_gift_card_button\n\t\t$tracer.trace(__method__)\n\t\treturn ToolTag.new(input.className(\"ats-addanothergiftbtn\"), __method__, self)\n end", "def ing_form; end", "def click2delete_button(params = {}, url = '/ajax/', confirm = 0, imgurl = '/ajimg/delete.png')\n confirm = 1 if confirm == true\n confirm = 0 if confirm == false\n output = \"<span class='RHA c2d button'><a href='javascript:void;'><img src='#{imgurl}' class='RHA ajimg c2d' style='border:0px;' alt='Delete item' /></a>\"\n output << \"<input class='RHA c2d confirm set' type='hidden' value='#{confirm}' /><input class='RHA c2d confirm clicks' type='hidden' value='0' />\"\n output << \"<input class='RHA url' type='hidden' value='#{url}' />\"\n params.each do |name, value|\n name = \"RHA::\" + name.to_s\n output << \"<input type='hidden' class='RHA c2d param' name=#{name.inspect} value=#{value.to_s.inspect} />\\n\"\n end\n output << \"<div class='RHA c2d confirm text' style='display:none;color:white;background-color:red;font-weight:bold;'>#{confirm}</div></span>\"\n output\n end", "def click_new_post\n click NEW_POST_BUTTON\n end", "def set_hidden_field(id, field, form = self)\n form.first(\"##{id}\", visible: false).set(field[:value])\n end", "def cit_submit_tag(object)\n text = object.new_record? ? _(\"Create\") : _(\"Save\")\n submit_tag(text, :class => 'nolabel')\n end", "def get_button(buid, add_params = nil)\n params = {\n buid: buid\n }\n api_call('/global/buttons/:buid(.:format)',:get,params,add_params)\n end", "def placeholder_hidden_input\n if primitive?\n template.hidden_field_tag \"#{form_builder.object_name}[#{attribute_name}_attributes][]\", \"\"\n else\n template.hidden_field_tag \"#{form_builder.object_name}[#{attribute_name}_attributes][_kithe_placeholder][_destroy]\", 1\n end\n end", "def save_button\n if user_signed_in?\n if action_name == \"new\"\n \"<button class='btn-save' id='btn-save'><span><i class='fas fa-cloud'></i></span>Save</button>\".html_safe\n elsif action_name == 'edit' && current_user == @pen.user\n \"<button class='btn-save' id='btn-update'><span><i class='fas fa-cloud'></i></span>Save</button>\".html_safe\n end\n end\n end", "def button\n @edit = session[:edit] # Restore @edit for adv search box\n params[:display] = @display if %w[all_vms vms resource_pools].include?(@display) # Were we displaying sub-items\n\n @refresh_div = 'main_div' unless @display # Default div for button.rjs to refresh\n case params[:pressed]\n when 'resource_pool_delete'\n deleteresourcepools\n if @refresh_div == 'main_div' && @lastaction == 'show_list'\n replace_gtl_main_div\n else\n render_flash unless performed?\n end\n when 'resource_pool_protect'\n assign_policies(ResourcePool)\n else\n super\n end\n end", "def button\n params[:page] = @current_page unless @current_page.nil? # Save current page for list refresh\n @refresh_div = \"main_div\" # Default div for button.rjs to refresh\n\n case params[:pressed]\n when 'miq_request_delete' then deleterequests\n when 'miq_request_edit' then request_edit\n when 'miq_request_copy' then request_copy\n when 'miq_request_reload' then handle_request_reload\n else javascript_flash(:text => _('Button not yet implemented'), :severity => :error)\n end\n end", "def generate_form_to_add_service_sales_entry_details\n @sales_entry = SalesEntry.find_by_id params[:sales_entry_id]\n @sales_order = @sales_entry.sales_order \n end", "def generate_sales_entry_add_product_form\n @item= Item.find_by_id params[:selected_item_id]\n @sales_order = SalesOrder.find_by_id params[:sales_order_id]\n @new_object = SalesEntry.new \n end", "def buttons attrs = {}, &block\n Tagz.tag :div, { :class => 'form-buttons' }.merge(attrs), &block\n end" ]
[ "0.6666378", "0.66006607", "0.6559309", "0.6451646", "0.6353997", "0.63111794", "0.61738646", "0.61665714", "0.61242944", "0.61235887", "0.61193067", "0.61145574", "0.6049062", "0.6038238", "0.6019454", "0.6015727", "0.60116994", "0.59618545", "0.59570044", "0.595056", "0.5944767", "0.5944767", "0.5943118", "0.59350103", "0.59220386", "0.59057224", "0.5893811", "0.5878876", "0.5856951", "0.584153", "0.5827986", "0.5827986", "0.5827986", "0.5814566", "0.5793495", "0.57637066", "0.5746791", "0.5727625", "0.5727625", "0.5727288", "0.5704827", "0.570481", "0.56807876", "0.56695664", "0.56678194", "0.56317997", "0.563166", "0.5626879", "0.562042", "0.56202364", "0.56131667", "0.56076986", "0.55985326", "0.55977273", "0.558676", "0.5584497", "0.5584152", "0.5581298", "0.5571", "0.55525523", "0.5547661", "0.55411935", "0.55260247", "0.5523529", "0.5514955", "0.5512253", "0.55062884", "0.55014676", "0.54830086", "0.5472604", "0.5462092", "0.54531515", "0.5452957", "0.54455197", "0.5434381", "0.5430121", "0.5428542", "0.54284793", "0.54269576", "0.5424747", "0.5416617", "0.54109496", "0.5409733", "0.5404072", "0.5390416", "0.5384606", "0.53838116", "0.53776056", "0.5374609", "0.5373374", "0.53726125", "0.53659105", "0.5363334", "0.53600574", "0.53599995", "0.53525805", "0.5349205", "0.53442264", "0.5332273", "0.5331347" ]
0.72084606
0
Recursive function for display components finds parents and then children and organizes them in this way to display
def components_select_table(cp, depth) pt= "<option value=\"#{cp.id}\"" pt+= " selected=\"true\"" if @component == cp pt+= ">#{"-"*depth}" pt+= "#{cp.name}" pt+= "</option>\n" for child in cp.components if(child != @component) pt += components_select_table(child, depth+1) end end return pt end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def layout_children\n \n end", "def walk(elements, max_depth, *args)\n output = ''\n\n # invalid parameter or nothing to walk\n return output if max_depth < -1 || elements.blank?\n\n parent_field = @db_fields[:parent]\n\n # flat display\n if -1 == max_depth\n empty_array = {}\n elements.each do |e|\n display_element(e, empty_array, 1, 0, args, output)\n end\n return output\n end\n\n # Need to display in hierarchical order.\n # Separate elements into two buckets: top level and children elements.\n # Children_elements is two dimensional array, eg.\n # Children_elements[10][] contains all sub-elements whose parent is 10.\n top_level_elements = []\n children_elements = {}\n elements.each do |e|\n if e.send(parent_field).blank? || e.send(parent_field) == 0\n top_level_elements << e\n else\n children_elements[e.send(parent_field)] ||= []\n children_elements[e.send(parent_field)] << e\n end\n end\n\n # When none of the elements is top level.\n # Assume the first one must be root of the sub elements.\n if top_level_elements.blank?\n root = elements.first\n\n top_level_elements = []\n children_elements = {}\n elements.each do |e|\n if root.send(parent_field) == e.send(parent_field)\n top_level_elements << e\n else\n children_elements[e.send(parent_field).to_i] ||= []\n children_elements[e.send(parent_field).to_i] << e\n end\n end\n end\n\n top_level_elements.each do |e|\n display_element(e, children_elements, max_depth, 0, args, output)\n end\n\n # If we are displaying all levels, and remaining children_elements is not empty,\n # then we got orphans, which should be displayed regardless.\n if max_depth == 0 && !children_elements.empty?\n empty_array = {}\n children_elements.values.each do |orphans|\n orphans.each do |op|\n display_element(op, empty_array, 1, 0, args, output)\n end\n end\n end\n output\n end", "def child_components()\n @child_components\n end", "def do_chain_layout(sugar) \n seen_chains = []\n sugar.residue_composition.select { |r| ['GlcNAc','Gal'].include?(r.name(:ic)) }.each { |chain_start|\n debug(\"CHAIN:Start residue name is #{chain_start.name(:ic)}\")\n next if seen_chains.include?(chain_start)\n debug(\"CHAIN:Not seen before\")\n child_chains = sugar.get_chains_from_residue(chain_start).sort_by { |chain| chain.size }\n debug(\"CHAIN:In total there are #{child_chains.size} chains from this position\")\n child_chains.each { |child_chain|\n debug(\"CHAIN:A chain size is #{child_chain.size}\")\n next unless child_chain.size > 1\n debug(\"CHAIN: Doing a chain layout\")\n chain_desc = child_chain.collect {|r| r.name(:ic)+\"#{r.anomer},#{r.paired_residue_position}\"}.join(',')\n debug(\"CHAIN:Chain is #{chain_desc}\")\n\n chain_end = child_chain[-1]\n \n child_chain.reject! { |c| seen_chains.include?(c) }\n\n if child_chain.size > 0\n layout_chain(child_chain)\n seen_chains += child_chain\n end\n debug(\"CHAIN:Trying to arrange children for #{chain_end.name(:ic)}\")\n \n layout_chain_terminals(chain_end)\n\n seen_chains += (sugar.residue_composition(chain_end))[1..-1]\n }\n }\n return seen_chains\n # All chains should be starting at 0,0 and be laid out as straight (or shifted up for 6) lines\n end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def render_recursively(output_path, title, obj, parent = '')\n renderer.render(output_path, parent, title, obj.get_thumbs, obj.filter)\n\n # For Doc object, returns a list of makes. For the NodeSet object, returns a list of models.\n obj.filter.each do |key|\n # Only recurse if not the same as the parent to avoid an infinite loop\n if title != key\n nodes = obj.search('work:contains(\"' + key + '\")')\n render_recursively(output_path, key, nodes, title)\n end\n end\n end", "def render_tree(elements, symbols, parents = [])\n i = 0\n x = elements.map do |li|\n last = elements.length == i+1\n\n current = indentation(parents, last, symbols) + li[:value]\n\n children = \"\"\n if li[:children].length > 0\n children = \"\\n\" + render_tree(li[:children], symbols, parents + [last])\n end\n\n i += 1\n current + children\n end\n\n x.join(\"\\n\")\n end", "def display_parent_collections(document)\n\n text=\"\"\n parents = document.display_sets\n if parents.kind_of?(Array) and parents.count > 0\n unless parents.count == 1 && parents.first == \"info:fedora/hull:rootDisplaySet\"\n text = <<-EOS\n <div id=\"collections\" >\n <fieldset id=\"collection-fields\">\n <legend>#{pluralize(parents.count,\"In Collection\")[2..-1]}</legend>\n <div id=\"collections-list\">\n <dl>\n EOS\n parents.each { |id| \n pid=id.partition(\"/\")[2]\n text << <<-EOS\n <dt>\n EOS\n text << link_to(DisplaySet.name_of_set(pid), resource_path(pid)) \n text << <<-EOS\n </dt>\n EOS\n }\n text << <<-EOS\n </dl>\n </div>\n </fieldset>\n </div>\n EOS\n end\n end \n \n text.html_safe\n end", "def display_tree() \n list = []\n yield @tree.value\n left_child = @tree.left_child\n right_child = @tree.right_child\n\n list << left_child if left_child != nil\n list << right_child if right_child != nil\n\n loop do\n break if list.empty?\n node = list.shift\n yield node.value\n list << node.left_child if node.left_child != nil\n list << node.right_child if node.right_child != nil\n end\n end", "def render_children options = {}\n return if children.empty?\n\n flattened_children.map{ |child| render_child(child, options) }.join\n end", "def list_children(taxons_collection)\n taxons_collection.sort_by {|p| p.hierarchy}\n html_var = \"\"\n taxons_collection.each do |t|\n if not t.children.empty?\n html_var << \"<li><i class='icon-plus'> </i>\" << link_to(t.name, t) << \"<ul>\" << list_children(t.children) << \"</ul>\"\n else\n html_var << \"<li><i class='icon-white' style='visibility: hidden;'> </i>\" << link_to(t.name, t)\n end\n html_var << \"</li>\\n\"\n end\n return html_var.html_safe\nend", "def parents; end", "def render_children\n children = ''\n\n list_item.children.each do |child|\n children += self.class.render(child, opts)\n end\n\n children\n end", "def apply_children\n \n end", "def children() []; end", "def render(node = nil)\n elt = node | tree\n puts \"\\nNodes: #{elt.body.count}\"\n puts \"\\nAttributes:\"\n elt.attrs.each{ |k, v| puts(\"#{k}: #{v}\") }\n children = elt.body.select{ |i| i.is_a?(Node) }\n puts \"\\nChildren: #{children.each{ |c| render(c) }}\"\n\n\n end", "def render\n return merge_with_parent\n end", "def layout()\n layout_children()\n end", "def display_parent_child_test_cases\n \n end", "def children_navigation(document)\n content_tag(\n :div,\n '',\n class: \"al-contents child-components children-count-#{document.number_of_children}\",\n data: {\n collapse: I18n.t('arclight.views.show.collapse'),\n expand: I18n.t('arclight.views.show.expand'),\n arclight: {\n level: document.component_level.to_i + 1,\n path: search_catalog_path(hierarchy_context: 'component'),\n name: document.collection_name,\n view: 'child_components',\n parent: document.reference,\n directparent: document.reference,\n childrencount: document.number_of_children,\n originalDocument: document.id,\n originalParents: [document.reference],\n eadid: normalize_id(document.eadid),\n per_page: '100'\n }\n }\n )\n end", "def navigation_children\n sorted_children\n end", "def hierarchy\n p = self\n h = []\n while(p.parent != nil)\n h = [p] + h\n p = p.parent\n end\n h = [p] + h\n \n h\n end", "def draw_children\n first = true\n @children.each do |child|\n child.draw(1, first)\n first = false\n end\n puts '└──'\n end", "def components\n result = []\n\n @children.each do |_key, child_group|\n child_group.each do |child|\n result << child if child.is_a?(Component)\n end\n end\n\n result\n end", "def children\n @id = fix_id(params[:id], params[:format], params[:extra])\n if params[:root]==\"source\" then\n @isRoot = true;\n @work = DcmWork.new(@id)\n @children = [@work.pi]\n else\n @isRoot = false;\n @children = get_children(\"nla.\"+params[:root])\n end\n render :action => \"children.json\"\n end", "def populate_inheritance_heirarchy\n apps_and_templates = appTemplates + templates\n apps_and_templates.each do |temp| \n temp.attributes[:parent].to_s != '' ? app_or_temp = temp.attributes[:parent] :\n temp.attributes[:template].to_s != '' ? app_or_temp = temp.attributes[:template]:\n next\n next if app_or_temp == \"what the fuck?\"\n # if temp.attributes[:parent].is_a? String or temp.attributes[:template].is_a? String\n if not app_or_temp.empty?\n parent_template = self.templates.find { |template| template.name.downcase == app_or_temp.downcase }\n temp.child_of << parent_template\n parent_template.parent_of << temp\n end\n end \n end", "def children\n if self.rep_parent.nil?\n return super\n else\n the_children = Array.new\n self.rep_parent.children.each do |child|\n if child.is_a?(Repeatable)\n \n child.repititions.\n where(:show_date => self.show_date).each do |r|\n the_children << r\n end\n elsif child.show_date == self.show_date\n the_children << child\n end\n end\n return the_children\n end\n end", "def children()\n #Ressource.filter(:parent_id => self.id, :parent_service_id => self.service_id).all\n end", "def _display_tree(max_length=20, tabs='')\n\t\tif(@type != '')\n\t\t\tprint(tabs + \"[\" + @type + ((@param != '')? '(' + @param.to_s + ')': '') + \"]\\n\")\n\t\telse\n\t\t\tprint(tabs + \"[TEMPLATE:\" + @template.template_file + \"]\\n\")\n\t\tend\n\n\t\tfor content in @contents\n\t\t\tif(content.is_a?(SifterElement))\n\t\t\t\tcontent._display_tree(max_length, tabs + \"\\t\")\n\t\t\telsif(content.is_a?(SifterTemplate))\n\t\t\t\tcontent._display_tree(max_length, tabs + \"\\t\")\n\t\t\telse\n\t\t\t\tcontent.gsub!(/[\\r\\n]/, ' ')\n\t\t\t\tprint(tabs + \"\\t[TEXT:\" + content[0, max_length] + \"]\\n\")\n\t\t\tend\n\t\tend\n\tend", "def print_automation_objects(indent_level, hierarchy)\n case hierarchy.position\n when 'root'\n print_line(indent_level, \"#{hierarchy.obj_name} ($evm.root)\")\n when 'parent'\n print_line(indent_level, \"#{hierarchy.obj_name} ($evm.parent)\")\n when 'object'\n print_line(indent_level, \"#{hierarchy.obj_name} ($evm.object)\")\n else\n print_line(indent_level, \"#{hierarchy.obj_name}\")\n end\n indent_level += 1\n hierarchy.children.each do |child|\n print_automation_objects(indent_level, child)\n end\nend", "def descendents\n\n\t\t #children.preload(:parent).each do |child| child.descendents end\n\t\t children.each do |child|\n\t [child] + child.descendents\n\t end\n end", "def children; []; end", "def show_tree\n\tend", "def children=(_arg0); end", "def children=(_arg0); end", "def generate_class_tree_level(parent='')\n $all.map { |klass|\n if parent == klass['parentname']\n [\n klass['name'],\n \"classes/#{klass['fullname']}.html\", # klass.path, \n '',\n generate_class_tree_level(klass['fullname'])\n ]\n else\n nil\n end\n }.compact\nend", "def get_hierarchy(entity_class)\n content_tag(:ul, \n entity_class.find(:all, :conditions => 'parent_id IS NULL or parent_id = 0', :order => 'root_id, lft').collect {|root|\n get_subtree(root) }.join)\n end", "def child_output\n output = ''\n if children\n children.each_with_index do | child, i |\n output += child.output + \"\\n\"\n if @sizers and ( sizer_item = @sizers[child] )\n output += sizer_item.output\n end\n end\n end\n\n if self.main_sizer\n output << \"#{var_name}.sizer = #{main_sizer.var_name}\"\n end\n output\n end", "def children\n self.class.children(self) \n end", "def ascendants(result = nil, depth = 0)\n \n if (result.nil?)\n result = Hash.new\n end\n \n parents.each do |par|\n node = Array.new\n node[0] = par\n par_spice = par.spice\n if (!par_spice.nil? && par_spice.length > 0)\n # TBD: I know there is a Ruby way to copy an array but can't look it up on the plane - just copy myself for now\n spouse_list = Array.new\n par_spice.each do |s|\n spouse_list << s\n end\n node[1] = spouse_list\n end\n result[node] = depth\n par.ascendants(result, depth + 1)\n end \n \n return result\n \n end", "def see_tree(tree)\n tree.each do |i|\n puts \"---------------\"\n puts \"Node: #{i.value}\"\n puts \"Parent: \" + i.find_parent[0].value.to_s if i.find_parent.count > 0\n puts \"Left Child: \" + i.find_left_child[0].value.to_s if i.find_left_child.count > 0\n puts \"Right Child: \" + i.find_right_child[0].value.to_s if i.find_right_child.count > 0\n end\nend", "def get_content()\r\n result=''\r\n if self.children.empty?\r\n result=self.content\r\n else\r\n # Display line by line them if it has childern, but no layout\r\n if self.content.nil? || self.content.empty?\r\n self.children.each do |w|\r\n result +=w.get_content()\r\n result +='</br>' # Each child takes a new line\r\n end\r\n end\r\n end\r\n result\r\n end", "def inorder_display_helper node\n return nil if node.nil?\n inorder_display_helper(node.left_child)\n puts node.to_s\n inorder_display_helper(node.right_child)\n end", "def inorder_display\n puts \"ROOT: #{@root.value}\\n\"\n inorder_display_helper @root\n end", "def output_hierarchy(output=$stdout)\n hierarchy.print_tree(output)\n end", "def find_all_parents\n end", "def collect_tree_up_from (foliage,\n parents,\n except_homepage,\n except_page,\n except_with_children)\n ancestry_string = parents.collect {|x| x.id.to_s }.join(\"/\")\n name_prefix = parents.collect {|x| x.title }.join(\" / \")\n name_prefix += \" / \" if name_prefix.present?\n\n our_mans_indexes = []\n foliage.each_index do |indx|\n if foliage[indx].ancestry.to_s == ancestry_string\n our_mans_indexes << indx\n end\n end\n\n leaves = []\n\n our_mans_indexes.reverse!\n our_mans_indexes.each do |indx|\n leaves << foliage.delete_at(indx)\n end\n\n leaves.sort! {|a,b| (a.prior == b.prior) ? a.id <=> b.id : a.prior <=> b.prior }\n result = []\n\n leaves.each do |leaf|\n do_writing = true\n if (except_page && leaf == except_page) || (except_homepage && leaf.home?)\n do_writing = false\n end\n result << [ name_prefix + leaf.title, leaf.id ] if do_writing\n unless do_writing == false && except_with_children\n result += collect_tree_up_from foliage,\n (parents + [ leaf ]),\n except_homepage,\n except_page,\n except_with_children\n end\n end\n\n result\n end", "def get_children\n \t@children\n end", "def _display_tree(max_length=20, tabs='')\n\t\treturn @contents._display_tree(max_length, tabs)\n\tend", "def show_all_children_info\n descendants.map(&:to_s)\n end", "def display_element(element, children_elements, max_depth, depth, args, output)\n return unless element\n\n id_field = @db_fields[:id]\n id = element.send(id_field)\n\n # display this element\n @has_children = !children_elements[id].blank?\n if args[0].is_a? Hash\n args[0][:has_children] = @has_children # Back-compat.\n end\n\n self.start_el(output, element, depth, args[0] || {})\n newlevel = nil\n # descend only when the depth is right and there are childrens for this element\n if (max_depth == 0 || max_depth > depth + 1) && children_elements[id]\n children_elements[id].each do |child|\n if newlevel.nil?\n newlevel = true\n # start the child delimiter\n self.start_lvl(output, depth, args[0] || {})\n end\n display_element(child, children_elements, max_depth, depth + 1, args, output)\n end\n children_elements.delete(id)\n end\n\n if newlevel\n # end the child delimiter\n self.end_lvl(output, depth, args[0] || {})\n end\n\n # end this element\n self.end_el(output, element, depth, args[0] || {})\n end", "def show\n @page_structure = Page.find_by(parent_path: '', csv_id: @page.csv_id).subtree.arrange\n end", "def render\n path = [[root,0]]\n current_height = 0\n\n while (current, height = path.shift)\n next if nil_node_proc.call(current)\n # don't print empty leafs\n next if height >= max_height\n\n # height increased: we print the / \\ separator\n if height > current_height\n current_height += 1\n print_height_separator(current_height)\n end\n\n current.render(padding(height))\n\n # navigate left\n if !nil_node_proc.call(current.l)\n path.push([current.l, height + 1])\n elsif height < max_height\n path.push([EmptyNode.from_node(current), height + 1])\n end\n\n # navigate right\n if !nil_node_proc.call(current.r)\n path.push([current.r, height + 1])\n elsif height < max_height\n path.push([EmptyNode.from_node(current), height + 1])\n end\n end\n puts \"\\n\"\n end", "def print_parent_categories_table(component)\n s=\"<table class=\\\"tight_table\\\">\"\n s+=\"<tr>\"\n s+=\"<th align=\\\"left\\\">Categories</th>\"\n s+=\" </tr>\"\n\n if(!component.categories.empty?)\n for cat in component.categories.sort {|x,y| x.name <=> y.name }\n s+=\" <tr><td>#{link_to cat.name, cat, :target => 'blank'}</td></tr>\"\n end\n else\n s+=\" <tr><td>No Categories</td></tr>\"\n end\n\n s+=\"</table>\"\n\n return s\n end", "def children_for(list)\n list.map do |key, value|\n value = Array(value).flatten\n if value.any?\n after = \" \" * string.inspect.length + \" \"\n description = Hansi.render(THEME[:orange], key.to_s)\n Tree.new(description, *value, after: after, prefix_color: PREFIX_COLOR)\n end\n end\n end", "def ccs_in_ddi_order\n output = []\n harvest = lambda do |parent|\n output.append parent\n if parent.class.method_defined? :children\n parent.children.each(&harvest)\n end\n end\n harvest.call self.top_sequence\n output\n end", "def print_children(index)\n\t\tfor i in (0..(@binder_file_tree_array[index].length-1))\n\n\t\t\tnode = @binder_file_tree_array[index][i]\n\n\t\t\t\t@retarray << [\tnode.id.to_s,\n\t\t\t\t\t\t\t\tnode.title,\n\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\tnode.format.to_i,\n\t\t\t\t\t\t\t\tnode.versions]\n\n\t\t\tif @binder_parent_id_array.include? @binder_file_tree_array[index][i].id.to_s\n\t\t\t\t@retarray += print_children(index + 1)\n\t\t\tend\n\t\tend\n\t\treturn @retarray.uniq\n\tend", "def generate_html\n to_return = \"\"\n\n @child_objects.each do |child_object|\n to_return += child_object.generate_html\n end\n\n return to_return\n end", "def parse_el(el, parent_numbers = [])\n\n # get element subtype from $subtypes\n el_type = el.name\n binding.pry if el_type.nil?\n return nil if el_type.nil?\n\n begin\n num = el.children.first.attributes['value'].text\n rescue\n binding.pry\n end\n # binding.pry if num.nil? || num == \"\"\n return nil if num.nil?\n\n # not sure if this will still have previous elements on recurse\n # so if I add a paragraph_number once, will it still be there on recurse\n # parent numbers can't do path, unless it's an array\n\n if !parent_numbers.find_index{ |n| n.keys.first.to_s == \"#{el_type}_number\" }.nil?\n # binding.pry\n i = parent_numbers.find_index{ |n| n.keys.first.to_s == \"#{el_type}_number\" }\n parent_numbers[i] = { \"#{el_type}_number\": num } unless num.nil?\n # binding.pry\n else\n # binding.pry\n parent_numbers << { \"#{el_type}_number\": num } unless num.nil?\n # binding.pry\n end\n binding.pry if parent_numbers.size > 10\n\n # identifier is path supplied by uscode\n begin\n identifier = el.attributes['identifier']\n identifier = identifier.value unless identifier.nil?\n rescue\n binding.pry\n end\n\n # path is hierarchy of element types built from parent_numbers\n path = build_path_from_parent_numbers(parent_numbers)\n\n heading = el.css('heading').first\n heading = heading.text.strip unless heading.nil?\n\n # chapeaus will be in span in div\n chapeau = el.css('chapeau').first if el_type != 'section'\n chapeau = chapeau.text.strip unless chapeau.nil?\n\n continuation = el.css('continuation').first if el_type != 'section'\n continuation = continuation.text.strip unless continuation.nil?\n\n # need to verify at bottom most el, and if not chapeau\n el_text = el.css('content').first\n el_text = el_text.text.strip unless el_text.nil? || el_text == \"\"\n\n # create a new node of the subtype\n # klass = el_type.titleize.constantize\n n = Node.find_by(identifier: identifier, path: path, type: el_type, num: num, title_number: parent_numbers.first[:title_number])\n\n if !n.nil?\n puts \"Node already exists, skipping\".colorize(:red)\n return nil\n end\n\n klass = Node.new({\n type: el_type,\n num: num,\n parent_numbers: parent_numbers,\n identifier: identifier,\n path: path,\n heading: heading,\n chapeau: chapeau,\n continuation: continuation,\n text: el_text,\n title_number: parent_numbers.first[:title_number]\n })\n if klass.save!\n puts \"Node created #{path} at #{DateTime.now.in_time_zone(\"Eastern Time (US & Canada)\")} for Title #{parent_numbers.first[:title_number]}\".colorize(:green)\n end\n\n # add the subtype to a parent subtype\n # sections have no parents only children\n if el_type != 'section'\n parent = Node.find_by(path: get_base_path(parent_numbers)) # need up-one-level path\n parent.children << klass\n end\n\n el.children.each do |child|\n child_name = child.name\n next if child_name.nil? || child_name.blank?\n if $subtypes.any? { |t| child_name.include?(t) } # is the child a subtype?\n parse_el(child, parent_numbers.dup) # use .dup to remove a reference\n end\n end\n end", "def _children\n @children\n end", "def display_field(field, depth = 0, parents = [])\n my_parents = parents.dup\n field_str = ''\n name = field[:name]\n if field[:class] == BinData::Array\n field_str = \"\\n\" + (\"\\t\" * depth) + name.to_s.upcase\n parent = self\n my_parents.each do |pfield|\n parent = parent.send(pfield)\n end\n array_field = parent.send(name)\n field_str << process_array_field(array_field, (depth + 1))\n else\n if my_parents.empty?\n label = \"\\n\" + (\"\\t\" * depth) + name.to_s.upcase\n if field[:class].ancestors.include? BinData::Record\n field_str = label\n else\n value = send(name)\n field_str = format '%-30s %s', label, value\n end\n else\n parent = self\n my_parents.each do |pfield|\n parent = parent.send(pfield)\n end\n value = parent.send(name)\n label = field[:label] || name.to_s.capitalize\n label = \"\\n\" + (\"\\t\" * depth) + label\n field_str = format '%-30s %s', label, value\n end\n end\n my_parents << name\n field[:fields].each do |sub_field|\n field_str << display_field(sub_field, (depth + 1), my_parents)\n end\n field_str\n end", "def render_entry_children(context, page, depth)\n output = %{}\n\n children = page.children_with_minimal_attributes(@options[:add_attributes]).reject { |c| !include_page?(c) }\n if children.present?\n output = %{<ul id=\"#{@options[:id]}-#{page.slug.to_s.dasherize}\" class=\"#{bootstrap? ? 'dropdown-menu' : ''}\">}\n children.each do |c, page|\n css = []\n css << 'first' if children.first == c\n css << 'last' if children.last == c\n\n output << render_entry_link(context, c, css.join(' '), depth)\n end\n output << %{</ul>}\n end\n\n output\n end", "def children\n res = []\n @board.rows.each_with_index do |row, x|\n row.each_with_index { |item, y| res << [x,y] }\n end\n res\n end", "def show\n\t\tputs \"I am #{self}\"\n\t\tputs \"My value is #{@value}(#{@count})\"\n\t\tputs \"My parent is #{@parent.value}\" if @parent != nil\n\t\tputs \"My small child is #{@small_child.value}\" if @small_child != nil\n\t\tputs \"my big child is #{@big_child.value}\" if @big_child != nil\n\t\tputs \"\"\n\t\t@small_child.show if @small_child != nil\n\t\t@big_child.show if @big_child != nil\n\tend", "def _children\n @children\n end", "def _children\n @children\n end", "def _children\n @children\n end", "def _children\n @children\n end", "def render_entry_children(context, page, depth)\n output = %{}\n\n children = children(page).reject { |c| !include_page?(c) }\n if children.present?\n dropdown_class = @source == 'site' && page.depth == 1 ? @options[:dropdown_class] : ''\n output = %{<ul id=\"#{@options[:id]}-#{page.slug.to_s.dasherize}\" class=\"#{bootstrap? ? 'dropdown-menu' : dropdown_class}\">}\n children.each do |c, page|\n css = []\n css << 'first' if children.first == c\n css << 'last' if children.last == c\n\n output << render_entry_link(context, c, css.join(' '), depth)\n end\n output << %{</ul>}\n end\n\n output\n end", "def children\n out = [] \n (0..2).each do |row|\n (0..2).each do |col|\n pos = [row, col]\n out << next_move_node(pos) if @board.empty?(pos)\n end\n end\n out\n end", "def rearrange_children!\n @rearrange_children = true\n end", "def generate_structure_containing_lower_level_components(root_component, series_num)\n @flattened_component_tree_structure = []\n generate_children_components_info(root_component)\n end", "def each_child\n \n end", "def parse_tree_to_composite_record records, options={}\n depth = options.fetch( :depth, 0 )\n parent = options.fetch( :parent, :root )\n view = []\n\n records.each do |r|\n if r.parent == parent\n v = Tempo::Views::ViewRecords::Composite.new r, depth: depth\n view << v\n if not r.children.empty?\n child_opts = options.clone\n child_opts[:depth] = depth + 1\n child_opts[:parent] = r.id\n child_array = parse_tree_to_composite_record records, child_opts\n view.push *child_array\n end\n end\n end\n\n view\nend", "def _children\n @children\n end", "def render_api_issue_children(issue, api)\n return if issue.leaf?\n api.array :children do\n issue.children.each do |child|\n api.issue(:id => child.id) do\n api.tracker(:id => child.tracker_id, :name => child.tracker.name) unless child.tracker.nil?\n api.subject child.subject\n render_api_issue_children(child, api)\n end\n end\n end\n end", "def children\n children = []\n board.rows.each_index do |row|\n board.rows[row].each_index do |col|\n pos = [row, col]\n if board[pos].nil?\n new_board = board.dup\n new_board[pos] = next_mover_mark\n children << self.class.new(new_board, switch_mark(next_mover_mark), pos)\n end\n end\n end\n children\n end", "def crumb_parents\n []\n end", "def render_facet_hierarchy_item(field_name, data, key)\n item = data[:_]\n subset = data.reject { |k,v| ! k.is_a?(String) }\n \n li_class = subset.empty? ? 'h-leaf' : 'h-node'\n li = ul = ''\n \n if item.nil?\n li = key\n elsif facet_in_params?(field_name, item.qvalue)\n li = render_selected_qfacet_value(field_name, item)\n else\n li = render_qfacet_value(field_name, item)\n end\n \n unless subset.empty?\n subul = subset.keys.sort.collect do |subkey| \n render_facet_hierarchy_item(field_name, subset[subkey], subkey) \n end.join('')\n ul = \"<ul>#{subul}</ul>\".html_safe\n end\n \n %{<li class=\"#{li_class}\">#{li.html_safe}#{ul.html_safe}</li>}.html_safe\nend", "def self_and_parents\n p = [self]\n parent = self.parent \n \n while parent do\n p << parent\n parent = parent.parent \n end\n p\n end", "def children\n _children\n end", "def recurse_nodes(parent_names, source_tmp_geo_area)\n if parent_names.count > 1\n parents = parent_names.dup # Tricky! \n name = parents.shift\n puts \"building internal node: #{name} : #{parents} \"\n add_item(\n name: name,\n parent_names: parents,\n source_table: source_tmp_geo_area.source_table,\n source_table_gid: source_tmp_geo_area.source_table_gid,\n is_internal_node: true\n )\n recurse_nodes(parents, source_tmp_geo_area)\n end\n end", "def node_tree(nodes, &block)\n \n nodes = nodes.dup\n printed_nodes = []\n \n result = \"<ul>\"\n \n # top level nodes first, then others\n for node in nodes\n next if node.instance_of?(Center) || node.instance_of?(Team)\n next unless node.parent == nil\n printed_nodes << node\n result += \"<li>\"\n\n if block_given?\n result += yield node\n else\n result += node.title\n end\n\n children = node.children.dup\n children.delete_if { |r| not nodes.include?(r) }\n if not children.empty?\n result += node_tree_help(children, nodes, printed_nodes, &block)\n end\n \n result += \"</li>\"\n end\n \n # TODO: Add depth counting here to get a minimum of trees\n for node in nodes\n next if printed_nodes.include? node\n printed_nodes << node\n \n result += \"<li>\"\n\n if block_given?\n result += yield node\n else\n result += node.title\n end\n\n children = node.children #.dup\n children.delete_if { |r| not nodes.include?(r) }\n\n if not children.empty?\n result += node_tree_help(children, nodes, printed_nodes, &block)\n end\n \n result += \"</li>\"\n end\n\n result += '</ul>'\n\n return result\n end", "def children\n TkWinfo.children(content)\n end", "def indented_child_options type, parent, depth=0, selected_id\n\n result = []\n unless parent.children.empty?\n parent.children.sort { |a, b| a.title.downcase <=> b.title.downcase }.each do |child|\n child_path = send(\"#{type.model_name.underscore}s_path\", :uri=>child.term_uri, :label=> child.title)\n assay_stat = child.assays.size == 0 ? \"\" : \"<span style='color: #666666;'>(#{child.assays.count} assays)</span>\".html_safe\n ontology_term_li = link_to(child.title, child_path).html_safe\n user_defined_term_li = link_to(child.title, child_path, {:style => \"color:green;font-style:italic\"}) + \"*\" + \" \" +\n (child.can_edit? ? link_to(image(\"edit\"), edit_polymorphic_path(child), {:style => \"vertical-align:middle\"}) : \"\") + \" \" +\n (child.can_destroy? ? (child.assays.count == 0 && child.children.empty? ? link_to(image(\"destroy\"), child, :confirm =>\n \"Are you sure you want to remove this #{child.class.name}? This cannot be undone.\",\n :method => :delete, :style => \"vertical-align:middle\") : \"\") : \"\").html_safe\n child_link = (child.respond_to?(:is_user_defined) && child.is_user_defined) ? user_defined_term_li : ontology_term_li\n\n result << (\"<li style=\\\"margin-left:#{12*depth}px;#{child.id == selected_id ? \"background-color: lightblue;\" : \"\"}\\\">\"+ (depth>0 ? \"└ \" : \" \") + child_link + assay_stat +\n \"</li>\")\n result = result + indented_child_options(type, child, depth+1,selected_id) if child.has_children?\n end\n end\n return result\n end", "def resources &block\n rc = components.collect do |resource_name, component|\n [resource_name.to_s.singularize.to_sym, component[:resource], component.slice(:title, :exclude, :namespace)]\n end\n last = rc.slice!(-1)\n parents = rc.inject(Hash.new){|p, v| p.merge!(v[0]=>v[1])}\n yield(parents, last[0], last[2])\n end", "def rebuild_hierarchies!\n query(\"MATCH (:Page)-[parent:parent]->(:Page) DELETE parent\")\n query(\"MATCH (:Page)-[in_clade:in_clade]->(:Page) DELETE in_clade\")\n missing = {}\n related = {}\n # HACK HACK HACK HACK: We want to use Resource.native here, NOT ITIS!\n itis = Resource.where(name: \"Integrated Taxonomic Information System (ITIS)\").first\n raise \" I tried to use ITIS as the native node for the relationships, but it wasn't there.\" unless itis\n Node.where([\"resource_id = ? AND parent_id IS NOT NULL AND page_id IS NOT NULL\",\n itis.id]).\n includes(:parent).\n find_each do |node|\n page_id = node.page_id\n parent_id = node.parent.page_id\n next if missing.has_key?(page_id) || missing.has_key?(parent_id)\n page = page_exists?(page_id)\n page = page.first if page\n if page\n relate(\"in_clade\", page, page)\n end\n next if related.has_key?(page_id)\n parent = page_exists?(parent_id)\n parent = parent.first if parent\n if page && parent\n if page_id == parent_id\n puts \"** OOPS! Attempted to add #{page_id} as a parent of itself!\"\n else\n relate(\"parent\", page, parent)\n relate(\"in_clade\", page, parent)\n related[page_id] = parent_id\n # puts(\"#{page_id}-[:parent]->#{parent_id}\")\n end\n else\n missing[page_id] = true unless page\n missing[parent_id] = true unless parent\n end\n end\n related.each do |page, parent|\n puts(\"#{page}-[:in_clade*]->#{parent}\")\n end\n puts \"Missing pages in TraitBank: #{missing.keys.sort.join(\", \")}\"\n end", "def children\n properties \n end", "def children\n steps\n end", "def print_all_children( window_handle, findTextOnly = false )\n\t\t\t@findTextOnly = findTextOnly\n\t\t\t\n\t\t\t# Process the parent window.\n\t\t\tif (@allChildren[window_handle] == nil)\n\t\t\t\tprintControlInfo( 0, window_handle )\n\t\t\t\t@allChildren[window_handle] = 1\n\t\t\tend\n\t\n\t\t\t# Enumerate the control's children.\n\t\t\tif (@childProcCalled[window_handle] == nil)\n\t\t\t\t# Enumeration has not been called on this control, so call it.\n\t\t\t\t@@EnumChildWindows.call(window_handle, @PrintChildInfoProc,\n\t\t\t\t\twindow_handle)\n\t\t\t\t@childProcCalled[window_handle] = 1\n\t\t\t\t\n\t\t\t\t# While the array of children to call is not empty, recurse\n\t\t\t\t# children.\n\t\t\t\twhile (@childrenToCall.first != nil)\n\t\t\t\t\thandle = @childrenToCall.shift\n\t\t\t\t\tprint_all_children( handle )\n\t\t\t\tend\n\t\t\tend\n\t\tend" ]
[ "0.61346304", "0.6076893", "0.6071293", "0.60281545", "0.60115606", "0.60115606", "0.60115606", "0.60115606", "0.60115606", "0.60115606", "0.60115606", "0.60115606", "0.60115606", "0.60115606", "0.60115606", "0.60115606", "0.5969188", "0.5958291", "0.5845511", "0.5841062", "0.57507825", "0.5735699", "0.5722254", "0.5704932", "0.56823385", "0.5641766", "0.5581426", "0.5552455", "0.55381763", "0.55341464", "0.5525842", "0.5518249", "0.5512334", "0.5510072", "0.5482961", "0.5475498", "0.5470149", "0.54443485", "0.54442465", "0.54367304", "0.5414253", "0.5414107", "0.5408327", "0.5402909", "0.53957933", "0.53957933", "0.5380507", "0.53803295", "0.5366882", "0.53666574", "0.5357772", "0.53483385", "0.5344976", "0.5341482", "0.5337536", "0.53260183", "0.52954686", "0.5290996", "0.52768916", "0.5274715", "0.5267605", "0.52635723", "0.52604854", "0.5258863", "0.52551115", "0.52428824", "0.5242254", "0.52396333", "0.5239592", "0.52330816", "0.5224823", "0.52228796", "0.5221051", "0.52193", "0.52131194", "0.52118874", "0.52118874", "0.52118874", "0.52118874", "0.520592", "0.51978475", "0.51885974", "0.51874", "0.51779073", "0.5177439", "0.51734567", "0.5166755", "0.51601815", "0.5155184", "0.51489234", "0.5144589", "0.5144099", "0.5142491", "0.5140177", "0.5133355", "0.51324767", "0.51258844", "0.5121835", "0.51172113", "0.51130366", "0.511125" ]
0.0
-1
Function to fill banner and logo portion of web pages
def banner if(@all_images.nil?) @all_images = Image.all end if(!@all_images.empty?) for img in @all_images if(img.picture_file_name == "Company_Logo.png") @imagelogo = img.picture.url end if(img.picture_file_name == "Company_Banner.png") @imagebanner = img.picture.url end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logo; end", "def logo; end", "def logo \n logo = @@doc.xpath(\"//div[contains(@id, 'logo')]\")\n logo += @@doc.xpath(\"//div[contains(@class, 'logo')]\")\n # najdenie href = .... skript\n logo_href = logo.xpath(\".//a//@href\")\n logo_src = logo.xpath(\".//img//@src\")\n\n lg = @@doc.at_xpath(\"//*[contains(@src, 'logo')]\")\n #lg += @@doc.xpath(\"//*[contains(@style, 'logo')]\")\n\n # checking if any logo was found\n if logo_src.size != 0\n template_logo = Hash.new\n template_logo[:written] = false\n if logo_href.size != 0 \n template_logo[:href] = logo_href.to_s\n template_logo[:href_sign] = true\n end\n template_logo[:src] = @@name + logo_src.to_s\n template_logo[:image] = true\n else \n template_logo = Hash.new\n template_logo[:image] = false\n end\n\n if lg != nil\n template_logo = Hash.new\n template_logo[:written] = false\n link = lg.parent\n \n template_logo[:href] = link.xpath('.//@href').to_s\n template_logo[:href_sign] = true\n\n template_logo[:src] = @@name + link.xpath('.//@src').to_s\n template_logo[:image] = true\n end\n\n # if no logo was found then make home with domain name \n if template_logo[:image] == false && lg == nil\n template_logo[:written] = true\n template_logo[:name] = @@name\n template_logo[:src] = @@page_name.capitalize\n end\n\n # sending logo info into template\n template_logo\n end", "def draw_banner\n bmp = Cache.picture(@quest.banner) # Get Picture\n # Shift the hue if requested\n bmp.hue_change(@quest.banner_hue) unless @quest.banner_hue == 0\n x = (contents_width - bmp.rect.width) / 2\n if x < 0 # Stretch horizontally if the banner is too wide\n dest_rect = bmp.rect.dup\n dest_rect.width = contents_width\n contents.stretch_blt(dest_rect, bmp, bmp.rect)\n else\n contents.blt(x, @draw_y, bmp, bmp.rect)\n end\n bmp.dispose\n end", "def page_header(site_config, page_count)\n # start common page region\n page = %(<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\">\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n <!-- The above 3 meta tags *must* come first in the head;\n any other head content must come *after* these tags -->\n <title>#{site_config['title']}</title>)\n page += add_icons\n page += %(\n <meta name=\"description\" content=\"#{site_config['description']}\">\n <meta name=\"theme-color\" content=\"##{site_config['theme_color']}\">\n <link rel=\"stylesheet\" href=\"assets/bootstrap/css/bootstrap.min.css\">\n <link rel=\"stylesheet\" href=\"assets/bootstrap/css/bootstrap-theme.min.css\">\n <style>\n .container-fluid { padding: 0px; }\n .navbar, .navbar-default { margin-bottom: 0; padding: 5pt; background-color: ##{site_config['theme_color']}; font-size: 12pt; }\n .navbar, .navbar-default li a { color: ##{site_config['text_color']} !important; }\n .navbar-default .navbar-brand { margin-left: 20px !important; color: ##{site_config['logo_text_color']}; font-size: 18pt; font-weight: bold; }\n .navbar-brand:hover { background-color: #{site_config['nav_hover_color']} !important; }\n div[id^=\"d3pie_chart_div_\"], canvas { margin-bottom: 100px; }\n footer { background-color: ##{site_config['theme_color']}; min-height: 200px;}\n footer ul a { color: ##{site_config['text_color']} !important; font-size: 13pt; }\n footer .container { margin-left: 15px; }\n .built { text-decoration: none !important; }\n .selected { background-color: #{site_config['nav_selected_color']}; font-weight: bold; }\n .navbar-default li:hover a { background-color: #{site_config['nav_hover_color']} !important; }\n h1 { text-align: center; background-color: ##{site_config['theme_color']}; padding: 14px; color: ##{site_config['text_color']}; }\n pre { white-space: pre-wrap; word-wrap: break-word; }\n .homepage { padding: 5px 30px 5px 30px; }\n .logo { float: left; }\n .oll { padding-left: 1em; }\n h2#other { text-align: center; }\n .plotlypie { height: 625px; }\n </style>\n </head>\n <body>\n <!-- Static navbar -->\n <nav class=\"navbar navbar-default\" id=\"head1\">\n <div class=\"container-fluid\">\n <div class=\"navbar-header\">\n <a href=\"index.html\"><img src=\"assets/images/logo.png\" alt=\"Ruby Powered\" class=\"logo\"></a>\n <button type=\"button\" class=\"navbar-toggle collapsed\" data-toggle=\"collapse\" data-target=\"#navbar\" aria-expanded=\"false\" aria-controls=\"navbar\">\n <span class=\"sr-only\">Toggle navigation</span>\n <span class=\"icon-bar\"></span>\n <span class=\"icon-bar\"></span>\n <span class=\"icon-bar\"></span>\n </button>\n <a class=\"navbar-brand\" href=\"index.html\">#{site_config['nav_heading']}</a>\n </div>\n <div id=\"navbar\" class=\"navbar-collapse collapse\">\n <ul class=\"nav navbar-nav\">)\n page += add_links(page_count)\n page += %(\n </ul>\n </div>\n </div>\n </nav>\n <div class=\"container-fluid\">)\n (0..page_count).map do |i|\n instance_variable_set(\"@page#{ii(i)}\", page)\n end\nend", "def header\n\t\tlogo_path = Rails.root.join('app','assets','images','longbourn_logo.png')\n\t\timage logo_path, :width => 70, :height => 45\n\t\tdraw_text \"Informe de Desempeño de Alumnos\", :at => [100,25], size:12\n\t\tdraw_text \"Longbourn Institute\", :at => [100,10], size:12\n\tend", "def header(in_page=\"\")\n\t # workaround to shoes/shoes4#1212:\n\t $clicky ||= []\n\t $clicky.each{ |i| i.hide }\n\t $clicky = []\n\t \n\t # Header\n\t self.scroll_top = 0\n\t background pattern(img_path \"bg1.png\")\n\t stack do\n\t background enve_blue(0.4)\n\t stack{ background rgb(0,0,0,1.0) } # workaround to shoes/shoes4#1190\n\t flow(width:1.0) do\n\t stack(width:40){}\n\t menu = [\n\t\t [\"Home\",\"/\",\"noun_208357_cc.png\"],\n\t\t [\"All tasks\",\"/index\",\"noun_208394_cc.png\"],\n\t\t [\"Examples\",\"/examples\",\"noun_229087_cc.png\"],\n\t\t [\"Update\",\"/update\",\"noun_229107_cc.png\"],\n\t\t [\"Website\",\"http://enve-omics.ce.gatech.edu/\",\n\t\t \"noun_208472_cc.png\"],\n\t\t [\"About\",\"/about\",\"noun_229118_cc.png\"]\n\t ]\n\t menu.each do |i|\n\t\t flow(width:60, height:65) do\n\t\t if i[1]==in_page\n\t\t\tbackground enve_blue(0.4)\n\t\t\tstack{ background rgb(0,0,0,1.0) } # shoes/shoes4#1190\n\t\t end\n\t\t stack(width:5, height:50){}\n\t\t stack(width:50) do\n\t\t\timage img_path((i[1]==in_page ? \"w-\" : \"\")+i[2]),\n\t\t\t width:50, height:50, margin:2\n\t\t\tinscription i[0], align:\"center\",\n\t\t\t size:(linux? ? 8 : 10),\n\t\t\t stroke: (i[1]==in_page ? white : black)\n\t\t end\n\t\t stack(width:5){}\n\t\t end.click{ (i[1]=~/^https?:/) ? open_url(i[1]) : visit(i[1]) }\n\t\t stack(width:5){}\n\t end\n\t end\n\t stack(height:5, width:1.0){}\n\t stack(height:2, width:1.0) { background black }\n\t end\n\t stack(height:20, width:1.0){}\n end", "def header_image\n header_img_path = request_from_reversemortgageplan? ? \"reversemortgageplan/\" : ''\n if @public_area and params[:path] and params[:path].empty?\n random_header = 1 + rand(7)\n content_tag(:div,'', :id => 'header_image', :style => \"background-image: url(/images/headers/#{header_img_path}large/header#{random_header}.jpg)\")\n else\n random_header = 1 + rand(8)\n content_tag(:div,'', :id => 'header_image', :style => \"background-image: url(/images/headers/#{header_img_path}small/header#{random_header}.jpg); height: 226px; margin-bottom: 10px\")\n end\n end", "def g_home_logo(page_title)\n if page_title.empty?\n '<a href=\"#\"><img class=\"brand\" width=\"26\" src=\"/assets/botflip-logo.svg\"></a><a href=\"#\" class=\"brand\">Miniflip</a>'.html_safe\n # link_to \"MiniFeed\", \"#\", class: \"brand\"\n else\n '<a href=\"/\"><img class=\"brand\" width=\"26\" src=\"/assets/botflip-logo.svg\"></a><a href=\"/\" class=\"brand\">Miniflip</a>'.html_safe\n end\n end", "def header\n image \"#{Rails.root}/app/assets/images/giftgardensmall.jpg\", \n width: 40, height: 40\n move_up 30\n text \"Activities Report\", size: 24, style: :bold, :align => :center\n end", "def place_ad_for_today\n copy_image\n update_page_heading\n end", "def home\n @page = Page.find_or_create_by(name: \"home\")\n @images = Dir.glob(\"app/assets/images/home_banner/cropped/*.jpg\")\n @twitter_client = get_twitter_client\n end", "def add_subdomain_logo\n @donor.logo = process_donor_logo @donor.url\n @donor.save\n end", "def logo_url\n logo? ? h.image_tag(logo.thumb_medium, alt: 'Logo', width: 90) :\n h.content_tag(:span, initial, class: 'brand_img_holder', style: 'width:43px; height:43px;')\n end", "def logo\r\n \tlogo = image_tag(\"logo.png\", :alt => \"mens fashion today\", :class => \"round\")\r\n end", "def logo=(_arg0); end", "def build_logo\n if @logo && [email protected]?\n bottom = @document.note.empty? ? 75 : (75 + note_height)\n @pdf.image(@logo, at: [0, bottom], fit: [x(200), y(50)])\n end\n end", "def run(content, params={})\n content.gsub!(\"div id=\\\"logo\\\"\", \"div id='hiddenlogo' style='display:none;'\")\n content.gsub!(\"http://euruko2009.org/archives\", \"/archives\")\n content.gsub!(\"http://app.euruko2009.org\", \"http://euruko2009.org\")\n content\n end", "def logo\n content_tag(:span, \"HASTINGS FINE HOMES\", class: \"logo\")\n end", "def logo\n rand_num = Random.rand(76) + 1\n \"http://www.biz-logo.com/examples/#{ rand_num < 10 ? \"00\" : \"0\" }#{rand_num}.gif\"\n end", "def settings_logo\n @page_title = _('Logo_settings')\n @logo = Confline.get_value(\"Logo_Picture\")\n end", "def show_logo\n\tcompany = company_from_subdomain\n\tclient = Customer.find(params[:id], :conditions => [\"company_id = ?\", company.id])\n\n unless client.logo?\n render :nothing => true\n return\n end\n\n image = Magick::Image.read( client.logo_path ).first\n if image\n send_file client.logo_path, :filename => \"logo\", :type => image.mime_type, :disposition => 'inline'\n else\n render :nothing => true\n end\n image = nil\n GC.start\n end", "def generate(pdf, logo)\n image, fit, align, link_overlay_start =\n logo.values_at(:image, :fit, :align, :link_overlay_start)\n pdf.image(image, fit: fit, align: align)\n pdf.move_up(link_overlay_start)\n transparent_link(pdf, logo)\n end", "def sp_logo\n sp.logo || DEFAULT_LOGO\n end", "def logo\n logo = image_tag(\"background.png\", :alt => \"background\")\n end", "def kopal_layout_after_page_header\n\n end", "def logo\n image_tag(\"logo.png\", :alt => \"Sample App\", :class => \"round\")\n end", "def logo\n image_tag(\"logo.png\", :alt => \"Sample App\", :class => \"round\")\n end", "def logo_link\n root_path\n end", "def logo\n\t\timage_tag(\"logo.png\", :alt => \"jobradar\", :class => \"round\")\n\tend", "def logo\n \"This is a cool logo !\"\n end", "def splash_page\n end", "def logo_path\n root_path\n end", "def logo_path\n root_path\n end", "def logo_path\n root_path\n end", "def header\n #This inserts an image in the pdf file and sets the size of the image\n #image \"#{Rails.root}/app/assets/images/header.png\", width: 530, height: 150\n end", "def banner_for(user, height=100)\n image_tag(url_for(user.set_banner(height)))\n end", "def banner\n checkConnection()\n @banner\n end", "def banner\n checkConnection()\n @banner\n end", "def display_intro\n # Display Company Logo\n display_logo\n # Display Emergency Information\n display_emergency_info\n end", "def draw\n fill_gradient(:from => Color::BLUE, :to => Color::CYAN)\n @header_image.draw(@header_x, @header_y, 100, 3, 3)\n super\n end", "def get_html_banner()\n\t\t\t\thtml = %Q{\n\t\t\t\t\t<html><body bgcolor=black style=\"color:cyan; font-family: monospace\">\n\t\t\t\t\t\t<pre>#{Xssf::XssfBanner::Logos[2]}</pre><h3 style=\"position:absolute; right:1%; top:75%\" align=\"right\"><u>msf ></u> _</h3>\n\t\t\t\t\t\t<table width=\"300\" height=\"35\" style=\"border: 1px solid green; position:absolute; left:450px; top:30%\">\n\t\t\t\t\t\t\t<tr align=center>\n\t\t\t\t\t\t\t\t<td width=\"33%\" onMouseover=\"this.bgColor='green'\" onMouseout=\"this.bgColor='black'\"\n\t\t\t\t\t\t\t\tonClick=\"parent.location='#{VICTIM_GUI}?#{PARAM_GUI_PAGE}=main';\" style=\"cursor:pointer; border: 1px solid green;\">LOGS</td>\n\t\t\t\t\t\t\t\t<td width=\"33%\" onMouseover=\"this.bgColor='green'\" onMouseout=\"this.bgColor='black'\"\n\t\t\t\t\t\t\t\tonClick=\"parent.location='#{VICTIM_GUI}?#{PARAM_GUI_PAGE}=stats';\" style=\"cursor:pointer; border: 1px solid green;\">STATS</td>\n\t\t\t\t\t\t\t\t<td width=\"33%\" onMouseover=\"this.bgColor='green'\" onMouseout=\"this.bgColor='black'\"\n\t\t\t\t\t\t\t\tonClick=\"parent.location='#{VICTIM_GUI}?#{PARAM_GUI_PAGE}=help';\" style=\"cursor:pointer; border: 1px solid green;\">HELP</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t</body></html>\n\t\t\t\t}\n\t\t\t\treturn html\n\t\t\tend", "def generate(pdf, logo)\n pdf.move_up logo[:y_start]\n pdf.bounding_box(\n [logo[:origin], pdf.cursor],\n width: logo[:width], height: logo[:height]\n ) do\n ImageLink.generate(pdf, logo)\n end\n end", "def logo_tag\n image_tag \"rails.png\", :alt => @page_title\n end", "def logo\n image_tag(\"boulder.png\", :width => \"100\", \n :height => \"75\",\n :alt => \"Learning RoR\", \n :class => \"round\")\n end", "def application_logo(classes)\n if cookies[:layout] == 'application' || cookies[:layout].nil?\n image_tag(asset_pack_path('media/images/duszek-awesome.svg'), class:\"#{classes}\")\n else\n image_tag(asset_pack_path('media/images/duszki.png'), class:\"#{classes}\")\n end\n end", "def create_logo(text)\n tag = 'h1' if item.identifier == '/'\n tag ||= 'div'\n\n \"<\" + tag + \" id=\\\"logo\\\"><a href=\\\"/\\\">\" + text + \"</a></\" + tag + \">\"\n end", "def get_logo_display\n\t\tif !logged_in?\n\t\t\treturn \"City Produce\"\n\t\tend\n\t\tif current_user.admin?\n\t\t\treturn \"Admin\"\n\t\tend\n\t\treturn \"Home\"\n\tend", "def logo\n logo=image_tag(\"rails.png\" , :alt=>\"Sample app\" ,:class=>\"round\")\n end", "def render\n\n # Load graphics.\n path = Rails.root.join('lib', 'assets', 'letterhead', 'letterhead.png')\n \n # Draw graphics on each page.\n self.repeat(:all) do\n self.image(path, at: [0.25.in, 10.75.in], width: 8.in, height: 1.25.in)\n end\n\n # Call parent render.\n super\n\n end", "def link_to_powered_by_logo\n link_to(content_tag(:div, '', :class => \"poweredByLogo fl ml10\"), home_page_url, {:popup => true})\n end", "def logo\n image_tag('rubyLogo.png', alt: 'Ruby on Rails Sample App', class: 'round', height: \"50px\")\n end", "def set_logo\n @logo = Logo.find(@company.logo_id) # NOTE: this raises a 404 if there's no logo,\n # which is what we want here.\n end", "def print_banner\n print_line BANNER\n print_line\n print_line\n end", "def crop_logo\n logo.recreate_versions! if crop_logo_x.present?\n end", "def place_initial\n @party_banners = []\n @header_banner = BannerBG.new(384,0,@viewport)\n @header_banner.bitmap = Cache.banner(\"[TPX] Formation\")\n @header_banner.opacity = 0\n @header_banner.move(384,0,255,10)\n @posx = 471\n Banner::StartSound.play\n ind = 0\n $game_system.menu_disabled = true\n back = $game_party.members.count\n $game_party.members.each do |r|\n banner = BannerBG.new(@posx,205+40*ind,@viewport2)\n banner.bitmap = Cache.banner(\"[TPJ]#{r.id}\")\n banner.opacity = 0\n banner.z = 49-ind\n banner.move(@posx,Banner::PosY[ind],255,10)\n @party_banners.push(banner)\n ind+=1\n end\n #Step 3: Reveal and slide-up the banners of current party members (All Gold)\n end", "def default_header_image\n return if @classroom.nil? or @classroom.new_record?\n\n image_id = @classroom.id % 10\n\n # Since we have only 1..7 available headers, lets map what doesn't fit\n image_id = 7 if image_id == 0 or image_id > 7\n @header_image = path_to_image(\"headers/#{image_id}.jpg\")\n render('shared/header_image')\n end", "def interchange_logo\n q = []\n q << \"[#{image_path(\"#{website.folder}/logo.png\")}, (default)]\"\n q << \"[#{image_path(\"#{website.folder}/logo.png\")}, (large)]\"\n q << \"[#{image_path(\"#{website.folder}/logo.png\")}, (medium)]\"\n q << \"[#{image_path(\"#{website.folder}/logo-sm.png\")}, (only screen and (max-width: 720px))]\"\n\n image_tag('', #\"#{website.folder}/logo.png\",\n class: \"no-resize no-resize-for-small\",\n alt: Setting.site_name(website),\n data: { interchange: q.join(\", \") })\n end", "def interchange_logo\n q = []\n q << \"[#{image_path(\"#{website.folder}/logo.png\")}, (default)]\"\n q << \"[#{image_path(\"#{website.folder}/logo.png\")}, (large)]\"\n q << \"[#{image_path(\"#{website.folder}/logo.png\")}, (medium)]\"\n q << \"[#{image_path(\"#{website.folder}/logo-sm.png\")}, (only screen and (max-width: 720px))]\"\n\n image_tag('', #\"#{website.folder}/logo.png\",\n class: \"no-resize no-resize-for-small\",\n alt: Setting.site_name(website),\n data: { interchange: q.join(\", \") })\n end", "def logo_link\n link_to(logo_img, view_context.root_path)\n end", "def set_info\n @page_header = 'Insight Engine'\n @page_secondary = 'Let\\'s get a view at 10,000 feet.'\n @page_title = 'LeadAccount | Insight Engine'\n @page_icon = 'lightbulb'\n end", "def homepage\n Bbc_homepage.new(@browser)\n end", "def render\n\n # Skip if page is not letterhead.\n unless self.class::LETTERHEAD_FORMAT == :none\n\n # Determine letterhead properties.\n path = Rails.root.join('lib', 'assets', 'letterhead', \"#{self.class::LETTERHEAD_FORMAT.to_s}.png\")\n x = nil\n y = nil\n width = nil\n height = 1.25\n case self.class::LETTERHEAD_FORMAT\n when :portrait, :portrait_mono\n x = 0.25\n y = 10.75\n width = 8\n when :landscape, :landscape_mono, :packing_list, :packing_list_mono\n x = 0.25\n y = 8.25\n width = 10.5\n end\n\n # Draw graphic on each page.\n self.repeat(:all) do\n self.image(path, at: [x.in, y.in], width: width.in, height: height.in)\n end\n\n end\n\n # Call parent render.\n super\n\n end", "def process_donor_logo(donor_url)\n logo_url = nil\n\n page_html = get_page_html donor_url\n if page_html\n logo_node = page_html.at_css('link[rel=\"image_src\"]')\n logo_url = URI.parse(logo_node[:href]) unless logo_node.nil?\n end\n\n logo_url\n end", "def casein_config_logo\n \t'/images/logo_ss.jpg'\n end", "def set_info\n @page_header = 'Dashboard'\n @page_title = 'LeadAccount | Dashboard'\n @page_icon = 'dashboard'\n end", "def header_img\n image_tag('header-img-2.jpg', border: 0)\n end", "def generate_header(title, path = nil)\n version = Version::VERSION\n\n vars = {\n 'title' => escape_html(title),\n 'favicon' => escape_html(asset_url('favicon.ico')),\n 'style' => escape_html(asset_url('sabredav.css')),\n 'iconstyle' => escape_html(asset_url('openiconic/open-iconic.css')),\n 'logo' => escape_html(asset_url('sabredav.png')),\n 'baseUrl' => @server.base_uri\n }\n\n html = <<HTML\n<!DOCTYPE html>\n<html>\n<head>\n <title>#{vars['title']} - tilia/dav #{version}</title>\n <link rel=\"shortcut icon\" href=\"#{vars['favicon']}\" type=\"image/vnd.microsoft.icon\" />\n <link rel=\"stylesheet\" href=\"#{vars['style']}\" type=\"text/css\" />\n <link rel=\"stylesheet\" href=\"#{vars['iconstyle']}\" type=\"text/css\" />\n</head>\n<body>\n <header>\n <div class=\"logo\">\n <a href=\"#{vars['baseUrl']}\"><img src=\"#{vars['logo']}\" alt=\"tilia/dav\" /> #{vars['title']}</a>\n </div>\n </header>\n <nav>\nHTML\n\n # If the path is empty, there's no parent.\n if !path.blank?\n parent_uri = Http::UrlUtil.split_path(path).first\n full_path = @server.base_uri + Http::UrlUtil.encode_path(parent_uri)\n html << \"<a href=\\\"#{full_path}\\\" class=\\\"btn\\\">⇤ Go to parent</a>\"\n else\n html << '<span class=\"btn disabled\">⇤ Go to parent</span>'\n end\n\n html << ' <a href=\"?sabreAction=plugins\" class=\"btn\"><span class=\"oi\" data-glyph=\"puzzle-piece\"></span> Plugins</a>'\n html << '</nav>'\n\n html\n end", "def kopal_layout_before_page_header\n\n end", "def logo\n get_attribute(Yoti::Attribute::APPLICATION_LOGO)\n end", "def robot_image_generator\n img_base_url = 'https://robohash.org/'\n @robot.img_sm = img_base_url + @robot.robot_name + '?size=80x80'\n @robot.img_lg = img_base_url + @robot.robot_name + '?size=300x300'\n end", "def beer_logo_path\n self.logo_path.url(:medium)\n end", "def test_home_header\n p @driver.title\n assert @wait.until {@driver.find_element(:css, 'header.container-fluid').displayed?}\n @driver.find_element(:xpath, '//header/div/nav/ul/li').click\n assert @wait.until {@driver.find_element(:css, 'header.container-fluid div.logoNavHolder').displayed?}\n assert element_present?(:css, 'a.logo i.icon') # Check BK NZ Logo\n @driver.find_element(:css, 'a.logo i.icon').click\n end", "def splash\n @phone, @prefix = classify_phone\n @items = case @prefix\n when 'webkit' then $WK_ITEMS\n when 'touch' then $TO_ITEMS\n when 'basic' then $BA_ITEMS\n end\n @theme = 'brownell'\n render :template => 'home/splash', :layout => @prefix\n end", "def prerender_header_and_footer(options); end", "def drawHeader\n if cursor == bounds.top\n bounding_box([bounds.left, bounds.top], width: bounds.right, height: 30) do\n transparent(0.5) do \n float{image \"#{Rails.root}/app/assets/images/central.png\", height: 30, position: :left, vposition: :center}\n text \"#{Time.new.strftime('%d-%m-%Y')}\", align: :right, valign: :center\n end\n end\n end\n end", "def index\n @menu = \"board\"\n @board = \"banner\"\n @section = \"index\"\n \n @banner_left = Banner.all(:location => \"left\", :order => [:order])\n @banner_center = Banner.all(:location => \"center\", :order => [:order])\n @banner_right = Banner.all(:location => \"right\", :order => [:order])\n \n render 'banner' \n end", "def company_customization_primary_logo\n @company && @company.customizations&.primary_header_logo\n end", "def footer_gi_logo_link\n $tracer.trace(__method__)\n return ToolTag.new(nav.className(\"logo\"), __method__)\n end", "def showBanner\n\treturn unless $options.show_banner\n\tputs <<BANNER\n ____ ____ ____ ___________ ____ __ __ ______\n / ___\\\\_/ __ \\\\ / \\\\_/ __ \\\\_ __ \\\\/ _ \\\\| | \\\\/ ___/\n / /_/ > ___/| | \\\\ ___/| | \\\\( <_> ) | /\\\\___ \\\\\n \\\\___ / \\\\___ >___| /\\\\___ >__| \\\\____/|____//____ >\n\\\\_____/ \\\\/ \\\\/ \\\\/ project generator \\\\/\n\nBANNER\nend", "def banner(banner_src)\n content_for(:custom_banner) { banner_src.html_safe }\n end", "def getLogo( a, b, c, d)\n params = Hash.new\n params['a'] = a\n params['b'] = b\n params['c'] = c\n params['d'] = d\n return doCurl(\"get\",\"/logo\",params)\n end", "def build_web_page(info_hash, id_hash, id_date, id_status)\n image_counter = info_hash.length\n \n File.open('rovers_index.html', 'w') do |file|\n file.puts \"<html>\\n<head>\\n<title>Rovers Nasa!</title>\\n</head>\"\n file.puts \"<body>\\n<section class='container'>\"\n file.puts \"<h1> FOTOGRAFIAS DE LOS ROVERS DE LA NASA CON SUS CARACTERISTICAS</h1>\"\n file.puts\"<ul>\"\n image_counter.times do |i| \n file.puts \"\\t<img src='#{info_hash[i]}'width='250'>\"\n file.puts \"\\n<li><p> ID is: #{id_hash[i]}</p></li>\"\n file.puts \"<li><p>Date in Earth: #{id_date[i]}</p></li>\"\n file.puts \"<li><p> Satelite Status: #{id_status[i]}</p></li>\"\n\n end\n file.puts \"</ul>\\n</section>\\n</body>\\n<html>\"\n end\n end", "def main_homepage\n\t\t\t@section = Section.homepage\n\t\t\t@main_homepage = @page = Asset.find_by_section_id_and_resource_type(@section.id, 'Homepage')\n\t\t\t@is_homepage = true\n\t\t\thomepage\n end", "def gi_header_link\n $tracer.trace(__method__)\n return ToolTag.new(div.className(create_ats_regex_string(\"site-banner\")).a.innerText(\"/GameInformer/\"), __method__)\n end", "def render_header\n class_names = ''\n class_names += 'has-url' if @browser_url\n \"<figure class=\\\"browser-mockup #{class_names}\\\">\"\n end", "def content\n @bgs, @gbs = [], []\n img = image(\"#{HH::STATIC}/hhhello.png\")\n img.move 305, 42\n @bgs << img\n @bgs << rect(38, 0, width-38, 35, fill: \"#CDC\")\n @bgs << rect(38, 0, width-38, 38, fill: black.push(0.05)..black.push(0.2))\n @tabs, @tables = [], HH::DB.tables\n @scripts = HH.scripts\n\n hometab \"Programs\", true, 50, 13 do\n @slot.append do\n @homepane.clear{home_scripts}\n flush\n end\n end\n hometab \"Samples\", false, 168, 13 do\n @slot.append do\n @homepane.clear{sample_scripts}\n flush\n end\n end\n @bgs << rect(38, 38, 300, 4, fill: rgb(233, 239, 224))\n\n @slot.append do\n stack(height: 40){}\n @homepane = flow(margin_top: 10){home_scripts}\n flush\n end\n\n=begin\n stack :margin_left => 12 do\n background rgb(233, 239, 224, 0.85)..rgb(233, 239, 224, 0.0)\n image 10, 70\n end\n @bulletin_stack = stack do\n end\n=end\n end", "def load_homepage\n logger.info 'Loading Canvas homepage'\n navigate_to \"#{WebDriverUtils.canvas_base_url}\"\n end", "def header_and_footer\n @title = _'Labvirt'\n @footer = _'Something nice should go down here...'\n end", "def banner_copyright\n return unless banner\n\n %(Header photo: &copy; <a href=\"#{banner.url}\">#{banner.author}</a>)\n end", "def banner_path\n path = @path[[email protected] - 4] + '_banner.png'\n path_remote = @path_remote[0...@path_remote.length - 4] + '_banner.png'\n File.exists?(path) ? path_remote : 'https://maps.avicus.net' + '/default_map_banner.png' # May need configured\n end", "def show\n @page = Page.find(params[:id])\n @columns = @page.columns.order(\"position ASC\")\n @new_contact = Contact.new\n \n begin\n @bannerimg = Ckeditor::Picture.find(@page.ckeditor_asset_id)\n rescue\n @bg_css = \"background:none;\"\n else \n @bannerheight = Paperclip::Geometry.from_file(@bannerimg).height\n @bannerimg_path = view_context.image_path(@bannerimg.url)\n @bg_css = \"background-image:url(\" + @bannerimg_path + \"); background-position: bottom center; background-repeat: no-repeat; height:\" + @bannerheight.to_s + \"px;\"\n end \n \n render :layout => \"pageshow\"\n end", "def setup\n\t\tsize(1800,900) ; background(20) ; frame_rate 30 #JR\n\t\t# size(1400,850) ; background(20) ; frame_rate 30\n\t\t@w, @h = [width,height].map{|i|i/2.0} ; @i = 0\n \t@m = [235,18,85]\n\n \ttext_font create_font(\"SanSerif\",25) ; stroke(200,200,200)\n \t# @img = loadImage(\"/Users/Jon/Desktop/craigslist_map2.jpg\")\n \t@img = loadImage(\"/Users/Jon/Desktop/full_santa_fe.png\")\n\tend", "def load_page\n logger.info 'Loading Core homepage'\n get ConfigCore.base_url\n when_exists(page_heading, Config.medium_wait)\n end", "def print_intro\n border\n print_image\n puts \"\n Welcome to Mastermind, Shitty.0!\\n\".red\n border_bottom\n end", "def display_course_logo(course)\n content_tag(:span, class: ['image']) do\n image_tag(course.logo.medium.url || 'course_default_logo.svg')\n end\n end", "def header_posicao_047_a_076\n\t\t\t\t\t\t\"#{conta.razao_social}\".adjust_size_to(30)\n\t\t\t\t\tend", "def pos_rseg_header\n pos_page_body\n end", "def banner_line(end_cap_string, center_string, fill_string, banner_width)\n end_cap_string + center_string.center(banner_width, fill_string) + end_cap_string\nend", "def select_logo_title\n\t\tdefine_area\n\t\tif @area == 'model'\n\t\t\tlogo_title = t('layouts.main_filters.collection')\n\t\telsif @area == 'creation'\n\t\t\tlogo_title = t('layouts.main_filters.creation')\n\t\telsif @area == 'accessory' || @area == 'fabric' || @area == 'workshop'\n\t\t\tlogo_title = t('layouts.main_filters.shop')\n\t\tend\n\tend" ]
[ "0.6290007", "0.6290007", "0.626753", "0.58364266", "0.58134824", "0.5807064", "0.5796127", "0.57858896", "0.5716966", "0.5715799", "0.56910914", "0.56882775", "0.5578631", "0.5566212", "0.5566051", "0.5545519", "0.5525533", "0.5465267", "0.54374325", "0.5426832", "0.5423977", "0.5397898", "0.53760225", "0.53640974", "0.5358992", "0.5321139", "0.5320643", "0.5320643", "0.5297633", "0.5277412", "0.52761084", "0.526092", "0.5255181", "0.5255181", "0.5255181", "0.5253787", "0.52355874", "0.52202535", "0.52202535", "0.52186966", "0.52020186", "0.5195793", "0.5179961", "0.51769096", "0.5165495", "0.51611847", "0.51506484", "0.5132626", "0.5117405", "0.50990206", "0.50881535", "0.50881046", "0.50862277", "0.50737214", "0.50708574", "0.50688714", "0.5058241", "0.5052757", "0.5052757", "0.50175476", "0.5016019", "0.50058824", "0.5003058", "0.49884126", "0.4977626", "0.4963495", "0.49618956", "0.49553373", "0.49438727", "0.49289772", "0.49181893", "0.48958033", "0.48725986", "0.48715496", "0.4868173", "0.48625344", "0.48584387", "0.48435995", "0.48416916", "0.48266196", "0.4820744", "0.48178738", "0.48171303", "0.48157215", "0.48062629", "0.4801733", "0.48011068", "0.47990972", "0.4795066", "0.4791503", "0.4790155", "0.47872356", "0.47783673", "0.47763973", "0.47635818", "0.47598004", "0.47517803", "0.4743972", "0.4743339", "0.47424108" ]
0.5557388
15
Recursive function for display components finds parents and then children and organizes them in this way to display
def checkbox_accord(items_hash, show_properties=false, depth=0) if(depth == 0 && items_hash.keys.empty?) return "No Items Available" end if(@items_to_select.nil?) @items_to_select = [] end if(items_hash.keys.empty?) return "" end pt = "<ul " if(depth == 0) pt += "id=\"id#{Time.now.usec}\" class=\"accordion\"" end pt+=">" expand = true for item in items_hash.keys pt += "<li" if(depth == 0 && expand && (!item.is_a?(Property) || !item.valuefields.empty?)) pt += " class=\"expand\"" expand = false end pt +=">" #Checks what class the item is if(item.is_a?(Category)) pt += "<div class=\"inline\">&nbsp</div>#{check_box_tag "parent_ids[]", item.id, @items_to_select.include?(item), :id=>"a#{item.id}"}" + "<label for=\"a#{item.id}\">#{item.name}</label>" elsif(item.is_a?(Product)) pt += "<div class=\"inline\">&nbsp</div>#{check_box_tag "product_ids[]", item.id, @items_to_select.include?(item), :id=>"p#{item.id}"}" + "<label for=\"p#{item.id}\">#{item.name}</label>" elsif(item.is_a?(Component)) pt += "<div class=\"inline\">&nbsp</div>#{check_box_tag "component_parent_ids[]", item.id, @items_to_select.include?(item), :id=>"c#{item.id}"}" + "<label for=\"c#{item.id}\">#{item.name}</label>" elsif(item.is_a?(Valuefield)) pt += "<div class=\"inline\">&nbsp</div>#{check_box_tag "valuefield_ids[]", item.id, @items_to_select.include?(item), :id=>"v#{item.id}"}" + "<label for=\"v#{item.id}\">#{item.name}</label>" elsif(item.is_a?(Group)) #not currently used pt += "<div class=\"inline\">&nbsp</div>#{check_box_tag "group_ids[]", item.id, @items_to_select.include?(item), :id=>"g#{item.id}"}" + "<label for=\"g#{item.id}\">#{item.name}</label>" elsif(item.is_a?(Property)) if(show_properties) pt += "<div class=\"inline\">&nbsp</div>#{check_box_tag "#{parent}[property_id]", item.id, @items_to_select.include?(item), :id=>"o#{item.id}"}" + "<label for=\"o#{item.id}\">#{item.name}</label>" elsif(!item.valuefields.empty?) pt += "<div class=\"inline\">&nbsp</div><b>#{item.name}</b>" end end pt += checkbox_accord(items_hash[item], show_properties, depth+1) pt += "</li>" end pt += "</ul>" return pt end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def layout_children\n \n end", "def walk(elements, max_depth, *args)\n output = ''\n\n # invalid parameter or nothing to walk\n return output if max_depth < -1 || elements.blank?\n\n parent_field = @db_fields[:parent]\n\n # flat display\n if -1 == max_depth\n empty_array = {}\n elements.each do |e|\n display_element(e, empty_array, 1, 0, args, output)\n end\n return output\n end\n\n # Need to display in hierarchical order.\n # Separate elements into two buckets: top level and children elements.\n # Children_elements is two dimensional array, eg.\n # Children_elements[10][] contains all sub-elements whose parent is 10.\n top_level_elements = []\n children_elements = {}\n elements.each do |e|\n if e.send(parent_field).blank? || e.send(parent_field) == 0\n top_level_elements << e\n else\n children_elements[e.send(parent_field)] ||= []\n children_elements[e.send(parent_field)] << e\n end\n end\n\n # When none of the elements is top level.\n # Assume the first one must be root of the sub elements.\n if top_level_elements.blank?\n root = elements.first\n\n top_level_elements = []\n children_elements = {}\n elements.each do |e|\n if root.send(parent_field) == e.send(parent_field)\n top_level_elements << e\n else\n children_elements[e.send(parent_field).to_i] ||= []\n children_elements[e.send(parent_field).to_i] << e\n end\n end\n end\n\n top_level_elements.each do |e|\n display_element(e, children_elements, max_depth, 0, args, output)\n end\n\n # If we are displaying all levels, and remaining children_elements is not empty,\n # then we got orphans, which should be displayed regardless.\n if max_depth == 0 && !children_elements.empty?\n empty_array = {}\n children_elements.values.each do |orphans|\n orphans.each do |op|\n display_element(op, empty_array, 1, 0, args, output)\n end\n end\n end\n output\n end", "def child_components()\n @child_components\n end", "def do_chain_layout(sugar) \n seen_chains = []\n sugar.residue_composition.select { |r| ['GlcNAc','Gal'].include?(r.name(:ic)) }.each { |chain_start|\n debug(\"CHAIN:Start residue name is #{chain_start.name(:ic)}\")\n next if seen_chains.include?(chain_start)\n debug(\"CHAIN:Not seen before\")\n child_chains = sugar.get_chains_from_residue(chain_start).sort_by { |chain| chain.size }\n debug(\"CHAIN:In total there are #{child_chains.size} chains from this position\")\n child_chains.each { |child_chain|\n debug(\"CHAIN:A chain size is #{child_chain.size}\")\n next unless child_chain.size > 1\n debug(\"CHAIN: Doing a chain layout\")\n chain_desc = child_chain.collect {|r| r.name(:ic)+\"#{r.anomer},#{r.paired_residue_position}\"}.join(',')\n debug(\"CHAIN:Chain is #{chain_desc}\")\n\n chain_end = child_chain[-1]\n \n child_chain.reject! { |c| seen_chains.include?(c) }\n\n if child_chain.size > 0\n layout_chain(child_chain)\n seen_chains += child_chain\n end\n debug(\"CHAIN:Trying to arrange children for #{chain_end.name(:ic)}\")\n \n layout_chain_terminals(chain_end)\n\n seen_chains += (sugar.residue_composition(chain_end))[1..-1]\n }\n }\n return seen_chains\n # All chains should be starting at 0,0 and be laid out as straight (or shifted up for 6) lines\n end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def render_recursively(output_path, title, obj, parent = '')\n renderer.render(output_path, parent, title, obj.get_thumbs, obj.filter)\n\n # For Doc object, returns a list of makes. For the NodeSet object, returns a list of models.\n obj.filter.each do |key|\n # Only recurse if not the same as the parent to avoid an infinite loop\n if title != key\n nodes = obj.search('work:contains(\"' + key + '\")')\n render_recursively(output_path, key, nodes, title)\n end\n end\n end", "def render_tree(elements, symbols, parents = [])\n i = 0\n x = elements.map do |li|\n last = elements.length == i+1\n\n current = indentation(parents, last, symbols) + li[:value]\n\n children = \"\"\n if li[:children].length > 0\n children = \"\\n\" + render_tree(li[:children], symbols, parents + [last])\n end\n\n i += 1\n current + children\n end\n\n x.join(\"\\n\")\n end", "def display_parent_collections(document)\n\n text=\"\"\n parents = document.display_sets\n if parents.kind_of?(Array) and parents.count > 0\n unless parents.count == 1 && parents.first == \"info:fedora/hull:rootDisplaySet\"\n text = <<-EOS\n <div id=\"collections\" >\n <fieldset id=\"collection-fields\">\n <legend>#{pluralize(parents.count,\"In Collection\")[2..-1]}</legend>\n <div id=\"collections-list\">\n <dl>\n EOS\n parents.each { |id| \n pid=id.partition(\"/\")[2]\n text << <<-EOS\n <dt>\n EOS\n text << link_to(DisplaySet.name_of_set(pid), resource_path(pid)) \n text << <<-EOS\n </dt>\n EOS\n }\n text << <<-EOS\n </dl>\n </div>\n </fieldset>\n </div>\n EOS\n end\n end \n \n text.html_safe\n end", "def display_tree() \n list = []\n yield @tree.value\n left_child = @tree.left_child\n right_child = @tree.right_child\n\n list << left_child if left_child != nil\n list << right_child if right_child != nil\n\n loop do\n break if list.empty?\n node = list.shift\n yield node.value\n list << node.left_child if node.left_child != nil\n list << node.right_child if node.right_child != nil\n end\n end", "def render_children options = {}\n return if children.empty?\n\n flattened_children.map{ |child| render_child(child, options) }.join\n end", "def list_children(taxons_collection)\n taxons_collection.sort_by {|p| p.hierarchy}\n html_var = \"\"\n taxons_collection.each do |t|\n if not t.children.empty?\n html_var << \"<li><i class='icon-plus'> </i>\" << link_to(t.name, t) << \"<ul>\" << list_children(t.children) << \"</ul>\"\n else\n html_var << \"<li><i class='icon-white' style='visibility: hidden;'> </i>\" << link_to(t.name, t)\n end\n html_var << \"</li>\\n\"\n end\n return html_var.html_safe\nend", "def parents; end", "def render_children\n children = ''\n\n list_item.children.each do |child|\n children += self.class.render(child, opts)\n end\n\n children\n end", "def apply_children\n \n end", "def children() []; end", "def render(node = nil)\n elt = node | tree\n puts \"\\nNodes: #{elt.body.count}\"\n puts \"\\nAttributes:\"\n elt.attrs.each{ |k, v| puts(\"#{k}: #{v}\") }\n children = elt.body.select{ |i| i.is_a?(Node) }\n puts \"\\nChildren: #{children.each{ |c| render(c) }}\"\n\n\n end", "def render\n return merge_with_parent\n end", "def layout()\n layout_children()\n end", "def display_parent_child_test_cases\n \n end", "def children_navigation(document)\n content_tag(\n :div,\n '',\n class: \"al-contents child-components children-count-#{document.number_of_children}\",\n data: {\n collapse: I18n.t('arclight.views.show.collapse'),\n expand: I18n.t('arclight.views.show.expand'),\n arclight: {\n level: document.component_level.to_i + 1,\n path: search_catalog_path(hierarchy_context: 'component'),\n name: document.collection_name,\n view: 'child_components',\n parent: document.reference,\n directparent: document.reference,\n childrencount: document.number_of_children,\n originalDocument: document.id,\n originalParents: [document.reference],\n eadid: normalize_id(document.eadid),\n per_page: '100'\n }\n }\n )\n end", "def navigation_children\n sorted_children\n end", "def hierarchy\n p = self\n h = []\n while(p.parent != nil)\n h = [p] + h\n p = p.parent\n end\n h = [p] + h\n \n h\n end", "def draw_children\n first = true\n @children.each do |child|\n child.draw(1, first)\n first = false\n end\n puts '└──'\n end", "def components\n result = []\n\n @children.each do |_key, child_group|\n child_group.each do |child|\n result << child if child.is_a?(Component)\n end\n end\n\n result\n end", "def children\n @id = fix_id(params[:id], params[:format], params[:extra])\n if params[:root]==\"source\" then\n @isRoot = true;\n @work = DcmWork.new(@id)\n @children = [@work.pi]\n else\n @isRoot = false;\n @children = get_children(\"nla.\"+params[:root])\n end\n render :action => \"children.json\"\n end", "def populate_inheritance_heirarchy\n apps_and_templates = appTemplates + templates\n apps_and_templates.each do |temp| \n temp.attributes[:parent].to_s != '' ? app_or_temp = temp.attributes[:parent] :\n temp.attributes[:template].to_s != '' ? app_or_temp = temp.attributes[:template]:\n next\n next if app_or_temp == \"what the fuck?\"\n # if temp.attributes[:parent].is_a? String or temp.attributes[:template].is_a? String\n if not app_or_temp.empty?\n parent_template = self.templates.find { |template| template.name.downcase == app_or_temp.downcase }\n temp.child_of << parent_template\n parent_template.parent_of << temp\n end\n end \n end", "def children()\n #Ressource.filter(:parent_id => self.id, :parent_service_id => self.service_id).all\n end", "def children\n if self.rep_parent.nil?\n return super\n else\n the_children = Array.new\n self.rep_parent.children.each do |child|\n if child.is_a?(Repeatable)\n \n child.repititions.\n where(:show_date => self.show_date).each do |r|\n the_children << r\n end\n elsif child.show_date == self.show_date\n the_children << child\n end\n end\n return the_children\n end\n end", "def _display_tree(max_length=20, tabs='')\n\t\tif(@type != '')\n\t\t\tprint(tabs + \"[\" + @type + ((@param != '')? '(' + @param.to_s + ')': '') + \"]\\n\")\n\t\telse\n\t\t\tprint(tabs + \"[TEMPLATE:\" + @template.template_file + \"]\\n\")\n\t\tend\n\n\t\tfor content in @contents\n\t\t\tif(content.is_a?(SifterElement))\n\t\t\t\tcontent._display_tree(max_length, tabs + \"\\t\")\n\t\t\telsif(content.is_a?(SifterTemplate))\n\t\t\t\tcontent._display_tree(max_length, tabs + \"\\t\")\n\t\t\telse\n\t\t\t\tcontent.gsub!(/[\\r\\n]/, ' ')\n\t\t\t\tprint(tabs + \"\\t[TEXT:\" + content[0, max_length] + \"]\\n\")\n\t\t\tend\n\t\tend\n\tend", "def descendents\n\n\t\t #children.preload(:parent).each do |child| child.descendents end\n\t\t children.each do |child|\n\t [child] + child.descendents\n\t end\n end", "def print_automation_objects(indent_level, hierarchy)\n case hierarchy.position\n when 'root'\n print_line(indent_level, \"#{hierarchy.obj_name} ($evm.root)\")\n when 'parent'\n print_line(indent_level, \"#{hierarchy.obj_name} ($evm.parent)\")\n when 'object'\n print_line(indent_level, \"#{hierarchy.obj_name} ($evm.object)\")\n else\n print_line(indent_level, \"#{hierarchy.obj_name}\")\n end\n indent_level += 1\n hierarchy.children.each do |child|\n print_automation_objects(indent_level, child)\n end\nend", "def children; []; end", "def show_tree\n\tend", "def children=(_arg0); end", "def children=(_arg0); end", "def generate_class_tree_level(parent='')\n $all.map { |klass|\n if parent == klass['parentname']\n [\n klass['name'],\n \"classes/#{klass['fullname']}.html\", # klass.path, \n '',\n generate_class_tree_level(klass['fullname'])\n ]\n else\n nil\n end\n }.compact\nend", "def get_hierarchy(entity_class)\n content_tag(:ul, \n entity_class.find(:all, :conditions => 'parent_id IS NULL or parent_id = 0', :order => 'root_id, lft').collect {|root|\n get_subtree(root) }.join)\n end", "def child_output\n output = ''\n if children\n children.each_with_index do | child, i |\n output += child.output + \"\\n\"\n if @sizers and ( sizer_item = @sizers[child] )\n output += sizer_item.output\n end\n end\n end\n\n if self.main_sizer\n output << \"#{var_name}.sizer = #{main_sizer.var_name}\"\n end\n output\n end", "def children\n self.class.children(self) \n end", "def ascendants(result = nil, depth = 0)\n \n if (result.nil?)\n result = Hash.new\n end\n \n parents.each do |par|\n node = Array.new\n node[0] = par\n par_spice = par.spice\n if (!par_spice.nil? && par_spice.length > 0)\n # TBD: I know there is a Ruby way to copy an array but can't look it up on the plane - just copy myself for now\n spouse_list = Array.new\n par_spice.each do |s|\n spouse_list << s\n end\n node[1] = spouse_list\n end\n result[node] = depth\n par.ascendants(result, depth + 1)\n end \n \n return result\n \n end", "def see_tree(tree)\n tree.each do |i|\n puts \"---------------\"\n puts \"Node: #{i.value}\"\n puts \"Parent: \" + i.find_parent[0].value.to_s if i.find_parent.count > 0\n puts \"Left Child: \" + i.find_left_child[0].value.to_s if i.find_left_child.count > 0\n puts \"Right Child: \" + i.find_right_child[0].value.to_s if i.find_right_child.count > 0\n end\nend", "def get_content()\r\n result=''\r\n if self.children.empty?\r\n result=self.content\r\n else\r\n # Display line by line them if it has childern, but no layout\r\n if self.content.nil? || self.content.empty?\r\n self.children.each do |w|\r\n result +=w.get_content()\r\n result +='</br>' # Each child takes a new line\r\n end\r\n end\r\n end\r\n result\r\n end", "def inorder_display_helper node\n return nil if node.nil?\n inorder_display_helper(node.left_child)\n puts node.to_s\n inorder_display_helper(node.right_child)\n end", "def inorder_display\n puts \"ROOT: #{@root.value}\\n\"\n inorder_display_helper @root\n end", "def output_hierarchy(output=$stdout)\n hierarchy.print_tree(output)\n end", "def find_all_parents\n end", "def collect_tree_up_from (foliage,\n parents,\n except_homepage,\n except_page,\n except_with_children)\n ancestry_string = parents.collect {|x| x.id.to_s }.join(\"/\")\n name_prefix = parents.collect {|x| x.title }.join(\" / \")\n name_prefix += \" / \" if name_prefix.present?\n\n our_mans_indexes = []\n foliage.each_index do |indx|\n if foliage[indx].ancestry.to_s == ancestry_string\n our_mans_indexes << indx\n end\n end\n\n leaves = []\n\n our_mans_indexes.reverse!\n our_mans_indexes.each do |indx|\n leaves << foliage.delete_at(indx)\n end\n\n leaves.sort! {|a,b| (a.prior == b.prior) ? a.id <=> b.id : a.prior <=> b.prior }\n result = []\n\n leaves.each do |leaf|\n do_writing = true\n if (except_page && leaf == except_page) || (except_homepage && leaf.home?)\n do_writing = false\n end\n result << [ name_prefix + leaf.title, leaf.id ] if do_writing\n unless do_writing == false && except_with_children\n result += collect_tree_up_from foliage,\n (parents + [ leaf ]),\n except_homepage,\n except_page,\n except_with_children\n end\n end\n\n result\n end", "def get_children\n \t@children\n end", "def _display_tree(max_length=20, tabs='')\n\t\treturn @contents._display_tree(max_length, tabs)\n\tend", "def show_all_children_info\n descendants.map(&:to_s)\n end", "def display_element(element, children_elements, max_depth, depth, args, output)\n return unless element\n\n id_field = @db_fields[:id]\n id = element.send(id_field)\n\n # display this element\n @has_children = !children_elements[id].blank?\n if args[0].is_a? Hash\n args[0][:has_children] = @has_children # Back-compat.\n end\n\n self.start_el(output, element, depth, args[0] || {})\n newlevel = nil\n # descend only when the depth is right and there are childrens for this element\n if (max_depth == 0 || max_depth > depth + 1) && children_elements[id]\n children_elements[id].each do |child|\n if newlevel.nil?\n newlevel = true\n # start the child delimiter\n self.start_lvl(output, depth, args[0] || {})\n end\n display_element(child, children_elements, max_depth, depth + 1, args, output)\n end\n children_elements.delete(id)\n end\n\n if newlevel\n # end the child delimiter\n self.end_lvl(output, depth, args[0] || {})\n end\n\n # end this element\n self.end_el(output, element, depth, args[0] || {})\n end", "def show\n @page_structure = Page.find_by(parent_path: '', csv_id: @page.csv_id).subtree.arrange\n end", "def render\n path = [[root,0]]\n current_height = 0\n\n while (current, height = path.shift)\n next if nil_node_proc.call(current)\n # don't print empty leafs\n next if height >= max_height\n\n # height increased: we print the / \\ separator\n if height > current_height\n current_height += 1\n print_height_separator(current_height)\n end\n\n current.render(padding(height))\n\n # navigate left\n if !nil_node_proc.call(current.l)\n path.push([current.l, height + 1])\n elsif height < max_height\n path.push([EmptyNode.from_node(current), height + 1])\n end\n\n # navigate right\n if !nil_node_proc.call(current.r)\n path.push([current.r, height + 1])\n elsif height < max_height\n path.push([EmptyNode.from_node(current), height + 1])\n end\n end\n puts \"\\n\"\n end", "def print_parent_categories_table(component)\n s=\"<table class=\\\"tight_table\\\">\"\n s+=\"<tr>\"\n s+=\"<th align=\\\"left\\\">Categories</th>\"\n s+=\" </tr>\"\n\n if(!component.categories.empty?)\n for cat in component.categories.sort {|x,y| x.name <=> y.name }\n s+=\" <tr><td>#{link_to cat.name, cat, :target => 'blank'}</td></tr>\"\n end\n else\n s+=\" <tr><td>No Categories</td></tr>\"\n end\n\n s+=\"</table>\"\n\n return s\n end", "def children_for(list)\n list.map do |key, value|\n value = Array(value).flatten\n if value.any?\n after = \" \" * string.inspect.length + \" \"\n description = Hansi.render(THEME[:orange], key.to_s)\n Tree.new(description, *value, after: after, prefix_color: PREFIX_COLOR)\n end\n end\n end", "def ccs_in_ddi_order\n output = []\n harvest = lambda do |parent|\n output.append parent\n if parent.class.method_defined? :children\n parent.children.each(&harvest)\n end\n end\n harvest.call self.top_sequence\n output\n end", "def print_children(index)\n\t\tfor i in (0..(@binder_file_tree_array[index].length-1))\n\n\t\t\tnode = @binder_file_tree_array[index][i]\n\n\t\t\t\t@retarray << [\tnode.id.to_s,\n\t\t\t\t\t\t\t\tnode.title,\n\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\tnode.format.to_i,\n\t\t\t\t\t\t\t\tnode.versions]\n\n\t\t\tif @binder_parent_id_array.include? @binder_file_tree_array[index][i].id.to_s\n\t\t\t\t@retarray += print_children(index + 1)\n\t\t\tend\n\t\tend\n\t\treturn @retarray.uniq\n\tend", "def generate_html\n to_return = \"\"\n\n @child_objects.each do |child_object|\n to_return += child_object.generate_html\n end\n\n return to_return\n end", "def parse_el(el, parent_numbers = [])\n\n # get element subtype from $subtypes\n el_type = el.name\n binding.pry if el_type.nil?\n return nil if el_type.nil?\n\n begin\n num = el.children.first.attributes['value'].text\n rescue\n binding.pry\n end\n # binding.pry if num.nil? || num == \"\"\n return nil if num.nil?\n\n # not sure if this will still have previous elements on recurse\n # so if I add a paragraph_number once, will it still be there on recurse\n # parent numbers can't do path, unless it's an array\n\n if !parent_numbers.find_index{ |n| n.keys.first.to_s == \"#{el_type}_number\" }.nil?\n # binding.pry\n i = parent_numbers.find_index{ |n| n.keys.first.to_s == \"#{el_type}_number\" }\n parent_numbers[i] = { \"#{el_type}_number\": num } unless num.nil?\n # binding.pry\n else\n # binding.pry\n parent_numbers << { \"#{el_type}_number\": num } unless num.nil?\n # binding.pry\n end\n binding.pry if parent_numbers.size > 10\n\n # identifier is path supplied by uscode\n begin\n identifier = el.attributes['identifier']\n identifier = identifier.value unless identifier.nil?\n rescue\n binding.pry\n end\n\n # path is hierarchy of element types built from parent_numbers\n path = build_path_from_parent_numbers(parent_numbers)\n\n heading = el.css('heading').first\n heading = heading.text.strip unless heading.nil?\n\n # chapeaus will be in span in div\n chapeau = el.css('chapeau').first if el_type != 'section'\n chapeau = chapeau.text.strip unless chapeau.nil?\n\n continuation = el.css('continuation').first if el_type != 'section'\n continuation = continuation.text.strip unless continuation.nil?\n\n # need to verify at bottom most el, and if not chapeau\n el_text = el.css('content').first\n el_text = el_text.text.strip unless el_text.nil? || el_text == \"\"\n\n # create a new node of the subtype\n # klass = el_type.titleize.constantize\n n = Node.find_by(identifier: identifier, path: path, type: el_type, num: num, title_number: parent_numbers.first[:title_number])\n\n if !n.nil?\n puts \"Node already exists, skipping\".colorize(:red)\n return nil\n end\n\n klass = Node.new({\n type: el_type,\n num: num,\n parent_numbers: parent_numbers,\n identifier: identifier,\n path: path,\n heading: heading,\n chapeau: chapeau,\n continuation: continuation,\n text: el_text,\n title_number: parent_numbers.first[:title_number]\n })\n if klass.save!\n puts \"Node created #{path} at #{DateTime.now.in_time_zone(\"Eastern Time (US & Canada)\")} for Title #{parent_numbers.first[:title_number]}\".colorize(:green)\n end\n\n # add the subtype to a parent subtype\n # sections have no parents only children\n if el_type != 'section'\n parent = Node.find_by(path: get_base_path(parent_numbers)) # need up-one-level path\n parent.children << klass\n end\n\n el.children.each do |child|\n child_name = child.name\n next if child_name.nil? || child_name.blank?\n if $subtypes.any? { |t| child_name.include?(t) } # is the child a subtype?\n parse_el(child, parent_numbers.dup) # use .dup to remove a reference\n end\n end\n end", "def _children\n @children\n end", "def display_field(field, depth = 0, parents = [])\n my_parents = parents.dup\n field_str = ''\n name = field[:name]\n if field[:class] == BinData::Array\n field_str = \"\\n\" + (\"\\t\" * depth) + name.to_s.upcase\n parent = self\n my_parents.each do |pfield|\n parent = parent.send(pfield)\n end\n array_field = parent.send(name)\n field_str << process_array_field(array_field, (depth + 1))\n else\n if my_parents.empty?\n label = \"\\n\" + (\"\\t\" * depth) + name.to_s.upcase\n if field[:class].ancestors.include? BinData::Record\n field_str = label\n else\n value = send(name)\n field_str = format '%-30s %s', label, value\n end\n else\n parent = self\n my_parents.each do |pfield|\n parent = parent.send(pfield)\n end\n value = parent.send(name)\n label = field[:label] || name.to_s.capitalize\n label = \"\\n\" + (\"\\t\" * depth) + label\n field_str = format '%-30s %s', label, value\n end\n end\n my_parents << name\n field[:fields].each do |sub_field|\n field_str << display_field(sub_field, (depth + 1), my_parents)\n end\n field_str\n end", "def render_entry_children(context, page, depth)\n output = %{}\n\n children = page.children_with_minimal_attributes(@options[:add_attributes]).reject { |c| !include_page?(c) }\n if children.present?\n output = %{<ul id=\"#{@options[:id]}-#{page.slug.to_s.dasherize}\" class=\"#{bootstrap? ? 'dropdown-menu' : ''}\">}\n children.each do |c, page|\n css = []\n css << 'first' if children.first == c\n css << 'last' if children.last == c\n\n output << render_entry_link(context, c, css.join(' '), depth)\n end\n output << %{</ul>}\n end\n\n output\n end", "def children\n res = []\n @board.rows.each_with_index do |row, x|\n row.each_with_index { |item, y| res << [x,y] }\n end\n res\n end", "def show\n\t\tputs \"I am #{self}\"\n\t\tputs \"My value is #{@value}(#{@count})\"\n\t\tputs \"My parent is #{@parent.value}\" if @parent != nil\n\t\tputs \"My small child is #{@small_child.value}\" if @small_child != nil\n\t\tputs \"my big child is #{@big_child.value}\" if @big_child != nil\n\t\tputs \"\"\n\t\t@small_child.show if @small_child != nil\n\t\t@big_child.show if @big_child != nil\n\tend", "def _children\n @children\n end", "def _children\n @children\n end", "def _children\n @children\n end", "def _children\n @children\n end", "def render_entry_children(context, page, depth)\n output = %{}\n\n children = children(page).reject { |c| !include_page?(c) }\n if children.present?\n dropdown_class = @source == 'site' && page.depth == 1 ? @options[:dropdown_class] : ''\n output = %{<ul id=\"#{@options[:id]}-#{page.slug.to_s.dasherize}\" class=\"#{bootstrap? ? 'dropdown-menu' : dropdown_class}\">}\n children.each do |c, page|\n css = []\n css << 'first' if children.first == c\n css << 'last' if children.last == c\n\n output << render_entry_link(context, c, css.join(' '), depth)\n end\n output << %{</ul>}\n end\n\n output\n end", "def children\n out = [] \n (0..2).each do |row|\n (0..2).each do |col|\n pos = [row, col]\n out << next_move_node(pos) if @board.empty?(pos)\n end\n end\n out\n end", "def rearrange_children!\n @rearrange_children = true\n end", "def generate_structure_containing_lower_level_components(root_component, series_num)\n @flattened_component_tree_structure = []\n generate_children_components_info(root_component)\n end", "def each_child\n \n end", "def parse_tree_to_composite_record records, options={}\n depth = options.fetch( :depth, 0 )\n parent = options.fetch( :parent, :root )\n view = []\n\n records.each do |r|\n if r.parent == parent\n v = Tempo::Views::ViewRecords::Composite.new r, depth: depth\n view << v\n if not r.children.empty?\n child_opts = options.clone\n child_opts[:depth] = depth + 1\n child_opts[:parent] = r.id\n child_array = parse_tree_to_composite_record records, child_opts\n view.push *child_array\n end\n end\n end\n\n view\nend", "def _children\n @children\n end", "def render_api_issue_children(issue, api)\n return if issue.leaf?\n api.array :children do\n issue.children.each do |child|\n api.issue(:id => child.id) do\n api.tracker(:id => child.tracker_id, :name => child.tracker.name) unless child.tracker.nil?\n api.subject child.subject\n render_api_issue_children(child, api)\n end\n end\n end\n end", "def children\n children = []\n board.rows.each_index do |row|\n board.rows[row].each_index do |col|\n pos = [row, col]\n if board[pos].nil?\n new_board = board.dup\n new_board[pos] = next_mover_mark\n children << self.class.new(new_board, switch_mark(next_mover_mark), pos)\n end\n end\n end\n children\n end", "def crumb_parents\n []\n end", "def render_facet_hierarchy_item(field_name, data, key)\n item = data[:_]\n subset = data.reject { |k,v| ! k.is_a?(String) }\n \n li_class = subset.empty? ? 'h-leaf' : 'h-node'\n li = ul = ''\n \n if item.nil?\n li = key\n elsif facet_in_params?(field_name, item.qvalue)\n li = render_selected_qfacet_value(field_name, item)\n else\n li = render_qfacet_value(field_name, item)\n end\n \n unless subset.empty?\n subul = subset.keys.sort.collect do |subkey| \n render_facet_hierarchy_item(field_name, subset[subkey], subkey) \n end.join('')\n ul = \"<ul>#{subul}</ul>\".html_safe\n end\n \n %{<li class=\"#{li_class}\">#{li.html_safe}#{ul.html_safe}</li>}.html_safe\nend", "def children\n _children\n end", "def self_and_parents\n p = [self]\n parent = self.parent \n \n while parent do\n p << parent\n parent = parent.parent \n end\n p\n end", "def recurse_nodes(parent_names, source_tmp_geo_area)\n if parent_names.count > 1\n parents = parent_names.dup # Tricky! \n name = parents.shift\n puts \"building internal node: #{name} : #{parents} \"\n add_item(\n name: name,\n parent_names: parents,\n source_table: source_tmp_geo_area.source_table,\n source_table_gid: source_tmp_geo_area.source_table_gid,\n is_internal_node: true\n )\n recurse_nodes(parents, source_tmp_geo_area)\n end\n end", "def node_tree(nodes, &block)\n \n nodes = nodes.dup\n printed_nodes = []\n \n result = \"<ul>\"\n \n # top level nodes first, then others\n for node in nodes\n next if node.instance_of?(Center) || node.instance_of?(Team)\n next unless node.parent == nil\n printed_nodes << node\n result += \"<li>\"\n\n if block_given?\n result += yield node\n else\n result += node.title\n end\n\n children = node.children.dup\n children.delete_if { |r| not nodes.include?(r) }\n if not children.empty?\n result += node_tree_help(children, nodes, printed_nodes, &block)\n end\n \n result += \"</li>\"\n end\n \n # TODO: Add depth counting here to get a minimum of trees\n for node in nodes\n next if printed_nodes.include? node\n printed_nodes << node\n \n result += \"<li>\"\n\n if block_given?\n result += yield node\n else\n result += node.title\n end\n\n children = node.children #.dup\n children.delete_if { |r| not nodes.include?(r) }\n\n if not children.empty?\n result += node_tree_help(children, nodes, printed_nodes, &block)\n end\n \n result += \"</li>\"\n end\n\n result += '</ul>'\n\n return result\n end", "def indented_child_options type, parent, depth=0, selected_id\n\n result = []\n unless parent.children.empty?\n parent.children.sort { |a, b| a.title.downcase <=> b.title.downcase }.each do |child|\n child_path = send(\"#{type.model_name.underscore}s_path\", :uri=>child.term_uri, :label=> child.title)\n assay_stat = child.assays.size == 0 ? \"\" : \"<span style='color: #666666;'>(#{child.assays.count} assays)</span>\".html_safe\n ontology_term_li = link_to(child.title, child_path).html_safe\n user_defined_term_li = link_to(child.title, child_path, {:style => \"color:green;font-style:italic\"}) + \"*\" + \" \" +\n (child.can_edit? ? link_to(image(\"edit\"), edit_polymorphic_path(child), {:style => \"vertical-align:middle\"}) : \"\") + \" \" +\n (child.can_destroy? ? (child.assays.count == 0 && child.children.empty? ? link_to(image(\"destroy\"), child, :confirm =>\n \"Are you sure you want to remove this #{child.class.name}? This cannot be undone.\",\n :method => :delete, :style => \"vertical-align:middle\") : \"\") : \"\").html_safe\n child_link = (child.respond_to?(:is_user_defined) && child.is_user_defined) ? user_defined_term_li : ontology_term_li\n\n result << (\"<li style=\\\"margin-left:#{12*depth}px;#{child.id == selected_id ? \"background-color: lightblue;\" : \"\"}\\\">\"+ (depth>0 ? \"└ \" : \" \") + child_link + assay_stat +\n \"</li>\")\n result = result + indented_child_options(type, child, depth+1,selected_id) if child.has_children?\n end\n end\n return result\n end", "def children\n TkWinfo.children(content)\n end", "def resources &block\n rc = components.collect do |resource_name, component|\n [resource_name.to_s.singularize.to_sym, component[:resource], component.slice(:title, :exclude, :namespace)]\n end\n last = rc.slice!(-1)\n parents = rc.inject(Hash.new){|p, v| p.merge!(v[0]=>v[1])}\n yield(parents, last[0], last[2])\n end", "def rebuild_hierarchies!\n query(\"MATCH (:Page)-[parent:parent]->(:Page) DELETE parent\")\n query(\"MATCH (:Page)-[in_clade:in_clade]->(:Page) DELETE in_clade\")\n missing = {}\n related = {}\n # HACK HACK HACK HACK: We want to use Resource.native here, NOT ITIS!\n itis = Resource.where(name: \"Integrated Taxonomic Information System (ITIS)\").first\n raise \" I tried to use ITIS as the native node for the relationships, but it wasn't there.\" unless itis\n Node.where([\"resource_id = ? AND parent_id IS NOT NULL AND page_id IS NOT NULL\",\n itis.id]).\n includes(:parent).\n find_each do |node|\n page_id = node.page_id\n parent_id = node.parent.page_id\n next if missing.has_key?(page_id) || missing.has_key?(parent_id)\n page = page_exists?(page_id)\n page = page.first if page\n if page\n relate(\"in_clade\", page, page)\n end\n next if related.has_key?(page_id)\n parent = page_exists?(parent_id)\n parent = parent.first if parent\n if page && parent\n if page_id == parent_id\n puts \"** OOPS! Attempted to add #{page_id} as a parent of itself!\"\n else\n relate(\"parent\", page, parent)\n relate(\"in_clade\", page, parent)\n related[page_id] = parent_id\n # puts(\"#{page_id}-[:parent]->#{parent_id}\")\n end\n else\n missing[page_id] = true unless page\n missing[parent_id] = true unless parent\n end\n end\n related.each do |page, parent|\n puts(\"#{page}-[:in_clade*]->#{parent}\")\n end\n puts \"Missing pages in TraitBank: #{missing.keys.sort.join(\", \")}\"\n end", "def children\n properties \n end", "def children\n steps\n end", "def print_all_children( window_handle, findTextOnly = false )\n\t\t\t@findTextOnly = findTextOnly\n\t\t\t\n\t\t\t# Process the parent window.\n\t\t\tif (@allChildren[window_handle] == nil)\n\t\t\t\tprintControlInfo( 0, window_handle )\n\t\t\t\t@allChildren[window_handle] = 1\n\t\t\tend\n\t\n\t\t\t# Enumerate the control's children.\n\t\t\tif (@childProcCalled[window_handle] == nil)\n\t\t\t\t# Enumeration has not been called on this control, so call it.\n\t\t\t\t@@EnumChildWindows.call(window_handle, @PrintChildInfoProc,\n\t\t\t\t\twindow_handle)\n\t\t\t\t@childProcCalled[window_handle] = 1\n\t\t\t\t\n\t\t\t\t# While the array of children to call is not empty, recurse\n\t\t\t\t# children.\n\t\t\t\twhile (@childrenToCall.first != nil)\n\t\t\t\t\thandle = @childrenToCall.shift\n\t\t\t\t\tprint_all_children( handle )\n\t\t\t\tend\n\t\t\tend\n\t\tend" ]
[ "0.6136771", "0.60764915", "0.6071726", "0.6028393", "0.6013297", "0.6013297", "0.6013297", "0.6013297", "0.6013297", "0.6013297", "0.6013297", "0.6013297", "0.6013297", "0.6013297", "0.6013297", "0.6013297", "0.59695125", "0.5958582", "0.5846982", "0.5840842", "0.57517064", "0.5736912", "0.5723691", "0.5705973", "0.56846184", "0.5643147", "0.5581754", "0.55540204", "0.55391115", "0.55362755", "0.5526857", "0.5519395", "0.5512053", "0.55108386", "0.5482388", "0.5476032", "0.54708266", "0.5444777", "0.54447097", "0.54378146", "0.5415086", "0.54145616", "0.54095626", "0.5404138", "0.53973526", "0.53973526", "0.53804314", "0.5379656", "0.536871", "0.5367286", "0.53576815", "0.5348388", "0.5345756", "0.53425384", "0.5338172", "0.5326517", "0.5295516", "0.5290713", "0.52778023", "0.52755", "0.5268569", "0.52638465", "0.5261749", "0.5258715", "0.5255579", "0.5244297", "0.5242947", "0.52412564", "0.52401936", "0.5233322", "0.5225801", "0.5224193", "0.52216786", "0.5220381", "0.521376", "0.5212886", "0.5212886", "0.5212886", "0.5212886", "0.52065873", "0.5198088", "0.5189311", "0.51867884", "0.5179304", "0.517834", "0.5174367", "0.51672983", "0.5160154", "0.51559633", "0.51499784", "0.5145068", "0.5144579", "0.5143305", "0.51390415", "0.51336604", "0.51335305", "0.5126347", "0.5122134", "0.5118729", "0.5114268", "0.5110812" ]
0.0
-1
Recursive function for display components finds parents and then children and organizes them in this way to display Used to disable parent in list so you cannot remove or add it to itself
def checkbox_accord2(items_hash, show_properties=false, depth=0) if(depth == 0 && items_hash.keys.empty?) return "No Items Available" end if(@items_to_select.nil?) @items_to_select = [] end if(items_hash.keys.empty?) return "" end pt = "<ul " if(depth == 0) pt += "id=\"id#{Time.now.usec}\" class=\"accordion\"" end pt+=">" expand = true for item in items_hash.keys pt += "<li" if(depth == 0 && expand && (!item.is_a?(Property) || !item.valuefields.empty?)) pt += " class=\"expand\"" expand = false end pt +=">" #Checks what class the item is if(item.is_a?(Category)) pt += "<div class=\"inline\">&nbsp</div>#{check_box_tag "parent_ids[]", item.id, @items_to_select.include?(item), :id=>"a#{item.id}"}" + "<label for=\"a#{item.id}\">#{item.name}</label>" elsif(item.is_a?(Product)) pt += "<div class=\"inline\">&nbsp</div>#{check_box_tag "product_ids[]", item.id, @items_to_select.include?(item), :id=>"p#{item.id}"}" + "<label for=\"p#{item.id}\">#{item.name}</label>" elsif(item.is_a?(Component)) #Checks to see if the current component is the parent so you cannot select it if(item.eql?(@parent)) pt += "<div class=\"inline\">&nbsp</div>#{check_box_tag "component_parent_ids[]", item.id, @items_to_select.include?(item), :id=>"c#{item.id}", :disabled => true}" + "<label for=\"c#{item.id}\">#{item.name}</label>" else pt += "<div class=\"inline\">&nbsp</div>#{check_box_tag "component_parent_ids[]", item.id, @items_to_select.include?(item), :id=>"c#{item.id}"}" + "<label for=\"c#{item.id}\">#{item.name}</label>" end elsif(item.is_a?(Valuefield)) pt += "<div class=\"inline\">&nbsp</div>#{check_box_tag "valuefield_ids[]", item.id, @items_to_select.include?(item), :id=>"v#{item.id}"}" + "<label for=\"v#{item.id}\">#{item.name}</label>" elsif(item.is_a?(Group)) #not currently used pt += "<div class=\"inline\">&nbsp</div>#{check_box_tag "group_ids[]", item.id, @items_to_select.include?(item), :id=>"g#{item.id}"}" + "<label for=\"g#{item.id}\">#{item.name}</label>" elsif(item.is_a?(Property)) if(show_properties) pt += "<div class=\"inline\">&nbsp</div>#{check_box_tag "#{parent}[property_id]", item.id, @items_to_select.include?(item), :id=>"o#{item.id}"}" + "<label for=\"o#{item.id}\">#{item.name}</label>" elsif(!item.valuefields.empty?) pt += "<div class=\"inline\">&nbsp</div><b>#{item.name}</b>" end end pt += checkbox_accord2(items_hash[item], show_properties, depth+1) pt += "</li>" end pt += "</ul>" return pt end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def layout_children\n \n end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children() []; end", "def parents; end", "def child_components()\n @child_components\n end", "def display_parent_collections(document)\n\n text=\"\"\n parents = document.display_sets\n if parents.kind_of?(Array) and parents.count > 0\n unless parents.count == 1 && parents.first == \"info:fedora/hull:rootDisplaySet\"\n text = <<-EOS\n <div id=\"collections\" >\n <fieldset id=\"collection-fields\">\n <legend>#{pluralize(parents.count,\"In Collection\")[2..-1]}</legend>\n <div id=\"collections-list\">\n <dl>\n EOS\n parents.each { |id| \n pid=id.partition(\"/\")[2]\n text << <<-EOS\n <dt>\n EOS\n text << link_to(DisplaySet.name_of_set(pid), resource_path(pid)) \n text << <<-EOS\n </dt>\n EOS\n }\n text << <<-EOS\n </dl>\n </div>\n </fieldset>\n </div>\n EOS\n end\n end \n \n text.html_safe\n end", "def children; []; end", "def hierarchy\n p = self\n h = []\n while(p.parent != nil)\n h = [p] + h\n p = p.parent\n end\n h = [p] + h\n \n h\n end", "def render_tree(elements, symbols, parents = [])\n i = 0\n x = elements.map do |li|\n last = elements.length == i+1\n\n current = indentation(parents, last, symbols) + li[:value]\n\n children = \"\"\n if li[:children].length > 0\n children = \"\\n\" + render_tree(li[:children], symbols, parents + [last])\n end\n\n i += 1\n current + children\n end\n\n x.join(\"\\n\")\n end", "def walk(elements, max_depth, *args)\n output = ''\n\n # invalid parameter or nothing to walk\n return output if max_depth < -1 || elements.blank?\n\n parent_field = @db_fields[:parent]\n\n # flat display\n if -1 == max_depth\n empty_array = {}\n elements.each do |e|\n display_element(e, empty_array, 1, 0, args, output)\n end\n return output\n end\n\n # Need to display in hierarchical order.\n # Separate elements into two buckets: top level and children elements.\n # Children_elements is two dimensional array, eg.\n # Children_elements[10][] contains all sub-elements whose parent is 10.\n top_level_elements = []\n children_elements = {}\n elements.each do |e|\n if e.send(parent_field).blank? || e.send(parent_field) == 0\n top_level_elements << e\n else\n children_elements[e.send(parent_field)] ||= []\n children_elements[e.send(parent_field)] << e\n end\n end\n\n # When none of the elements is top level.\n # Assume the first one must be root of the sub elements.\n if top_level_elements.blank?\n root = elements.first\n\n top_level_elements = []\n children_elements = {}\n elements.each do |e|\n if root.send(parent_field) == e.send(parent_field)\n top_level_elements << e\n else\n children_elements[e.send(parent_field).to_i] ||= []\n children_elements[e.send(parent_field).to_i] << e\n end\n end\n end\n\n top_level_elements.each do |e|\n display_element(e, children_elements, max_depth, 0, args, output)\n end\n\n # If we are displaying all levels, and remaining children_elements is not empty,\n # then we got orphans, which should be displayed regardless.\n if max_depth == 0 && !children_elements.empty?\n empty_array = {}\n children_elements.values.each do |orphans|\n orphans.each do |op|\n display_element(op, empty_array, 1, 0, args, output)\n end\n end\n end\n output\n end", "def apply_children\n \n end", "def show_in_child_list?\n\t\t\ttrue\n\t\tend", "def navigation_children\n sorted_children\n end", "def do_chain_layout(sugar) \n seen_chains = []\n sugar.residue_composition.select { |r| ['GlcNAc','Gal'].include?(r.name(:ic)) }.each { |chain_start|\n debug(\"CHAIN:Start residue name is #{chain_start.name(:ic)}\")\n next if seen_chains.include?(chain_start)\n debug(\"CHAIN:Not seen before\")\n child_chains = sugar.get_chains_from_residue(chain_start).sort_by { |chain| chain.size }\n debug(\"CHAIN:In total there are #{child_chains.size} chains from this position\")\n child_chains.each { |child_chain|\n debug(\"CHAIN:A chain size is #{child_chain.size}\")\n next unless child_chain.size > 1\n debug(\"CHAIN: Doing a chain layout\")\n chain_desc = child_chain.collect {|r| r.name(:ic)+\"#{r.anomer},#{r.paired_residue_position}\"}.join(',')\n debug(\"CHAIN:Chain is #{chain_desc}\")\n\n chain_end = child_chain[-1]\n \n child_chain.reject! { |c| seen_chains.include?(c) }\n\n if child_chain.size > 0\n layout_chain(child_chain)\n seen_chains += child_chain\n end\n debug(\"CHAIN:Trying to arrange children for #{chain_end.name(:ic)}\")\n \n layout_chain_terminals(chain_end)\n\n seen_chains += (sugar.residue_composition(chain_end))[1..-1]\n }\n }\n return seen_chains\n # All chains should be starting at 0,0 and be laid out as straight (or shifted up for 6) lines\n end", "def list_children(taxons_collection)\n taxons_collection.sort_by {|p| p.hierarchy}\n html_var = \"\"\n taxons_collection.each do |t|\n if not t.children.empty?\n html_var << \"<li><i class='icon-plus'> </i>\" << link_to(t.name, t) << \"<ul>\" << list_children(t.children) << \"</ul>\"\n else\n html_var << \"<li><i class='icon-white' style='visibility: hidden;'> </i>\" << link_to(t.name, t)\n end\n html_var << \"</li>\\n\"\n end\n return html_var.html_safe\nend", "def parent_lists\n self.parents(List)\n end", "def parent_sections\n self.parents(ListSection)\n end", "def indented_child_options type, parent, depth=0, selected_id\n\n result = []\n unless parent.children.empty?\n parent.children.sort { |a, b| a.title.downcase <=> b.title.downcase }.each do |child|\n child_path = send(\"#{type.model_name.underscore}s_path\", :uri=>child.term_uri, :label=> child.title)\n assay_stat = child.assays.size == 0 ? \"\" : \"<span style='color: #666666;'>(#{child.assays.count} assays)</span>\".html_safe\n ontology_term_li = link_to(child.title, child_path).html_safe\n user_defined_term_li = link_to(child.title, child_path, {:style => \"color:green;font-style:italic\"}) + \"*\" + \" \" +\n (child.can_edit? ? link_to(image(\"edit\"), edit_polymorphic_path(child), {:style => \"vertical-align:middle\"}) : \"\") + \" \" +\n (child.can_destroy? ? (child.assays.count == 0 && child.children.empty? ? link_to(image(\"destroy\"), child, :confirm =>\n \"Are you sure you want to remove this #{child.class.name}? This cannot be undone.\",\n :method => :delete, :style => \"vertical-align:middle\") : \"\") : \"\").html_safe\n child_link = (child.respond_to?(:is_user_defined) && child.is_user_defined) ? user_defined_term_li : ontology_term_li\n\n result << (\"<li style=\\\"margin-left:#{12*depth}px;#{child.id == selected_id ? \"background-color: lightblue;\" : \"\"}\\\">\"+ (depth>0 ? \"└ \" : \" \") + child_link + assay_stat +\n \"</li>\")\n result = result + indented_child_options(type, child, depth+1,selected_id) if child.has_children?\n end\n end\n return result\n end", "def rearrange_children!\n @rearrange_children = true\n end", "def render\n return merge_with_parent\n end", "def children=(_arg0); end", "def children=(_arg0); end", "def crumb_parents\n []\n end", "def children\n []\n end", "def grand_children\n []\n end", "def render_recursively(output_path, title, obj, parent = '')\n renderer.render(output_path, parent, title, obj.get_thumbs, obj.filter)\n\n # For Doc object, returns a list of makes. For the NodeSet object, returns a list of models.\n obj.filter.each do |key|\n # Only recurse if not the same as the parent to avoid an infinite loop\n if title != key\n nodes = obj.search('work:contains(\"' + key + '\")')\n render_recursively(output_path, key, nodes, title)\n end\n end\n end", "def display_parent_child_test_cases\n \n end", "def children\n if self.rep_parent.nil?\n return super\n else\n the_children = Array.new\n self.rep_parent.children.each do |child|\n if child.is_a?(Repeatable)\n \n child.repititions.\n where(:show_date => self.show_date).each do |r|\n the_children << r\n end\n elsif child.show_date == self.show_date\n the_children << child\n end\n end\n return the_children\n end\n end", "def children\n []\n end", "def lineage\n\t\tparents = []\n\t\tlist = self\n\t\twhile list.parentlist_id\n\t\t\tlist = List.find(list.parentlist_id)\n\t\t\tparents << list\n\t\tend\n\t\t\n\t\tif parents.length > 0\n \t\tparents.reverse!.slice(1..-1)\n else\n parents\n end\n end", "def children()\n #Ressource.filter(:parent_id => self.id, :parent_service_id => self.service_id).all\n end", "def allowed_children_comps\n []\n end", "def users4order\n [self] + children.select { |child| child.children.count == 0 }\n end", "def find_all_parents\n end", "def render_children\n children = ''\n\n list_item.children.each do |child|\n children += self.class.render(child, opts)\n end\n\n children\n end", "def allowed_children; end", "def display_tree() \n list = []\n yield @tree.value\n left_child = @tree.left_child\n right_child = @tree.right_child\n\n list << left_child if left_child != nil\n list << right_child if right_child != nil\n\n loop do\n break if list.empty?\n node = list.shift\n yield node.value\n list << node.left_child if node.left_child != nil\n list << node.right_child if node.right_child != nil\n end\n end", "def _parent; end", "def show_tree\n\tend", "def parent_list\n parents = []\n if @attributes.key?('parentCollectionList') then\n parents = DSpaceObj.convert_value(nil, @attributes['parentCollectionList'])\n end\n if @attributes['parentCommunity'] then\n com = DSpaceObj.convert_value(nil, @attributes['parentCommunity'])\n parents << com if com\n end\n if @attributes.key?('parentCommunityList') then\n list = DSpaceObj.convert_value(nil, @attributes['parentCommunityList'])\n parents += list if list\n end\n parents\n end", "def populate_inheritance_heirarchy\n apps_and_templates = appTemplates + templates\n apps_and_templates.each do |temp| \n temp.attributes[:parent].to_s != '' ? app_or_temp = temp.attributes[:parent] :\n temp.attributes[:template].to_s != '' ? app_or_temp = temp.attributes[:template]:\n next\n next if app_or_temp == \"what the fuck?\"\n # if temp.attributes[:parent].is_a? String or temp.attributes[:template].is_a? String\n if not app_or_temp.empty?\n parent_template = self.templates.find { |template| template.name.downcase == app_or_temp.downcase }\n temp.child_of << parent_template\n parent_template.parent_of << temp\n end\n end \n end", "def ccs_in_ddi_order\n output = []\n harvest = lambda do |parent|\n output.append parent\n if parent.class.method_defined? :children\n parent.children.each(&harvest)\n end\n end\n harvest.call self.top_sequence\n output\n end", "def children\n self.class.children(self) \n end", "def generate_class_tree_level(parent='')\n $all.map { |klass|\n if parent == klass['parentname']\n [\n klass['name'],\n \"classes/#{klass['fullname']}.html\", # klass.path, \n '',\n generate_class_tree_level(klass['fullname'])\n ]\n else\n nil\n end\n }.compact\nend", "def parentage\n get_parents unless @already_fetched_parents\n @already_fetched_parents = true\n super\n end", "def get_children\n \t@children\n end", "def collect_tree_up_from (foliage,\n parents,\n except_homepage,\n except_page,\n except_with_children)\n ancestry_string = parents.collect {|x| x.id.to_s }.join(\"/\")\n name_prefix = parents.collect {|x| x.title }.join(\" / \")\n name_prefix += \" / \" if name_prefix.present?\n\n our_mans_indexes = []\n foliage.each_index do |indx|\n if foliage[indx].ancestry.to_s == ancestry_string\n our_mans_indexes << indx\n end\n end\n\n leaves = []\n\n our_mans_indexes.reverse!\n our_mans_indexes.each do |indx|\n leaves << foliage.delete_at(indx)\n end\n\n leaves.sort! {|a,b| (a.prior == b.prior) ? a.id <=> b.id : a.prior <=> b.prior }\n result = []\n\n leaves.each do |leaf|\n do_writing = true\n if (except_page && leaf == except_page) || (except_homepage && leaf.home?)\n do_writing = false\n end\n result << [ name_prefix + leaf.title, leaf.id ] if do_writing\n unless do_writing == false && except_with_children\n result += collect_tree_up_from foliage,\n (parents + [ leaf ]),\n except_homepage,\n except_page,\n except_with_children\n end\n end\n\n result\n 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 parent_list\n self.parent_lists[0]\n end", "def children\n []\n end", "def children\n []\n end", "def children\n []\n end", "def get_hierarchy(entity_class)\n content_tag(:ul, \n entity_class.find(:all, :conditions => 'parent_id IS NULL or parent_id = 0', :order => 'root_id, lft').collect {|root|\n get_subtree(root) }.join)\n end", "def self_and_parents\n p = [self]\n parent = self.parent \n \n while parent do\n p << parent\n parent = parent.parent \n end\n p\n end", "def render_children options = {}\n return if children.empty?\n\n flattened_children.map{ |child| render_child(child, options) }.join\n end", "def children_navigation(document)\n content_tag(\n :div,\n '',\n class: \"al-contents child-components children-count-#{document.number_of_children}\",\n data: {\n collapse: I18n.t('arclight.views.show.collapse'),\n expand: I18n.t('arclight.views.show.expand'),\n arclight: {\n level: document.component_level.to_i + 1,\n path: search_catalog_path(hierarchy_context: 'component'),\n name: document.collection_name,\n view: 'child_components',\n parent: document.reference,\n directparent: document.reference,\n childrencount: document.number_of_children,\n originalDocument: document.id,\n originalParents: [document.reference],\n eadid: normalize_id(document.eadid),\n per_page: '100'\n }\n }\n )\n end", "def children\n []\n end", "def children\n []\n end", "def recurse_nodes(parent_names, source_tmp_geo_area)\n if parent_names.count > 1\n parents = parent_names.dup # Tricky! \n name = parents.shift\n puts \"building internal node: #{name} : #{parents} \"\n add_item(\n name: name,\n parent_names: parents,\n source_table: source_tmp_geo_area.source_table,\n source_table_gid: source_tmp_geo_area.source_table_gid,\n is_internal_node: true\n )\n recurse_nodes(parents, source_tmp_geo_area)\n end\n end", "def children\n child_check\n super\n end", "def parent_shape_containers\n if @parent_shape_containers.nil?\n if parent.is_a?(Drawable)\n @parent_shape_containers = []\n elsif !parent.container?\n @parent_shape_containers = parent.parent_shape_containers\n else\n @parent_shape_containers = parent.parent_shape_containers + [parent]\n end\n end\n @parent_shape_containers\n end", "def roots\n acts_as_nested_set_options[:class].find(:all, :conditions => \"(#{acts_as_nested_set_options[:parent_column]} IS NULL OR #{acts_as_nested_set_options[:parent_column]} = 0)\", :order => \"#{acts_as_nested_set_options[:left_column]}\")\n end", "def parent_adopts_children\n if parent(true)\n self.class.transaction do\n children(true).each{|child| parent.children << child}\n end\n else\n orphan_children\n end\n end", "def setup_child_parent_links\n # Clear all links\n @items.each do |item|\n item.parent = nil\n item.children = []\n end\n\n @items.each do |item|\n # Get parent\n parent_identifier = item.identifier.sub(/[^\\/]+\\/$/, '')\n parent = @items.find { |p| p.identifier == parent_identifier }\n next if parent.nil? or item.identifier == '/'\n\n # Link\n item.parent = parent\n parent.children << item\n end\n end", "def setup_child_parent_links\n # Clear all links\n @items.each do |item|\n item.parent = nil\n item.children = []\n end\n\n @items.each do |item|\n # Get parent\n parent_identifier = item.identifier.sub(/[^\\/]+\\/$/, '')\n parent = @items.find { |p| p.identifier == parent_identifier }\n next if parent.nil? or item.identifier == '/'\n\n # Link\n item.parent = parent\n parent.children << item\n end\n end", "def print_parent_categories_table(component)\n s=\"<table class=\\\"tight_table\\\">\"\n s+=\"<tr>\"\n s+=\"<th align=\\\"left\\\">Categories</th>\"\n s+=\" </tr>\"\n\n if(!component.categories.empty?)\n for cat in component.categories.sort {|x,y| x.name <=> y.name }\n s+=\" <tr><td>#{link_to cat.name, cat, :target => 'blank'}</td></tr>\"\n end\n else\n s+=\" <tr><td>No Categories</td></tr>\"\n end\n\n s+=\"</table>\"\n\n return s\n end", "def parents\n @parents ||= parent ? parent.parents + Array(parent) : []\n end", "def children_for(list)\n list.map do |key, value|\n value = Array(value).flatten\n if value.any?\n after = \" \" * string.inspect.length + \" \"\n description = Hansi.render(THEME[:orange], key.to_s)\n Tree.new(description, *value, after: after, prefix_color: PREFIX_COLOR)\n end\n end\n end", "def find_pages_for_parents_list\n @pages_for_parents_list = []\n Page.find_all_by_parent_id(nil, :order => \"position ASC\").each do |page|\n @pages_for_parents_list << page\n @pages_for_parents_list += add_pages_branch_to_parents_list(page)\n end\n @pages_for_parents_list.flatten.compact!\n\n # We need to remove all references to the current page or any of its decendants or we get a nightmare.\n @pages_for_parents_list.reject! do |page|\n page.id == @page.id or @page.descendants.include?(page)\n end unless @page.nil? or @page.new_record?\n end", "def _children\n @children\n end", "def _children\n @children\n end", "def _children\n @children\n end", "def _children\n @children\n end", "def ascendants(result = nil, depth = 0)\n \n if (result.nil?)\n result = Hash.new\n end\n \n parents.each do |par|\n node = Array.new\n node[0] = par\n par_spice = par.spice\n if (!par_spice.nil? && par_spice.length > 0)\n # TBD: I know there is a Ruby way to copy an array but can't look it up on the plane - just copy myself for now\n spouse_list = Array.new\n par_spice.each do |s|\n spouse_list << s\n end\n node[1] = spouse_list\n end\n result[node] = depth\n par.ascendants(result, depth + 1)\n end \n \n return result\n \n end", "def parents\n respond_to?(:collectionHasParent) ? collectionHasParent : []\n end", "def force_division!\n children.each {|c| c.force_division!}\n end", "def descendents\n\n\t\t #children.preload(:parent).each do |child| child.descendents end\n\t\t children.each do |child|\n\t [child] + child.descendents\n\t end\n end", "def parents\n if parent.nil?\n [self]\n else\n parent.parents + [self]\n end\n end", "def _children\n @children\n end", "def layout()\n layout_children()\n end", "def as_nestable_list(roots, &block)\n content_tag(:div, class: 'dd') do\n nestable_list_recursive(roots, block)\n end\n end", "def preserve_children?\n false\n end", "def child_tree\n child_check\n child_tree = self.clone\n child_tree.removeFromParent!\n child_tree\n end", "def children\n self.class.find(:all, :conditions => \"#{acts_as_nested_set_options[:scope]} AND #{acts_as_nested_set_options[:parent_column]} = #{self.id}\", :order => acts_as_nested_set_options[:left_column])\n end", "def generate_structure_containing_lower_level_components(root_component, series_num)\n @flattened_component_tree_structure = []\n generate_children_components_info(root_component)\n end", "def rearrange_children\n if rearrange_children?\n self.disable_timestamp_callback()\n self.children.each do |child|\n child.update_path!\n child.save\n # child.reload # might not need to reload?\n end\n self.enable_timestamp_callback()\n end\n @rearrange_children = false\n true\n end", "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 render_entry_children(context, page, depth)\n output = %{}\n\n children = page.children_with_minimal_attributes(@options[:add_attributes]).reject { |c| !include_page?(c) }\n if children.present?\n output = %{<ul id=\"#{@options[:id]}-#{page.slug.to_s.dasherize}\" class=\"#{bootstrap? ? 'dropdown-menu' : ''}\">}\n children.each do |c, page|\n css = []\n css << 'first' if children.first == c\n css << 'last' if children.last == c\n\n output << render_entry_link(context, c, css.join(' '), depth)\n end\n output << %{</ul>}\n end\n\n output\n end", "def _children\n @children\n end", "def cobrand_render_or_parent_only(opts)\r\n cobrand_render opts.merge({ :vp_parent_only => true })\r\n end" ]
[ "0.6071768", "0.60606915", "0.60606915", "0.60606915", "0.60606915", "0.60606915", "0.60606915", "0.60606915", "0.60606915", "0.60606915", "0.60606915", "0.60606915", "0.60606915", "0.6047931", "0.60171854", "0.60146433", "0.5884541", "0.58659977", "0.5821498", "0.5749071", "0.5743927", "0.5699342", "0.5674284", "0.5671783", "0.56571984", "0.56545305", "0.5648667", "0.564519", "0.5645144", "0.5638553", "0.5563709", "0.55478215", "0.55478215", "0.5546343", "0.54964566", "0.54944134", "0.54873973", "0.54704624", "0.5462193", "0.5459311", "0.5453656", "0.5443885", "0.5441392", "0.54369193", "0.5435588", "0.54250604", "0.54224545", "0.5414556", "0.5409831", "0.54007196", "0.5395088", "0.5379634", "0.53764236", "0.5366839", "0.5356617", "0.53475213", "0.53393096", "0.5332539", "0.5331469", "0.5321932", "0.5318095", "0.5318095", "0.5318095", "0.5306927", "0.5304161", "0.5303371", "0.5298607", "0.52963346", "0.52963346", "0.5293316", "0.52920216", "0.5287362", "0.52865684", "0.52771115", "0.52756", "0.52756", "0.5271198", "0.52689874", "0.52508473", "0.5240055", "0.52394754", "0.52394754", "0.52394754", "0.52394754", "0.523232", "0.5222807", "0.5222797", "0.5221786", "0.5220867", "0.5217531", "0.52163506", "0.5206429", "0.52040243", "0.51914036", "0.51866114", "0.5179513", "0.5174875", "0.51690066", "0.5164449", "0.51627195", "0.51545644" ]
0.0
-1
Function to build a radio button list
def radio_list(items) rl = "<ul>" if(!items.empty?) for item in items if(item.is_a?(Category)) #not currently used rl += "#{radio_button_tag "category_ids[]", item.id, @items_to_select.include?(item), :id=>"a#{item.id}"}" + "<label for=\"a#{item.id}\">#{item.name}</label><br />" elsif(item.is_a?(Product)) rl += "#{radio_button_tag "product_ids[]", item.id, @items_to_select.include?(item), :id=>"p#{item.id}"}" + "<label for=\"p#{item.id}\">#{item.name}</label><br />" #{item.name}</label>" elsif(item.is_a?(Component)) rl += "#{radio_button_tag "component_ids[]", item.id, @items_to_select.include?(item), :id=>"c#{item.id}"}" + "<label for=\"c#{item.id}\">#{item.name}</label><br />" elsif(item.is_a?(Valuefield)) rl += "#{radio_button_tag "valuefield_ids[]", item.id, @items_to_select.include?(item), :id=>"v#{item.id}"}" + "<label for=\"v#{item.id}\">#{item.name}</label><br />" elsif(item.is_a?(Group)) #not currently used rl += "#{radio_button_tag "group_ids[]", item.id, @items_to_select.include?(item), :id=>"g#{item.id}"}" + "<label for=\"g#{item.id}\">#{item.name}</label><br />" elsif(item.is_a?(Property)) rl += "#{radio_button_tag "property_ids[]", item.id, @items_to_select.include?(item), :id=>"o#{item.id}"}" + "<label for=\"o#{item.id}\">#{item.name}</label><br />" end end rl += "</ul>" end return rl end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def radiobuttons; end", "def collection_radio_buttons(method, collection, value_method, text_method, options = T.unsafe(nil), html_options = T.unsafe(nil), &block); end", "def radio_buttons(method, choices, options = {})\n choices.map!{ |i| i.is_a?(Array) ? i : [i] }\n build_shell(method, options, \"radio_buttons_field\") do\n choices.map{ |c| radio_button method, c[1], :label => c[0],\n :label_for => [object_name, method, c[1].to_s.downcase].join('_') }\n end\n end", "def radio_button_choice_template(l = {})\n <<-END\n #{l[:element]} #{l[:label]}\n\t END\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 radiolist(text, items, height=0, width=0, listheight=0)\n itemlist = ''\n for item in items\n itemlist << \"\\\"#{item[0]}\\\" \\\"#{item[1]}\\\" #{item[2] ? 'on' : 'off'} \"\n\n if @itemhelp\n itemlist << %( \"#{item[3]}\" )\n end\n end\n\n command = %(--radiolist \"#{text}\" #{height.to_i} #{width.to_i} #{listheight.to_i} #{itemlist})\n call_and_capture command\n end", "def radio_buttons(attribute, options)\n caption = (options.delete(:label) || attribute.to_s.titleize).gsub(' ', '&nbsp;') + \":\"\n html = @template.content_tag(:dt, @template.content_tag(:span, caption))\n html << @template.content_tag(:dd) do\n returning choices_html = String.new do\n options[:choices].each do |choice|\n label, value = choice.is_a?(Array) ? [choice.first, choice.last.to_s] : [choice.to_s.titleize, choice.to_s]\n choices_html << radio_button(attribute, value, :class => 'radio') + \n @template.content_tag(\"label\" , label, :for => \"#{object_name}_#{attribute}_#{value}\" ) \n end\n end\n end\n end", "def radio_group(name = \"\", *values)\n if name.kind_of?(Hash)\n values = name[\"VALUES\"]\n name = name[\"NAME\"]\n end\n values.collect{|value|\n if value.kind_of?(String)\n radio_button(name, value) + value\n else\n if value[-1] == true || value[-1] == false\n radio_button(name, value[0], value[-1]) +\n value[-2]\n else\n radio_button(name, value[0]) +\n value[-1]\n end\n end\n }.join\n end", "def createListTypeButtons\n @listTypeGroup = Qt::ButtonGroup.new\n allBtn = KDE::PushButton.new('All') do |w|\n w.objectName = 'switchButton'\n w.checkable = true\n w.autoExclusive = true\n connect(w, SIGNAL(:clicked), self, SLOT(:getList))\n end\n\n highlightsBtn = KDE::PushButton.new('Highlights') do |w|\n w.objectName = 'switchButton'\n w.setMinimumWidth(80)\n w.checkable = true\n w.autoExclusive = true\n connect(w, SIGNAL(:clicked), self, SLOT(:getList))\n end\n\n mostBtn = KDE::PushButton.new('Most Popular') do |w|\n w.objectName = 'switchButton'\n w.checkable = true\n w.autoExclusive = true\n connect(w, SIGNAL(:clicked), self, SLOT(:getList))\n end\n listTypeHLayout = Qt::HBoxLayout.new\n listTypeHLayout.addWidget(allBtn, 54) # 2nd parameter is stretch.\n listTypeHLayout.addWidget(highlightsBtn, 180)\n listTypeHLayout.addWidget(mostBtn,235)\n\n @listTypeGroup.addButton(allBtn, 0)\n @listTypeGroup.addButton(highlightsBtn, 1)\n @listTypeGroup.addButton(mostBtn, 2)\n @listTypeGroup.exclusive = true\n\n listTypeHLayout\n end", "def radiobutton(criteria = T.unsafe(nil)); end", "def fui_radio_buttons(name, attrs = {})\n raise ArgumentError, \"the second argument hash is empty\" if attrs.empty?\n attrs.each_with_object \"\" do |(key, value), tags|\n tags << fui_radio(name, key, value)\n end.html_safe\n end", "def radio_button; end", "def radio_button_tag(name, value, checked = T.unsafe(nil), options = T.unsafe(nil)); end", "def radio_button(method, tag_value, options = T.unsafe(nil)); end", "def radio_button(object_name, method, tag_value, options = T.unsafe(nil)); end", "def makeButton(radio, item)\n if radio\n NSButton.radioButtonWithTitle('', target: self, action: 'buttonAction:')\n else\n NSButton.checkboxWithTitle('', target: self, action: 'buttonAction:')\n end.tap do |button|\n button.lineBreakMode = 5 # NSLineBreakByTruncatingMiddle\n button.state = NSOnState if item.end_with?(\"\\n\") # NSControlStateValueOn\n button.title = item.chomp\n end\n end", "def printChoicesOnScreen()\n $strAnswer = ($arrCorrectAnswers[$intQuestionOnScreen - 1].strip)\n # Based on the number of correct answers, the program decides to use radio or check buttons\n if $strAnswer.length == 1\n $radioChoice = TkVariable.new\n $radioA = Tk::Tile::RadioButton.new($frmChoiceA) {text ''; variable $radioChoice; value 'A'; command {yourAnswer}}\n $radioB = Tk::Tile::RadioButton.new($frmChoiceB) {text ''; variable $radioChoice; value 'B'; command {yourAnswer}}\n $radioC = Tk::Tile::RadioButton.new($frmChoiceC) {text ''; variable $radioChoice; value 'C'; command {yourAnswer}}\n $radioD = Tk::Tile::RadioButton.new($frmChoiceD) {text ''; variable $radioChoice; value 'D'; command {yourAnswer}}\n $radioA.grid :column => 0, :row => 0\n $radioB.grid :column => 0, :row => 0\n $radioC.grid :column => 0, :row => 0\n $radioD.grid :column => 0, :row => 0\n else\n $option_one = TkVariable.new( 0 )\n $checkA = Tk::Tile::CheckButton.new($frmChoiceA) {text \"\"; variable $option_one; onvalue 'A'; command {yourAnswer}}\n $option_two = TkVariable.new( 0 )\n $checkB = Tk::Tile::CheckButton.new($frmChoiceB) {text \"\"; variable $option_two; onvalue 'B'; command {yourAnswer}}\n $option_three = TkVariable.new( 0 )\n $checkC = Tk::Tile::CheckButton.new($frmChoiceC) {text \"\"; variable $option_three; onvalue 'C'; command {yourAnswer}}\n $option_four = TkVariable.new( 0 )\n $checkD = Tk::Tile::CheckButton.new($frmChoiceD) {text \"\"; variable $option_four; onvalue 'D'; command {yourAnswer}}\n $checkA.grid :column => 0, :row => 0\n $checkB.grid :column => 0, :row => 0\n $checkC.grid :column => 0, :row => 0\n $checkD.grid :column => 0, :row => 0\n end\nend", "def radio_button_elements(identifier)\n platform.radio_buttons_for(identifier.clone)\n end", "def radio_buttons_field_template(l = {})\n default_field_template(l)\n end", "def form_template(options = {}) # value = nil, disabled = false, show_all = true)\n\t\tdisabled = options[:disabled] ? true : false\n\t\tanswer = options[:answers]\n\t\tshow_all = options[:show_all] && true || false\n\t\tfast = options[:fast] ? true : false\n\t\tedit = options[:edit] ? true : false\n\t\tonclick = options[:onclick] || \"onclick='toggleRadio(this)'\"\n\t\tno = options[:number].to_s || self.question.number.to_s\n\t\tswitch_off = options[:switch_off]\n\t\tc_id = cell_id(no)\n\n\t\tnewform = []\n\t\tquestion_no = \"Q#{no}\" # self.question.number.to_s\n\t\tchecked = false\n\n\t\tq_items = self.question_items\n\t\t\n\t\tq_items.each_with_index do |item, i|\n\t\t span = inner_span(q_items.size-1 == i)\n\t\t\tswitch_src = (i > 0) ? switch_source(options) : \"\" # set switch on positive answers; 0 is 'no'\n \t\t\n\t\t\tif show_all\n\t\t\t\tchecked = (value == item.value ? 'checked=\"checked\"' : nil)\n\t\t\t\tswitch = ((switch_src.blank? || switch_off) ? nil : \"class='rating #{switch_src}'\")\n\t\t\t\tdisable = (disabled ? \"disabled\" : nil)\n\t\t\t\t# id = \"id='#{c_id.strip}_#{i}'\"\n\t\t\t\tnewform << div_item(\n\t\t\t\t\"<input id='#{c_id}_#{i}' #{onclick} name='#{question_no}[#{c_id}]' type='radio' value='#{item.value}' #{switch} #{disable} #{checked} >\" + # removed />\n\t\t\t\t(item.text.blank? ? \"\" : \"<label class='radiolabel' for='#{c_id}_#{i}'>#{item.text}</label>\"), \"radio #{span} #{(i+1)==q_items.length ? self.validation : \"\"}\".rstrip)\n\t\t\telse # show only answers, not all radiobuttons, disabled\n\t\t\t\tnewform << if value == item.value # show checked radiobutton\n span_item(\"<input id='#{c_id}_#{i}' name='#{question_no}[#{c_id}]' type='radio' value='#{item.value}' checked='checked'\" +\n \t\t\t\t\t(disabled ? \" disabled\" : \"\") + \" />\" +\n \t\t\t\t\t(item.text.empty? ? \"\" : \"<label class='radiolabel' for='#{c_id}_#{i}'>#{item.text}</label>\"), \"radio #{span}\")\n\t\t\t\telse # spacing\n\t\t\t\t\tspan_item(item.text.empty? ? \"&nbsp;&nbsp;&nbsp&nbsp;&nbsp;\" : div_item(item.text, \"radiolabel\"), \"radio #{span}\")\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t# default value, obsoleted. Default value is set when no value is given in create_cells\n\t\tif show_all\n\t\t\tnewform << div_item(\"<input id='#{c_id}_9' name='#{question_no}[#{c_id}]' type='radio' value='9' #{checked ? '' : checked} style='display:none;' >\", # removed />\n\t\t\t\"hidden_radio\")\n\t\tend\n\t\tnewform.join\n\tend", "def radiolist(text, items, height=0, width=0, listheight=0)\n\n tmp = Tempfile.new('tmp')\n\n itemlist = String.new\n\n for item in items\n if item[2]\n item[2] = \"on\"\n else\n item[2] = \"off\"\n end\n itemlist += \"\\\"\" + item[0].to_s + \"\\\" \\\"\" + item[1].to_s +\n \"\\\" \" + item[2] + \" \"\n\n if @itemhelp\n itemlist += \"\\\"\" + item[3].to_s + \"\\\" \"\n end\n end\n\n command = option_string() + \"--radiolist \\\"\" + text.to_s +\n \"\\\" \" + height.to_i.to_s + \" \" + width.to_i.to_s +\n \" \" + listheight.to_i.to_s + \" \" + itemlist + \"2> \" +\n tmp.path\n success = system(command)\n\n if success\n \t selected_string = tmp.readline\n \t\ttmp.close!\n return selected_string\n else\n\t\t\ttmp.close!\n return success\n end\n\n\tend", "def radio_button_selection(form, method, *args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n args.inject(\"\") do |sum, pair|\n sum += form.radio_button(method, pair.first, options) + form.label(method + \"_\" + pair.first.to_s, pair.last) + \" \"\n end \n end", "def quick_radiobutton(how, what)\n QuickRadioButton.new(self, how, what, parent_widget, window_id, :radiobutton)\n end", "def add_radio_button(name, group, label_text, options = {}, &block)\n raise ArgumentError, 'group cannot be blank' if group.to_s.strip == ''\n options = options.dup\n group = group.to_sym\n @stkw_var_list[group] ||= TkVariable.new\n options[:variable] = @stkw_var_list[group]\n options[:value] ||= name.to_s.strip\n if options.delete(:selected)\n @stkw_var_list[group] = options[:value]\n end\n proc = get_command(options.delete(:command), &block)\n add_widget Tk::Tile::Radiobutton, name, label_text, options, &proc\n end", "def radio_button(method, tag_value, options = {})\n label = options.delete(:label)\n @builder.radio_button(method, tag_value, options) +\n \" \" + label_tag_sg(@builder, label, false, method, tag_value)\n end", "def my_all_radio_button(my, myjs_function, all, alljs_function, mode_type)\n return %Q{\n <div class=\"fl mt1\">\n <table cellspacing=\"0\" cellpadding=\"0\">\n <tr>\n <td><input type=\"radio\" name=\"myallradio\" style=\"margin:0 5px 0 2px;display:inline\" value=\"my\" onclick=\"#{myjs_function}\" #{'checked=\"checked\"' if mode_type.eql?('MY') || mode_type.eql?(nil) || mode_type.eql?(\"\")} /></td>\n <td><label class=\"mr8\">#{my}</label></td>\n <td>&nbsp;</td>\n <td><input type=\"radio\" name=\"myallradio\" style=\"margin:0 5px 0 0;\" value=\"all\" onclick=\"#{alljs_function}\" #{'checked=\"checked\"' if mode_type.eql?('ALL') } /></td>\n <td><label>#{all}</label></td>\n </tr>\n </table>\n </div>\n }\n end", "def radios_for(method, vals, options={})\n \n end", "def format_radio\n @attr[:checked] = :checked if @opts[:checked]\n @attr[:type] = :radio\n tag(:input)\n end", "def render_menu\n @choices.each_with_index do |choice, index|\n indicator = (index + 1 == @active) ? @marker : Symbols::SPACE\n indicator += Symbols::SPACE\n message = if @selected.include?(choice)\n selected = @prompt.decorate(Symbols::RADIO_CHECKED, :green)\n selected + Symbols::SPACE + choice.name\n else\n Symbols::RADIO_UNCHECKED + Symbols::SPACE + choice.name\n end\n newline = (index == @choices.length - 1) ? '' : \"\\n\"\n @prompt.print(indicator + message + newline)\n end\n end", "def radio_group(field, choices, options={}, &block) \n\n # handle special cases\n if choices == :boolean\n choices = [[\"True\", \"true\"], [\"False\", \"false\"]]\n elsif choices == :yes_no\n choices = [[\"Yes\", \"yes\"], [\"No\", \"no\"]]\n elsif choices.class != Array\n choices = []\n end\n \n # build radio choices html \n choices_html = \"\"\n choices.each do |key, value|\n radio_html = radio_button_input(field, value)+key\n \n # wrap radio html in a label (for easier selection)\n choices_html << @template.content_tag(:label, radio_html, :class => \"radio-option\")\n end\n \n # wrap the radio-group with a label\n format_with_label(field, options.merge(:field_type => \"radio-group\"), choices_html, &block)\n end", "def render_prompt_item(form, is_radio, checked, id, value)\n html = ''\n if is_radio\n html += form.radio_button :answer, value, :id => id,\n :class => 'prompt-radio-input', :checked => checked\n else\n form.fields_for :answer, :index do |checkbox_form|\n html += checkbox_form.check_box value, :id => id,\n :class => 'prompt-radio-input', :checked => checked\n end\n end\n html.html_safe\n end", "def radios_by_string(f, p, c, d = \"\")\n\t\trender :partial => \"shared/forms/radio_strings\", :locals => { \n\t\t\t:f => f, :param => p, :collection => c, :default => d\n\t\t}\n\tend", "def select_groups\n frm.radio(:id=>\"groups\").set\n end", "def groupRadio _obj, _args\n \"_obj groupRadio _args;\" \n end", "def rcp_powerstate;radio(:name, 'receptacleStateGroup', \"#{mode}\");end", "def radio_button(name = \"\", value = nil, checked = nil)\n attributes = if name.kind_of?(String)\n { \"TYPE\" => \"radio\", \"NAME\" => name,\n \"VALUE\" => value, \"CHECKED\" => checked }\n else\n name[\"TYPE\"] = \"radio\"\n name\n end\n input(attributes)\n end", "def test_collection_as_radio_buttons\n actual = @builder.input(:pill, as: :radio_buttons, collection: [:a, :b])\n expected = <<-HTML\n <div class=\"form-group row radio_buttons optional form_pill\">\n <label class=\"col-sm-3 form-control-label radio_buttons optional\">Pill</label>\n <div class=\"col-sm-9\">\n <input name=\"form[pill]\" type=\"hidden\" value=\"\"/>\n <div class=\"form-check\">\n <input class=\"form-check-input radio_buttons optional\" id=\"form_pill_a\" name=\"form[pill]\" type=\"radio\" value=\"a\"/>\n <label class=\"collection_radio_buttons\" for=\"form_pill_a\">a</label>\n </div>\n <div class=\"form-check\">\n <input class=\"form-check-input radio_buttons optional\" id=\"form_pill_b\" name=\"form[pill]\" type=\"radio\" value=\"b\"/>\n <label class=\"collection_radio_buttons\" for=\"form_pill_b\">b</label>\n </div>\n <small class=\"form-text text-muted\">Collection as radio buttons example</small>\n </div>\n </div>\n HTML\n assert_xml_equal expected, actual\n end", "def radios_for_revenue_matter_rpt(opts)\n return %Q{\n <div class=\"fl\">\n <table>\n <tr>\n <td><input type=\"radio\" name=\"get_records\" id=\"get_records\" value=\"Basic\" #{opts[:basic_checked]} /></td>\n <td>Basic</td>\n <td>&nbsp;</td>\n <td><input name=\"get_records\" type=\"radio\" id=\"get_records\" value=\"Detail\" #{opts[:detail_checked]} /></td>\n <td>Detail</td>\n </tr>\n </table>\n </div>\n }\n end", "def showRadio _args\n \"showRadio _args;\" \n end", "def type_radio object, method, label_text, value\n warn \"[DEPRECATION] `type_radio` is deprecated. Please use `f.radio_button` instead.\"\n \n content_tag :div, :class => :\"type-check\" do\n attr_id = \"#{object.class.to_s.downcase}[#{method}]\".to_sym\n output = String.new\n output << radio_button_tag(attr_id, value, object.read_attribute(method)==value )\n output << content_tag(:label, label_text, :for => attr_id) unless label_text.blank?\n end\n end", "def customRadio _obj, _args\n \"_obj customRadio _args;\" \n end", "def assert_radio_button(model, *attributes)\n attributes.each do |attribute|\n assert_select \"input[type=radio][name=?]\",\n \"#{model.to_s}[#{attribute.to_s}]\"\n end\n end", "def initialize form, config={}, &block\n @surround_chars = ['(', ')'] if @surround_chars.nil?\n super\n $log.warn \"XXX: FIXME Please set 'value' for radiobutton. If not sure, try setting it to the same value as 'text'\" unless @value\n # I am setting value of value here if not set 2011-10-21 \n @value ||= @text\n ## trying with off since i can't do conventional style construction\n #raise \"A single Variable must be set for a group of Radio Buttons for this to work.\" unless @variable\n end", "def rpt_selection_helper(radiobtn)\n opts = {}\n if params[:date_selected]\n opts[:style] = \"margin:0px\"\n opts[:checked] = \"checked\"\n else\n opts[:style] = \"display:none; margin:0px\"\n opts[:checked] = \"\"\n end\n if radiobtn == \"All\" # bug 9611 # changed from radiobtn != \"My\"\n opts[:all_checked] = \"checked\"\n else\n opts[:my_checked] = \"checked\"\n end\n opts\n end", "def checkboxes; end", "def test_collection_as_radio_buttons_without_label\n actual = @builder.input(:pill, as: :radio_buttons, collection: [:a, :b], legend_tag: false)\n expected = <<-HTML\n <div class=\"form-group row radio_buttons optional form_pill\">\n <label class=\"col-sm-3 form-control-label radio_buttons optional\">Pill</label>\n <div class=\"col-sm-9\">\n <input name=\"form[pill]\" type=\"hidden\" value=\"\"/>\n <div class=\"form-check\">\n <input class=\"form-check-input radio_buttons optional\" id=\"form_pill_a\" name=\"form[pill]\" type=\"radio\" value=\"a\"/>\n <label class=\"collection_radio_buttons\" for=\"form_pill_a\">a</label>\n </div>\n <div class=\"form-check\">\n <input class=\"form-check-input radio_buttons optional\" id=\"form_pill_b\" name=\"form[pill]\" type=\"radio\" value=\"b\"/>\n <label class=\"collection_radio_buttons\" for=\"form_pill_b\">b</label>\n </div>\n <small class=\"form-text text-muted\">Collection as radio buttons example</small>\n </div>\n </div>\n HTML\n assert_xml_equal expected, actual\n end", "def input_radio(name, options = [])\n field = field_content(name)\n input = {}\n unless field.nil?\n input[:question] = prop(field, 'question')\n input[:name] = name\n input[:options] = options_group(prop(field, 'options'), name, options)\n end\n input\n end", "def build_choice_screen(prompt_msg_array=nil,screen_attributes=nil,plugins=nil)\n outputs = [nil,nil,nil,nil,nil,nil,nil]\n\n if prompt_msg_array.class.name == \"Array\"\n index = 6\n msg_array_size = prompt_msg_array.length - 1\n (prompt_msg_array.length).times do\n outputs[index] = prompt_msg_array[msg_array_size]\n index -= 1\n msg_array_size -= 1\n end\n end\n\n field_configs = Array.new\n for output_line in outputs\n field_configs[field_configs.length] = {:type=>\"text_line\",:name=>\"output\",:value=>output_line.to_s}\n end\n\n buttons = {\"B3Label\"=>\"Cancel\" ,\"B2Submit\"=>\"no\",\"B2Label\"=>\"no\",\"B1Submit\"=>\"yes\",\"B1Label\"=>\"yes\",\"B1Enable\"=>\"true\",\"B2Enable\"=>\"true\",\"B3Enable\"=>\"false\" }\n result_screen_def = PdtScreenDefinition.gen_screen_xml(field_configs,buttons,screen_attributes,plugins)\n return result_screen_def\n end", "def radio_button(object_name, method, tag_value, options = {})\n InstanceTag.new(object_name, method, self, nil, options.delete(:object)).to_radio_button_tag(tag_value, options)\n end", "def radio_button_element(identifier)\n platform.radio_button_for(identifier.clone)\n end", "def init_vars\n @hbox = Gtk::HBox.new\n @mode_vbox = Gtk::VBox.new\n @idiom_vbox = Gtk::VBox.new\n @geral_vbox = Gtk::VBox.new\n @new_btn = Gtk::Button.new('')\n @quit_btn = Gtk::Button.new('')\n self.resizable = false\n self.modal = true\n @mode_rdo = []\n (0..4).each{|i|\n @mode_rdo[i] = OptionsRadioButton.new(@mode_rdo[0])\n }\n @mode_rdo[0].selected = true\n @idiom_rdo = []\n (0..2).each{|i|\n @idiom_rdo[i] = Gtk::RadioButton.new(@idiom_rdo[0])\n }\n end", "def fui_radio_button(name, id, text, options = {})\n fui_radio(name, id, text, options)\n end", "def type\n assert_exists\n 'radio'\n end", "def hops_pur_member_radio_button\n $tracer.trace(__method__)\n return ToolTag.new(input.id(\"/EdgeAuthenticationTypeRadioButton/\"), __method__, self)\n end", "def to_enum_radio_tag(values, options = {})\n # Remove when we no longer support 1.1.\n begin\n v = value(object)\n rescue ArgumentError\n v = value\n end\n add_default_name_and_id(options)\n values = enum_values\n raise ArgumentError, \"No values for enum select tag\" unless values\n tag_text = ''\n template = options.dup\n template.delete('checked')\n values.each do |enum|\n opts = template.dup\n opts['checked'] = 'checked' if v and v == enum\n tag_text << \"<label>#{enum}: \"\n tag_text << to_radio_button_tag(enum, opts)\n tag_text << \"</label>\"\n end\n tag_text\n end", "def radio_group(field = nil, options = {}, &block)\n Input::RadioGroup.new(self, field, options).render(&block)\n end", "def add_image_radio_button(name, group, image_path, options = {}, &block)\n raise ArgumentError, 'group cannot be blank' if group.to_s.strip == ''\n options = options.dup\n group = group.to_sym\n @stkw_var_list[group] ||= TkVariable.new\n options[:variable] = @stkw_var_list[group]\n options[:value] ||= name.to_s.strip\n if options.delete(:selected)\n @stkw_var_list[group] = options[:value]\n end\n proc = get_command(options.delete(:command), &block)\n image = TkPhotoImage.new(file: image_path)\n add_widget Tk::Tile::Radiobutton, name, nil, options.merge(image: image), &proc\n end", "def assert_radio_button(*args)\n options = args.extract_options!\n assert_select \"input[type=radio][name=?]\", extract_name(args)\n end", "def yes_no_options(radio_hints = {})\n [\n RadioOption.new(true, I18n.t(\"generic.yes\"), radio_hints[:yes]),\n RadioOption.new(false, I18n.t(\"generic.no\"), radio_hints[:no]),\n ]\n end", "def ui_radio_field(content = nil, options = nil, html_options = nil, &block)\n UiBibz::Ui::Core::Forms::Choices::RadioField.new(content, options, html_options, &block).render\n end", "def get_field_list_rtpl\n '<input disabled=\"disabled\" type=\"checkbox\" id=\"' + @id + '\" name=\"' + @name + '\" class=\"' + @class_txt + '\" value=\"1\" checked=\"{%=' + @model_name + '[:' + @name + ']%}\" />'\n end", "def source_buttons\n\n # Temporary hack for mockup purposes, let's populate the units ComboBox\n # with some example values\n units = [\n \"Arbitrary Executable File Formats File System Automount Point\",\n \"Automounts filesystems on demand\",\n \"ACPI Event Daemon\"\n ]\n\n # For each option, we'll need an id, a label and, optionally,\n # some extra content\n options = [\n [:source_all, _(\"Any source\")], \n [:source_unit, _(\"Unit\"), ComboBox(Id(:unit_name), \"\", units)],\n [:source_file, _(\"File\"), InputField(Id(:file_name), \"\", \"\") ]\n ]\n\n options.map do |id, label, extra|\n Left(HBox(RadioButton(Id(id), label), *extra))\n end\n end", "def enum_radio(object_name, method, options = {})\n InstanceTag.new(object_name, method, self, nil, options.delete(:object)).to_enum_radio_tag(\"enum\", options) \n end", "def display_choices(selections)\n display = []\n selections.each do |y, z|\n thing = \"[#{z.to_s}]#{y.to_s.slice(z.length, y.length)}\"\n display << thing\n end\n display\nend", "def checkbox_list(items)\n cl = \"<ul>\"\n if(!items.empty?)\n item_class = items[0].class.to_s\n item_class_sub = item_class[0..0].to_s\n for item in items\n cl += \"<li>#{check_box_tag(item_class +\"_ids[]\", item.id, @items_to_select.include?(item), :id=>\"#{item_class_sub + \"\" + item.id.to_s}\")}\"\n\n cl += \"<label for=\\\"#{item_class_sub + \"\" + item.id.to_s}\\\">#{item.name}</label></li>\"\n\n end\n cl += \"</ul>\"\n end\n return cl\n end", "def set_radioshow\n @radioshow = Radioshow.find(params[:id])\n end", "def make_option_list\n end", "def make_option_list\n end", "def test_collection_as_radio_buttons_inline\n actual = @builder.input(:color, as: :radio_buttons, collection: [:a, :b], wrapper: :horizontal_collection_inline)\n expected = <<-HTML\n <div class=\"form-group row radio_buttons required form_color\">\n <label class=\"col-sm-3 form-control-label radio_buttons required\">Color <abbr title=\"required\">*</abbr></label>\n <div class=\"col-sm-9\">\n <input name=\"form[color]\" type=\"hidden\" value=\"\"/>\n <div class=\"form-check form-check-inline\">\n <input class=\"form-check-input radio_buttons required\" id=\"form_color_a\" name=\"form[color]\" type=\"radio\" value=\"a\"/>\n <label class=\"collection_radio_buttons\" for=\"form_color_a\">a</label>\n </div>\n <div class=\"form-check form-check-inline\">\n <input class=\"form-check-input radio_buttons required\" id=\"form_color_b\" name=\"form[color]\" type=\"radio\" value=\"b\"/>\n <label class=\"collection_radio_buttons\" for=\"form_color_b\">b</label>\n </div>\n <small class=\"form-text text-muted\">Collection as inline radio buttons example</small>\n </div>\n </div>\n HTML\n assert_xml_equal expected, actual\n end", "def draw_choices(bootstrap, type, method, collection, value_method, text_method, _options, html_options)\n draw_form_group_fieldset(bootstrap, method) do\n if bootstrap.custom_control\n label_css_class = \"custom-control-label\"\n\n form_check_css_class = \"custom-control\"\n form_check_css_class +=\n case type\n when :radio_button then \" custom-radio\"\n when :check_box then \" custom-checkbox\"\n end\n\n form_check_css_class += \" custom-control-inline\" if bootstrap.check_inline\n\n add_css_class!(html_options, \"custom-control-input\")\n\n else\n label_css_class = \"form-check-label\"\n\n form_check_css_class = \"form-check\"\n form_check_css_class += \" form-check-inline\" if bootstrap.check_inline\n\n add_css_class!(html_options, \"form-check-input\")\n end\n\n errors = draw_errors(bootstrap, method)\n help_text = draw_help(bootstrap)\n\n add_css_class!(html_options, \"is-invalid\") if errors.present?\n\n content = \"\".html_safe\n collection.each_with_index do |item, index|\n item_value = item.send(value_method)\n item_text = item.send(text_method)\n\n content << content_tag(:div, class: form_check_css_class) do\n concat yield method, item_value, html_options\n concat label(method, item_text, value: item_value, class: label_css_class)\n if ((collection.count - 1) == index) && !bootstrap.check_inline\n concat errors if errors.present?\n concat help_text if help_text.present?\n end\n end\n end\n\n if bootstrap.check_inline\n content << errors if errors.present?\n content << help_text if help_text.present?\n end\n\n content\n end\n end", "def generate_list(list_name,options_table)\n name.set list_name\n #set all checkboxes off before you start\n block_size_checkboxes.each do |checkbox|\n checkbox.set(false)\n end\n\n options_table.raw.each do |row|\n case row[0]\n when 'Arm'\n arm_names.each_with_index do |arm,index|\n arm_ratios[index].set row[2] if arm.text == row[1]\n end\n when 'Rand ID'\n if row[1] == 'Sequential'\n numbers_sequential.click\n starting_number.set row[2] if row[2] != ''\n elsif row[1] == 'Random'\n numbers_random.click\n if row[2] != ''\n range.set(true)\n starting_number.set row[2]\n ending_number.set row[3]\n end\n end\n when 'Sites'\n site_num_start.set row[1]\n site_num_end.set row[2]\n when 'Block Size'\n block_sizes.each_with_index do |block,index|\n if block.text==row[1]\n block_size_checkboxes[index].set(true)\n number_of_blocks[index].set row[2]\n end\n break if index >= block_size_checkboxes.size()-1\n end\n when 'Rand Seed'\n randseed_checkbox.set(true)\n randseed.set row[1]\n end\n end\n generate_list_btn.click\n end", "def handling_method_buttons\n $tracer.trace(__method__)\n # unit_test_no_generate: handling_method_buttons, input.className(create_ats_regex_string(\"ats-wis-shippingoptions\")).parent(\"div\").at(1); WebInStoreRadioButtons\n return WebInStoreRadioButtons.new(ToolTag.new(input.className(create_ats_regex_string(\"ats-wis-shippingoptions\")).parent(\"div\").at(1), __method__, self), self)\n end", "def rcp_lockstate;catdet.radio(:name, 'lockStateTypeGroup1', \"#{mode}\");end", "def filterList(input)\n set = false\n [*input].each_with_object([]) do |item, output|\n item = item.to_s\n item = item.chomp if (@accessoryType == 'combobox') ||\n (@accessoryType == 'radiobutton' && set)\n set = true if item.end_with?(\"\\n\")\n output << item unless item.empty? || (output & [item, \"#{item}\\n\"]).any?\n end\n end", "def destroyChoicesOnScreen()\n if $strAnswer.length == 1\n $radioA.destroy\n $radioB.destroy\n $radioC.destroy\n $radioD.destroy\n else\n $checkA.destroy\n $checkB.destroy\n $checkC.destroy\n $checkD.destroy\n end\nend", "def SetRadioButton(radioidfromhash)\n\t\tcase\n\t\t\twhen radioidfromhash == 'radioid1'\n\t\t\t\t@radioid = @radioid1\n\t\t\t\t@radiocheck = 'Pyramids'\n\t\t\twhen radioidfromhash == 'radioid2'\n\t\t\t\t@radioid = @radioid2\n\t\t\t\t@radiocheck = 'Stonehenge'\n\t\t\twhen radioidfromhash == 'radioid3'\n\t\t\t\t@radioid = @radioid3\n\t\t\t\t@radiocheck = 'Las Vegas'\n\t\t\twhen radioidfromhash == 'radioid4'\n\t\t\t\t@radioid = @radioid4\n\t\t\t\t@radiocheck = 'Antarctica'\n\t\tend\n\tend", "def hops_pur_not_member_radio_button\n $tracer.trace(__method__)\n return ToolTag.new(input.id(\"/CCAuthenticationTypeRadioButton/\"), __method__, self)\n end", "def buttonAccessory(width, height, radio = false)\n return if (buttonList = filterList(@input)).empty?\n height = buttonList.length * BUTTON_HEIGHT\n @accessory = NSBox.alloc\n .initWithFrame([[0, 0], [width, height]])\n .tap do |box|\n box.titlePosition = 0\n buttonWidth = width\n buttonList.each_with_index do |item, index|\n button = makeButton(radio, item)\n button.frame = [[0, height - (index + 1) * BUTTON_HEIGHT], [width, MIN_HEIGHT]]\n button.toolTip = @labels[index]\n if @dimensions[:width].nil?\n button.sizeToFit # use full width only when auto-sizing\n buttonWidth = button.frame.size.width + 10 if button.frame.size.width > buttonWidth\n end\n box.addSubview(button)\n end\n adjustment = @sheet ? PADDING : (PADDING / 2) + 1 # sheet vs window\n box.frameSize = [buttonWidth + 10, height + adjustment] # adjust box for contents\n end\n setBorder\n @alert.accessoryView = @accessory\n end", "def display_choices\n display = []\n VALID_CHOICES.each do |key, val|\n display << \"[#{val}]#{key.to_s.slice(val.length, key.length)}\"\n end\n display\nend", "def description\n 'Choose multiple values using checkbox'\n end", "def initialize(dsl, app)\n super(dsl, app, ::Swt::SWT::RADIO)\n self.group = dsl.group\n end", "def create\n @s = []\n params.each do |name, value|\n if name =~ /vertical_(.+)$/\n if value =~ /radio(.+)$/\n @s << $1.to_i\n end\n end\n end\n @poll = Poll.find(Pollitem.find(@s[0].to_i).poll_id)\n for s in @s\n @survey = Survey.create(pollitem_id: s.to_i, user_id: current_user.id, poll_id: @poll.id)\n end\n\n\n respond_to do |format|\n if @survey.save\n format.html { redirect_to @survey, notice: 'Survey was successfully created.' }\n format.json { render :show, status: :created, location: @survey }\n format.js\n else\n format.html { render :new }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end", "def filter_radio_link(title, key, value=nil)\n url = params.permit(AdminController::FILTER_PARAMS)\n url.merge!(key => value)\n content_tag :label do\n radio_button_tag(key, value, params[key] == value, onclick:\n \"window.location.href = '#{url_for(url)}'\") + ' ' + title\n end\n end", "def chooses(label)\n field = find_field(label, RadioField)\n field.choose\n end", "def select_specify_dates\n frm.radio(:id=>\"hidden_specify\").set\n end", "def createHypothesisButtons(hypothesis)\n\t\tcss = self.btnCSS(hypothesis)\n\t\taccept = ButtonCreator.new(:assetName => 'check.png', :assetSize => 40, :css => css)\n\t\treject = ButtonCreator.new(:assetName => 'close.png', :assetSize => 40, :css => css)\n\n\t\taccept.signal_connect('clicked') { self.btn_accept_clicked(hypothesis) }\n\t\treject.signal_connect('clicked') { self.btn_reject_clicked(hypothesis) }\n\n\t\treturn GridCreator.fromArray([accept, reject], :vertical => true)\n\tend", "def create_input_by_arm object_id, arm_id, model_name\n coder = HTMLEntities.new # create a coder to code value fields for each question\n obj_id = object_id.to_s\n obj_string = get_camel_caps(model_name)\n obj = obj_string.constantize.find(obj_id)\n obj_type = obj.field_type\n subq_field_name = \"#{model_name}_sub[#{obj_id.to_s}-#{arm_id.to_s}]\"\n\n retVal = \"\"\n if obj_type.match(\"matrix_\")\n # the TRUE indicates that we're creating the matrix for an arm\n retVal = create_matrix_input(obj, obj_type, model_name, {:editing=>@study.nil?, :arm_id=>arm_id})\n else\n # if this is a text field there are no options. otherwise, get the options\n unless obj_type == \"text\"\n # gather options for this field\n question_choices = (obj_string + \"Field\").constantize.where(model_name + \"_id\" => obj_id).order(\"row_number ASC\")\n options = question_choices.collect{|opt| opt.option_text}\n end\n chosen_values = []\n unless @study.nil?\n #unless params[:study_id].nil?\n chosen = get_selected_by_arm(obj_id, arm_id, model_name, obj_string)\n chosen_values = chosen.collect{|x| x[0]}\n chosen_subqs = chosen.collect{|x| x[1]}\n end\n case obj_type\n\n # RADIO INPUTS (includes YES/NO)\n when \"radio\", \"yesno\"\n i=0\n # keep a list of names of each radio group for the clear link\n options.each do |option|\n checked = \"\"\n if chosen_values.include?(option.to_s)\n checked = \"CHECKED\"\n end\n\n retVal += '<input class=\"cbox question_radio_input editable_field\" title=\"option\" section_name=\"'+model_name+'\" type=\"radio\" option_id=\"'+question_choices[i].id.to_s+'\" arm_id=\"' + arm_id.to_s + '\" obj_id=\"' + obj_id + '\" name=\"'+model_name+'['+obj_id+'-'+arm_id.to_s+']\" value=\"' + coder.encode(option.to_s.gsub('\"','\\\"')) + '\" ' + checked.to_s + '> ' + option.to_s\n if question_choices[i].has_subquestion\n retVal += '... <span class=\"radio_group_'+obj_id.to_s+'_'+arm_id.to_s+'\" id=\"option_' + question_choices[i].id.to_s + '_'+arm_id.to_s+'_sq_span\">'\n if checked == \"CHECKED\"\n subq_val = chosen_subqs[chosen_values.index(option.to_s)]\n retVal += fill_in_subquestion(question_choices[i].subquestion, subq_val, subq_field_name, 'radio','false')\n else\n retVal += fill_in_subquestion(question_choices[i].subquestion, nil, subq_field_name, 'radio',\"disabled\")\n end\n retVal += '</span>'\n end\n retVal += \"<br/>\"\n i+=1\n\n end\n # SELECT INPUTS\n when \"select\"\n retVal += '<select class=\"question_select_input editable_field\" title=\"option\" section_name=\"'+model_name+'\" arm_id=\"' + arm_id.to_s + '\" obj_id=\"'+obj_id.to_s+'\" name=\"'+model_name+'['+obj_id.to_s+'-'+arm_id.to_s+']\" id=\"'+model_name+'_'+obj_id.to_s+'-'+arm_id.to_s+'\">'\n # NO LONGER USING THE AUTO-OTHER FIELD GENERATOR\n #retVal += attach_listener_for_other(model_name+\"_\"+obj_id.to_s+'_'+arm_id.to_s)\n\n #some variables for showing the other fields\n # NO LONGER USING THE 'OTHER' FIELD SINCE USERS CAN ADD IT ON THEIR OWN\n #options << 'Other'\n text_input = \"\"\n found_it = false\n found_at_index = -1\n i=0\n retVal += \"<option value='' >-- Make Your Selection --</option>\"\n options.each do |option|\n selected = \"\"\n if chosen_values.include?(option.to_s)\n selected = \"SELECTED\"\n found_it = true\n found_at_index = i\n # NO LONGE USING THE AUTO-OTHER FIELD\n #elsif chosen_values.length > 0 && !found_it && option.to_s == \"Other\"\n #\tselected = \"SELECTED\"\n #\ttext_input = get_other_input_element_by_arm(chosen_values[0], obj_id.to_s, arm_id.to_s, model_name)\n end\n continued=\"\"\n if !question_choices[i].nil?\n if question_choices[i].has_subquestion\n continued = \"...\"\n end\n end\n retVal += '<option value=\"' + coder.encode(option.to_s.gsub('\"','\\\"')) + '\" ' + selected + \">\" + option.to_s + continued + \"</option>\"\n i+=1\n end\n retVal +=\"</select>&nbsp;<span id='select_#{obj_id.to_s}_#{arm_id.to_s}_sq_span'>\"\n if found_it && found_at_index > -1\n if question_choices[found_at_index].has_subquestion\n subq_val = chosen_subqs[chosen_values.index(options[found_at_index])]\n retVal += fill_in_subquestion(question_choices[found_at_index].subquestion, subq_val, subq_field_name, 'select','false')\n end\n ## TOOK THIS OUT WHEN ADDING IN THE 'MAKE YOUR SELECTION' OPTION\n #elsif\tquestion_choices[0].has_subquestion\n #\tretVal += fill_in_subquestion(question_choices[0].subquestion,\"\",subq_field_name,\"select\",\"disabled\")\n end\n\n retVal += \"</span>\"\n retVal += text_input.to_s\n\n # CHECK BOX INPUTS\n when \"checkbox\"\n i=0\n options.each do |option|\n checked = \"\"\n if chosen_values.include?(option.to_s)\n checked = \"checked\"\n end\n puts \"Trying to encode the string. Option is #{option} and encoded it's #{coder.encode(option.to_s.gsub('\"','\\\"'))}\\n\\n\"\n retVal += '<input class=\"cbox question_checkbox_input editable_field\" title=\"option\" section_name=\"'+model_name+'\" type=\"checkbox\" ' + checked + ' obj_id=\"'+obj_id.to_s+'\" option_id=\"' + question_choices[i].id.to_s + '\" name=\"'+model_name+'['+obj_id.to_s+'-'+arm_id.to_s+'][]\" arm_id=\"'+arm_id.to_s+'\" id=\"'+model_name+'_'+obj_id.to_s+'_'+question_choices[i].id.to_s+'\" value=\"' + coder.encode(option.to_s.gsub('\"','\\\"')) + '\"> ' + option.to_s\n\n if question_choices[i].has_subquestion\n retVal += '... <span class=\"checkbox_group_'+obj_id.to_s+'_'+arm_id.to_s+'\" id=\"option_' + question_choices[i].id.to_s + '_' + arm_id.to_s + '_sq_span\">'\n field_name = \"#{model_name}_sub[#{obj_id.to_s}-#{arm_id.to_s}][#{question_choices[i].id.to_s}]\"\n if checked == \"checked\"\n subq_val = chosen_subqs[chosen_values.index(option.to_s)]\n retVal += fill_in_subquestion(question_choices[i].subquestion, subq_val, field_name, 'checkbox','false')\n else\n retVal += fill_in_subquestion(question_choices[i].subquestion, nil, field_name, 'checkbox',\"disabled\")\n end\n retVal += '</span>'\n end\n retVal += \"<br/>\"\n i+=1\n end\n\n else\n value=\"\"\n\n unless chosen_values.empty?\n value = \"#{chosen_values[0]}\"\n end\n retVal += \"<textarea aria-label='Question Answer Field' cols='75' rows='1' class='editable_field' name='#{model_name}[#{obj_id.to_s}-#{arm_id.to_s}]' id='#{model_name}_#{obj_id.to_s}-#{arm_id.to_s}' value='#{value}'>#{value}</textarea><br/>\"\n end\n end\n return retVal\n end", "def create_list\n @list = Array.new(6) { |i| DexButton.new(@viewport, i) }\n end", "def d_alrmcnfg(state); catdet.radio(:name, 'drStateAlrmCfg',\"#{state}\"); end", "def makeCallButtons\n callButtonId = 1\n callButtonFloor = 1\n for callButtonCounter in 1..@amountOfFloors\n #If not first floor\n if callButtonCounter > 1\n callButton = CallButton.new(callButtonId, 'off', callButtonFloor, 'down')\n @callButtonsList.push(callButton)\n callButtonId += 1\n end\n #If not last floor\n if callButtonCounter < @amountOfFloors\n callButton = CallButton.new(callButtonId, 'off', callButtonFloor, 'up')\n @callButtonsList.push(callButton)\n callButtonId += 1\n end\n callButtonFloor += 1\n end\n end", "def radio_check(table)\n table.radios.each{|x| if x.checked? then return x.value end }\n end", "def unordered_list(list_items)\n drapper(\"<ul>#{list.map{ |list_item| \"<li>#{list_item}</li>\" }.join}</ul>\")\n\n\n def button(button_text, class_hash = nil)\n if class_hash\n drapper(\"<button class='#{class_hash[:class]}'>#{button_text}</button>\")\n else\n drapper(\"<button>#{button_text}</button>\")\n end\n end\n end", "def tipo_input(tipo,opcoes,obrigatoria,nome,id)\n case tipo\n when 1\n name = \"respostas[#{id}][resposta][]\"\n return text_field_tag name, nil,:required => obrigatoria,:placeholder=> nome\n \n \n when 4\n\n html = \"<div id='obrigatoria_#{obrigatoria}'>\".html_safe\n\n if !opcoes.empty?\n opcoes.each do |o|\n html << \"<input type='checkbox' name='respostas[#{id}][resposta][]' value='\".html_safe\n html << o.html_safe\n html << \"'>&nbsp;&nbsp;\".html_safe\n html << o.html_safe\n html << \"<br>\".html_safe\n #html << \"<input type='hidden' name='respostas[id][resposta][]' value='0' />\".html_safe \n end\n\n html << \"</div>\".html_safe\n end\n return html\n when 3\n \n html = \"\"\n if !opcoes.empty?\n select_tag \"respostas[#{id}][resposta][]\", options_for_select(opcoes.collect{ |u| [u, u] }), :include_blank => true\n end\n\n when 2 \n html = \"\".html_safe\n if opcoes != \"\"\n opcoes.each do |o|\n html << \"<input type='radio' name='respostas[#{id}][resposta][]' value='#{o}'> #{o} \".html_safe \n #html << \"<input type='hidden' name='respostas[resposta][]' value='0' />\".html_safe \n end\n end\n return html\n\n when 5\n name = \"respostas[#{id}][resposta][]\"\n return text_area_tag name, nil,:required => obrigatoria,:placeholder=> nome\n end\n\n end", "def getsmr_cb (questionChild,type,number,ask,hashNames)\r\n name=\"#{type}_#{number}\"\r\n getContainsKey(hashNames,type,name)\r\n listOptions = getListOptions(questionChild,\"option\")\r\n erbTemplate = getTemplate(\"../encuestas/templates/smr_cb.template\",binding)\r\n return erbTemplate.to_s\r\n end", "def build_check_box_without_hidden_field(options); end", "def select_site_members\n frm.radio(:id=>\"site\").set\n end", "def generateCompareMmr_cb (list)\r\n hash = Hash.new\r\n list.each{|value|\r\n val = value.split('_')\r\n key = val[0]+\"_\"+val[1]+\"_\"+val[2]\r\n if hash[key]\r\n hash[key] = hash[key]+\"$(\"+'\"'+\"input[name='\"+value+\"[]'\"+\"]:checked\"+'\"'+\").length == 0\"+\"||\"\r\n else\r\n hash[key] = \"$(\"+'\"'+\"input[name='\"+value+\"[]'\"+\"]:checked\"+'\"'+\").length == 0\"+\"||\"\r\n end\r\n }\r\n return hash\r\n end", "def radio_button_field_select(value)\n @field.all(:css, 'span[class=\"radio-option-item\"]').each do | name |\n if name.text.downcase == value.to_s.downcase\n control = name.all(:css, 'input[type=\"radio\"]').first\n control.set true\n break\n end\n end\n end", "def ro_standard\n value = @record.respond_to?(@yaml['name']) ? @record[@yaml['name']] : nil\n return self if value.nil?\n# \n choices = get_choices()\n if value.class == Array # multiple choices\n html = ''\n value.each do |element|\n choices.each do |choice|\n if choice.to_s == element.to_s\n html << '<br>' if html.size > 0\n html << \"#{element.to_s}\"\n end\n end \n end\n return super(html)\n else\n choices.each do |choice|\n if choice.class == Array\n return super(choice.first) if choice.last.to_s == value.to_s\n else\n return super(choice) if choice.to_s == value.to_s\n end \n end\n end\n super('')\nend", "def assert_radiobutton_selected(radiobutton_name)\n assert_togglebutton_selected radiobutton_name\n end" ]
[ "0.7448311", "0.69899714", "0.6984335", "0.69725823", "0.6946345", "0.68229556", "0.6820075", "0.6739062", "0.65432394", "0.64837223", "0.6454941", "0.64338064", "0.6326125", "0.6298247", "0.6253906", "0.6190775", "0.6186663", "0.61753744", "0.61707795", "0.61401755", "0.6084493", "0.608218", "0.60477763", "0.6024983", "0.600312", "0.60004973", "0.592587", "0.592567", "0.5899941", "0.588799", "0.5882565", "0.58410484", "0.58077323", "0.57236916", "0.5672218", "0.5668559", "0.5660614", "0.5657153", "0.5630151", "0.54994196", "0.5473155", "0.5473114", "0.5446991", "0.542561", "0.5392001", "0.5379671", "0.53781736", "0.5376968", "0.5365338", "0.5305882", "0.5299145", "0.52812606", "0.5274501", "0.52729857", "0.5268554", "0.5216794", "0.5204539", "0.520431", "0.52042645", "0.5202781", "0.5202712", "0.5191045", "0.5183953", "0.51825285", "0.517178", "0.51713026", "0.51705766", "0.51705766", "0.5164119", "0.5155311", "0.51471436", "0.5144672", "0.5144501", "0.51345485", "0.5128108", "0.5124994", "0.5108521", "0.5105176", "0.50983334", "0.50863373", "0.5078563", "0.50736964", "0.5070778", "0.5063636", "0.5029342", "0.5021127", "0.5014476", "0.5004446", "0.50036526", "0.4992556", "0.49905437", "0.49758467", "0.49577308", "0.49488723", "0.49485558", "0.4946484", "0.49381375", "0.4935532", "0.49240845", "0.49181247" ]
0.76315546
0
Function to build a checkbox list only usable for an array of the same class
def checkbox_list(items) cl = "<ul>" if(!items.empty?) item_class = items[0].class.to_s item_class_sub = item_class[0..0].to_s for item in items cl += "<li>#{check_box_tag(item_class +"_ids[]", item.id, @items_to_select.include?(item), :id=>"#{item_class_sub + "" + item.id.to_s}")}" cl += "<label for=\"#{item_class_sub + "" + item.id.to_s}\">#{item.name}</label></li>" end cl += "</ul>" end return cl end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkboxes; 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 build_check_box(unchecked_value, options); end", "def collection_check_boxes(method, collection, value_method, text_method, options = T.unsafe(nil), html_options = T.unsafe(nil), &block); end", "def checkboxes_for(method,vals,options={})\n \n end", "def build_check_box_without_hidden_field(options); end", "def checkbox(criteria = T.unsafe(nil)); end", "def checkbox(item)\n name_li(item).checkbox\n end", "def check_box_array(method, options = {}, &contents)\n data = options.delete(:from)\n data = drop_down(data, options) if data.is_a?(Symbol)\n\n columns = options.delete(:columns) || 1\n output = [\"<table style='width: 100%; border: 0; border-collapse: collapse'>\"]\n output << \"<tr>\"\n \n value = object.send(method)\n \n Array(data).each_with_index do |data_item, index|\n if index % columns == 0 && index > 0\n output << \"</tr><tr>\"\n end\n \n output << \"<td>\"\n output << @template.check_box_tag(\"#{@object_name}[#{method}][]\", data_item.id, value.include?(id_value))\n output << \" \" + @template.capture(data_item, &contents)\n output << \"</td>\"\n end\n \n output << \"</tr></table>\"\n @template.concat output.join\n end", "def build_check_box_without_hidden_field\n build_check_box(nil)\n end", "def build_check_box(unchecked_value = unchecked_value())\n @builder.check_box(attribute_name, input_html_options, checked_value, unchecked_value)\n end", "def description\n 'Choose multiple values using checkbox'\n end", "def checkbox_elements(identifier)\n platform.checkboxes_for(identifier.clone)\n end", "def check_box_filter_for(column, object)\n content_tag :li, :class => \"checkbox\" do\n name = \"f[#{ column }][]\"\n id = \"f_#{ column }_#{ object.id }\"\n\n res = check_box_tag(name, object.id, filter_checked?(column, object), \n :id => id, :class => \"checkbox\")\n res += content_tag(:span, object.to_s)\n\n res\n end\n end", "def collection_check_boxes(method, collection, value_method, text_method, options = {}, html_options = {})\n bootstrap = form_bootstrap.scoped(options.delete(:bootstrap))\n return super if bootstrap.disabled\n\n content = \"\".html_safe\n unless options[:include_hidden] == false\n content << hidden_field(method, multiple: true, value: \"\")\n end\n\n args = [bootstrap, :check_box, method, collection, value_method, text_method, options, html_options]\n content << draw_choices(*args) do |m, v, opts|\n opts[:multiple] = true\n opts[:include_hidden] = false\n ActionView::Helpers::FormBuilder.instance_method(:check_box).bind(self).call(m, opts, v)\n end\n end", "def check_box_options\n [:tag_ids, Tag.order(:name), :id, :name]\n end", "def checkbox_section(form, attribute, choices, options = {})\n options = {\n :checked_method => nil, \n :name_method => \"name\", \n :value_method => \"id\", \n :disabled => false,\n :include_toggle => true,\n :checkbox_side => \"left\",\n :include_blank => true\n }.merge(options)\n \n field_name = options[:field_name] || field_name(form, attribute)\n field_name += '[]'\n base_id = options[:field_id] || field_id(form, attribute)\n checkboxes_id = \"#{base_id}_checkboxes\"\n opts = options[:disabled] ? {:disabled => \"true\"} : {}\n already_checked = case \n when options[:checked_method].is_a?(Array)\n options[:checked_method]\n when options[:checked_method].nil?\n []\n else\n form.object.send(options[:checked_method])\n end\n \n checkboxes = choices.map do |choice|\n is_checked = options[:checked_method] ? already_checked.include?(choice) : false\n display_name = choice.send(options[:name_method]).html_safe\n value = choice.send(options[:value_method])\n checkbox_id = \"#{base_id}_#{name_to_id(value)}\"\n checkbox = check_box_tag(field_name, value, is_checked, opts.merge({:id => checkbox_id}))\n checkbox_and_label = label_tag checkbox_id, :class => \"action\" do \n options[:checkbox_side] == \"left\" ? checkbox + display_name : display_name + checkbox\n end\n content_tag(:li, checkbox_and_label, :class => cycle(\"odd\", \"even\", :name => \"tigerstriping\"))\n end.join(\"\\n\").html_safe\n checkboxes_ul = content_tag(:ul, checkboxes)\n\n # reset the tiger striping\n reset_cycle(\"tigerstriping\")\n\n # if there are only a few choices, don't show the scrolling and the toggle\n size = choices.size\n css_class = checkbox_section_css_class(size)\n toggle = \"\".html_safe\n if options[:include_toggle] && size > (ArchiveConfig.OPTIONS_TO_SHOW * 6)\n toggle = checkbox_section_toggle(checkboxes_id, size)\n end\n \n # We wrap the whole thing in a div module with the classes\n return content_tag(:div, toggle + checkboxes_ul + toggle + (options[:include_blank] ? hidden_field_tag(field_name, \" \") : ''.html_safe), :id => checkboxes_id, :class => css_class)\n end", "def labeled_checkbox( text, checked, object, property )\n tag_id = object.to_s.gsub(/[\\[,\\]]/, \"_\") + \"_\" + property.to_s\n adds = \"checked='checked'\" if checked\n\n str = \"<input type='checkbox' name='#{object+\"[\"+property.to_s+\"]\"}' value='#{property}' id='#{tag_id}' #{adds} />&nbsp;\"\n str += \"<label for='#{tag_id}'><a class='hidden_link' style='display: inline' href=\\\"javascript:toggleCheckBox('#{tag_id}')\\\">#{h(text)}</a></label>\\n\" \n\n return str\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 create_boolean_collection(options) #:nodoc:\n options[:true] ||= ::Formtastic::I18n.t(:yes)\n options[:false] ||= ::Formtastic::I18n.t(:no)\n options[:value_as_class] = true unless options.key?(:value_as_class)\n\n [ [ options.delete(:true), true], [ options.delete(:false), false ] ]\n end", "def build_hidden_field_for_checkbox; end", "def format_checkbox\n @attr[:type] = :checkbox\n @attr[:checked] = :checked if @opts[:checked]\n if @attr[:name] && !@opts[:no_hidden]\n attr = {:type=>:hidden}\n unless attr[:value] = @opts[:hidden_value]\n attr[:value] = CHECKBOX_MAP[@attr[:value]]\n end\n attr[:id] = \"#{@attr[:id]}_hidden\" if @attr[:id]\n attr[:name] = @attr[:name]\n [tag(:input, attr), tag(:input)]\n else\n tag(:input)\n end\n end", "def test_collection_as_check_boxes\n actual = @builder.input(:choises, as: :check_boxes, collection: %w(a b))\n expected = <<-HTML\n <div class=\"form-group row check_boxes required form_choises\">\n <label class=\"col-sm-3 form-control-label check_boxes required\">Choises <abbr title=\"required\">*</abbr></label>\n <div class=\"col-sm-9\">\n <input name=\"form[choises][]\" type=\"hidden\" value=\"\"/>\n <div class=\"form-check\">\n <input class=\"form-check-input check_boxes required\" id=\"form_choises_a\" name=\"form[choises][]\" type=\"checkbox\" value=\"a\"/>\n <label class=\"collection_check_boxes\" for=\"form_choises_a\">a</label>\n </div>\n <div class=\"form-check\">\n <input class=\"form-check-input check_boxes required\" id=\"form_choises_b\" name=\"form[choises][]\" type=\"checkbox\" value=\"b\"/>\n <label class=\"collection_check_boxes\" for=\"form_choises_b\">b</label>\n </div>\n <small class=\"form-text text-muted\">Collection as check boxes example</small>\n </div>\n </div>\n HTML\n assert_xml_equal expected, actual\n end", "def define_selected!(array)\r\n array.each do |o|\r\n unless(o.respond_to?(:selected?))\r\n def o.selected?\r\n false\r\n end\r\n end\r\n end\r\n end", "def get_field_list_rtpl\n '<input disabled=\"disabled\" type=\"checkbox\" id=\"' + @id + '\" name=\"' + @name + '\" class=\"' + @class_txt + '\" value=\"1\" checked=\"{%=' + @model_name + '[:' + @name + ']%}\" />'\n end", "def check_content(item)\n self.li(:text=>item).checkbox.set\n end", "def display_check_box( value )\n html = String.new\n html += \"<input type=\\\"checkbox\\\" readonly disabled\"\n html += \" checked\" if value\n html += \"/>\"\n html.html_safe\n end", "def check_box; end", "def checkbox_group(name = \"\", *values)\n if name.kind_of?(Hash)\n values = name[\"VALUES\"]\n name = name[\"NAME\"]\n end\n values.collect{|value|\n if value.kind_of?(String)\n checkbox(name, value) + value\n else\n if value[-1] == true || value[-1] == false\n checkbox(name, value[0], value[-1]) +\n value[-2]\n else\n checkbox(name, value[0]) +\n value[-1]\n end\n end\n }.join\n end", "def render_item_checkbox(item)\n %(<input type=\"checkbox\"\n class=\"task-list-item-checkbox\"\n #{'checked=\"checked\"' if item.complete?}\n disabled=\"disabled\"\n />)\n end", "def friendly_types_list(arr)\n fixed_arr = Array(arr).map do |x|\n case x\n when \"TrueClass\"\n \"true\"\n when \"FalseClass\"\n \"false\"\n else\n x\n end\n end\n fixed_arr.compact.join(\", \")\n end", "def check_content(item)\n name_li(item).checkbox.set\n end", "def check_box_tag(name, value = T.unsafe(nil), checked = T.unsafe(nil), options = T.unsafe(nil)); end", "def sellable_items\n all_items.select { |item| item.traddable? }\n end", "def input_checkbox(name)\n field = field_content(name)\n option_item(field, field_id(name), name)\n end", "def checkbox_accord2(items_hash, show_properties=false, depth=0)\n if(depth == 0 && items_hash.keys.empty?)\n return \"No Items Available\"\n end\n if(@items_to_select.nil?)\n @items_to_select = []\n end\n if(items_hash.keys.empty?)\n return \"\"\n end\n pt = \"<ul \"\n if(depth == 0)\n pt += \"id=\\\"id#{Time.now.usec}\\\" class=\\\"accordion\\\"\"\n end\n pt+=\">\"\n expand = true\n for item in items_hash.keys\n pt += \"<li\"\n if(depth == 0 && expand && (!item.is_a?(Property) || !item.valuefields.empty?))\n pt += \" class=\\\"expand\\\"\"\n expand = false\n end\n pt +=\">\"\n #Checks what class the item is\n if(item.is_a?(Category))\n pt += \"<div class=\\\"inline\\\">&nbsp</div>#{check_box_tag \"parent_ids[]\", item.id, @items_to_select.include?(item), :id=>\"a#{item.id}\"}\" + \"<label for=\\\"a#{item.id}\\\">#{item.name}</label>\"\n elsif(item.is_a?(Product))\n pt += \"<div class=\\\"inline\\\">&nbsp</div>#{check_box_tag \"product_ids[]\", item.id, @items_to_select.include?(item), :id=>\"p#{item.id}\"}\" + \"<label for=\\\"p#{item.id}\\\">#{item.name}</label>\"\n elsif(item.is_a?(Component))\n #Checks to see if the current component is the parent so you cannot select it\n if(item.eql?(@parent))\n pt += \"<div class=\\\"inline\\\">&nbsp</div>#{check_box_tag \"component_parent_ids[]\", item.id, @items_to_select.include?(item), :id=>\"c#{item.id}\", :disabled => true}\" + \"<label for=\\\"c#{item.id}\\\">#{item.name}</label>\"\n else\n pt += \"<div class=\\\"inline\\\">&nbsp</div>#{check_box_tag \"component_parent_ids[]\", item.id, @items_to_select.include?(item), :id=>\"c#{item.id}\"}\" + \"<label for=\\\"c#{item.id}\\\">#{item.name}</label>\"\n end\n elsif(item.is_a?(Valuefield))\n pt += \"<div class=\\\"inline\\\">&nbsp</div>#{check_box_tag \"valuefield_ids[]\", item.id, @items_to_select.include?(item), :id=>\"v#{item.id}\"}\" + \"<label for=\\\"v#{item.id}\\\">#{item.name}</label>\"\n elsif(item.is_a?(Group)) #not currently used\n pt += \"<div class=\\\"inline\\\">&nbsp</div>#{check_box_tag \"group_ids[]\", item.id, @items_to_select.include?(item), :id=>\"g#{item.id}\"}\" + \"<label for=\\\"g#{item.id}\\\">#{item.name}</label>\"\n elsif(item.is_a?(Property))\n if(show_properties)\n pt += \"<div class=\\\"inline\\\">&nbsp</div>#{check_box_tag \"#{parent}[property_id]\", item.id, @items_to_select.include?(item), :id=>\"o#{item.id}\"}\" + \"<label for=\\\"o#{item.id}\\\">#{item.name}</label>\"\n elsif(!item.valuefields.empty?)\n pt += \"<div class=\\\"inline\\\">&nbsp</div><b>#{item.name}</b>\"\n end\n end\n pt += checkbox_accord2(items_hash[item], show_properties, depth+1)\n pt += \"</li>\"\n end\n pt += \"</ul>\"\n return pt\n end", "def format_checkbox\n @attr[:disabled] = :disabled\n @opts[:no_hidden] = true unless @opts.has_key?(:no_hidden)\n super\n end", "def purcc_checkbox\n #unit_test_no_generate: purcc_checkbox, span.className(create_ats_regex_string(\"ats-purccbox\"))\n $tracer.trace(__method__)\n return ToolTag.new(span.className(create_ats_regex_string(\"ats-purccbox\")), __method__)\n end", "def create_boolean_collection(options) #:nodoc:\n options[:true] ||= ::I18n.t(:yes)\n options[:false] ||= ::I18n.t(:no)\n options[:value_as_class] = true unless options.key?(:value_as_class)\n\n [ [ options.delete(:true), true], [ options.delete(:false), false ] ]\n end", "def checkbox_accord(items_hash, show_properties=false, depth=0)\n\n if(depth == 0 && items_hash.keys.empty?)\n return \"No Items Available\"\n end\n\n if(@items_to_select.nil?)\n @items_to_select = []\n end\n\n if(items_hash.keys.empty?)\n return \"\"\n end\n\n pt = \"<ul \"\n if(depth == 0)\n pt += \"id=\\\"id#{Time.now.usec}\\\" class=\\\"accordion\\\"\"\n end\n\n pt+=\">\"\n\n expand = true\n for item in items_hash.keys\n pt += \"<li\"\n if(depth == 0 && expand && (!item.is_a?(Property) || !item.valuefields.empty?))\n pt += \" class=\\\"expand\\\"\"\n expand = false\n end\n pt +=\">\"\n #Checks what class the item is\n if(item.is_a?(Category))\n pt += \"<div class=\\\"inline\\\">&nbsp</div>#{check_box_tag \"parent_ids[]\", item.id, @items_to_select.include?(item), :id=>\"a#{item.id}\"}\" + \"<label for=\\\"a#{item.id}\\\">#{item.name}</label>\"\n elsif(item.is_a?(Product))\n pt += \"<div class=\\\"inline\\\">&nbsp</div>#{check_box_tag \"product_ids[]\", item.id, @items_to_select.include?(item), :id=>\"p#{item.id}\"}\" + \"<label for=\\\"p#{item.id}\\\">#{item.name}</label>\"\n elsif(item.is_a?(Component))\n pt += \"<div class=\\\"inline\\\">&nbsp</div>#{check_box_tag \"component_parent_ids[]\", item.id, @items_to_select.include?(item), :id=>\"c#{item.id}\"}\" + \"<label for=\\\"c#{item.id}\\\">#{item.name}</label>\"\n elsif(item.is_a?(Valuefield))\n pt += \"<div class=\\\"inline\\\">&nbsp</div>#{check_box_tag \"valuefield_ids[]\", item.id, @items_to_select.include?(item), :id=>\"v#{item.id}\"}\" + \"<label for=\\\"v#{item.id}\\\">#{item.name}</label>\"\n elsif(item.is_a?(Group)) #not currently used\n pt += \"<div class=\\\"inline\\\">&nbsp</div>#{check_box_tag \"group_ids[]\", item.id, @items_to_select.include?(item), :id=>\"g#{item.id}\"}\" + \"<label for=\\\"g#{item.id}\\\">#{item.name}</label>\"\n elsif(item.is_a?(Property))\n if(show_properties)\n pt += \"<div class=\\\"inline\\\">&nbsp</div>#{check_box_tag \"#{parent}[property_id]\", item.id, @items_to_select.include?(item), :id=>\"o#{item.id}\"}\" + \"<label for=\\\"o#{item.id}\\\">#{item.name}</label>\"\n elsif(!item.valuefields.empty?)\n pt += \"<div class=\\\"inline\\\">&nbsp</div><b>#{item.name}</b>\"\n end\n\n end\n\n pt += checkbox_accord(items_hash[item], show_properties, depth+1)\n pt += \"</li>\"\n\n end\n\n pt += \"</ul>\"\n\n return pt\n\n end", "def habtm_check_boxes_field_template(l = {})\n <<-END\n <div data-role=\"fieldcontain\" id=\"#{l[:div_id]}\" class=\"field\">\n\t #{l[:label]}<br />\n <div class=\"habtm_check_boxes\">#{l[:element]}</div>#{l[:decoration]}\n #{\"<p class=\\\"field_description\\\">#{l[:description]}</p>\" unless l[:description].blank?}\n\t </div>\n\t END\n end", "def nested_boolean_choice_field(form, name, attribute, opts = {})\n on_change = (attribute.new_record? ? \"nestedCheckboxChanged(this)\" : nil)\n class_name = (attribute.new_record? ? \"nested_checkbox\" : nil)\n\n if opts[:onchange] and on_change\n on_change += \"; #{ opts[:onchange] }\"\n end\n\n opts[:class] = \"#{ opts[:class] } #{ class_name }\"\n\n options = opts.merge({ :onchange => on_change, :index => attribute.id })\n return form.check_box(name, options)\n end", "def build_list\n return false\n end", "def labeled_checkbox(label, name, value, options={})\n id = options.delete(:id) || name\n\n attrs = options.map { |(k, v)| \" #{h k}='#{h v}'\" }.join('')\n\n [ \"<label#{attrs} class='checkbox' for='#{id}'>\",\n checkbox(name, value, :id => id),\n \"<span>#{h label}</span>\",\n \"</label>\"\n ].join(\"\\n\")\n\n end", "def labeled_checkbox(label, name, value, options={})\n id = options.delete(:id) || name\n\n attrs = options.map { |(k, v)| \" #{h k}='#{h v}'\" }.join('')\n\n [ \"<label#{attrs} class='checkbox' for='#{id}'>\",\n checkbox(name, value, :id => id),\n \"<span>#{h label}</span>\",\n \"</label>\"\n ].join(\"\\n\")\n\n end", "def items\n items = []\n @collection.each_with_index do |item, index|\n if index == @current && index == @selected\n items << [true, true, item]\n\n elsif index == @current\n items << [false, true, item]\n\n elsif index == @selected\n items << [true, false, item]\n\n else\n items << [false, false, item]\n\n end\n end\n items\n end", "def format_checkbox\n @opts[:no_hidden] = true unless @opts.has_key?(:no_hidden)\n super\n end", "def tag_checkbox(article, tags)\n html = \"\"\n return html if tags == nil || tags.empty?\n tags.each do |tag|\n checked = \"\"\n if tag.selected?(article)\n checked = \" checked\"\n end\n html << <<-HTML\n <label for=\"tag_#{tag.id}\" class=\"checkbox inline tagcheck\">\n <input type=\"checkbox\" id=\"tag_#{tag.id}\" value=\"#{tag.name}\" class=\"tagCheck\"#{checked}>#{tag.name}</input>\n </label>\n HTML\n end\n html.html_safe\n end", "def test_collection_as_check_boxes_inline\n actual = @builder.input(:fruit, as: :check_boxes, collection: [:a, :b], wrapper: :horizontal_collection_inline)\n expected = <<-HTML\n <div class=\"form-group row check_boxes required form_fruit\">\n <label class=\"col-sm-3 form-control-label check_boxes required\">Fruit <abbr title=\"required\">*</abbr></label>\n <div class=\"col-sm-9\">\n <input name=\"form[fruit][]\" type=\"hidden\" value=\"\"/>\n <div class=\"form-check form-check-inline\">\n <input class=\"form-check-input check_boxes required\" id=\"form_fruit_a\" name=\"form[fruit][]\" type=\"checkbox\" value=\"a\"/>\n <label class=\"collection_check_boxes\" for=\"form_fruit_a\">a</label>\n </div>\n <div class=\"form-check form-check-inline\">\n <input class=\"form-check-input check_boxes required\" id=\"form_fruit_b\" name=\"form[fruit][]\" type=\"checkbox\" value=\"b\"/>\n <label class=\"collection_check_boxes\" for=\"form_fruit_b\">b</label>\n </div>\n <small class=\"form-text text-muted\">Collection as inline check boxes example</small>\n </div>\n </div>\n HTML\n assert_xml_equal expected, actual\n end", "def bibliografiasChecklist\n return unless params[:f_desc].present?\n return unless params[:f_desc].include?('x_bibliografia')\n return unless @bibliografias.any?\n\n html = \"<h5 class='etiqueta-checklist'>Bibliografía</h5>\"\n\n @bibliografias.each_with_index do |bibliografia, indice|\n html << \"<p id='biblio-checklist-#{indice+1}'>#{bibliografia} <sup><strong>[#{indice+1}]</strong></sup></p>\"\n end\n\n html.html_safe\n end", "def check_box(method, orig_options = {}, checked_value = '1',\n unchecked_value = '0')\n options = decorate_opts_with_disabled(orig_options)\n div_wrapper do\n @template.content_tag :div, class: 'checkbox' do\n label_control(method) do\n orig_check_box(method, options, checked_value, unchecked_value) +\n method.to_s.humanize\n end\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 get_checked_items\n find_all { | i | checked?(i) } \n end", "def has_checkbox_summary_array?\n ccf = checkbox_choice_fields\n ccf && ccf.length > 1\n end", "def array_to_html array, type\n '<ul> <li>' +\n array.join('</li><li>')\n + '</li> </ul>'\nend", "def checklist(item)\n @array.include?(item)\n end", "def checkbox_guard_for(elt_name, visible=false)\n check_box_tag(\"show_\" << elt_name.to_s, '1', visible,\n :onclick => %Q{$('##{elt_name}').slideToggle();})\n end", "def gift_message_checkbox\n $tracer.trace(__method__)\n #unit_test_no_generate: gift_message_checkbox, input.className(create_ats_regex_string(\"ats-giftmsgcheckbox\"))\n return ToolTag.new(input.className(create_ats_regex_string(\"ats-giftmsgcheckbox\")), __method__, self)\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 collection_checks(method, collection, value_method, text_method, options = {}, &block)\n check_boxes = []\n collection.each do |choice|\n text = choice.send(text_method)\n value = choice.send(value_method)\n check = MetaSearch::Check.new\n check.box = @template.check_box_tag(\n \"#{@object_name}[#{method}][]\",\n value,\n [@object.send(method)].flatten.include?(value),\n options.merge(:id => [@object_name, method.to_s, value.to_s.underscore].join('_'))\n )\n check.label = @template.label_tag([@object_name, method.to_s, value.to_s.underscore].join('_'),\n text)\n if block_given?\n yield check\n else\n check_boxes << check\n end\n end\n check_boxes unless block_given?\n end", "def checklist_items\n return @checklist_items\n end", "def store_checkboxes_setup(store_name, attrs)\n define_method(\"#{store_name}_keys\") do\n list = [];\n attrs.each do |attr|\n if send(attr) == true\n list.push(attr)\n end\n end\n list\n end\n define_method(\"#{store_name}_options\") do\n @i18n_base_scope = [:activerecord, :options, self.class.name.underscore, store_name]\n list = [];\n attrs.each do |attr|\n if send(attr) == true\n list.push(I18n.t(\"#{attr}\", scope: @i18n_base_scope, :default => attr.to_s.humanize))\n end\n end\n list\n end\n end", "def checkbox_name\n \"mail[#{name}_check]\"\n end", "def gift_message_checkbox\n $tracer.trace(__method__)\n return ToolTag.new(span.className(create_ats_regex_string(\"ats-wis-giftmsgcheckbox\")).input, __method__)\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 labelled_check_box(method, text = nil, check_box_options = {})\n label_options = check_box_options.delete(:label) || {}\n if check_box_options[:editable] == false\n %Q{#{label(method, \"#{text || method.to_s.titleize}\", label_options)} <div class=\"labelled\" id=\"#{object_name}_#{method}\">#{@object.send(method)}</div>}.html_safe\n else\n %Q{<div class=\"check_box\"><div class=\"input\">#{check_box(method, check_box_options)}</div><div class=\"label\">#{label(method, text || method.to_s.titleize)}</div></div>}.html_safe\n end\n end", "def as_selectable_array\n all.inject([]) { |h,t| h << [t.name, t.key] }\n end", "def get_field_edit_html\n # if([email protected]? && (@value == '1' || @value == 1)) then\n if ([email protected]? && @value == true) then\n checked = 'checked=\"true\"'\n else\n checked = ''\n end\n '<input type=\"checkbox\" id=\"' + @id + '\" name=\"' + @name + '\" value=\"1\" class=\"' + @class_txt + '\" ' + @checked + ' />'\n end", "def check_box_field(attr, options = {}, &block)\n label_text = options.delete :label\n input_html = input_html_for attr, options, &block\n errors_html = errors_html_for attr\n label_html_for attr, class: 'check-box-label' do\n @template.content_tag(:span, input_html, class: 'check-box-wrapper') +\n @template.content_tag(:span, label_text, class: 'label-text') +\n errors_html\n end\n end", "def basic_check_list(filter, tag_name)\n check_filter_by_class(filter)\n click_filter(filter)\n li_arr = get_results_as_array\n check_number_of_results(li_arr)\n check_result_has_headline(li_arr)\n check_result_has_summary(li_arr)\n check_show_more_result_btn\n check_result_has_img(li_arr)\n collect_Business_tag(li_arr)\n if tag_name != 'All'\n check_result_datasite(li_arr, tag_name)\n end\n check_result_has_date(li_arr)\n end", "def checked; end", "def type_check object, method, label_text\n warn \"[DEPRECATION] `type_check` is deprecated. Please use `f.check_box` instead.\"\n \n content_tag :div, :class => :\"type-check\" do\n attr_id = \"#{object.class.to_s.downcase}[#{method}]\".to_sym\n output = String.new\n output << check_box_tag(attr_id, object.read_attribute(method))\n output << content_tag(:label, label_text, :for => attr_id) unless label_text.blank?\n end\n end", "def modal_opt_in_checkbox\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.input.className(create_ats_regex_string(\"ats-optinbox\")), format_method(__method__))\n end", "def form_checkbox(&block)\n content_tag(:div, capture(&block), class: \"checkbox\")\n end", "def ui_checkbox_field(content = nil, options = nil, html_options = nil, &block)\n UiBibz::Ui::Core::Forms::Choices::CheckboxField.new(content, options, html_options, &block).render\n end", "def camposDescarga(tipo_descarga=nil)\n checkbox = ''\n campos = { x_tipo_distribucion: 'Tipo de distribución', x_cat_riesgo: 'Categorías de riesgo y comercio internacional', x_ambiente: 'Ambiente', x_nombres_comunes: 'Nombres comunes', x_bibliografia: 'Bibliografía' }\n \n case tipo_descarga\n when 'basica'\n when 'avanzada'\n campos.merge!({ x_col_basicas: 'Columnas basicas', x_taxa_sup: 'Taxonomía superior', x_url_ev: 'URL de la especie en enciclovida' })\n when 'region'\n campos = { x_num_reg: 'Número de registros' }.merge(campos.merge!({ x_col_basicas: 'Columnas basicas', x_taxa_sup: 'Taxonomía superior', x_url_ev: 'URL de la especie en enciclovida' }))\n when 'checklist'\n campos.merge!({ x_estatus: 'Solo válidos/aceptados', x_distribucion: 'Distribución (reportada en literatura)', x_residencia: 'Categoría de residencia (aves)', x_formas: 'Formas de crecimiento (plantas)', x_interaccion: 'Interacciones biológicas' }) \n end\n \n campos.each do |valor, label|\n if valor.to_s == 'x_col_basicas'\n checkbox << check_box_tag('f_desc[]', valor, true, style: 'display: none;', id: \"f_#{tipo_descarga}_#{valor}\")\n else\n checkbox << \"<div class='custom-control custom-switch'>\"\n checkbox << check_box_tag('f_desc[]', valor, false, class: \"custom-control-input\", id: \"f_#{tipo_descarga}_#{valor}\")\n checkbox << \"<label class='custom-control-label' for='f_#{tipo_descarga}_#{valor}'>#{label}</label>\"\n checkbox << \"</div>\"\n end\n\n \n end\n\n checkbox.html_safe\n end", "def same_address_checkbox\n $tracer.trace(__method__)\n #unit_test_no_generate: same_address_checkbox, input.id(\"BillingSame\").type('checkbox')\n return ToolTag.new(input.id(\"BillingSame\").type('checkbox'), __method__, self)\n end", "def add_checkbox_field(form, model, field, text, checked=false)\n html = <<-HTML\n <div class=\"form-group\">\n <div class=\"col-sm-3\">&nbsp;</div>\n <div class=\"col-sm-9\">\n <label>\n #{form.check_box(field, :checked => checked)}\n <span class=\"lbl\"> #{text}</span>\n </label>\n </div>\n </div>\n HTML\n html.html_safe\n end", "def input_checkbox_group(name, options = [])\n field = field_content(name)\n field_name = prop(field, 'name') || name\n group = {}\n unless field.nil?\n group[:question] = prop(field, 'question')\n group[:name] = field_name\n group[:checkboxes] = options.presence || options_group(prop(field, 'options'), field_name)\n end\n group\n end", "def wiki_checkbox\n adding_field do |f|\n output = \"\".html_safe\n output << f.label(:wiki, \"Wiki\")\n output << f.check_box(:wiki)\n output\n end\n end", "def create_checkbox_field(form, value, name, label, field_id, validation: nil, readonly: false)\n render partial: 'dynamic_form/fields/checkbox_field',\n locals: {\n f: form,\n field_value: value,\n field_name: name,\n field_label: label,\n field_id:,\n readonly:,\n validation:\n }\n end", "def build_hidden_field_for_checkbox\n @builder.hidden_field(attribute_name, :value => unchecked_value, :id => nil,\n :disabled => input_html_options[:disabled],\n :name => input_html_options[:name])\n end", "def checkbox(name, value=nil, options={})\n selected = ''\n selected = \" checked='1'\" if value\n attrs = options.map { |(k, v)| \" #{h k}='#{h v}'\" }.join('')\n\n [ \"<input type='hidden' name='#{name}' value='0'>\" +\n \"<input#{attrs} type='checkbox' name='#{name}' value='1'#{selected}>\"\n ].join(\"\\n\")\n end", "def checkbox(name, value=nil, options={})\n selected = ''\n selected = \" checked='1'\" if value\n attrs = options.map { |(k, v)| \" #{h k}='#{h v}'\" }.join('')\n\n [ \"<input type='hidden' name='#{name}' value='0'>\" +\n \"<input#{attrs} type='checkbox' name='#{name}' value='1'#{selected}>\"\n ].join(\"\\n\")\n end", "def filterList(input)\n set = false\n [*input].each_with_object([]) do |item, output|\n item = item.to_s\n item = item.chomp if (@accessoryType == 'combobox') ||\n (@accessoryType == 'radiobutton' && set)\n set = true if item.end_with?(\"\\n\")\n output << item unless item.empty? || (output & [item, \"#{item}\\n\"]).any?\n end\n end", "def label_select_home(filter, value)\n html = nil\n if filter&.include?(value)\n html = <<-HTML\n <input class=\"form-check-input hidden required\" type=\"checkbox\" value=\"#{value}\" name=\"criteria[knowledge_level][]\" id=\"criteria_knowledge_level_#{value}\" checked>\n <label class=\"collection_check_boxes category-choice-home active\" for=\"criteria_knowledge_level_#{value}\">\n #{value.capitalize}\n </label>\n HTML\n else\n html = <<-HTML\n <input class=\"form-check-input hidden required\" type=\"checkbox\" value=\"#{value}\" name=\"criteria[knowledge_level][]\" id=\"criteria_knowledge_level_#{value}\">\n <label class=\"collection_check_boxes category-choice-home\" for=\"criteria_knowledge_level_#{value}\">\n #{value.capitalize}\n </label>\n HTML\n end\n html.html_safe\n end", "def checklist_items=(value)\n @checklist_items = value\n end", "def nombresComunesChecklist(taxon)\n return unless params[:f_desc].present?\n return unless params[:f_desc].include?('x_nombres_comunes')\n\n nombres = taxon.dame_nombres_comunes_catalogos\n return '' unless nombres.any?\n html = \"<label class='etiqueta-checklist'>Nombre(s) común(es):</label> \"\n\n nombres_completos = []\n nombres.each do |hash_nombres|\n lengua = hash_nombres.keys.first\n nombres_completos << \"<span>#{hash_nombres[lengua].uniq.sort.join(', ')} <sub>(#{lengua})</sub></span>\"\n end\n\n html << nombres_completos.join('; ') + '.' if nombres_completos.any?\n @@html << \"<p class='m-0'>#{html}</p>\"\n end", "def quick_checkbox(how, what)\n QuickCheckbox.new(self, how, what, parent_widget, window_id, :checkbox)\n end", "def check_box_field_template(l = {})\n <<-END\n <div data-role=\"fieldcontain\" id=\"#{l[:div_id]}\" class=\"field\">\n\t #{l[:element]} #{l[:label]} #{l[:decoration]}<br />\n\t #{\"<p class=\\\"field_description\\\">#{l[:description]}</p>\" unless l[:description].blank?}\n\t </div>\n\t END\n end", "def checkbox_checked\n return 'checked=checked' if show\n\n ''\n end", "def check_list(model)\n\t\tmodal = \"<div class='modal hide fade content_tab2' id='check_#{model.nome}'>\"\n\t\tmodal += \"<div class='modal-header'>\"\n\t\tmodal += \"<button type='button' class='close' data-dismiss='modal' aria-hidden='true'>&times;</button>\"\n\t\tmodal += \"<h3>CHECK LIST</h3>\"\n\t\tmodal += '</div>'\n\t\tmodal += \"<div class='modal-body'>\"\n\t\tmodal += \"<ul class='checklist'>\"\n\t\tmodel.produtos.each do |p|\n\t\t\tmodal += \"<li><input type='checkbox'/>#{p.nome}</li>\"\n\t\tend\n\t\tmodal += \"</ul>\"\n\n\t\tmodal += \"</div>\"\n\t\tmodal += \"</div>\"\n\n\t\traw modal\n\tend", "def box_set_results_for(set_of_boxes)\n set_of_boxes.map { |box| is_there_a_check_on(box) }\nend", "def html(cell_value)\n if multi_value?\n prefix = '<li class=\"check_box_true\"><span>'\n postfix = '</span></li>'\n end\n\n texts(cell_value).collect{|t| \"#{prefix}#{t}#{postfix}\" }.join\n end", "def add_checkbox(text, id=nil)\n html = <<-HTML\n <div class=\"form-group\">\n <div class=\"col-sm-3\">&nbsp;</div>\n <div class=\"col-sm-9\">\n <label>\n <input type=\"checkbox\" id=\"#{id unless id.nil?}\">\n <span class=\"lbl\"> #{text}</span>\n </label>\n </div>\n </div>\n HTML\n html.html_safe\n end", "def consent_checkbox_label\n # unit_test_no_generate: consent_checkbox_label, label.className(create_ats_regex_string(\"ats-consentboxlbl\"))\n $tracer.trace(__method__)\n return ToolTag.new(label.className(create_ats_regex_string(\"ats-consentboxlbl\")), __method__)\n end", "def checkbox(key)\n field_type = @form.getFieldType(key.to_s)\n return unless field_type == @acrofields.FIELD_TYPE_CHECKBOX\n\n all_states = @form.getAppearanceStates(key.to_s)\n yes_state = all_states.reject{|x| x == \"Off\"}\n \n \n @form.setField(key.to_s, yes_state.first) unless (yes_state.size == 0)\n end", "def checklist(text, items, height=0, width=0, listheight=0)\n itemlist = items.map do |item|\n str = %(\"#{item[0]}\" \"#{item[1]}\" \"#{item[2] ? 'on' : 'off'}\")\n @itemhelp ? %(#{str} \"#{item[3]}\") : str\n end.join(' ')\n\n command = %(--checklist \"#{text}\" #{height.to_i} #{width.to_i} #{listheight.to_i} #{itemlist})\n call_and_capture command do |value|\n selected_string = value.chomp.chomp('\"')\n selected_string.split('\" \"').collect{|item| item.delete!('\\\\')}\n end\n end", "def display_distinct_label_and_check_box\n tag.section do\n check_box_tag(:distinct, '1', user_wants_distinct_results?, class: :cbx) +\n label_tag(:distinct, 'Return distinct records')\n end\n end", "def check_box_tag(name, options = {})\n html = content_tag(:dt) do\n content_tag(:label , \"#{options.delete(:label)}:\", :for => options[:id])\n end\n\n options[:class] = append_class_name(options[:class], 'checkbox')\n html << content_tag(:dd) do\n checked = options.delete(:value).to_s != 'false'\n @super.hidden_field_tag(name, \"0\", :id => \"#{options[:id]}_hidden\") +\n @super.check_box_tag(name, \"1\", checked, options)\n end\n end" ]
[ "0.68280846", "0.679491", "0.6624006", "0.65273535", "0.63910574", "0.6323731", "0.6249029", "0.6192223", "0.61546016", "0.61353314", "0.61196727", "0.6092349", "0.60013986", "0.5910738", "0.5887161", "0.58766425", "0.5864241", "0.58504075", "0.58073705", "0.5799527", "0.57901967", "0.57319117", "0.573026", "0.5702928", "0.5669143", "0.56560665", "0.5648533", "0.56474495", "0.56439924", "0.5622784", "0.5605494", "0.55778956", "0.5572903", "0.5568354", "0.5557443", "0.5531081", "0.5527876", "0.55144525", "0.55135465", "0.5496438", "0.5484934", "0.54689676", "0.54666346", "0.54405105", "0.54405105", "0.54328614", "0.5422773", "0.5422609", "0.54195505", "0.53770804", "0.53761995", "0.5338845", "0.5338722", "0.53363615", "0.5294099", "0.52795464", "0.5271214", "0.5267059", "0.5257073", "0.52188903", "0.5210843", "0.5206516", "0.52008355", "0.519765", "0.5194777", "0.51916766", "0.51875514", "0.5187419", "0.5177467", "0.51477325", "0.51302576", "0.51246476", "0.5122513", "0.51133466", "0.50870115", "0.5084817", "0.5079765", "0.5071075", "0.5069101", "0.5063711", "0.5048998", "0.5047433", "0.5038362", "0.5038362", "0.5038236", "0.50289416", "0.5023498", "0.5007947", "0.5006196", "0.50060856", "0.5005702", "0.49934435", "0.49877813", "0.49695575", "0.4960776", "0.49596947", "0.4954199", "0.49514595", "0.4951325", "0.49476385" ]
0.7032377
0
Recursive function for display categories or components finds parents and then children and organizes them in this way to display
def main_menu_accord(items_hash, show_properties=false, depth=0) if(depth == 0 && items_hash.keys.empty?) return "No Items Available" end if(@items_to_select.nil?) @items_to_select = [] end if(items_hash.keys.empty?) return "" end pt = "<ul " if(depth == 0) pt += "id=\"id#{Time.now.usec}\" class=\"accordion\"" end pt+=">" expand = true for item in items_hash.keys pt += "<li" if(depth == 0 && expand && (!item.is_a?(Property) || !item.valuefields.empty?)) pt += " class=\"expand\"" expand = false end pt +=">" if(item.is_a?(Category)) pt += "<div class=\"inline\">&nbsp&nbsp&nbsp</div><label class=\"label_main_menu\">#{link_to(item.name, item)}</label>" elsif(item.is_a?(Component)) pt += "<div class=\"inline\">&nbsp&nbsp&nbsp</div><label class=\"label_main_menu\">#{link_to(item.name, 'tabs/component/' + item.id.to_s)}</label>" end pt += main_menu_accord(items_hash[item], show_properties, depth+1) pt += "</li>" end pt += "</ul>" return pt end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_children(taxons_collection)\n taxons_collection.sort_by {|p| p.hierarchy}\n html_var = \"\"\n taxons_collection.each do |t|\n if not t.children.empty?\n html_var << \"<li><i class='icon-plus'> </i>\" << link_to(t.name, t) << \"<ul>\" << list_children(t.children) << \"</ul>\"\n else\n html_var << \"<li><i class='icon-white' style='visibility: hidden;'> </i>\" << link_to(t.name, t)\n end\n html_var << \"</li>\\n\"\n end\n return html_var.html_safe\nend", "def print_parent_categories_table(component)\n s=\"<table class=\\\"tight_table\\\">\"\n s+=\"<tr>\"\n s+=\"<th align=\\\"left\\\">Categories</th>\"\n s+=\" </tr>\"\n\n if(!component.categories.empty?)\n for cat in component.categories.sort {|x,y| x.name <=> y.name }\n s+=\" <tr><td>#{link_to cat.name, cat, :target => 'blank'}</td></tr>\"\n end\n else\n s+=\" <tr><td>No Categories</td></tr>\"\n end\n\n s+=\"</table>\"\n\n return s\n end", "def find_all_sidebar_submenu_category(category)\n if !category.children.empty?\n html_code = ''\n category.children.each do |sub_category|\n html_code += '<div class=\"col-sm-12 col-md-3\">\n <ul class=\"links list-unstyled\">'\n html_code += print_sidebar_submenu_category(sub_category)\n html_code += '</ul></div>'\n end\n end\n html_code += ''\n end", "def render_recursively(output_path, title, obj, parent = '')\n renderer.render(output_path, parent, title, obj.get_thumbs, obj.filter)\n\n # For Doc object, returns a list of makes. For the NodeSet object, returns a list of models.\n obj.filter.each do |key|\n # Only recurse if not the same as the parent to avoid an infinite loop\n if title != key\n nodes = obj.search('work:contains(\"' + key + '\")')\n render_recursively(output_path, key, nodes, title)\n end\n end\n end", "def parse_category_tree\n dry_run_notification\n\n page_html = get_page_html @donor.url\n\n if page_html\n main_category_last = page_html.css('.content > .main-cat').last\n return false if main_category_last.nil?\n main_category_last.css('> .cat-item > .middle').each do |parent_category|\n parent_category_link = get_category_link(parent_category.at_css('a'))\n\n next if parent_category_link[:name].empty? && parent_category_link[:path].empty?\n\n category_parent = save_category(parent_category_link) unless DRY_RUN\n display_category_structure(parent_category_link, \"#{'-' * 80}\\n\")\n\n if parent_category\n parent_category.css('.main-cat > .cat-item > .middle').each do |subcategory_first_level_node|\n subcategory_first_level_link = get_category_link(subcategory_first_level_node.at_css('a'))\n\n subcategory_first_level = save_category(subcategory_first_level_link, category_parent.id) unless DRY_RUN\n display_category_structure(subcategory_first_level_link, ' ' * 2)\n\n subcategory_first_level_node.css('.main-cat > .cat-item > .middle').each do |subcategory_second_level_node|\n subcategory_second_level_link = get_category_link(subcategory_second_level_node.at_css('a'))\n\n save_category(subcategory_second_level_link, subcategory_first_level.id) unless DRY_RUN\n display_category_structure(subcategory_second_level_link, ' ' * 4)\n end\n end\n end\n end\n end\n end", "def category_tree\n cats = []\n categories.each do |cat|\n cats << cat\n cats = cats + cat.ancestors\n end\n return cats\n end", "def get_hierarchy(entity_class)\n content_tag(:ul, \n entity_class.find(:all, :conditions => 'parent_id IS NULL or parent_id = 0', :order => 'root_id, lft').collect {|root|\n get_subtree(root) }.join)\n end", "def parent_categories\n c = self\n categories = []\n until c.parent.blank? do\n c = c.parent\n categories.unshift c\n end\n categories\n end", "def render_tree(elements, symbols, parents = [])\n i = 0\n x = elements.map do |li|\n last = elements.length == i+1\n\n current = indentation(parents, last, symbols) + li[:value]\n\n children = \"\"\n if li[:children].length > 0\n children = \"\\n\" + render_tree(li[:children], symbols, parents + [last])\n end\n\n i += 1\n current + children\n end\n\n x.join(\"\\n\")\n end", "def index\n @blogs = Blog.all\n @parents = Category.all.where(ancestry: nil)\n # binding.pry\n # @grandchilds = Category.where(ancestry: \"1/3\")\n # @grandchilds2 = Category.where(ancestry: \"2/4\")\n end", "def collect_tree_up_from (foliage,\n parents,\n except_homepage,\n except_page,\n except_with_children)\n ancestry_string = parents.collect {|x| x.id.to_s }.join(\"/\")\n name_prefix = parents.collect {|x| x.title }.join(\" / \")\n name_prefix += \" / \" if name_prefix.present?\n\n our_mans_indexes = []\n foliage.each_index do |indx|\n if foliage[indx].ancestry.to_s == ancestry_string\n our_mans_indexes << indx\n end\n end\n\n leaves = []\n\n our_mans_indexes.reverse!\n our_mans_indexes.each do |indx|\n leaves << foliage.delete_at(indx)\n end\n\n leaves.sort! {|a,b| (a.prior == b.prior) ? a.id <=> b.id : a.prior <=> b.prior }\n result = []\n\n leaves.each do |leaf|\n do_writing = true\n if (except_page && leaf == except_page) || (except_homepage && leaf.home?)\n do_writing = false\n end\n result << [ name_prefix + leaf.title, leaf.id ] if do_writing\n unless do_writing == false && except_with_children\n result += collect_tree_up_from foliage,\n (parents + [ leaf ]),\n except_homepage,\n except_page,\n except_with_children\n end\n end\n\n result\n end", "def walk(elements, max_depth, *args)\n output = ''\n\n # invalid parameter or nothing to walk\n return output if max_depth < -1 || elements.blank?\n\n parent_field = @db_fields[:parent]\n\n # flat display\n if -1 == max_depth\n empty_array = {}\n elements.each do |e|\n display_element(e, empty_array, 1, 0, args, output)\n end\n return output\n end\n\n # Need to display in hierarchical order.\n # Separate elements into two buckets: top level and children elements.\n # Children_elements is two dimensional array, eg.\n # Children_elements[10][] contains all sub-elements whose parent is 10.\n top_level_elements = []\n children_elements = {}\n elements.each do |e|\n if e.send(parent_field).blank? || e.send(parent_field) == 0\n top_level_elements << e\n else\n children_elements[e.send(parent_field)] ||= []\n children_elements[e.send(parent_field)] << e\n end\n end\n\n # When none of the elements is top level.\n # Assume the first one must be root of the sub elements.\n if top_level_elements.blank?\n root = elements.first\n\n top_level_elements = []\n children_elements = {}\n elements.each do |e|\n if root.send(parent_field) == e.send(parent_field)\n top_level_elements << e\n else\n children_elements[e.send(parent_field).to_i] ||= []\n children_elements[e.send(parent_field).to_i] << e\n end\n end\n end\n\n top_level_elements.each do |e|\n display_element(e, children_elements, max_depth, 0, args, output)\n end\n\n # If we are displaying all levels, and remaining children_elements is not empty,\n # then we got orphans, which should be displayed regardless.\n if max_depth == 0 && !children_elements.empty?\n empty_array = {}\n children_elements.values.each do |orphans|\n orphans.each do |op|\n display_element(op, empty_array, 1, 0, args, output)\n end\n end\n end\n output\n end", "def populate_inheritance_heirarchy\n apps_and_templates = appTemplates + templates\n apps_and_templates.each do |temp| \n temp.attributes[:parent].to_s != '' ? app_or_temp = temp.attributes[:parent] :\n temp.attributes[:template].to_s != '' ? app_or_temp = temp.attributes[:template]:\n next\n next if app_or_temp == \"what the fuck?\"\n # if temp.attributes[:parent].is_a? String or temp.attributes[:template].is_a? String\n if not app_or_temp.empty?\n parent_template = self.templates.find { |template| template.name.downcase == app_or_temp.downcase }\n temp.child_of << parent_template\n parent_template.parent_of << temp\n end\n end \n end", "def display_parent_collections(document)\n\n text=\"\"\n parents = document.display_sets\n if parents.kind_of?(Array) and parents.count > 0\n unless parents.count == 1 && parents.first == \"info:fedora/hull:rootDisplaySet\"\n text = <<-EOS\n <div id=\"collections\" >\n <fieldset id=\"collection-fields\">\n <legend>#{pluralize(parents.count,\"In Collection\")[2..-1]}</legend>\n <div id=\"collections-list\">\n <dl>\n EOS\n parents.each { |id| \n pid=id.partition(\"/\")[2]\n text << <<-EOS\n <dt>\n EOS\n text << link_to(DisplaySet.name_of_set(pid), resource_path(pid)) \n text << <<-EOS\n </dt>\n EOS\n }\n text << <<-EOS\n </dl>\n </div>\n </fieldset>\n </div>\n EOS\n end\n end \n \n text.html_safe\n end", "def show\n #binding.pry\n add_breadcrumb \"Articles\",articles_path\n [email protected]\n if cat\n cat.ancestors.reverse_each { |a| add_breadcrumb a.name,category_path(a) }\n add_breadcrumb cat.name,category_path(cat)\n end\n add_breadcrumb @article.title,article_path\n #ASK how to make this more DRY\n end", "def show\n #require \"debugger\"\n #debugger\n @category = Category.find(params[:id])\n current_category = @category\n #@parent_stack = []\n # \n #while current_category.parent do\n # @parent_stack.unshift(current_category.parent)\n # current_category = current_category.parent\n #end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category }\n end\n end", "def generate_class_tree_level(parent='')\n $all.map { |klass|\n if parent == klass['parentname']\n [\n klass['name'],\n \"classes/#{klass['fullname']}.html\", # klass.path, \n '',\n generate_class_tree_level(klass['fullname'])\n ]\n else\n nil\n end\n }.compact\nend", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def render_children options = {}\n return if children.empty?\n\n flattened_children.map{ |child| render_child(child, options) }.join\n end", "def render_facet_hierarchy_item(field_name, data, key)\n item = data[:_]\n subset = data.reject { |k,v| ! k.is_a?(String) }\n \n li_class = subset.empty? ? 'h-leaf' : 'h-node'\n li = ul = ''\n \n if item.nil?\n li = key\n elsif facet_in_params?(field_name, item.qvalue)\n li = render_selected_qfacet_value(field_name, item)\n else\n li = render_qfacet_value(field_name, item)\n end\n \n unless subset.empty?\n subul = subset.keys.sort.collect do |subkey| \n render_facet_hierarchy_item(field_name, subset[subkey], subkey) \n end.join('')\n ul = \"<ul>#{subul}</ul>\".html_safe\n end\n \n %{<li class=\"#{li_class}\">#{li.html_safe}#{ul.html_safe}</li>}.html_safe\nend", "def parse_category_tree\n dry_run_notification\n\n page_html = get_page_html \"#{@donor.url}/mall/index.htm\"\n return display_error \"\\e[33;1m#{self.class}##{__method__}\\e[0m failed to get page html\" if page_html.blank?\n\n page_html.css('#headerWarp .cateAllList ul li').each do |menu_item|\n category_link_level_1 = get_link menu_item.at_css('dt a')\n category_level_1 = save_category(category_link_level_1) unless DRY_RUN\n display_category_structure category_link_level_1, \"#{'-' * 80}\\n\"\n\n menu_item.css('dd a').each do |menu_sub_item|\n category_link_level_2 = get_link menu_sub_item\n save_category(category_link_level_2, category_level_1.id) unless DRY_RUN\n display_category_structure category_link_level_2, ' '\n end\n end\n end", "def indented_child_options type, parent, depth=0, selected_id\n\n result = []\n unless parent.children.empty?\n parent.children.sort { |a, b| a.title.downcase <=> b.title.downcase }.each do |child|\n child_path = send(\"#{type.model_name.underscore}s_path\", :uri=>child.term_uri, :label=> child.title)\n assay_stat = child.assays.size == 0 ? \"\" : \"<span style='color: #666666;'>(#{child.assays.count} assays)</span>\".html_safe\n ontology_term_li = link_to(child.title, child_path).html_safe\n user_defined_term_li = link_to(child.title, child_path, {:style => \"color:green;font-style:italic\"}) + \"*\" + \" \" +\n (child.can_edit? ? link_to(image(\"edit\"), edit_polymorphic_path(child), {:style => \"vertical-align:middle\"}) : \"\") + \" \" +\n (child.can_destroy? ? (child.assays.count == 0 && child.children.empty? ? link_to(image(\"destroy\"), child, :confirm =>\n \"Are you sure you want to remove this #{child.class.name}? This cannot be undone.\",\n :method => :delete, :style => \"vertical-align:middle\") : \"\") : \"\").html_safe\n child_link = (child.respond_to?(:is_user_defined) && child.is_user_defined) ? user_defined_term_li : ontology_term_li\n\n result << (\"<li style=\\\"margin-left:#{12*depth}px;#{child.id == selected_id ? \"background-color: lightblue;\" : \"\"}\\\">\"+ (depth>0 ? \"└ \" : \" \") + child_link + assay_stat +\n \"</li>\")\n result = result + indented_child_options(type, child, depth+1,selected_id) if child.has_children?\n end\n end\n return result\n end", "def apply_children\n \n end", "def layout_children\n \n end", "def categories\r\n return handle_resource_not_found unless @article_category\r\n\r\n add_category_breadcrumbs(@article_category)\r\n if @article_category.leaf?\r\n @title_text = @article_category.display_text\r\n @articles = fetch_articles(order_by, nil, :conditions => {:article_category_id => @article_category.id}, :include => [:user, :article_category])\r\n @other_recent_posts = @article_category.parent.all_recent_posts(:exclude_category => @article_category) if @article_category.parent\r\n render 'articles/subcategories'\r\n else\r\n return unless check_category_for_stale\r\n @subcategories_with_posts = @article_category.children.with_published_articles\r\n render 'articles/categories'\r\n end\r\n end", "def category_links(category)\n links = \"\"\n iterated_cat = category\n if iterated_cat.parent.nil?\n links = insert_category_link(links,iterated_cat)\n else \n i = 0\n while !iterated_cat.parent.nil? and iterated_cat != Sfcatnode.root\n links = insert_category_link(links,iterated_cat)\n iterated_cat = iterated_cat.parent\n i+= 1\n end\n end\n links.insert(0,\"#{link_to('All Solutions', :action => 'index')}\")\n end", "def index\n category = params[:category]\n category = category == nil ? ROOT_ID : category.to_i\n\n current_category = Category.find(category)\n\n # Create an array of nearest childs of current_category\n @categories = current_category.categories\n\n # Create ancestors path\n @category_seq = [current_category]\n until @category_seq.first.id == ROOT_ID\n @category_seq.unshift( @category_seq[0].category )\n end\n\n # Create an array of all childs\n subcategories = get_subc(current_category)\n\n # Create an array of all products which belongs to current_category\n @items = current_category.products.to_a\n\n subcategories.each do |c|\n c.products.each { |p| @items.push p }\n end\n\n @items = Kaminari.paginate_array(@items).page(params[:page]).per(7)\n\n respond_to do |format|\n format.html\n format.js {}\n end\n\n\tend", "def render_entry_children(context, page, depth)\n output = %{}\n\n children = children(page).reject { |c| !include_page?(c) }\n if children.present?\n dropdown_class = @source == 'site' && page.depth == 1 ? @options[:dropdown_class] : ''\n output = %{<ul id=\"#{@options[:id]}-#{page.slug.to_s.dasherize}\" class=\"#{bootstrap? ? 'dropdown-menu' : dropdown_class}\">}\n children.each do |c, page|\n css = []\n css << 'first' if children.first == c\n css << 'last' if children.last == c\n\n output << render_entry_link(context, c, css.join(' '), depth)\n end\n output << %{</ul>}\n end\n\n output\n end", "def render_children\n children = ''\n\n list_item.children.each do |child|\n children += self.class.render(child, opts)\n end\n\n children\n end", "def cat_loop\n # sort by cat, then subcat, then sub subcat\n current_cat = ''\n current_subcat = ''\n\n category_rows.each do |c|\n # Loop through and write the cat, subcat or subsubcat if it has not already been written (so it is unique)\n cat = c['CategoryPath'].split('->')[0]\n subcat = c['CategoryName'] || ''\n\n if current_cat != cat\n output << category_tag + cat + line_break\n current_cat = cat\n end\n\n if current_subcat != subcat\n output << tags[:product] + subcat + \"\\t\" + line_break\n current_subcat = subcat\n end\n end\n\n output\n end", "def do_chain_layout(sugar) \n seen_chains = []\n sugar.residue_composition.select { |r| ['GlcNAc','Gal'].include?(r.name(:ic)) }.each { |chain_start|\n debug(\"CHAIN:Start residue name is #{chain_start.name(:ic)}\")\n next if seen_chains.include?(chain_start)\n debug(\"CHAIN:Not seen before\")\n child_chains = sugar.get_chains_from_residue(chain_start).sort_by { |chain| chain.size }\n debug(\"CHAIN:In total there are #{child_chains.size} chains from this position\")\n child_chains.each { |child_chain|\n debug(\"CHAIN:A chain size is #{child_chain.size}\")\n next unless child_chain.size > 1\n debug(\"CHAIN: Doing a chain layout\")\n chain_desc = child_chain.collect {|r| r.name(:ic)+\"#{r.anomer},#{r.paired_residue_position}\"}.join(',')\n debug(\"CHAIN:Chain is #{chain_desc}\")\n\n chain_end = child_chain[-1]\n \n child_chain.reject! { |c| seen_chains.include?(c) }\n\n if child_chain.size > 0\n layout_chain(child_chain)\n seen_chains += child_chain\n end\n debug(\"CHAIN:Trying to arrange children for #{chain_end.name(:ic)}\")\n \n layout_chain_terminals(chain_end)\n\n seen_chains += (sugar.residue_composition(chain_end))[1..-1]\n }\n }\n return seen_chains\n # All chains should be starting at 0,0 and be laid out as straight (or shifted up for 6) lines\n end", "def categories_for_solution_search(category)\n [Sfcatnode.root] + category.children\n end", "def generateChildNodeBy(hashCategory)\n\t\tif hashCategory.nil? then return nil\n\t\telse return treeDisplay(hashCategory) end\n\tend", "def list\r\n\t\t@current_area = 'categories'\r\n\t\t@current_menu = 'products'\r\n\r\n\t\tif params[:select]\r\n\t\t\tif params[:delete]\r\n\t\t\t\t# you MUST manually move child nodes in an acts_as_tree up before calling\r\n\t\t\t\t# the destroy! method. Otherwise Rails will automatically go and delete all\r\n\t\t\t\t# the child nodes even before the selected nodes' 'before_destroy' callback\r\n\t\t\t\t# is triggered!\r\n\t\t\t\tparams[:select].keys.each do |k|\r\n\t\t\t\t\tthe_cat = Category.find(k)\r\n\t\t\t\t\tthe_cat.move_children_up()\r\n\t\t\t\t\tCategory.destroy(the_cat.id)\r\n\t\t\t\tend\r\n\t\t\telsif params[:move_up]\r\n\t\t\t\t# We have to use a Hash as Array iterators do not like sparse indexing.\r\n\t\t\t\tselected_categories = Hash.new\r\n\t\t\t\tcat_index = Hash.new\r\n\t\t\t\tparams[:select].keys.each do |k|\r\n\t\t\t\t\tc = Category.find(k)\r\n\t\t\t\t\tif selected_categories[c.parent_id].nil?\r\n\t\t\t\t\t\tselected_categories[c.parent_id] = Hash.new\r\n\t\t\t\t\tend\r\n\t\t\t\t\tselected_categories[c.parent_id][c.id] = c.sequence\r\n\t\t\t\t\tcat_index[c.id] = c\r\n\t\t\t\tend\r\n\t\t\t\tselected_categories.each do |i, parent|\r\n\t\t\t\t\t# Hash.sort converts the hash into a nested array before sorting; [0] = key, [1] = value.\r\n\t\t\t\t\t# Note that we only want the IDs which are contained in the index 'j'.\r\n\t\t\t\t\tparent.sort{|a,b| (a[1]<=>b[1])}.each do |j, the_sequence|\r\n\t\t\t\t\t\tcat_index[j].move_higher\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\telsif params[:move_down]\r\n\t\t\t\t# See comments for move_up above\r\n\t\t\t\tselected_categories = Hash.new\r\n\t\t\t\tcat_index = Hash.new\r\n\t\t\t\tparams[:select].keys.each do |k|\r\n\t\t\t\t\tc = Category.find(k)\r\n\t\t\t\t\tif selected_categories[c.parent_id].nil?\r\n\t\t\t\t\t\tselected_categories[c.parent_id] = Hash.new\r\n\t\t\t\t\tend\r\n\t\t\t\t\tselected_categories[c.parent_id][c.id] = c.sequence\r\n\t\t\t\t\tcat_index[c.id] = c\r\n\t\t\t\tend\r\n\t\t\t\tselected_categories.each do |i, parent|\r\n\t\t\t\t\t# Note order of b/a is swapped to move down. This and move_lower instead of move_higher\r\n\t\t\t\t\t# is the only difference between this and the move_up code above.\r\n\t\t\t\t\tparent.sort{|a,b| (b[1]<=>a[1])}.each do |j, the_sequence|\r\n\t\t\t\t\t\tcat_index[j].move_lower\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\t\texpire_fragment(:controller => :products, :action => :home, :part => 'category_menu')\r\n\t\tend\r\n\r\n\t\t@root_cat = Category.find(1)\r\n\tend", "def render_entry_children(context, page, depth)\n output = %{}\n\n children = page.children_with_minimal_attributes(@options[:add_attributes]).reject { |c| !include_page?(c) }\n if children.present?\n output = %{<ul id=\"#{@options[:id]}-#{page.slug.to_s.dasherize}\" class=\"#{bootstrap? ? 'dropdown-menu' : ''}\">}\n children.each do |c, page|\n css = []\n css << 'first' if children.first == c\n css << 'last' if children.last == c\n\n output << render_entry_link(context, c, css.join(' '), depth)\n end\n output << %{</ul>}\n end\n\n output\n end", "def child_components()\n @child_components\n end", "def category_tree\n @category_tree = {}\n get_category_browse_nodes.each do |n|\n build_category_tree(n)\n end\n @category_tree\n end", "def parse_category_tree\n dry_run_notification\n sub_menu_url = \"#{donor_domain}/web/index.php/home/data_sub_menu\"\n page_html = get_page_html \"#{donor_domain}/web/\"\n page_html.css('#menu_ul li').each do |parent_category|\n parent_category_id = parent_category[:source3]\n next if parent_category_id.blank?\n\n # Get sub menu html by category id\n sub_menu_page_html = get_page_html(sub_menu_url, :post, { cat_id: parent_category_id })\n\n next if sub_menu_page_html.blank?\n\n parent_category_link = get_link sub_menu_page_html.at_css('a')\n\n # Parent category name en/th language versions separated by \"/\"\n parent_category_link[:name] = parent_category_link[:name].split(' / ')[('en' == @lang) ? 0 : 1]\n category_parent = save_category(parent_category_link) unless DRY_RUN\n display_category_structure(parent_category_link, \"#{'-' * 80}\\n\")\n\n sub_menu_page_html.css('.inner > ul > li').each do |subcategory_first_level_node|\n subcategory_first_level_link_node = subcategory_first_level_node.at_css('.a_header')\n subcategory_first_level_link = get_link(subcategory_first_level_link_node)\n # Name convert notes:\n # 1. Get raw link html with inner_html() in order to get en/th language versions separated by \"<br>\"\n # 2. Method content() convert html entities to characters: &Amp; --> &, &#3650;&#3607; --> โท\n # 3. Converting methods order: squish() must be the last operation, otherwise spaces left\n subcategory_first_level_link[:name] = get_name(\n Nokogiri::HTML.fragment subcategory_first_level_link_node.inner_html.split('<br>')[('en' == @lang) ? 0 : 1]\n )\n subcategory_first_level = save_category(subcategory_first_level_link, category_parent.id) unless DRY_RUN\n display_category_structure(subcategory_first_level_link, ' ' * 2)\n\n subcategory_first_level_node.css('.sub_menu a').each do |subcategory_second_level_node|\n subcategory_second_level_link = get_link(subcategory_second_level_node)\n save_category(subcategory_second_level_link, subcategory_first_level.id) unless DRY_RUN\n display_category_structure(subcategory_second_level_link, ' ' * 4)\n end\n end\n end if page_html\n end", "def navigation_children\n sorted_children\n end", "def sort_categories\n #loop to sort categories parents and children\n for cat in @all_categories\n #if category parent id == nill then hash = current category else if parent id of category = nil then parent id hash is nil\n if(cat.parent_id.nil?)\n @all_categories_hash[0] = [cat]\n else\n if(@all_categories_hash[cat.parent_id].nil?)\n @all_categories_hash[cat.parent_id] = []\n end\n @all_categories_hash[cat.parent_id].push(cat)\n end\n end\n #Sort loop for categories\n for key in @all_categories_hash.keys\n @all_categories_hash[key].sort!{|x,y| x.name <=> y.name}\n end\n end", "def hierarchy\n p = self\n h = []\n while(p.parent != nil)\n h = [p] + h\n p = p.parent\n end\n h = [p] + h\n \n h\n end", "def category_menu_items(aRootCategory, aOptions={})\n\t\t\taBaseUrl = (aOptions[:base_url] || '')\n\t\t\taIdPrefix = (aOptions[:id_prefix] || '')\n\t\t\tcategory = aOptions[:category]\n\t\t\tcategory = category.name.urlize('+') if category.is_a?(Category)\n\t\t\ttree_nodes = construct_category_tree(aRootCategory)\n\t\n\t\t\t# now turn tree_nodes into menu items, still as array of levels\n\t\t\ttree_items = []\n\t\t\tlast_lvl = nil\n\t\t\ttree_nodes.each do |lvl|\n\t\t\t\titem_level = []\n\t\t\t\tlvl.each do |node|\n\t\t\t\t\tname = (node.name.index('/') ? File.basename(node.name) : node.name)\n\t\t\t\t\titem = {:id => aIdPrefix+node.id.to_s, :name => name }\t\n\t\t\t\t\titem[:node] = node\n\t\t\t\t\tif last_lvl && parent_item = last_lvl.find {|i| i[:node].id == node.parent_id}\n\t\t\t\t\t\tparent_item[:children] ||= []\n\t\t\t\t\t\tparent_item[:children] << item\n\t\t\t\t\t\titem[:url] = parent_item[:url]\n\t\t\t\t\t\titem[:url] += '+' unless item[:url]=='' || item[:url].ends_with?('/') || item[:url].ends_with?('+')\n\t\t\t\t\t\titem[:url] += name.urlize('-')\n\t\t\t\t\telse\n\t\t\t\t\t\titem[:url] = File.join(aBaseUrl,name.urlize('-'))\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\titem[:selected] = true if category && (category==node.name.urlize('+'))\n\t\t\t\t\titem[:order] = aOptions[:order_proc].call(item) if aOptions.has_key?(:order_proc)\n\t\t\t\t\titem_level << item\n\t\t\t\tend\n\t\t\t\ttree_items << item_level\n\t\t\t\tlast_lvl = item_level\n\t\t\tend\n\t\t\t# clean\n\t\t\ttree_items.each do |lvl|\n\t\t\t\tlvl.each do |i| \n\t\t\t\t\ti.filter_include!([:url,:selected,:id,:name,:children,:order])\n\t\t\t\t\ti[:children].sort! {|a,b| a[:order].to_i <=> b[:order].to_i} if i[:children].is_a?(Array)\n\t\t\t\tend\n\t\t\tend\n\t\t\ttree_items.first.sort! {|a,b| a[:order].to_i <=> b[:order].to_i}\n\t\t\ttree_items.first\n\t\tend", "def parents; end", "def add_child\n category_id = params[:id].gsub('category_', '')\n @category = Category.find(category_id)\n parent_id = params[:parent_id]\n if parent_id\n @parent = Category.find(parent_id)\n @category.parent = @parent \n else\n @category.parent = nil\n end\n @category.save!\n render :update do |page|\n page.remove(\"category_#{@category.id}_row\")\n if @parent\n if @parent.name == ASSOCIATION.short_name\n page.replace_html(\"category_root\", :partial => \"category\", :collection => @parent.children.sort)\n else\n page.call(:expandDisclosure, parent_id)\n end\n end\n if @parent.nil?\n page.replace_html(\"unknown_category_root\", :partial => \"category\", :collection => Category.find_all_unknowns.sort)\n end\n end\n end", "def ancestry_nested_comments(comments)\n comments.map do |comment, sub_comments|\n render(comment) + content_tag(:div, ancestry_nested_comments(sub_comments), class: 'ancestry_nested_comments')\n end.join.html_safe\n end", "def render(node = nil)\n elt = node | tree\n puts \"\\nNodes: #{elt.body.count}\"\n puts \"\\nAttributes:\"\n elt.attrs.each{ |k, v| puts(\"#{k}: #{v}\") }\n children = elt.body.select{ |i| i.is_a?(Node) }\n puts \"\\nChildren: #{children.each{ |c| render(c) }}\"\n\n\n end", "def children() []; end", "def restructure\n node_id = params[:node_id].to_i\n parent_id = params[:parent_id].to_i\n prev_id = params[:prev_id].to_i\n next_id = params[:next_id].to_i\n\n render :text => \"Do nothing\" and return if parent_id.zero? && prev_id.zero? && next_id.zero?\n\n @realty_category ||= parent.realty_categories.find(node_id)\n\n if prev_id.zero? && next_id.zero?\n @realty_category.move_to_child_of parent.realty_categories.find(parent_id)\n elsif !prev_id.zero?\n @realty_category.move_to_right_of parent.realty_categories.find(prev_id)\n elsif !next_id.zero?\n @realty_category.move_to_left_of parent.realty_categories.find(next_id)\n end\n end", "def children\n @id = fix_id(params[:id], params[:format], params[:extra])\n if params[:root]==\"source\" then\n @isRoot = true;\n @work = DcmWork.new(@id)\n @children = [@work.pi]\n else\n @isRoot = false;\n @children = get_children(\"nla.\"+params[:root])\n end\n render :action => \"children.json\"\n end", "def category_controls_tree(directive, category)\n controls = category.controls.where(:directive_id => directive).all\n children = category.children.all.map do |subcategory|\n category_controls_tree(directive, subcategory)\n end.compact\n if controls.size > 0 || children.size > 0\n [category, children, controls]\n else\n nil\n end\n end", "def getChildCategories\n Category.find(:all, :conditions => \"parent_category_id = #{self.id}\", :order => ':id')\nend", "def crumb_parents\n []\n end", "def display_tree() \n list = []\n yield @tree.value\n left_child = @tree.left_child\n right_child = @tree.right_child\n\n list << left_child if left_child != nil\n list << right_child if right_child != nil\n\n loop do\n break if list.empty?\n node = list.shift\n yield node.value\n list << node.left_child if node.left_child != nil\n list << node.right_child if node.right_child != nil\n end\n end", "def children_navigation(document)\n content_tag(\n :div,\n '',\n class: \"al-contents child-components children-count-#{document.number_of_children}\",\n data: {\n collapse: I18n.t('arclight.views.show.collapse'),\n expand: I18n.t('arclight.views.show.expand'),\n arclight: {\n level: document.component_level.to_i + 1,\n path: search_catalog_path(hierarchy_context: 'component'),\n name: document.collection_name,\n view: 'child_components',\n parent: document.reference,\n directparent: document.reference,\n childrencount: document.number_of_children,\n originalDocument: document.id,\n originalParents: [document.reference],\n eadid: normalize_id(document.eadid),\n per_page: '100'\n }\n }\n )\n end", "def components\n result = []\n\n @children.each do |_key, child_group|\n child_group.each do |child|\n result << child if child.is_a?(Component)\n end\n end\n\n result\n end", "def create_child_items\n category.path.each do |category|\n create_child_item_for_category category\n end\n end", "def show_tree\n\tend", "def get_sidebar_filter_categories(categories)\n html_code = ''\n if !categories.children.empty?\n\n html_code += '<div class=\"sidebar-module-container\">\n <div class=\"sidebar-filter\">\n <div class=\"sidebar-widget outer-bottom-small wow fadeInUp animated\">\n <h3 class=\"section-title\">shop by</h3>\n <div class=\"widget-header\">\n <h4 class=\"widget-title\">Category</h4>\n </div>\n <div class=\"sidebar-widget-body\">\n <div class=\"accordion\">'\n categories.children.each do |category|\n html_code += '<div class=\"accordion-group\">\n <div class=\"accordion-heading\">'\n html_code += link_to category.category_name, category_path(category: category.id), {class: 'accordion-toggle collapsed'}\n html_code += '</div></div>'\n end\n html_code += '</div></div></div></div></div>'\n end\n html_code.html_safe\n end", "def print_recursive_menu(menu_entry)\n menu_children = MenuEntry.find_all_by_parent_id(menu_entry.id)\n current_entry = \"<li>\" + menu_link(menu_entry) + \"</li>\"\n return current_entry if menu_children.size == 0\n current_entry = \"<li>\" + menu_link(menu_entry) + \"<ul>\"\n for menu_child in menu_children do\n current_entry += print_recursive_menu(menu_child)\n end\n current_entry += \"</ul></li>\"\n return current_entry\n end", "def display_segment( node )\n html = \"<li>\".html_safe\n node_class = \"folder\"\n if node.class == Venue\n node_class = \"file\"\n end\n if node.class == Organisation\n node_class = \"web-browser\"\n end\n if node == nil then\n html << \"<span class=\\\"#{node_class}\\\"> <a href=\\\"/location_tree/NIL\\\">Found NIL</a> </span>\".html_safe\n html << \"<ul id=\\\"children_of_NIL\\\">\".html_safe\n\n else\n html << \"<span class=\\\"#{node_class}\\\"> <a href=\\\"/location_tree/#{node.id}\\\">#{node.to_s}</a> </span>\".html_safe\n html << \"<ul id=\\\"children_of_#{node.id}\\\">\".html_safe\n node.children.each{|child_node|\n html << display_segment( child_node )}\n end\n html << \"</ul></li>\".html_safe\n end", "def children()\n #Ressource.filter(:parent_id => self.id, :parent_service_id => self.service_id).all\n end", "def array\n # assign the sorted tree to a variable\n newlist = params[:ul].sort\n # initialize the previous item\n previous = nil\n #loop through each item in the new list (passed via ajax)\n newlist.each_with_index do |array, index|\n # get the category id of the item being moved\n moved_item_id = array[1][:id].gsub(/category_/,'')\n # find the object that is being moved (in database)\n @current_category = Category.find_by_id(moved_item_id)\n # if this is the first item being moved, move it to the root.\n unless previous.nil?\n @previous_item = Category.find_by_id(previous)\n @current_category.move_to_right_of(@previous_item)\n else\n @current_category.move_to_root\n end\n # then, if this item has children we need to loop through them\n unless array[1][:children].blank?\n # NOTE: unless there are no children in the array, send it to the recursive children function\n childstuff(array[1], @current_category)\n end\n # set previous to the last moved item, for the next round\n previous = moved_item_id\n end\n Category.rebuild!\n render :nothing => true\n end", "def solution(t)\n # write your code in Ruby 2.2\n depth = 0\n childs = []\n\n childs << t.l if t.l\n childs << t.r if t.r\n\n while not childs.empty? do\n depth += 1\n\n cc = []\n childs.each do |t|\n cc << t.l if t.l\n cc << t.r if t.r\n end\n\n childs = cc\n end\n\n depth\nend", "def get_children_recursion(node)\n\tif node.class == SOCIAL_NETWORK[0].class\n\t\tnode.children.each do |child|\n\t\t\tget_children_recursion(delegate_word(child))\n\t\tend\n\tend\nend", "def ascendants(result = nil, depth = 0)\n \n if (result.nil?)\n result = Hash.new\n end\n \n parents.each do |par|\n node = Array.new\n node[0] = par\n par_spice = par.spice\n if (!par_spice.nil? && par_spice.length > 0)\n # TBD: I know there is a Ruby way to copy an array but can't look it up on the plane - just copy myself for now\n spouse_list = Array.new\n par_spice.each do |s|\n spouse_list << s\n end\n node[1] = spouse_list\n end\n result[node] = depth\n par.ascendants(result, depth + 1)\n end \n \n return result\n \n end", "def index\n if params[:roots]\n @categories = Category.roots\n else\n @categories = Category.children\n end\n\n @categories = @categories.paginate(:page => params[:page], :per_page => 25)\n end", "def descendents\n\n\t\t #children.preload(:parent).each do |child| child.descendents end\n\t\t children.each do |child|\n\t [child] + child.descendents\n\t end\n end", "def get_all_children(catalog)\n catalog.descendant_catalogs\n end", "def show\n @category = Category.find(params[:id])\n if @main_category.nil?\n @categories = Category.where(:parent_id => nil).order('title')\n else\n @categories = @main_category.children\n end\n @ancestors_for_current = @category.ancestors.collect{|c| c.id.to_i} + [@category.id.to_i]\n respond_with(@category)\n end", "def children\n Brand.where(:parent => self.name).order('sort_order, name')\n end", "def category_list_classes depth, children\n depth_class = \"depth--#{depth}\"\n children_class = children.any? ? 'has-children' : ''\n \"#{depth_class} #{children_class}\"\n end", "def expand_categories(categories, text)\r\n html = '<ul class=\"'+text+'\">'\r\n categories.each do |cat|\r\n options = { :url => edit_article_category_path(cat), :method => :get, :loading => \"wait_for_content_update('edit')\" }\r\n child_categories = cat.children\r\n nested_html = child_categories.empty? ? '' : expand_categories(child_categories, \"subtitles\")\r\n html << '<li class=\"article_category\">' + link_to_remote(cat.display_text, options) + nested_html + '</li>'\r\n end\r\n html + '</ul>'\r\n end", "def self_and_siblings\n parent ? parent.children : Category.roots\n end", "def self_and_siblings\n parent ? parent.children : Category.roots\n end", "def rebuild_hierarchies!\n query(\"MATCH (:Page)-[parent:parent]->(:Page) DELETE parent\")\n query(\"MATCH (:Page)-[in_clade:in_clade]->(:Page) DELETE in_clade\")\n missing = {}\n related = {}\n # HACK HACK HACK HACK: We want to use Resource.native here, NOT ITIS!\n itis = Resource.where(name: \"Integrated Taxonomic Information System (ITIS)\").first\n raise \" I tried to use ITIS as the native node for the relationships, but it wasn't there.\" unless itis\n Node.where([\"resource_id = ? AND parent_id IS NOT NULL AND page_id IS NOT NULL\",\n itis.id]).\n includes(:parent).\n find_each do |node|\n page_id = node.page_id\n parent_id = node.parent.page_id\n next if missing.has_key?(page_id) || missing.has_key?(parent_id)\n page = page_exists?(page_id)\n page = page.first if page\n if page\n relate(\"in_clade\", page, page)\n end\n next if related.has_key?(page_id)\n parent = page_exists?(parent_id)\n parent = parent.first if parent\n if page && parent\n if page_id == parent_id\n puts \"** OOPS! Attempted to add #{page_id} as a parent of itself!\"\n else\n relate(\"parent\", page, parent)\n relate(\"in_clade\", page, parent)\n related[page_id] = parent_id\n # puts(\"#{page_id}-[:parent]->#{parent_id}\")\n end\n else\n missing[page_id] = true unless page\n missing[parent_id] = true unless parent\n end\n end\n related.each do |page, parent|\n puts(\"#{page}-[:in_clade*]->#{parent}\")\n end\n puts \"Missing pages in TraitBank: #{missing.keys.sort.join(\", \")}\"\n end", "def show\n\n component_type = @component.component_types.first\n\n add_breadcrumb \"#{component_type ? component_type.title : 'Товары'}\", component_type ? components_path(component_type_id: component_type.id) : components_path\n\n # http://stackoverflow.com/questions/35614878/breadcrumbs-on-rails-list-show-as-child-of-index\n add_breadcrumb \"#{@component.title}\", component_path(@component.id) \n\n @components = Component.where.not(id: params[:id]).includes(:component_types).where( :component_types => {:id => @component.component_types.first.id}).order(:title)\n end", "def _display_tree(max_length=20, tabs='')\n\t\tif(@type != '')\n\t\t\tprint(tabs + \"[\" + @type + ((@param != '')? '(' + @param.to_s + ')': '') + \"]\\n\")\n\t\telse\n\t\t\tprint(tabs + \"[TEMPLATE:\" + @template.template_file + \"]\\n\")\n\t\tend\n\n\t\tfor content in @contents\n\t\t\tif(content.is_a?(SifterElement))\n\t\t\t\tcontent._display_tree(max_length, tabs + \"\\t\")\n\t\t\telsif(content.is_a?(SifterTemplate))\n\t\t\t\tcontent._display_tree(max_length, tabs + \"\\t\")\n\t\t\telse\n\t\t\t\tcontent.gsub!(/[\\r\\n]/, ' ')\n\t\t\t\tprint(tabs + \"\\t[TEXT:\" + content[0, max_length] + \"]\\n\")\n\t\t\tend\n\t\tend\n\tend", "def children; []; end", "def categories_in_path(&block)\n list = []\n current_node = self\n while current_node && current_node.name != 'Categories'\n yield current_node if block_given?\n list.insert(0, current_node)\n current_node = current_node.parent\n end\n list\n end", "def output_hierarchy(output=$stdout)\n hierarchy.print_tree(output)\n end", "def comb_kinds tree\n entries_with_parent = tree.reject {|c| c[:parent].nil? }\n tree.each do |c|\n next c unless c[:kind] == 'v'\n maybe_child = entries_with_parent.select {|e| e[:parent] == c[:name]}\n unless maybe_child.empty?\n c[:kind] = 'o'\n end\n end\n tree\n end", "def find_all_parents\n end", "def flatten_hierarchy c=self\n result = [c]\n c.subclasses.each do |s|\n result += flatten_hierarchy(s)\n end\n result\n end", "def gen_xml \n @xml = Builder::XmlMarkup.new\n @parent_categories = CptCategory.find(:all, :conditions => [\"parent_id = 1002795\"])\n render :layout => false\n end", "def children\n self.class.children(self) \n end", "def build_items(item, limit, index, hierarchical = false, root_path = \"\")\n return \"\" if index > limit || !item.children.present?\n\n html = \"<ul class='#{index == 1 ? \"menu\" : \"sub-menu\"}'>\"\n item.children.order_default.each do |i|\n if i.visible && i.active\n html << \"<li class='#{\"menu-item-has-children\" if i.children.present?} #{\"active\" if i.slug == params[:menu_id] || i.slug == request.original_fullpath.match(/(\\D+\\/{1}|\\D+)/)[0].gsub('/', '')}'>\"\n\n if i.external_link.blank?\n if hierarchical\n html << \"<a href='#{root_path}/#{i.slug}'>#{i.name}</a>\"\n else\n html << \"<a href='/#{i.slug}'>#{i.name}</a>\"\n end\n else\n html << \"<a href='#{i.external_link}' rel='#{(i.follow || i.follow.nil?) ? \"follow\" : \"nofollow\"}' target='#{i.target.blank? ? '_self' : i.target}'>#{i.name}</a>\"\n end\n\n html << build_items(i, limit, index + 1, hierarchical, root_path + \"/#{i.slug}\")\n html << \"</li>\"\n end\n end\n html << \"</ul>\"\n html.html_safe\n end", "def node_tree(nodes, &block)\n \n nodes = nodes.dup\n printed_nodes = []\n \n result = \"<ul>\"\n \n # top level nodes first, then others\n for node in nodes\n next if node.instance_of?(Center) || node.instance_of?(Team)\n next unless node.parent == nil\n printed_nodes << node\n result += \"<li>\"\n\n if block_given?\n result += yield node\n else\n result += node.title\n end\n\n children = node.children.dup\n children.delete_if { |r| not nodes.include?(r) }\n if not children.empty?\n result += node_tree_help(children, nodes, printed_nodes, &block)\n end\n \n result += \"</li>\"\n end\n \n # TODO: Add depth counting here to get a minimum of trees\n for node in nodes\n next if printed_nodes.include? node\n printed_nodes << node\n \n result += \"<li>\"\n\n if block_given?\n result += yield node\n else\n result += node.title\n end\n\n children = node.children #.dup\n children.delete_if { |r| not nodes.include?(r) }\n\n if not children.empty?\n result += node_tree_help(children, nodes, printed_nodes, &block)\n end\n \n result += \"</li>\"\n end\n\n result += '</ul>'\n\n return result\n end", "def nested_array_to_html(nodes)\n classes = \"depth-#{ nodes.first[:depth] }\"\n classes += \" folder-tree\" if nodes.first[:depth].zero?\n\n html = \"<ul class=\\\"#{ classes }\\\">\"\n nodes.each do |node|\n html += \"<li>\"\n\n if node[:children]\n html += '<i class=\"icon-folder-close\"></i>'\n else\n html += '<i class=\"icon-file-alt\"></i>'\n end\n\n html += \"<span class=\\\"name\\\">#{ node[:name].strip }</span>\"\n unless (node[:children].nil? || node[:children].empty?)\n html += nested_array_to_html(node[:children]) \n end\n html += '</li>'\n end\n\n html += '</ul>'\n\n html\n end", "def get_children\n \t@children\n end", "def get_cates_descs\n categoryDescArr = []\n categoriesRoot = Category.where(parent_id: 0).limit(6)\n categoriesRoot.each do |parentCate|\n cateInfo = []\n firstChildren = Category.where(parent_id: parentCate.id).limit(3)\n childrenNameStr = ''\n firstChildren.each do |child|\n childrenNameStr += child.name+\",\"# remove last ,\n \n end\n \n cateInfo << parentCate.id\n cateInfo << parentCate.name\n cateInfo << childrenNameStr\n \n categoryDescArr << cateInfo\n\n end \n \n return categoryDescArr\n end" ]
[ "0.62460667", "0.61734307", "0.60595036", "0.60291016", "0.59943783", "0.59648705", "0.59152275", "0.5897785", "0.5880277", "0.5879299", "0.5876584", "0.5875109", "0.587058", "0.58647096", "0.58403486", "0.58352774", "0.58015704", "0.5794056", "0.5794056", "0.5794056", "0.5794056", "0.5794056", "0.5794056", "0.5794056", "0.5794056", "0.5794056", "0.5794056", "0.5794056", "0.5794056", "0.5752873", "0.5724409", "0.5713413", "0.5703737", "0.56742275", "0.5667875", "0.5662391", "0.56099576", "0.5597079", "0.55927235", "0.5585817", "0.55784285", "0.5573879", "0.55675036", "0.5564474", "0.5560981", "0.5538042", "0.5536163", "0.5528644", "0.5525241", "0.5524461", "0.55159897", "0.55148464", "0.5511711", "0.55075675", "0.55040467", "0.5500967", "0.5496248", "0.5495813", "0.5495352", "0.5473258", "0.5461422", "0.5443615", "0.544203", "0.5426526", "0.54145896", "0.53994745", "0.53943235", "0.537957", "0.53783906", "0.537615", "0.5374161", "0.53740233", "0.5364317", "0.5359189", "0.535575", "0.5354865", "0.5352223", "0.5349943", "0.5343667", "0.53317904", "0.532971", "0.53261274", "0.53239", "0.5314199", "0.5314199", "0.5310679", "0.53106767", "0.53043365", "0.53029585", "0.5296514", "0.5292642", "0.52856284", "0.52848905", "0.52805483", "0.5276754", "0.5273876", "0.52671134", "0.52534854", "0.52479833", "0.524543", "0.5244937" ]
0.0
-1
Prints a list of links for the Main Menu
def print_link_list(items) linkString = "" if(!items.empty? && items[0].is_a?(Category)) linkString += "<tr><td>#{link_to "New Category", new_category_url, {:style=>'color:#FF8000'}}</td></tr>" linkString += "<tr><td>#{main_menu_accord(all_category_hash)}</td></tr>" elsif(!items.empty? && items[0].is_a?(Component)) linkString += "<tr><td>#{link_to "New Component", new_component_url, {:style=>'color:#FF8000'}}</td></tr>" linkString += "<tr><td>#{main_menu_accord(all_component_hash)}</td></tr>" elsif(!items.empty?) for item in items if(item.is_a?(Product)) if(item == items[0]) linkString += "<tr><td>#{link_to "New Product", new_product_url, {:style=>'color:#FF8000'}}</td></tr>" end linkString += "<tr><td>#{link_to(item.name, 'tabs/product/' + item.id.to_s)}</td></tr>" elsif(item.is_a?(Group)) if(item == items[0]) linkString += "<tr><td>#{link_to "New Group", new_group_url, {:style=>'color:#FF8000'}}</td></tr>" end linkString += "<tr><td>#{link_to(item.name, item)}</td></tr>" elsif(item.is_a?(Property)) if(item == items[0]) linkString += "<tr><td>#{link_to "New Property", new_property_url, {:style=>'color:#FF8000'}}</td></tr>" end linkString += "<tr><td>#{link_to(item.name, item)}</td></tr>" elsif(item.is_a?(DataFile)) if(item == items[0]) linkString += "<tr><td>#{link_to "New Data File", new_data_file_url, {:style=>'color:#FF8000'}}</td></tr>" end linkString += "<tr><td>#{link_to(item.filedata_file_name, item)}</td></tr>" elsif(item.is_a?(Image)) if(item == items[0]) linkString += "<tr><td>#{link_to "New Image", new_image_url, {:style=>'color:#FF8000'}}</td></tr>" end linkString += "<tr><td>#{link_to(item.picture_file_name, item)}</td></tr>" elsif(item.is_a?(Validation)) if(item == items[0]) linkString += "<tr><td>#{link_to "New Validation", new_validation_url, {:style=>'color:#FF8000'}}</td></tr>" end linkString += "<tr><td>#{link_to(item.extension, item)}</td></tr>" elsif(item.is_a?(Valuefield)) if(item == items[0]) linkString += "<tr><td>#{link_to "New Value Field", new_valuefield_url, {:style=>'color:#FF8000'}}</td></tr>" end linkString += "<tr><td>#{link_to(item.name, item)}</td></tr>" elsif(item.is_a?(TableAlias)) if(item == items[0]) linkString += "<tr><th>Original Name</th>" linkString += "<th>Current Name</th></tr>" end linkString += "<tr><td>#{item.tableName}</td>" linkString += "<td>#{link_to(item.aliasName, item)}</td></tr>" end end else linkString += "None Available." end return linkString end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_menu\n puts \"\\nMain Menu\"\n puts \"1. Daily Prophet - News!\"\n puts \"2. Evanesco - Exit\"\n end", "def main_menu_link; MAIN_MENU_LINK; end", "def show_main_menu\n puts \"What would you like do next?\"\n puts \" new - Create a new contact\"\n puts \" list - List all contacts\"\n puts \" delete - Delete a contact\"\n puts \" show - Display contact details\"\n # puts \" find - Find a contact\"\n print \"> \"\n end", "def main_menu\r\n puts \"\\nMain Menu.\"\r\n puts \"A. List Buildings\"\r\n puts \"B. List Machines\"\r\n puts \"C. List Snacks\"\r\n puts \"D. List Users\"\r\n puts \"E. Find a Snack\"\r\n puts \"F. Add a New Snack\"\r\n puts \"G. Create New User\"\r\n puts \"H. List Favorites\"\r\n puts \"I. Find Favorites\"\r\n puts \"J. Add Favorites\"\r\n puts \"Q. Quit\"\r\nend", "def main_menu\n puts \"Here is a list of available commands:\"\n puts \" new - Create a new contact\"\n puts \" list - List all contacts\"\n puts \" show - Show a contact\"\n puts \" search - Search contacts\"\n puts \" delete - Deletes a contact\"\n end", "def show_main_menu\n puts \" Welcome to the app. What's next?\"\n puts \" new - Create a new contact\"\n puts \" list - List all contacts\"\n puts \" list important - List all contacts\"\n puts \" show :id - Display contact details\"\n puts \" delete - Delete an entry\"\n puts \" find - Find an entry\"\n print \"> \"\n end", "def print_aside(links)\n s = \"<ul>\"\n for link in links\n s += \"<li><a href='\" + link[0] + \"'\"\n\n if link[0].include? params[:action]\n s += \" class='active'\"\n end\n\n s += \">\" + link[1] + \"</a></li>\"\n end\n s += \"</ul>\"\n\n return s.html_safe\n end", "def main_menu\n puts <<~Doc\n Welocome to the New York Times Bestsellers List!\n Please choose one of the following options to get started:\n Doc\n NytBestsellersList::Lists.print_list_names\n end", "def display_main_menu(clear_screen = false)\n clear if clear_screen\n title_header(TITLES[:main_menu],\"_\",\"-\",false)\n\n Api.main_topics.each_with_index do |type, i|\n puts \"#{(\" \" * (PROFILE_SIDE / 2))}#{i+1}\".green + \". #{type}\" \n end\n\n puts \"\\n NAVIGATE: \".black.on_green + \" #{nav_main}\".on_black\n input_menu\n end", "def show_main_menu\n puts \"Welcome to the app. What's next?\".yellow\n puts \" new - Create a new contact\"\n puts \" list - List all contacts\"\n puts \" show - display details via index\"\n puts \" find - find someone by name\"\n puts \" quit - Exit Application\"\n print \"> \"\n end", "def print_main_menu\n puts \"1. Add a contact\"\n puts \"2. Modify a contact\"\n puts \"3. Display all contacts\"\n puts \"4. Display a contact\"\n puts \"5. Display contact attributes\"\n puts \"6. Delete a contact\"\n puts \"7. Exit\"\n end", "def show_main_menu\n puts \"Welcome to the app. What's next?\"\n puts \" new - Create a new contact\"\n puts \" list - List all contacts\"\n puts \" find - Find by name\"\n puts \" quit - Exit Application\"\n print \"> \"\n end", "def show_main_menu\n puts \"Welcome to the app. What's next?\"\n puts \" new - Create a new contact\"\n puts \" list - List all contacts\"\n puts \" find - Find by name\"\n puts \" delete - Delete by ID\"\n puts \" quit - Exit Application\"\n print \"> \"\n end", "def print_menu\n\t\tsystem ('cls') or system ('clear')\n\t\t@todo_list.print_list\n\t\tprint_menu_options\n\tend", "def print_menu\n puts \"1. List patients\"\n # ....\n end", "def show_main_menu\n puts \"Welcome to the app. What's next?\"\n puts \" new - Create a new contact\"\n puts \" list - List all contacts\"\n puts \" show id - Show info for contact id number\"\n puts \" quit - Exit Application\"\n print \"> \"\n end", "def display_main_menu\n puts '################################'\n puts '# {N}- Network Stuff #'\n puts '# {RF}- Read File #'\n # puts '# {GF}- Generate File #'\n # puts '# {D}- Run as Daemon #'\n # puts '# {TD}- Run as Trigger Daemon #'\n puts '# {Q}- Quit #'\n puts '################################'\nend", "def show_main_menu\n puts \"Welcome to the app. What would you like to do?\"\n puts \" new - Create a new contact\"\n puts \" list - List all contacts\"\n puts \" quit - Exit Application\"\n puts \" show - shows contact with specific id\"\n puts \" find - find a user\"\n print \"> \"\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 show_main_menu\n puts \"\\e[H\\e[2J\"\n puts \"Welcome to the app. What's next?\"\n puts \" new - Create a new contact\"\n puts \" list - List all contacts\"\n puts \" quit - Exit Application\"\n print \"> \"\n end", "def print_menu\n self.menu_items.each do |item|\n p \"#{item.dish_name.upcase} 😋 $#{item.price}\"\n end\n end", "def main()\n main_menu(SHOW_HEADER);\n end", "def main_menu\n puts \"---------------Animal shelter 4.5A-----------\"\n puts\n puts \"[1] List clients\"\n puts \"[2] List animals for adoption\"\n puts \"[3] Add a new client\"\n puts \"[4] Add a new animal\"\n puts\n puts\n puts \"[5] exit\"\n puts \"---------------------------------------------\"\nend", "def main_menu(owner_name, owner)\n puts \"#{page_break}\\n\n Select from the following menu options to get started:\\n\n 1 - Make New Appointent\n 2 - Reschedule Appointment\n 3 - Cancel Appointment\n 4 - Search for a Groomer\n 5 - Exit\n \"\n end", "def main_menu()\n system 'clear'\n loop do\n headline(\"My Petsitter App\")\n puts \"#{@emoji[:smiling_cat_face_with_open_mouth]} Welcome! #{@emoji[:dog_face]}\".colorize(:bold)\n puts @headline\n input = @prompt.select('Menu:') do |menu|\n menu.choice name: 'Pet Sitters', value: \"PET_SITTERS\"\n menu.choice name: 'Clients', value: \"CLIENTS\"\n menu.choice name: 'Jobs', value: \"JOBS\"\n menu.choice name: 'Logout', value: \"EXIT\"\n end\n puts '-' * 20\n go_to(input)\n end\n end", "def sub_menu\n puts \"\\n***********************************************\".colorize(:magenta).blink\n puts \"Type the following letters to do...\".colorize(:blue)\n puts \"-----------------------------------------------\".colorize(:cyan).bold\n puts \"s = Save Recipe to My Favorites\".colorize(:blue)\n puts \"r = Rate Recipe\".colorize(:blue)\n puts \"a = See Average Recipe Rating\".colorize(:blue)\n puts \"o = Open Link to See the Steps for This Recipe\".colorize(:blue)\n puts \"m = Back to Main Menu\".colorize(:blue)\n puts \"***********************************************\\n \".colorize(:magenta).blink\n end", "def menu_html\n menu = wiki.settings.menu\n if !menu.nil?\n html = \"<ul>\\n\"\n menu.each do |item|\n title, href = item['title'], item['href']\n if version != 'master' && item['href'].index('/') == 0\n prefix = version.start_with?('v') ? \"/#{version}\" : \"/v#{version}\"\n else\n prefix = \"\"\n end\n html << \"<li class=\\\"minibutton\\\"><a href=\\\"#{prefix}#{href}\\\">#{title}</a></li>\\n\"\n end\n html << \"</ul>\\n\"\n end\n end", "def navi(rel_pos=\"/~kunolab/\")\n puts \"<ul class='menuBar'>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/MiniWorkshop/2nd/index.html\\\">Mini-Workshop</a>\"\n puts \"<li><a href=\\\"https://calendar.google.com/calendar/embed?src=kunogroup%40gmail.com&ctz=Asia%2FTokyo\\\">久野研カレンダー(KunoLabCalendar)</a>\"\n puts \"<li><a href=\\\"/~kunolab/seminar/ronbun/2018/index.html\\\">論文紹介(Paper Presentation)</a>\"\n puts \"<li><a href=\\\"/~kunolab/seminar/kenkyu/2018/index.html\\\">研究紹介(Research Presentation)</a>\"\n puts \"<li><a href='#'>ゼミ(Seminar) <image src=\\\"image/sita3.png\\\" class=\\\"headImg\\\"></a>\"\n puts \"<ul>\"\n puts \"<li><a href=\\\"/~kunolab/seminar/Lepton_2017/index.html\\\"><image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Leptonゼミ(2017)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Modern_2016/index.html\\\"><image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Thomsonゼミ(2016)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Modern_2015/index.html\\\"><image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Thomsonゼミ(2015)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Perkins_2015/index.html\\\"><image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Perkinsゼミ(2015)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Mann_2014/index.html\\\"><image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Mannゼミ(2014)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Mann/index.html\\\"><image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Mannゼミ(2013)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Elementary_2013/index.html\\\"><image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> 素粒子物理学ゼミ(2013)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Leo_2012/index.html\\\"><image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Leoゼミ(2012)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Perkins_2012/index.html\\\"><image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Perkinsゼミ(2012)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Elementary/index.html\\\"><image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> 素粒子物理学ゼミ(2012)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Knoll/index.html\\\"> <image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Knollゼミ(2011)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Knoll_en/index.html\\\"> <image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Knoll(en)ゼミ(2011)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Roe/index.html\\\"> <image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Roeゼミ(2011)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Leo/index.html\\\"> <image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Leoゼミ(2010)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Perkins_en/index.html\\\"><image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Perkins(en)ゼミ(2010)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Leo_en/index.html\\\"> <image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Leo(en)ゼミ(2010)</a></li>\"\n puts \"</ul>\"\n puts \"</ul>\"\nend", "def display_menu\n puts \"1. Scrapp townhalls' emails from web\"\n puts \"2. Send massive emails to townhalls\"\n puts \"3. Follow towhalls on Twitter\"\n puts \"4. Print me the JSON\"\n puts \"5. Exit program\"\n end", "def print_menu\n MENU.each do |i| \n # in general, avoid printing things.\n # Return them instead and let the code that called it\n # to return it\n puts \"#{i[:name]} costs #{i[:price]}\"\n end\n end", "def admin_main_navigation\n entries = \"\"\n alchemy_modules.each do |alchemy_module|\n entries << alchemy_main_navigation_entry(alchemy_module)\n end\n entries.html_safe\n end", "def menu_options\n system \"clear\"\n puts \"~~~ Welcome #{@user.username} to the Main Menu ~~~\\n\\n\" \n puts \"{1} Continue from previous story \"\n puts \"{2} Create new story\"\n puts \"{3} Delete a story\"\n puts \"{4} Tutorial\"\n puts \"{5} End My Session\"\nend", "def show_main_menu\n puts \"Welcome to Contacts APP, What's next?\"\n puts \" new - Create a new contact\"\n puts \" list - List all contacts\"\n puts \" show - Enter ID to show detail of a contact\"\n puts \" find - Find contacts by name\"\n puts \" add - Add phone numbers\"\n puts \" save - Save contact to CSV file\"\n puts \" quit - Save & Exit Application\"\n print \"> \"\n end", "def links\n construct_html(self.items)\n end", "def display_menu\n system('clear')\n arr = ['My List', 'Recommendations', 'Playlist', 'Account Details', 'Exit']\n @prompt.select(\"》 MAIN MENU 《\\n\".colorize(:light_green), arr)\n end", "def main_menu\n name_selector\n puts \"Okay #{@name}, what would you like to do?\"\n loop do\n case menu_arrows\n when '1'\n @recommendation.recommendation_menu\n when '2'\n puts 'you have the following number of games in your library: '\n @game_library.game_instances\n puts 'your custom list of games:'\n @game_library.user_games_lister\n when '3'\n puts 'add a game:'\n @game_library.add_title\n when '4'\n @game_library.delete_games\n when '5'\n @time_used.time_wasted\n when '6'\n @game_library.write_games\n puts 'thanks for your time!'\n exit\n end\n end\n end", "def print_main_menu\n\t\tputs \"[1] Add a contact\"\n\t\tputs \"[2] Modify a contact\"\n\t\tputs \"[3] Display all contacts\" \n\t\tputs \"[4] Display one contact\"\n\t\tputs \"[5] Display an attribute\"\n\t\tputs \"[6] Delete a contact\"\n\t\tputs \"[7] Exit\"\n\t\tputs \"Enter a number\"\n\tend", "def show_main_menu\n puts \"Welcome to Contacts APP, What's next?\"\n puts \" new - Create a new contact\"\n puts \" list - List all contacts\"\n puts \" update - Enter ID to update a contact\"\n puts \" show - Enter ID to show detail of a contact\"\n puts \" find - Find contacts by name\"\n puts \" save - Save contact to CSV file\"\n puts \" quit - Save & Exit Application\"\n print \"> \"\n end", "def output_nav(items)\n html = Array.new\n items.each do |text, path|\n item_path = Rails.application.routes.recognize_path(path)\n current_path = {:action => params[:action], :controller => params[:controller]}\n class_name = text.downcase\n if item_path[:controller] == current_path[:controller] && item_path[:action] == current_path[:action]\n class_name << \" active\"\n end\n html << content_tag(:li, link_to(text, path), :class => class_name)\n end\n html.join(\"\\n\").html_safe\n end", "def main_menu\n puts\"(b) - basic calculator\"\n puts\"(a) - advanced calculator\"\n puts\"(bmi) - body mass index\"\n puts\"(t) - trip calculator\"\n puts\"(m) - morgage\"\n puts\"(q) - quit\"\nend", "def displaymenu # Console only\r\n\t\t @output.puts \"Menu: (1) Play | (2) New | (3) Analysis | (9) Exit\"\r\n\t\t end", "def do_render_menu (menu_items)\n\n result = menu_items.collect do |i|\n controller_name, action, text, title = i\n if controller.controller_name == controller_name\n text\n else\n link_to(\n text,\n {\n :controller => controller_name,\n :action => action\n },\n {\n :title => title\n })\n end\n end\n result.join(\" | \")\n end", "def menu\n # This uses a HEREDOC for multiline listing\n puts \"-------------------------\".colorize(:green) \n puts <<-MENU\n\nChoose a how you would like to see a card. You can view by name, creature, enchantment or sorcery:\n1. See cards by Name \n2. See cards by Creature \n3. See cards by Enchantment \n4. See cards by Sorcery\n\nOr type 'exit' at any time to leave the program. Type 'menu' to return to the main menu.\n MENU\n end", "def main_menu\n puts \"Main Menu\"\n puts \"(a) - Basic calculator\"\n puts \"(b) - Advanced calculator\"\n puts \"(c) - Special calculators\"\n puts \"(q) - Quit\"\nend", "def menu_list(*link_hashes)\n content_tag :ul do \n links = link_hashes.collect do |lh| \n menu_item_if_permitted(lh[:name], lh[:path], *lh[:sublist])\n end\n raw links.join\n end\n end", "def display_menu(menu)\n puts menu.title\n menu.menu_items.each_with_index { |item| puts \"#{item.key_user_returns}.\\t #{item.user_message}\" }\n end", "def menu\n puts \"- Type in a #{\"Nintendo Character\".colorize(:red)} | #{\"Game Series\".colorize(:blue)} | #{\"Amiibo Series\".colorize(:green)}\\n\\n\"\n puts \"- Type #{'1'.colorize(:yellow)} for a list of all the Game Series included in the Amiibo collection\"\n puts \"- Type #{'2'.colorize(:yellow)} for a list of all the Amiibo Series included in the Amiibo collection\"\n puts \"- Type #{'3'.colorize(:yellow)} for a list of all the Characters included in Amiibo collection\"\n puts \"- Type #{'4'.colorize(:yellow)} for a list of ALL Amiibos collection\\n\\n\"\n puts \"- Type #{'exit'.colorize(:yellow)} to exit the CLI\\n\\n\"\n puts \"--------------------------------------------------------------------------------\\n\\n\"\n sleep(2)\n end", "def print_menu\n output.puts \"Madden's Car Selection Tool-\"\n \n # Print Current Model Info\n print_model_info\n\n # Print Menu Choices\n print_menu_choices\n\n # Get User Choice\n output.print \"Enter choice: \"\n end", "def main_menu\n h = { \n \"1\" => :view_article,\n \"2\" => :view_comments,\n :f => :display_forum,\n :v => :view_menu,\n :r => :reload,\n :m => :fetch_more,\n :R => :reddit_options,\n :H => :hacker_options,\n :s => :sort_menu, \n :C => :config_menu,\n :a => :view_article,\n :c => :view_comments,\n :x => :extras\n }\n=begin\n :a => :ack,\n \"/\" => :ffind,\n :l => :locate,\n :v => :viminfo,\n :z => :z_interface,\n :d => :child_dirs,\n :r => :recent_files,\n :t => :dirtree,\n \"4\" => :tree,\n :F => :filter_menu,\n :c => :command_menu ,\n :B => :bindkey_ext_command,\n :M => :newdir,\n \"%\" => :newfile,\n=end\n\n menu \"Main Menu\", h\nend", "def read_menu(drinks)\n drinks.each do |drink|\n puts \"----- #{drink} ------\"\n end\n end", "def print_menu(options)\n i = 0\n options.each do |attribute|\n puts \"[#{i}] #{attribute}\"\n i += 1\n end\n end", "def main_menu\n h = {\n a: :ag,\n z: :z_interface,\n # f: :file_actions,\n b: :bookmark_menu,\n c: :create_menu,\n f: :filter_menu,\n o: :order_menu,\n s: :selection_menu,\n t: :toggle_menu,\n v: :view_menu,\n '`' => :goto_parent_dir,\n x: :extras\n }\n menu 'Main Menu', h\nend", "def print_items\n if @past_menu.nil?\n term.erase_body\n @items.each_with_index do |item, i|\n print_item(item, i, reverse: i == @cur_menu)\n end\n else\n print_item(@items[@past_menu], @past_menu)\n print_item(@items[@cur_menu], @cur_menu, reverse: true)\n end\n end", "def print_main_menu\n\t\tputs \"[1] Add a new contact\"\n\t\tputs \"[2] Modify an existing contact\"\n\t\tputs \"[3] Delete a contact\"\n\t\tputs \"[4] Display all the contacts\"\n\t\tputs \"[5] Display an attribute\"\n\t\tputs \"[6] Exit\"\n\t\tputs \"Enter a number: \"\n \tend", "def menu\n puts \"Menu\"\n puts \"1. List Channels\"\n puts \"2. List Users\"\n puts \"3. Select User\"\n puts \"4. Select Channel\"\n puts \"5. Send Message\"\n puts \"6. Quit\"\nend", "def view_all_locations\n print_all_locations\n puts \"\\n\"\n location_menu\nend", "def links; end", "def links; end", "def printMenu\n\t\tself.report(\"\n\t\tEscolha uma opção\n\t\t1 - Trocar palavra-chave.\n\t\t2 - Ver palavra-chave.\n\t\t3 - Ver arquivo.\n\t\t4 - Sair.\n\t\t? \", 1)\t\t\n\tend", "def print_menu_options\n puts \"\"\n puts \"-------Main menu-------\".center(50)\n puts \"1. Add Students\"\n puts \"2. Show all students\"\n puts \"3. Show all the students that their names starts with an 'A'\"\n puts \"4. Show all the students that their names have less than 12 characters\"\n puts \"5. Show the students grouped by cohort\"\n puts \"6. Save the students in a file\"\n puts \"7. Load students from the file\"\n puts \"8. Update student information\"\n puts \"9. Exit\"\nend", "def main_menu\n ctrlr = request.parameters['controller'].split('/').last\n dashboard_class = (ctrlr == 'dashboard' ? 'current' : '')\n assets_class = (ctrlr == 'assets' ? 'current' : '')\n design_class = ((ctrlr == 'themes' || ctrlr == 'resources') ? 'current' : '')\n contacts_class = (ctrlr == 'contacts' ? 'current' : '')\n settings_class = (ctrlr == 'settings' ? 'current' : '')\n content_class = ((ctrlr == 'home' || ctrlr == 'links' || ctrlr == 'news_items' || ctrlr == 'portfolios' || ctrlr == 'assigned_assets' || ctrlr == 'resume_sections' || ctrlr == 'resume_items' || ctrlr == 'galleries') ? 'current' : '')\n admin_class = ((ctrlr == 'users' || ctrlr == 'sites' || ctrlr == 'memberships') ? 'current' : '')\n \n result = content_tag('li', link_to('Dashboard', admin_dashboard_path, :class => dashboard_class))\n result << content_tag('li', link_to('Content', edit_admin_home_path, :class => content_class))\n result << content_tag('li', link_to(assets_name, admin_assets_path, :class => assets_class))\n result << content_tag('li', link_to('Design', admin_themes_path, :class => design_class))\n result << content_tag('li', link_to('Contacts', admin_contacts_path, :class => contacts_class))\n result << content_tag('li', link_to('Settings', edit_admin_settings_path, :class => settings_class))\n if admin?\n result << content_tag('li', link_to('Admin', admin_users_path, :class => admin_class))\n end\n result\n end", "def list\n puts \"\\n\\n#{Job.count} job postings found\\n\\n\"\n Job.list.map do |job|\n puts \"#{job.id}. #{job.firstline}\"\n end\n puts menu\n end", "def print_menu\n puts \"User's Menu\\n-----------\"\n puts \"1. Input the students\"\n puts \"2. Show the students\"\n puts \"3. Save the list to a file\"\n puts \"4. Load the list from a file\"\n puts \"9. Exit\" # 9 because we'll be adding more items\nend", "def print_menu\n puts \"\\nMAIN MENU\"\n puts \"add (+)\"\n puts \"subtract (-)\"\n puts \"multiply (*)\"\n puts \"divide (/)\"\n puts \"modulo (%)\"\n puts \"exponify (^)\"\nend", "def print_menu\n #print menu message\n border = @menu[:message].gsub(/\\s|\\S/, '*')\n puts border\n puts @menu[:message]\n puts border\n\n #print dishes This is very convoluted but using nested loops i can \n #print the menu and keep it organized the way i want it\n @menu[:options].each do |item| #this grabs all the items in the options hash\n item[:dish].each_with_index do |item2, index| #this grabs the dish array within the option hash\n puts \"#{index+1}. #{item2} - $#{(item[:price][index])}\"#the item[:price][index] grabs all the prices associated with each menu item\n end \n end\n end", "def main_menu\n\n\tputs \"***Ruby Cheatsheet***\"\n\tputs \"1. Command Line\"\n\tputs \"2. IDE\" \n\tputs \"3. Search\"\n\tputs \"4. Quit\"\n\tputs \"Make a selection 1 - 4:\"\n\nend", "def print_menu_entry(sons, entry, view_ctrl)\n has_submenu = sons[entry.id].present?\n is_current_page = (@page && @page == entry.target) || request.path == entry.url\n item_class = entry.html_class.present? ? [entry.html_class] : []\n item_class << 'sub' if has_submenu\n item_class << 'current_page' if is_current_page\n\n content_tag :li, id: \"menu_item_#{entry.id}\", class: item_class.join(' ') do\n title_link = link_to(entry.title,\n entry.target_id.to_i > 0 ? main_app.site_page_path(entry.target_id) : entry.url,\n alt: entry.title, title: entry.description, target: entry.new_tab ? '_blank' : '')\n\n li_content = []\n li_content << content_tag(:div, '', class: 'hierarchy') if view_ctrl\n li_content << if view_ctrl\n content_tag(:div, style: 'min-height: 25px', class: \"menuitem-ctrl#{' deactivated' unless entry.publish}\") do\n div_content = []\n div_content << content_tag(:span) do\n [\n toggle_field(entry, 'publish', 'toggle', controller: 'sites/admin/menus/menu_items', menu_id: entry.menu_id),\n \" #{title_link}\",\n ( (entry and entry.target) ? \" [ #{entry.target.try(:title)} ] \" : \" [ #{entry.url unless entry.url.blank?} ] \")\n ].join.html_safe\n end\n div_content << content_tag(:div, class: 'pull-right') do\n menu_content = []\n menu_content << link_to(icon('edit', text: ''), edit_site_admin_menu_menu_item_path(entry.menu_id, entry.id), title: t('edit')) if test_permission(:menu_items, :edit)\n menu_content << link_to(icon('trash', text: ''), site_admin_menu_menu_item_path(entry.menu_id, entry.id), method: :delete, data: { confirm: t('are_you_sure') }, title: t('destroy')) if test_permission(:menu_items, :destroy)\n menu_content << link_to(icon('move', text: ''), '#', class: 'handle', title: t('move')) if test_permission(:menu_items, :change_position)\n menu_content << link_to('+', new_site_admin_menu_menu_item_path(entry.menu_id, parent_id: entry.id), class: 'btn btn-success btn-xs', title: t('add_sub_menu')) if test_permission(:menu_items, :new)\n menu_content.join.html_safe\n end\n div_content.join.html_safe\n end\n else\n title_link\n end\n li_content << content_tag(:menu, class: 'submenu') do\n sons[entry.id].map do |child|\n print_menu_entry(sons, child, view_ctrl)\n end.join.html_safe\n end if has_submenu\n li_content.join.html_safe\n end\n end", "def show_menu\n planet_list = \"\"\n i = 1\n @solar_system.length.times do |n|\n planet_list << \"\\n#{i}. #{@solar_system[n].name}\"\n i += 1\n end\n return \"\\nPlanet List#{planet_list}\\nOther: Exit\\n\\n\"\n end", "def print_menu\n isFinished = true\n while (isFinished)\n puts @menu_description\n @menu_items.each_pair { |key, value|\n puts \"(#{key}) #{value}\"\n }\n\n isFinished = determine_action(get_entry(\"Select option: \"))\n end\n end", "def menu\n puts '1) Promedio de notas'\n puts '2) Inasistencia alumnos'\n puts '3) Alumnos aprobados'\n puts '4) Salir'\nend", "def main_menu\n puts \"(b) - basic calculator\"\n puts \"(a) - advanced calculator\"\n puts \"(bmi) - BMI calculator\"\n puts \"(m) - mortgage calculator\"\n puts \"(t) - trip calculator\"\n puts \"(q) - quit\"\nend", "def print_menu\n puts \"Which action [list|add|delete|mark|idea|quit]?\"\nend", "def set_menu_links\n @menu_link = [{\n link_name: 'Главная',\n link_path: root_path,\n link_class: 'home-class'\n }, {\n link_name: 'QR коды',\n link_path: qr_codes_path\n }, {\n link_name: 'Наши контакты',\n link_path: contacts_path\n }, {\n link_name: 'О нас',\n link_path: about_path\n }]\n\n @users_link = []\n if current_user\n @users_link.push({\n link_name: 'Выход',\n link_path: logout_path,\n link_method: :delete\n })\n else\n @users_link.push({\n link_name: 'Регистрация',\n link_path: new_user_path\n })\n @users_link.push({\n link_name: 'Войти',\n link_path: login_path\n })\n end\n end", "def print_menu menu_level= '0'\n print_menu_header menu_level\n\n 20.times do |counter|\n lvl = \"#{menu_level}.#{counter}\"\n puts \" #{counter} : \" + @menu_map[lvl][0] if @menu_map.has_key?(lvl)\n end\n puts \"Make a choice between those items. (X to exit)\"\n puts \"Use left arrow to go back\"\n end", "def menu\n\tputs\n\tputs\n puts \"Welcome to the Real Estate search engine\"\n puts \"To list all available apartments, please press 1\"\n puts \"Press Q to quit\"\nend", "def main_navigation\n nodes_stack = RailsAdmin::Config.visible_models(:controller => self.controller)\n node_model_names = nodes_stack.map{ |c| c.abstract_model.model_name }\n\n nodes_stack.group_by(&:navigation_label).map do |navigation_label, nodes|\n\n nodes = nodes.select{ |n| n.parent.nil? || !n.parent.to_s.in?(node_model_names) }\n li_stack = navigation nodes_stack, nodes\n\n li_a_home = link_to localizing_path(dashboard_path), class: 'pjax' do\n content_tag(:i, '', class: 'icon icon-home') + content_tag(:span, t('admin.actions.dashboard.menu'))\n end\n %{<li class=\"homelink\">#{li_a_home}</li>#{li_stack}} if li_stack.present?\n end.join.html_safe\n end", "def print_main_menu\t\n\t puts\n\t puts \"[1] Add a new contact\"\n\t puts \"[2] Modify an existing contact\"\n\t puts \"[3] Search and display a contact\"\n\t puts \"[4] Delete a contact\"\n\t puts \"[5] Display all contacts\"\n\t puts \"[6] Display a list by attribute\"\n\t puts \"[7] Exit this system\"\n\t puts\n\t puts \"Please enter a number from the above options: \"\n\tend", "def output_jobs(links)\n links.length\n links.each { |link| puts link.text + \"\\n\\t\" + \"https://www.jobsatosu.com\" + link['href']}\nend", "def menu\n puts \"\\n************************************************************\".colorize(:magenta).blink\n puts \"Select an option (1-5) from the menu below:\".colorize(:blue).bold\n puts \"------------------------------------------------------------\".colorize(:cyan)\n puts \"1. Don't want to think about what to cook? \\n Spin the RANDOM WHEEL OF RECIPES!\".colorize(:blue)\n puts \"------------------------------------------------------------\".colorize(:cyan)\n puts \"2. Need some inspiration for cooking? \\n Find recipe by name OR \\n if you have leftover ingredients search your ingredients!\".colorize(:blue)\n puts \"------------------------------------------------------------\".colorize(:cyan)\n puts \"3. Feeling creative? \\n Write and save your own recipe!\".colorize(:blue)\n puts \"------------------------------------------------------------\".colorize(:cyan)\n puts \"4. View ALL your favorite recipes in 1 place!\".colorize(:blue)\n puts \"------------------------------------------------------------\".colorize(:cyan)\n puts \"5. You're done? Time to exit...\".colorize(:blue)\n puts \"************************************************************\\n \".colorize(:magenta).blink\n end", "def main_menu\n h = { \n :a => :ack,\n \"/\" => :ffind,\n :l => :locate,\n :v => :viminfo,\n :z => :z_interface,\n :d => :child_dirs,\n :r => :recent_files,\n :t => :dirtree,\n \"4\" => :tree,\n :s => :sort_menu, \n :F => :filter_menu,\n :c => :command_menu ,\n :B => :bindkey_ext_command,\n :M => :newdir,\n \"%\" => :newfile,\n :x => :extras\n }\n menu \"Main Menu\", h\nend", "def print_menu\n puts \"1. Input the students\"\n puts \"2. Show the students\"\n puts \"3. Save the list to a csv file\"\n puts \"4. Load the list from a csv file\"\n puts \"5. Print the source code for this programme\"\n puts \"9. Exit\" # 9 because we'll be adding more items\nend", "def view_menu\n h = {\n f: :select_from_visited_files,\n d: :select_from_used_dirs,\n b: :view_bookmarks,\n s: :list_selected_files,\n c: :child_dirs,\n r: :recent_files,\n t: :tree,\n e: :dirtree\n }\n menu 'View Menu', h\nend", "def print_main_menu\n puts '[1] Add a new contact'\n puts '[2] Modify an existing contact'\n puts '[3] Delete a contact'\n puts '[4] Display all the contacts'\n puts '[5] Search by attribute'\n puts '[6] Exit'\n puts 'Enter a number: '\n\n end", "def index\n \t#display text and links \n end", "def print_descriptions(menu)\n\tmenu.each_with_index { |menu, index| puts \"\\t#{index + 1}) #{menu.item}: #{menu.description}\\n\\n\"}\nend", "def print_main_menu\n puts \"[1] Add a new contact\"\n puts \"[2] Modify an existing contact\"\n puts \"[3] Delete a contact\"\n puts \"[4] Display all contacts\"\n puts \"[5] Search by attribute\"\n puts \"[6] delete_all\"\n puts \"[7] exit\"\n puts \"Enter a number: \"\n end", "def main_menu(identifier)\n find('nav.navbar a', text: identifier)\n end", "def show_nav_bar(message_dir_name)\n if message_dir_name\n index = Index.new\n before = index.entry_before(message_dir_name)\n after = index.entry_after(message_dir_name)\n else\n before = after = nil\n end\n\n\n res = '<p><table align=\"center\"><tr>'\n \n res += %{<td align=\"right\" width=\"40%\">} \n if before\n res += \"<a href=\\\"display.cgi?ms=#{before}\\\">\" +\n \"&lt;&lt;&nbsp;Previous&nbsp;</a>\"\n else\n res += \"&nbsp;\"\n end\n res += \"</td>\\n\"\n\n res += \"<td align=\\\"center\\\" width=\\\"20%\\\">\" +\n \"<a href=\\\"display.cgi\\\">Index</a></td>\\n\"\n\n res += %{<td align=\"left\" width=\"40%\">} \n if after\n res += \"<a href=\\\"display.cgi?ms=#{after}\\\">&nbsp;Next&nbsp;>></a>\"\n else\n res += \"&nbsp;\"\n end\n res += \"</td>\\n\"\n \n res + \"</tr></table>\\n\"\nend", "def display_menu\n puts \"Choose from the following options: \\n\n to find a candidate, type 'find id' (ex. find 1)\n to view all candidates, type 'all'\n to view all qualified candidates, type 'qualified'\n to exit, type 'quit' \n to view menu, type 'menu' \\n\\n\"\nend", "def print_menu\n puts \"1. Input the students\"\n puts \"2. Show the students\"\n puts \"3. Save the list to a file\"\n puts \"4. Load the list from a file\"\n puts \"9. Exit\"\nend", "def print_menu\n puts \"1. Input the students\"\n puts \"2. Show the students\"\n puts \"3. Save the list to a file\"\n puts \"4. Load the list from a file\"\n puts \"9. Exit\"\nend", "def print_menu\n puts \"1. Input the students\"\n puts \"2. Show the students\"\n puts \"3. Save the list to a file\"\n puts \"4. Load the list to a file\"\n puts \"9. Exit\"\nend", "def insert_links\n @output << \"\\n\"\n @links.each_index do |index|\n @output << \" [#{index+1}]: #{@links[index]}\\n\"\n end\n end", "def print_api_call_menus\n name = convert_name_for_api(get_recipe_name_from_user)\n recipes_array = API.call_by_recipe_name(name)\n API.recipes_titles_array.each_with_index do |title, i|\n puts \"#{i + 1}. #{title.capitalize}\"\n puts \"-------------------------------------------------------\".colorize(:cyan).bold\n end\n end", "def navigation_menu(i18n_path, controller_paths, link_to_path, options={})\n code = '<li class=\"'\n code += 'active ' if is_menu_active? controller_paths\n code += 'first ' if options[:first]\n code += \"\\\">\\n\"\n code += link_to(I18n::t(i18n_path), link_to_path) + \"\\n\"\n code += \"</li>\\n\"\n\n code\n end", "def print\n puts \"====== Pastes History ======\".green\n unless @links.empty?\n @links.each_with_index { |l, i| puts \"#{i+1}. #{l}\" }\n else\n puts \"your history is empty...\"\n end\n puts \"============================\".green\n end", "def print_menu\n puts \"1. Input the students\"\n puts \"2. Show the students\"\n puts \"3. Save the list\"\n puts \"4. Load the list\"\n puts \"9. Exit\" # 9 because we'll be adding more items\nend", "def print_menu()\n menu = [\"Add Item charge\",\"Add Labor\",\"Apply Discount\",\"total\",\"New Transaction\", \"Exit Application\"];\n\n for i in 1..6 do\n puts(\"#{i}\\t\\t#{menu[i-1]}\");\n end \nend", "def display_menu\n puts \"Welcome to Lorrayne and Sherwin's coffee emporium!\\n\\n\"\n puts \"1) Add item - $5.00 - Light Bag\"\n puts \"2) Add item - $7.50 - Medium Bag\"\n puts \"3) Add item - $9.75 - Bold Bag\"\n puts \"4) Complete Sale\"\n end", "def nav_main(topic = \"main\")\n main = \"\"\n back = \"\"\n profile = \"[\" + \"\\#\".green + \"] View Profiles \"\n exit_cli = \"[\" + \"exit\".green + \"] Exit Program \"\n if topic != 'main'\n back = \"[\" + \"menu\".green + \"] Main Menu \" if topic != \"Top Ten\" || topic != \"kidnapped\"\n # else\n # main = \"[\" + \"menu\".green + \"] Main Menu \" if topic != \"main\"\n end\n \"#{profile}#{back}#{main}#{exit_cli}\"\n end" ]
[ "0.7791373", "0.70995426", "0.699932", "0.69667864", "0.6944903", "0.6921214", "0.6914723", "0.6905415", "0.6901675", "0.68729025", "0.67943513", "0.678148", "0.6678763", "0.66278976", "0.66183877", "0.659248", "0.65886325", "0.6583902", "0.65834916", "0.65670866", "0.65651846", "0.6542314", "0.6504647", "0.64492065", "0.64309096", "0.64233565", "0.6418411", "0.63845265", "0.63844764", "0.6381344", "0.6361999", "0.6344788", "0.63445157", "0.6335079", "0.6322422", "0.63071626", "0.6281784", "0.62637734", "0.62604314", "0.62564903", "0.62551385", "0.62505233", "0.6246607", "0.6245595", "0.6222469", "0.6214185", "0.621054", "0.6206128", "0.61870944", "0.61777", "0.61729825", "0.6154313", "0.6148428", "0.6141174", "0.61309606", "0.6130615", "0.612755", "0.612755", "0.6125805", "0.61181027", "0.61175734", "0.6112012", "0.6111667", "0.6110472", "0.6110017", "0.6087102", "0.6086439", "0.608019", "0.60642356", "0.6063712", "0.60420054", "0.60353476", "0.60297316", "0.602859", "0.60187274", "0.60038984", "0.5995031", "0.5993245", "0.59881043", "0.59839046", "0.5980385", "0.5963694", "0.59621966", "0.5962107", "0.5950819", "0.5944093", "0.5934443", "0.59322786", "0.5929173", "0.5922436", "0.5922436", "0.5913845", "0.5902119", "0.5902035", "0.5898761", "0.58969325", "0.5889362", "0.5887819", "0.5885805", "0.5880984" ]
0.6665403
13
Creates a hash for all categories
def all_category_hash(item=nil) hash = {} items = [] if(!item.nil?) for cat in @all_categories if(cat.parent_id.eql?(item.id)) items.push(cat) end end else for cat in @all_categories if(cat.parent_id.nil?) items.push(cat) end end end for cat in items hash[cat] = all_category_hash(cat) end return hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def categories\n raw_categories.to_hashugar\n end", "def categories(arg_)\n @config.lock\n\n objdata_ = _get_objdata(arg_)\n return nil unless objdata_\n hash_ = {}\n objdata_[2].each do |tup_, tupcats_|\n tupcats_.each do |cat_|\n hash_[cat_] = @categories[cat_][1].map{ |elem_| tup_[elem_] }\n end\n end\n hash_\n end", "def all_categories\n @mutex.synchronize do\n @categories.keys\n end\n end", "def categories\n Hash[self.class.catalogs.map { |fld, klass|\n name = fld.gsub(/_id$/, '_name');\n [fld, {:id => self.send(fld), :name => self.send(name)}] rescue nil\n }.reject {|cat| cat.nil?}]\n end", "def categories()\n @web.get('http://www.waymarking.com/cat/categorydirectory.aspx') do |page|\n ile = 0\n #puts page.parser.to_html.to_s\n cache = {}\n\n page.parser.css('div#content div.gutter a').each do |cat|\n href = cat.attr('href')\n m = Category::GUID_REGEXP.match href\n key = Waymarking::Utils.parameterize(cat.text)\n unless m.nil? then\n ile +=1\n raise DuplicatedCategory if cache.has_key? key\n\n cache[key] = m[1]\n #puts \"#{ile} #{key} #{cat.text} #{m[1]}\"\n else\n puts href\n end\n\n end\n\n cache2 = {}\n cache.keys.each do |key|\n @web.get(\"http://www.waymarking.com/cat/details.aspx?f=1&guid=#{cache[key]}&exp=True\") do |page2|\n begin\n cat = Waymarking::Category.from_html(page2)\n cache2[key] = cat\n rescue\n puts key\n end\n end\n end\n\n File.open('categories.yml', 'w') do |f|\n f.write YAML::dump(cache2)\n end\n end\n end", "def categories\n category_keys.collect(&:to_s)\n end", "def get_category_list\n ret_hash = Rails.cache.fetch(\"zaim_api/category\", expired_in: 1.day) do\n json_categories = self.zaim_api.category\n tmp_ret_hash = {}\n json_categories['categories'].each do |value|\n tmp_ret_hash[value['id']] = value['name']\n end\n tmp_ret_hash\n end\n ret_hash\n end", "def categories_by_taxonomy\n\n self.categories.inject({}) do |result, category|\n \n if result.has_key?(category.taxonomy.id.to_sym)\n result[category.taxonomy.id.to_sym] << category\n else\n result[category.taxonomy.id.to_sym] = [category]\n end\n \n result \n end \n\n end", "def extract_categories cats\n cats.inject Hash.new do |hash, tag|\n\n # iterate through groups if the tag belongs to multiple\n tag[\"groups\"].each do |group|\n name = group[\"name\"]\n hash[name] ||= []\n hash[name] << tag[\"name\"]\n end\n hash\n end\n end", "def to_hash( )\n\t\t\[email protected](Hash.new) do |hash, (name, count_or_calc)|\n\t\t\t\thash[name] = count_or_calc if count_or_calc.is_a?(Numeric)\n\t\t\t\thash\n\t\t\tend\n\t\tend", "def load_categories\n q = @db.query(\"select t.term_id, t.name, t.slug\n from wp_terms as t join wp_term_taxonomy as x\n on t.term_id = x.term_id\n where x.taxonomy = 'category'\")\n\n q.each_hash { |c| os = OpenStruct.new(c) ; @categories[os.term_id.to_i] = OpenStruct.new(c) }\n end", "def categories\n\t\t\t@cat_cache ||= @db.js('musicthoughts.all_categories()').map {|c| c.merge(category: c[@lang]) }\n\t\t\t@cat_cache\n\t\tend", "def getCategoryList\n categoryDump = @course.assessment_categories\n categories = {}\n for cat in categoryDump do\n categories[cat.name] = cat.id\n end\n return categories\n end", "def get_known_categories\n rKnownCategories = {}\n\n @MySQLConnection.query('SELECT name, id, value_type FROM stats_categories').each do |iRow|\n iCategoryName, iCategoryID, iValueType = iRow\n rKnownCategories[iCategoryName] = [ iCategoryID.to_i, iValueType.to_i ]\n end\n\n return rKnownCategories\n end", "def getCategories()\n\t\tcat = Array.new\n\t\tcat.push(\"heroku\")\n\t\tcat.push(\"go\")\n\t\tcat.push(\"github\")\n\t\tcat.push(\"docker\")\n\t\tcat.push(\"css\")\n\t\tcat.push(\"apache\")\n\t\tcat.push(\"html\")\n\t\tcat.push(\"bootstrap\")\n\t\tcat.push(\"java ee\")\n\t\tcat.push(\"javafx\")\n\t\tcat.push(\"java\")\n\t\tcat.push(\"jquery\")\n\t\tcat.push(\"mips\")\n\t\tcat.push(\"c++\")\n\t\tcat.push(\"laravel\")\n\t\tcat.push(\"linux\")\n\t\tcat.push(\"opengl\")\n\t\tcat.push(\"sml\")\n\t\tcat.push(\"javascript\")\n\t\tcat.push(\"mongo db\")\n\t\tcat.push(\"c\")\n\t\tcat.push(\"yacc\")\n\t\tcat.push(\"circuit\")\n\t\tcat.push(\"php\")\n\t\tcat.push(\"mysql\")\n\t\tcat.push(\"node js\")\n\t\tcat.push(\"photoshop\")\n\t\tcat.push(\"rails\")\n\t\tcat.push(\"postgres\")\n\t\tcat.push(\"ruby\")\n\t\tcat.push(\"redis\")\n\t\tcat.push(\"mac osx\")\n\t\tcat.push(\"sass\")\n\t\tcat.push(\"ubuntu\")\n\t\tcat.push(\"bower\")\n\t\tcat.push(\"wordpress\")\n\t\tcat.push(\"css\")\n\t\tcat.push(\"hosted\")\n\t\tcat.push(\"python\")\n\t\tcat.push(\"maven\")\n\t\tcat.push(\"maven mojo\")\n\t\tcat.push(\"composer\")\n\t\tcat.push(\"mips\")\n\t\tcat.push(\"gulp\")\n\t\tcat.push(\"grunt\")\n\t\tcat.push(\"phpstorm\")\n\t\tcat.push(\"react\")\n\t\tcat.push(\"swift\")\n\t\tcat.push(\"wordpress\")\n\t\tcat.push(\"tomcat\")\n\t\tcat.push(\"redis\")\n\t\tcat.push(\"travis\")\n\t\treturn cat\n\tend", "def categories_from_hash(hash)\n cat = []\n (1..hash.size).each { |i|\n cat.push(Item_Category.new(hash[i][0], hash[i][1]))\n }\n cat\n end", "def load_cookie_categorys\n unless @cookie_categorys\n cookie_category_info = load_json_file(\"data/luxgen/cookie_categorys.data\", \"cid\")\n\n @cookie_categorys = {}\n cookie_category_info.each do |key, value|\n categorys = (@cookie_categorys[key] ||= Set.new)\n\n value['cat'].split(\",\").each do |category|\n categorys.add(category)\n end\n end\n end\n\n @cookie_categorys\nend", "def category_key_value_pairs\n categories.collect{|k,v| [k,v['sCategory']]} rescue []\n end", "def getCategories\n @categories = []\n @categories << Category.new(name: \"All\", id: -1)\n @categories += Category.all\n end", "def set_categories\n @categories = {}\n @mechanize.page.search('//*[@id=\"prtcalst\"]//li').each do |cat|\n cat_link = cat.search('a')[0]\n cat_name = cat.search('.//em')[0].inner_text()\n catObj = Category.new()\n catObj.elem = cat_link\n catObj.name = cat_name\n @categories[cat_name] = catObj\n\n puts(\"#{cat_name}\")\n puts(\"-------------------\")\n end\n end", "def set_hash\n # Create a new hash for the renderd boxes\n\t\t@categories = {\n 'purchasers' => {\n \"class\": Purchaser,\n \"name\": 'Purchaser'\n },\n 'endusers' => {\n \"class\": EndUser,\n \"name\":'End User'\n },\n 'purchaseorders' => {\n \"class\": PurchaseOrder,\n \"name\": 'Purchase Order'\n },\n 'keys' => {\n \"class\": Key,\n \"name\": 'Key'\n }\n }\n end", "def category_tree\n @category_tree = {}\n get_category_browse_nodes.each do |n|\n build_category_tree(n)\n end\n @category_tree\n end", "def get_categories\n cats = []\n params.each do |k,v|\n if k.starts_with? \"category\"\n name = v\n num = cat_number(k) \n cats << [name,num]\n end\n end\n return cats\n end", "def category_keys\n @backend.category_keys\n end", "def fresh_categories\n # these are the categories that will be displayed by default\n # in the html view\n return {\n \"speakerData\" => {\"label\" => \"Character Direct Speech\", \"data\" => []},\n \"indirectData\" => {\"label\" => \"Character Indirect Diction\", \"data\" => []},\n \"traitData\" => {\"label\" => \"Trait: Character Type\", \"data\" => []}, \n \"genderData\" => {\"label\" => \"Trait: Character Sex\", \"data\" => []},\n \"maritalStateData\" => {\"label\" => \"Trait: Character Marriage Status\", \"data\" => []},\n \"socecStatusData\" => {\"label\" => \"Trait: Character Class Status\", \"data\" => []},\n \"ageData\" => {\"label\" => \"Trait: Character Age\", \"data\" => []},\n \"occupationData\" => {\"label\" => \"Trait: Character Occupation\", \"data\" => []},\n }\nend", "def categories_as_basic_with_all(returned = [])\r\n returned << categories.map { |x| { id: x.id, name: x.name }}\r\n returned.insert(0, { id: 0, name: \"All Categories\" })\r\n\r\n returned.flatten(1)\r\n end", "def categories_list\n @categories = Category.all.collect { |p| [p.name, p.id] }\n end", "def categories\n\t\trender :json => {:status => 1, :categories => {\"1\" => \"Apparel & Accessories\", \"2\" => \"Arts and Crafts\", \"3\" => \"Electronics\", \n\t\t\t\"4\" => \"Home Appliances\", \"5\" => \"Kids & Baby\", \"6\" => \"Movies, Music, Books & Games\", \"7\" => \"Motor Vehicles\", \n\t\t\t\"8\" => \"Office & Education\", \"9\" => \"Parties & Events\", \"10\" => \"Spaces & Venues\", \"11\" => \"Sports & Outdoors\", \"12\" => \"Tools & Gardening\", \"13\" => \"Other\"}}, :status => 200\n\t\treturn\n\tend", "def set_categories\n @categories = Category.order(:name).pluck(:name, :id)\n end", "def category_names\n categories.map {|category| CategoryCode[category]}\n end", "def count_categories!\n counts = Hash.new 0\n modify = []\n @all_sorters.each do |sorter|\n counts[sorter.category] += 1\n if @all_sorters.count{|xx|xx.category == sorter.category} > 1\n modify.push [sorter, counts[sorter.category]]\n end\n end\n modify.each do |sorter, count|\n sorter.category += \" #{count.to_roman}\"\n end\n end", "def channel_categories\n build :channel_categories, :using => data_for(:channel_categories)\n end", "def tax_categories\n @categories ||= {\n 'Exempt Rate' => {\n :id => nil,\n :rate => 0.00\n },\n 'Low Rate' => {\n :id => nil,\n :rate => 0.05\n },\n 'Full Rate' => {\n :id => nil,\n :rate => 0.20\n }\n }\n\n @categories.reject{|k,v| v[:id] }.each do |category_name, value|\n\n current = @db[:spree_tax_categories].where(:name => category_name).first\n\n if current\n value[:id] = current[:id]\n\n else\n timestamps = {:created_at => Time.now, :updated_at => Time.now}\n\n value[:id] = insert_returning_id(:spree_tax_categories, timestamps.merge({\n :name => category_name\n }))\n\n insert_returning_id(:spree_tax_rates, timestamps.merge({\n :amount => value[:rate],\n :zone_id => eu_zone[:id],\n :tax_category_id => value[:id]\n }))\n end\n\n end\n\n @categories\n end", "def categories_by_vote_count\n\t\tself.given_votes.group(:category_id).count.each_with_object({}) { |(k, v), h| ( h[v] ||= [] ) << self.given_votes.find_by(category_id: k) }\n\tend", "def categories_attributes=(categories_hashes) #writer\n #{\"0\"=>{\"name\"=>\"new catogory 1\"}, \"1\"=>{\"name\"=>\"new catogory 2\"}}\n #raise category_hashes.inspect\n #How would I create a catogory for each of the hashes inside categories_hashes\n categories_hashes.values.each do |category_attributes|\n\n #DO NOT CREATE A CATEGORY IF IT DOESN'T HAVE NAME\n #if category_attributes[:name].present?\n\n #create a new catogory if this post doesn't already have this catogory\n #find or create the catogory regardless of whether this post has it.\n category = Category.find_or_create_by(category_attributes)\n #ALSO DON'T DUPLICATE POST IF IT ALREADY HAVE IT.\n #How do i check if this post has this category already?\n if !self.categories.include?(category)\n #this is ineffecient because it will pull all catogories\n #self.categories << category 47:55\n self.post_categories.build(:category => category)\n\n #I need to create a catogory that is already associated with this post\n # and i need to make sure that this category already doesn't exist by name.\n end\n #end\n end\n\n end", "def all_categories\n end", "def render_headers\n rcats = { Category.category_key_headers => [] }\n object.categories.each do |cat|\n rcats[Category.category_key_headers].concat(\n Category.new(cat, options).render[Category.category_key_headers]\n )\n end\n rcats\n end", "def categories_attributes=(categories_hashes)\n # raise categories_hashes.inspect\n # {\"0\"=>{\"name\"=>\"new cat 1\"}, \"1\"=>{\"name\"=>new cat 2\"}}\n categories_hashes.each do |index, category_attributes|\n #need to create a category that is alrady assoicated with this post and make sure that this cateogry doesn't already exist\n\n #DO NOT CREATE A CATEGOERY if it doesn't have a name\n if category_attributes[:name].present?\n # also don't add a category if it already has it\n\n category = Category.find_or_create_by(name: category_attributes[:name])\n if !self.categories.include?(category)\n # post_categories\n # self.categories<< category\n self.post_categories.build(:category => category)\n end\n end\n end\n end", "def slugified_categories\n Array(@obj.data[\"categories\"]).each_with_object(Set.new) do |category, set|\n set << Utils.slugify(category.to_s)\n end.to_a.join(\"/\")\n end", "def all_categories\n\t\t@categories = Category.all\n\tend", "def set_all_categories\n @all_categories = Category.all.order_by_name\n end", "def categories_attributes=(categories_hashes)\n categories_hashes.each do |index, categories_attributes|\n if categories_attributes[:name].present?\n category = Category.find_or_create_by(name: categories_attributes[:name])\n if !self.categories.include?(category)\n self.post_categories.build(:category => category)\n end\n end\n end\n end", "def to_categories(sub_context)\n Array(sub_context).map { |id|\n categories[id] \n }.compact\n end", "def budget_categories_data\n # @budget.budget_items.collect { |budget_item| budget_item.category.name.to_s }.to_json\n categories = Category.for_budget.to_a\n categories << Category.find_by_name(\"Miscellaneous\")\n return categories.collect { |category| category.name.to_s }.to_json\n end", "def categories_attributes=(category_hashes)\n #hash looks like this {\"0\"={name:\"New Category\"}, \"1\"={name:\"Other New Category\"}}\n #for every value in the categoery_attributes hash...\n category_hashes.value.each do |i,category_attr|\n #each will be this: {name:\"New Category\"} - a hash that can be used to create a new cateogry\n #find or create a category by that attribute (will pass key and value in?)\n category=Category.find_or_create_by(name: category_attr[:name])\n\n #make a new post_category instance using the category\n #will make a new post_category with post_id of self.id and category_id of category.id\n self.post_categories.build(category:category)\n end\n end", "def categories_attributes=(category_attributes)\t\n category_attributes.values.each do |category_attribute|\t\n category = Category.find_or_create_by(category_attribute)\t\n self.categories << category\t\n end\t\n end", "def sort_categories\n for cat in @all_categories\n if(cat.parent_id == nil)\n @all_categories_hash[0] = [cat]\n else\n if(@all_categories_hash[cat.parent_id] == nil)\n @all_categories_hash[cat.parent_id] = []\n end\n @all_categories_hash[cat.parent_id].push(cat)\n end\n end\n for key in @all_categories_hash.keys\n @all_categories_hash[key].sort!{|x,y| x.name <=> y.name}\n end\n end", "def group_by_category(books)\n \tin_categories = {}\n \tbooks.each do |book|\n #make empty array in hash for that key if category as key not present\n \t\tif !in_categories.key? book.category.to_sym\n \t\t\tin_categories[book.category.to_sym] = []\n \t\tend\n #add book to category's array\n \t\tin_categories[book.category.to_sym] << book\n \tend\n \tin_categories\n end", "def categories_attributes=(categories_hashes)\n categories_hashes.each do |i, category_attributes|\n if category_attributes[:name].present?\n category = Category.find_or_create_by(name: category_attributes[:name])\n if !self.categories.include?(category)\n self.post_categories.build(:category => category)\n end\n end\n end\n end", "def all_matching_categories(categories)\n cross_version_category_mapping\n .select { |key, _value| categories.include?(key) }\n .values\n .flatten\n .uniq\n end", "def scrape_categories_page\n categories = {}\n # On non-root pages, the xpath is:\n # \"//ul[@id='nav-categories']/li/a\"\n @agent.get(clean_url('/')) do |page|\n page.search(\"//h2[text()='Categories']/following-sibling::ul/li/a\").each do |link|\n category_url = link.attributes[\"href\"].value\n categories[link.text.gsub(/[^\\w\\s]+/,'').lstrip] = category_url\n end\n end\n\n categories\n end", "def tag_category_mapping\n @tag_category_mapping ||= {\n \"general\" => 0,\n \"gen\" => 0,\n\n \"artist\" => 1,\n \"art\" => 1,\n\n \"copyright\" => 3,\n \"copy\" => 3,\n \"co\" => 3,\n\n \"character\" => 4,\n \"char\" => 4,\n \"ch\" => 4\n }\n end", "def categories_attributes=(categories_hash)\n # {\"0\"=>{\"name\"=>\"Romance\"}, \"1\"=>{\"name\"=>\"\"}}\n # raise categories_attributes.inspect\n categories_hash.each do |index, category_attribute|\n # find or create if post doesn't have this category BAD\n # self.category.find_or_create_by(name: category_attribute[:name])\n # find or create if this post doesn't exist yet GOOD\n if category_attribute[:name].present?\n category = Category.find_or_create_by(name: category_attribute[:name])\n if !self.categories.include?(category)\n self.post_categories.build(:category => category)\n end\n end\n end\n end", "def sort_categories\n #loop to sort categories parents and children\n for cat in @all_categories\n #if category parent id == nill then hash = current category else if parent id of category = nil then parent id hash is nil\n if(cat.parent_id.nil?)\n @all_categories_hash[0] = [cat]\n else\n if(@all_categories_hash[cat.parent_id].nil?)\n @all_categories_hash[cat.parent_id] = []\n end\n @all_categories_hash[cat.parent_id].push(cat)\n end\n end\n #Sort loop for categories\n for key in @all_categories_hash.keys\n @all_categories_hash[key].sort!{|x,y| x.name <=> y.name}\n end\n end", "def categories_attributes=(category_attributes)\n category_attributes.values.each do |category_attribute|\n if !category_attribute[:name].empty?\n category = Category.find_or_create_by(category_attribute)\n self.categories << category\n end\n end \n \n end", "def get_itunes_categories\n itunes_categories_raw = YAML::load( File.open( \"#{RAILS_ROOT}/config/iTunes.yml\" ) )\n itunes_categories = []\n itunes_categories_raw.keys.sort.each do |cat|\n itunes_categories.push cat => itunes_categories_raw[cat]\n end\n return itunes_categories\n end", "def categories_attributes=(category_hashes)\n # needed so post new form can be used to create categories_attributes\n category_hashes.each do | index, category_attributes |\n if category_attributes[:name].present?\n category = Category.find_or_create_by(name: category_attributes[:name])\n # if category already exists for post, don't add it\n if !self.categories.include?(category)\n self.categories << category # inefficient!\n self.save\n end\n end\n end\n end", "def assign_categories_for_admin\n categories = Category.all\n @categories = []\n categories.each { |category| @categories << [category.name, category.id] }\n end", "def category_attributes=(category_attributes)\n category_attributes.values.each do |category_attribute|\n category = Category.find_or_create_by(category_attribute)\n self.categories << category\n end\n end", "def build_categories(product, mapped_categories)\n collection = []\n\n product[:categories].each do |category_name|\n mapped_categories.each do |mapped_category|\n build_category_tree(collection, category_name, mapped_category)\n end\n end\n\n collection\n end", "def category_info\n {\n categories: self.object.appointments.map{ |appt| \n appt.category\n }\n \n }\n end", "def categories_attributes=(category_attributes)\n # byebug\n category_attributes.values.each do |category_attribute|\n unless category_attribute['name'].empty?\n category = Category.find_or_create_by(category_attribute)\n self.categories << category \n end \n end\n end", "def get_all_tire_categories\n cats = TireModelInfo.joins('INNER JOIN tire_models ON tire_models.tire_model_info_id = tire_model_infos.id',\n 'INNER JOIN tire_categories ON tire_models.tire_category_id = tire_categories.id')\n .where(tire_manufacturer_id: self.id)\n .select('DISTINCT tire_model_infos.id, tire_model_infos.tire_model_name, tire_categories.id AS \"category_id\", tire_categories.category_name AS \"category_name\"')\n .order('tire_categories.id ASC, tire_model_infos.tire_model_name ASC')\n result = Hash.new\n cats.each do |c|\n cat_id = c[:category_id]\n result[cat_id] = {:category_name => c[:category_name], :models => []} if result[cat_id].nil?\n result[cat_id][:models] << {:id => c.id, :name => c.tire_model_name}\n end\n result\n end", "def all(params = {})\n handle_all_request(\"/categories\", :categories, params)\n end", "def find_categories\n categories = @deck.cards.group_by do |card|\n card.category\n end\n categories.keys\n end", "def index\n @categories = collections_config.values\n end", "def categories_attributes=(category_attributes)\n category_attributes.values.each do |category_attribute|\n if category_attribute[\"name\"].present?\n category = Category.find_or_create_by(category_attribute)\n self.categories << category\n end\n end\n end", "def getCategoryAll()\n params = Hash.new\n return doCurl(\"get\",\"/category/all\",params)\n end", "def set_categories\r\n @categories = Category.where('courses_count > 0').order(:name)\r\n end", "def category_attributes=(category_attributes) # setter\n # raise category_attributes.inspect\n category_attributes.keys.each do |key|\n categories.new(category_attributes[key])\n end\n end", "def to_yaml_object\n return nil if @categories.empty?\n @categories\n end", "def to_yaml_object\n return nil if @categories.empty?\n @categories\n end", "def all(&block)\n categories = []\n\n # Categories are listed in catalog xml, so fetch that.\n catalog = Catalog.new(@options)\n catalog.all do |item|\n categories << {\n code: item[:subcategory].gsub(\"&amp;\", \"\").gsub(/[^A-Za-z0-9]/, \"_\").squeeze(\"_\").downcase,\n description: item[:subcategory].gsub(\"&amp;\", \"&\")\n }\n end\n\n categories.uniq! { |c| c[:code] }\n categories.sort_by! { |c| c[:code] }\n\n categories.each do |category|\n yield category\n end\n end", "def categories\n # @categories = Category.get_categories(@user.id)\n #@categories =Category.all.select(:id).select(:name).select(:description).select(:logo_url)\n @categories =Category.all\n user_cat= @user.categories.collect(&:id)\n categories = []\n @categories.each do |cat|\n cat_attr = cat.attributes\n user_cat.include?(cat.id) ? cat_attr.merge!('user_category' => true) : cat_attr.merge!('user_category' => false)\n categories << cat_attr\n end\n @categories = categories\n\n respond_to do |format|\n if @categories.blank?\n format.json {render json:{:success => false, :status_code => 404, :message => \"No category found\"}}\n format.xml {render xml:{:success => false, :status_code => 404, :message => \"No category found\"}}\n format.html {render json: {:success => false, :status_code => 404, :message => \"No category found\"}}\n else\n format.html {render json: {:success => true, :status_code => 200, :categories => @categories}}\n format.json {render json: {:success => true, :status_code => 200, :categories => @categories}}\n format.xml {render xml: {:success => true, :status_code => 200, :categories => @categories}}\n end\n end\n end", "def clil_categories_codes\n self.clil_categories.map { |c| c.code }.uniq\n end", "def urls( category = nil )\n\t\th = Hash.new\n\t\tcategory = [ category ] unless category.class == Array\n\t\t(category ? category : @refs.keys).each do |cat|\n\t\t\tnext unless @refs[cat]\n\t\t\t@refs[cat].each do |a|\n\t\t\t\ta[2].each do |b|\n\t\t\t\t\th[b[1].url] = [ b[1].category, b[1].category_label, b[1].title, b[1].title_ignored, b[1].title_group, b[1].key ]\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\th\n\tend", "def category_enum\n Category.all.collect {|p| [ p.name, p.id ] }\n end", "def make_catgraph()\n File.open(@catgraph_file, \"w\") do |catgraphf|\n i = 0\n @articles_map.keys.each do |title|\n print \"Count = #{i}\\n\"\n if title =~ /Category:/\n cats = extract_categories(title)\n cats_str = \"\"\n cats.each { |c| cats_str += \" #{c}\" }\n catgraphf.puts(\"#{@articles_map[title]}: #{cats_str}\")\n end\n i=i+1\n end\n end\n end", "def categories_list\n self.categories.collect{|c| c.name}\n end", "def collect\n c = {\n @name => {\n \"color\"=> @color,\n \"hover\"=> @hover,\n \"entries\"=> []\n }\n }\n entries.each{ |e| c[@name]['entries'] << e.collect }\n c\n end", "def items_by_categories\n set_parts = {}\n\n categories.each do |category|\n set_parts[category] = suitable_items.select do |item|\n item.category == category\n end\n end\n\n set_parts\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 set_categories\r\n csv = CSV.readlines(File.join('data', 'categories.csv'))\r\n @categories = csv.each_with_object({}) do |(key, val), hsh|\r\n hsh[key] = val\r\n end\r\n\r\n @items.each do |i|\r\n i.category = @categories[i.category]\r\n end\r\nend", "def categories\n @categories ||= wayfinder.decorated_vocabularies.sort_by(&:label)\n end", "def categories\n @categories = FinanceTransactionCategory.all(:conditions => {:deleted => false}, :order => 'name asc')\n @categories = @categories.select { |x| x.accessible? }\n @category_ids = @categories.map { |cat| cat.id if FinanceTransaction.find_by_category_id(cat.id).present? }.compact\n @multi_config = FinanceTransactionCategory.get_multi_configuration\n @fee_category_present = FinanceFeeCategory.first\n # @fixed_categories = @categories.reject { |c| !c.is_fixed }\n # @other_categories = @categories.reject { |c| c.is_fixed }\n end", "def get_categories\n @cards.each do |card|\n if [email protected]?(card.category)\n @categories << card.category\n end\n end\n @categories\n end", "def categories\n @categories ||= (@doc/\"Category\").collect { |it| Element.new(it) }\n end", "def clil_categories_codes\n self.clil_categories.map{|c| c.code}.uniq\n end", "def all_product_hash\n hash = {}\n items = @all_products\n for prod in items\n hash[prod] = {}\n end\n return hash\n end", "def hash_by_label\n @hash_by_label ||= begin\n result = {}\n flatten_hierarchy.each do |c|\n result[c.label.downcase]=c\n end\n result\n end\n end", "def all_category_ids\n end", "def generate_hash\n @tags.group_by do |x|\n x[:name]\n x.delete(:name)\n end\n end", "def categories\n []\n end", "def generate_categories\n Category.destroy_all\n\n puts 'Generating categories'\n\n Category.create(name: 'photo')\n Category.create(name: 'type')\n # Category.create(name: 'effectiveness')\nend", "def index\n @basic_categories = Category.where(:cat_type => \"Basics\")\n @theme_categories = Category.where(:cat_type => \"Themes\")\n \n # @theme_words = @theme_categories.find_words\n # @basic_words = @basic_categories.find_words\n # respond_to do |format|\n # format.html\n # format.json {render :json => @categories}\n # end\n @categories = {}\n Word.select(:id, :name, :category_id).each do |word|\n @categories[word.category_id] ||= []\n @categories[word.category_id].push word\n end\n end", "def categories\n categories = []\n @deck.cards.map do |turn|\n categories << turn.category\n end\n categories.uniq!\n end", "def categorize(elt2category, unknown=nil)\n categories = Hash.new { |h,k| h[k] = [] }\n self.each do |elt|\n if elt2category.include? elt\n categories[elt2category[elt]] << elt \n elsif unknown\n categories[unknown] << elt\n end\n end\n categories\n end", "def category_list_builder\n categories = API.get_categories\n categories.each do |cat|\n Category.new(cat)\n end\n end", "def categories_attributes=(categories)\n \tcategories.each do |index, category_hash|\n \t\tif category_hash[:name].present?\n\t\t\tcategory = Category.find_or_create_by(name: category_hash[:name])\n\t\t\tif !self.categories.include?(category)\n\t\t\t self.post_categories.build(:category => category) \n\t\t\tend\n end\n \tend\n end", "def category_names\n self.categories.map do |category|\n category.name\n end\n end" ]
[ "0.7814327", "0.7305079", "0.7221626", "0.71745896", "0.7056135", "0.70216185", "0.69317603", "0.6872085", "0.6694369", "0.66482854", "0.6633439", "0.6625173", "0.65950793", "0.65494233", "0.64804876", "0.6403787", "0.6390575", "0.6384256", "0.63443655", "0.63328743", "0.63019186", "0.6282658", "0.62401485", "0.62218845", "0.6201972", "0.6195949", "0.6195182", "0.6172491", "0.6155482", "0.6147646", "0.61411697", "0.61112016", "0.60616654", "0.60582346", "0.60568863", "0.6043802", "0.60364646", "0.60205805", "0.5967413", "0.5964595", "0.5953037", "0.5950068", "0.5942216", "0.5931759", "0.5925477", "0.59214544", "0.5918179", "0.5905281", "0.5904937", "0.59034544", "0.5901755", "0.58977705", "0.5880799", "0.5879279", "0.5870016", "0.5855245", "0.5848357", "0.58471584", "0.5835403", "0.5829034", "0.5817778", "0.58156997", "0.58122754", "0.5808789", "0.57952917", "0.57887655", "0.5787105", "0.5785029", "0.5780448", "0.57787067", "0.57779837", "0.57779837", "0.5776612", "0.57758266", "0.57674974", "0.57634443", "0.57440954", "0.57392097", "0.57389015", "0.5727098", "0.57249427", "0.5723523", "0.5721761", "0.57159436", "0.57144064", "0.5712989", "0.5703678", "0.5695117", "0.56884223", "0.56842995", "0.5683188", "0.5675812", "0.5663493", "0.56584775", "0.56531113", "0.5639562", "0.56391263", "0.56249046", "0.562451", "0.56178373" ]
0.722577
2
Creates a hash for all groups
def all_group_hash hash = {} for group in @all_groups hash[group] = {} end return hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_hash\n @groups.flatten.inject([]) {|hash, stone| hash << stone.to_s}.sort.hash\n end", "def hash\n [group, x, y].hash\n end", "def groups\n @groups ||= {}\n end", "def generate_hash\n @tags.group_by do |x|\n x[:name]\n x.delete(:name)\n end\n end", "def hash\n raw = [name, type, values.join('/')].join(' ')\n Digest::MD5.hexdigest(raw)\n end", "def create_groups(cohort)\n if cohort.length % 5 == 0\n hash = {} \t\n \tcounter = 1\n group_count = cohort.length / 5\n remainder = cohort.length % 5 \t\n # Set to groups(keys) to members(values)\n group_count.times do\n hash[counter] = cohort.slice!(0..4)\n counter += 1\n end\n else\n \thash = {}\n counter = 1 \n group_count = cohort.length / 4\n remainder = cohort.length % 4\n # Set to groups(keys) to members(values)\n group_count.times do\n hash[counter] = cohort.slice!(0..3)\n counter += 1\n end\n end\n # Add remainders\n counter = 1\n cohort.each do |string|\n hash[counter] << string\n counter += 1\n end\nreturn hash\nend", "def groups\n c = Hash.new\n @up.keys.each{|key|\n c.append(self.find(key),(key))\n }\n return c.values\n end", "def build_groups\n groups = {}\n roles = %w[client server initial]\n roles.each do |role|\n groups[role] = build_roles(role)\n end\n groups\n end", "def group_data\n data_hash = {color: @color, bling: @bling, age: @age, functional: @functional}\n end", "def to_hash\n hash = {}\n hash['Id'] = @id unless @id.nil?\n hash['Name'] = @name unless @name.nil?\n hash['TinyName'] = @tiny_name unless @tiny_name.nil?\n hash['StartGroupCallOnEnter'] = @start_call_on_enter unless @start_call_on_enter.nil?\n hash['EndGroupCallOnExit'] = @end_call_on_exit unless @end_call_on_exit.nil?\n unless @members.nil?\n l = []\n @members.each do |member|\n l.push(member.to_hash)\n end\n hash['Members'] = l unless l.empty?\n end\n hash\n end", "def groups(array_of_names)\r\n\r\n\tnum_people = array_of_names.length \t\t#how many people do we have?\r\n\tgroups_5 = num_people % 4 \t#how many groups will have 5\r\n\tgroups_4 = (num_people - (groups_5 * 5)) / 4 # how many groups will have 4\r\n\ttotal_groups = groups_4 + groups_5 \t\t#how many total groups\r\n\r\n\tgroup_hash = Hash.new([])\t#new hash initialized to empty arrays\r\n\t\r\n\tnum_group = 0\r\n\tindex = 0\r\n\r\n\tgroups_5.times do\r\n\t\tpeople_in_group = []\r\n\t\t5.times do\r\n\t\t\tpeople_in_group << array_of_names[index]\r\n\t\t\tindex += 1\r\n\t\tend\r\n\t\tgroup_hash[\"Accountability Group #{num_group}\"] = people_in_group\r\n\t\tnum_group += 1\r\n\tend\r\n\r\n\tgroups_4.times do\r\n\t\tpeople_in_group = []\r\n\t\t4.times do\r\n\t\t\tpeople_in_group << array_of_names[index]\r\n\t\t\tindex += 1\r\n\t\tend\r\n\t\tgroup_hash[\"Accountability Group #{num_group}\"] = people_in_group\r\n\t\tnum_group += 1\r\n\tend\r\n\r\n\treturn group_hash\r\n\r\nend", "def new_group(key)\n []\n end", "def hash\n [provider_name, host_name, host_port, host_ssl, host_tls, host_no_cert_check, bind_dn, bind_password, search_timeout, admin_pool_max_active, admin_pool_lookup_on_validate, user_pool_max_active, user_pool_lookup_on_validate, user_base_dn, user_objectclass, user_id_attribute, user_extra_filter, user_make_dn_path, group_base_dn, group_objectclass, group_name_attribute, group_extra_filter, group_make_dn_path, group_member_attribute, use_uid_for_ext_id, customattributes].hash\n end", "def to_hash\n ad_group_hash = {\n :id => self[:id],\n :name => self[:name],\n :status => self[:status]\n }\n end", "def to_jaxb_json_hash\n _h = {}\n if !groupIds.nil?\n _ha = Array.new\n groupIds.each { | _item | _ha.push _item.to_jaxb_json_hash }\n _h['groupIds'] = _ha\n end\n return _h\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 to_hash\n hash = {}\n %i[name sequence_no caption namespaced_name data_type width\n format hide pinned groupable group_by_seq\n group_sum group_avg group_min group_max].each { |a| hash[a] = send(a) }\n hash\n end", "def acct_groups(names)\r\n\r\n\tnum_groups = names.size / 4\r\n\r\n\tgroups_ary = Array.new(num_groups) { Array.new }\r\n\r\n\tnames.each_with_index do |name, index|\r\n\t\tgroups_ary[index % num_groups] << name\r\n\tend\r\n\r\n\tgroups_hash = Hash.new\r\n\tgroups_ary.each_with_index do |group_ary, index|\r\n\t\tgroups_hash[\"Accountability Group \" + (index+1).to_s] = group_ary\r\n\tend\r\n\r\n\treturn groups_hash\r\n\r\nend", "def groups\n groups = []\n @config['groups'].each do |k, v|\n groups << OpenStruct.new(\n name: k,\n size: Size.new(v['size']),\n rss: v['rss'],\n requests: v['requests'],\n path: v['path'])\n end\n groups.freeze\n end", "def add_groups(host, groups=[])\n for group in groups\n if !GROUPS.key?(group) then\n GROUPS[group] = []\n end\n GROUPS[group].push(host)\n end\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 grouped_objects\n product = {}\n hash.each do |key,value|\n product[value[\"name\"]] ||= []\n product[value[\"name\"]] << [key, value[\"id\"]]\n end\n product\n end", "def list_as_hash(group_names=[], &each_group)\n group_names = [group_names].flatten.compact\n glist = @@ec2.describe_security_groups(:group_name => group_names) || {}\n return unless glist['securityGroupInfo'].is_a?(Hash)\n groups = {}\n glist['securityGroupInfo']['item'].each do |oldg| \n g = Groups.from_hash(oldg)\n groups[g.name] = g\n end\n groups.each_value { |g| each_group.call(g) } if each_group\n groups = nil if groups.empty?\n groups\n end", "def create_groups(list)\n list_copy = []\n list.each {|item| list_copy.push(item)}\n all_groups = []\n list_copy.shuffle!\n while list_copy.size >= 4\n group = list_copy.pop(4)\n all_groups << group\n end\n if list_copy.size > 0\n list_copy.each_with_index do |person, index|\n person = list_copy.pop\n all_groups[index].push(person)\n end\n end\n hash = {}\n all_groups.each_with_index do |group, index|\n hash[\"Accountability Group #{index}\"] = group\n end\n p hash\nend", "def group_by(*args, &block)\n @members.group_by(*args, &block).map do |key, array|\n [key, self.class.new(array)]\n end.to_h\n end", "def active_groups_map\n @@groups ||= load_group_file || {}\n end", "def group_by(hash)\n hash.inject({}) do |ret_hash,(key,el)|\n group_key = yield el\n prev_for_group = ret_hash[group_key] || {}\n group = {key => el}.merge(prev_for_group)\n ret_hash.merge(group_key => group)\n end\n end", "def hash\n [_hash, name, owner].hash\n end", "def create_hash(&block); end", "def create_hash(&block); end", "def group_by(&block)\n result = {}\n each {|value|\n new_key = block.call(value)\n (result[new_key] ||= []) << value\n }\n result\n end", "def group_by(&block)\n result = {}\n each {|value|\n new_key = block.call(value)\n (result[new_key] ||= []) << value\n }\n result\n end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def key\n 'groupid'\n end", "def group_maker(array)\n group_hash = {}\n arrays = array.each_slice(5).to_a\n arrays.each do |item|\n if item.length == 2\n arrays[0].push(item[0])\n arrays[1].push(item[1])\n num = arrays.index(item)+1\n group_hash[\"group #{num}\"] = item\n group_hash.delete_if {|k,v| v.length <= 2}\n \n elsif item.length == 1\n arrays[0].push(item[0])\n num = arrays.index(item)+1\n group_hash[\"group #{num}\"] = item\n group_hash.delete_if {|k,v| v.length <= 2}\n else\n num = arrays.index(item)+1\n group_hash[\"group #{num}\"] = item\n end\n end\n return group_hash\nend", "def to_hash() end", "def hash\n [id, numero_estabelecimento, flag_matriz, id_grupo_economico, numero_receita_federal, nome, descricao, nome_fantasia, cep, nome_logradouro, numero_endereco, bairro, cidade, complemento, uf, cep2, nome_logradouro2, numero_endereco2, bairro2, cidade2, complemento2, uf2, obs, contato, email, flag_arquivo_secr_fazenda, flag_cartao_digitado, inativo, id_moeda, id_pais, associado_spc_brasil, mcc, id_tipo_estabelecimento, correspondencia, cargo_contato, tipo_pagamento, consulta, consulta2, consulta3, terminal, data_cadastramento, usuario].hash\n end", "def finalist_group(input_finalist_array)\n\t\tfinalist_hash = Hash.new\n\t\tinput_finalist_array.each {| finalist_name | finalist_hash[\"#{finalist_name}\"] = 0 } \n\t\treturn finalist_hash\n\tend", "def hash\n [host_list, total_matching, total_returned].hash\n end", "def group_all\n grp = {}\n grp.merge!(groupby_fields)\n grp.merge!(groupby_values)\n { '$group' => grp }\n end", "def get_all_groups\n grps = self.get_groups_recursively\n grps << self.home_group\n logged_in_group = Group.new(:name => \"logged in user\")\n logged_in_group.id = 0\n grps << logged_in_group\n anonymous_group = Group.new(:name => \"anonymous user\")\n anonymous_group.id = -1\n grps << anonymous_group\n return grps.compact.uniq\n end", "def create_group_map(options={})\n\n\tleague_id = options[:league_id]\n\tfixtures_xml = options[:xml]\n\n\tgroup_hash = Hash.new\n\n\tfixtures_xml.xpath(\"//Match\").each do |node|\n if [16, 17].include? league_id\n home_team_id = node.xpath(\"HomeTeam_Id\").text\n away_team_id = node.xpath(\"AwayTeam_Id\").text\n if group_hash[home_team_id].nil?\n group_hash[home_team_id] = Array.new\n group_hash[home_team_id] << home_team_id\n group_hash[home_team_id] << away_team_id\n elsif !group_hash[home_team_id].include? away_team_id\n group_hash[home_team_id] << away_team_id\n end\n end\n\tend\n\n groups = Array.new\n team_has_group = Hash.new\n group_hash.each do |k,v|\n if team_has_group[k].nil?\n groups << v\n v.each do |t|\n team_has_group[t] = true\n end\n end\n end\n\n # Group name order hard-coded for 2013 (due to xmlsoccer fixture order)\n if league_id == 16\n group_names = [ 'A', 'D', 'B', 'C', 'H', 'F', 'E', 'G', ]\n elsif league_id == 17\n group_names = [ 'A', 'E', 'F', 'B', 'C', 'D', 'J', 'H', 'I', 'K', 'G', 'L' ]\n end\n \n unsorted_groups = Hash.new\n groups.each do |group|\n group_name = group_names.shift\n unsorted_groups[group_name] = Array.new\n group.each do |team_id|\n unsorted_groups[group_name] << team_id\n group_hash[team_id.to_s] = group_name\n end\n end\n\n # @groups = Hash.new\n # unsorted_groups.keys.sort.each do |key|\n # @groups[key] = unsorted_groups[key]\n # end\n\n group_hash\n\nend", "def to_h\n hash = {}\n each_with_name{ |v, n| hash[n] = v}\n hash\n end", "def hash\n [account_id, cms_user_id, company, created_at, dept, email, first_name, group_ids, host_key, id, im_group_ids, jid, job_title, language, last_client_version, last_login_time, last_name, location, personal_meeting_url, phone_country, phone_number, pic_url, pmi, role_name, status, timezone, type, use_pmi, vanity_url, verified].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 to_hash\n h = super\n h['uid'] = @uid\n h\n end", "def hash_hash(h)\n require 'digest/md5'\n Digest::MD5.hexdigest(Marshal::dump(h.sort))\n end", "def to_hash\n index_hash = Hash.new\n index_hash[\"json_claz\"] = self.class.name\n index_hash[\"group\"] = group\n cloud_instructions_array.each do |single_cig|\n index_hash[\"\"] = single_cig\n end\n index_hash\n end", "def to_h\n super.merge owner: owner, group: group\n end", "def hash\n [auth_mode, count_per_project, email_from, email_host, email_port, email_identity, email_username, email_ssl, email_insecure, ldap_url, ldap_base_dn, ldap_filter, ldap_scope, ldap_uid, ldap_search_dn, ldap_timeout, ldap_group_attribute_name, ldap_group_base_dn, ldap_group_search_filter, ldap_group_search_scope, ldap_group_admin_dn, oidc_client_id, oidc_endpoint, oidc_name, oidc_scope, oidc_verify_cert, project_creation_restriction, quota_per_project_enable, read_only, self_registration, storage_per_project, token_expiration, verify_remote_cert, scan_all_policy].hash\n end", "def before_mapping_hash(gid_array)\n @log.info \"BEFORE_MAPPING_HASH\"\n ##TODO test test test\n\n hash = Hash.new\n gid_array.each { |gid| hash[gid] = @redis_connector.real_partition_of_node(gid).to_i }\n hash\n end", "def hash()\n #This is a stub, used for indexing\n end", "def groups=(groups_hash)\n client_principal.groups = Hash[groups_hash.map { |k, v| [k, v.sort] } ]\n end", "def sort_groups_initial(array)\n\t#Set number of groups (one if there are less than four people)\n\tgroup_num = array.length / 4\n\tgroup_num = 1 if array.length < 4\n\n\tcounter = 1\n\n\t#Create a new hash with a default value of an empty array for any key\n\tgroup_hash = Hash.new { |k,v| k[v] = [ ] }\n\n\tarray.each do |i|\n\t\t#Add name to group number\n\t\tgroup_hash[counter] << i\n\n\t\t#Increase group number, or loop back to first group\n\t\tif counter == group_num\n\t\t\tcounter = 1\n\t\telse\n\t\t\tcounter += 1\n\t\tend\n\tend\n\n\treturn group_hash\nend", "def hash(*) end", "def all_image_hash\n hash = {}\n items = @all_images\n for img in items\n hash[img] = {}\n end\n return hash\n end", "def hash\n members.hash\n 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 create_hash(ordered_family)\n santas = {}\n ordered_family.each_with_index do |person, index|\n santas[person] = ordered_family[(index + 1) % ordered_family.size]\n end\n return santas\n end", "def create_groups(people)\n number_people = people.length\n if number_people < 3\n group_quantity = 1\n else\n group_quantity = number_people / 3\n end\n group_number = 1\n groups_names = Hash.new(\"\")\n people.each do |name|\n if group_number <= group_quantity\n groups_names[group_number] += (name + \", \")\n group_number += 1\n else\n groups_names[1] += (name + \", \")\n group_number = 2\n end\n end\n groups_names.each do |group, name|\n print \"\\n\", \"Group \", group, \"\\n\"\n print name, \"\\n\"\n end\nend", "def hash\n \"#{self.class.name}-#{self.id}-#{@__metadata__.cas}-#{@__attributes__.hash}\".hash\n end", "def generate_keys(num)\n num.times.inject({}) do |acc, i| \n key = ::Digest::MD5.hexdigest(i.to_s)\n node = redis.node_for(key).client\n hash_key = \"redis://#{node.host}:#{node.port}/#{node.db}\"\n acc[hash_key] = [] if acc[hash_key].nil?\n acc[hash_key] << key\n acc\n end\n end", "def hash\n [compute, group_by, index, multi_compute, search].hash\n end", "def output_hash; end", "def hash\n @hash ||= Hash.new { |h, k| h[k] = Hash.new(&h.default_proc) }\n end", "def digestable_hash\n @item.slice(CLASS, QUEUE, LOCK_ARGS, APARTMENT).tap do |hash|\n hash.delete(QUEUE) if unique_across_queues?\n hash.delete(CLASS) if unique_across_workers?\n end\n end", "def hash_by_uri\n @hash_by_uri ||= begin\n result = {}\n flatten_hierarchy.each do |c|\n result[c.uri.to_s]=c\n end\n result\n end\n end", "def assigned_groups=(array_hash)\n # Find new groups (but no duplicates)\n self.added_groups = []\n array_hash.each do |h|\n unless groups.detect { |c| c.id.to_s == h[:id] } || self.added_groups.detect { |f| f.id.to_s == h[:id] }\n c = !h[:id].blank? ? Group.find(h[:id]) : Group.new({:page_object => self})\n c.attributes = h.reject { |k,v| k == :id } # input values, but don't try to overwrite the id\n self.added_groups << c unless c.nil?\n end\n end\n # Delete removed groups\n groups.each do |c|\n if h = array_hash.detect { |h| h[:id] == c.id.to_s }\n c.attributes = h.reject { |k,v| k == :id }\n else\n c.destroy_association = 1\n end\n end\n end", "def hash\n [id, alternate_id, type, first_name, surname, date_of_brith, date_of_birth, shipping_address, mailing_address, home_phone, mobile_phone, email_address, mailing_address_active, accounts, classifications, member_photo, gender, receive_email, receive_sms, password].hash\n end", "def hyrax_group_names\n groups\n end", "def hash\n [cluster, options].hash\n end", "def hash\n [cluster, options].hash\n end", "def hash\n [id, banco, agencia, conta_corrente, especie, numero_convenio, carteira, codigo_cedente, especie_tipo, especie_documento, aceite, instrucoes, local_pagamento1, local_pagamento2, endereco_cobranca_emissor, nome_beneficiario, cnpj_beneficiario, operador, data, maquina].hash\n end", "def user_group_general_info_hash\n wait_until_bus_section_load\n array = general_info_spans.map{ |span| span.text }\n Hash[*array]\n end", "def to_hash\n hsh = {\n id: id,\n status: status.to_sym,\n connect: running? ? connect.to_h : nil,\n time: info.wallclock_time.to_i / 60 # only update every minute\n }\n Digest::SHA1.hexdigest(hsh.to_json)\n end", "def collect_group_details\n return @groups_cache ||= @group_provider.groups unless @group_provider.nil?\n\n []\n end", "def to_hsh\n {name => {:columns => columns, :unqiue => unique}}\n end", "def to_hash\n {:hashes => @hashes}\n end", "def initialize_group_transform\n @parents_list = []\n @groups = Hash.new\n @parent_column = @query[\"group\"]\n @logs.select(@parent_column).group(@parent_column).order(@parent_column).each do |log|\n @groups[log[@parent_column]] = Hash.new\n @groups[log[@parent_column]][\"parent_values\"] = []\n @groups[log[@parent_column]][\"parent_values\"] << log[@parent_column]\n @groups[log[@parent_column]][\"child_values\"] = []\n @parents_list << log[@parent_column]\n end\n @parent_table_keys = []\n @parent_table_keys << @parent_column\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 hash\r\n\t\treturn @name.hash() + @type.hash()\r\n\tend", "def to_yml\n groups = get_groups\n groups = Hash[Array.new(groups.size) { |index| [\"Group #{index + 1}\", groups[index]] }]\n YAML.dump(groups)\n end", "def to_hash_groups(key_column, value_column=nil, opts=OPTS)\n if (@opts[:eager_graph] || @opts[:eager]) && !opts.has_key?(:all)\n opts = Hash[opts]\n opts[:all] = true\n end\n super\n end", "def process_group(group, result)\n\t\tif result.has_key?(group)\n\t\t\traise 'Repeated group. Invalid config file. ' << group\n\t\tend\n\t\t\n\t\tresult[group] = ModifiedHash.new\n\t\t#set global var to hold current group name. Used while processing key-val pair\n\t\t$current_group = group\n\tend", "def hash\n [discriminator, name].hash\n end", "def hash\n [sub, email, error_details, accounts, name, family_name, given_name, created].hash\n end", "def to_hash\n hash = {}\n hash[\"society\"] = society if society\n hash[\"balloting_group\"] = balloting_group.to_hash if balloting_group\n hash[\"working_group\"] = working_group if working_group\n hash[\"committee\"] = committee if committee\n hash\n end", "def hash\n [adwords_grouping, adwords_label1, adwords_label2, adwords_label3, adwords_label4, adwords_label5, age_group, available_at_physical_store, book_author, book_format, book_isbn, book_publisher, category_description, color, condition, custom_label0, custom_label1, custom_label2, custom_label3, custom_label4, gender, google_product_category, music_artist, music_format, music_release_date, omit_from_feed, product_type, promotion_id1, promotion_id10, promotion_id2, promotion_id3, promotion_id4, promotion_id5, promotion_id6, promotion_id7, promotion_id8, promotion_id9, search_dts, search_lowest_price, search_lowest_url, search_position, shipping_label, size, video_director, video_format, video_rating, video_release_date, video_starring].hash\n end", "def to_hash_groups(key_column, value_column = nil, opts = Sequel::OPTS)\n if value_column && !opts[:hash]\n clone(:_sequel_pg_type=>:hash_groups, :_sequel_pg_value=>[key_column, value_column]).fetch_rows(sql){|s| return s}\n {}\n elsif opts.empty?\n super(key_column, value_column)\n else\n super\n end\n end", "def to_hash\n {\n :id => @id,\n :name => @name,\n :email => @email,\n :hash => @hash,\n :role => @role,\n :color => @color,\n :nsfw => @nsfw\n }\n end", "def hasher\n Hashids.new(@hash_id_state[:salt], @hash_id_state[:length])\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" ]
[ "0.8311913", "0.6860097", "0.6604363", "0.65066975", "0.63019824", "0.62774056", "0.6254687", "0.62543106", "0.619326", "0.6178484", "0.61632216", "0.61543566", "0.6108044", "0.6099868", "0.60638934", "0.6053439", "0.60182005", "0.6002634", "0.6001861", "0.6001835", "0.60000336", "0.5999098", "0.5990709", "0.597333", "0.59664303", "0.59236485", "0.5900113", "0.58878314", "0.5866487", "0.5866487", "0.5792027", "0.5792027", "0.57826686", "0.57826686", "0.57826686", "0.57826686", "0.57826686", "0.57826686", "0.57826686", "0.5779178", "0.57733107", "0.5746658", "0.5742944", "0.5724114", "0.5719674", "0.57120264", "0.5711792", "0.57093257", "0.5688125", "0.56781906", "0.56618905", "0.56618905", "0.56618905", "0.56571704", "0.5656032", "0.5652626", "0.5649561", "0.5647081", "0.56454897", "0.56317604", "0.5629644", "0.56267864", "0.56191874", "0.56101966", "0.56076723", "0.560707", "0.56052136", "0.55901253", "0.5586656", "0.55781245", "0.55732644", "0.55666745", "0.5551589", "0.5542441", "0.5531508", "0.55228233", "0.55221653", "0.55085945", "0.5506679", "0.5506679", "0.55025846", "0.5498152", "0.54970044", "0.54874074", "0.5485246", "0.548522", "0.548392", "0.5481569", "0.5480846", "0.5479177", "0.5462401", "0.5457127", "0.5450843", "0.5450474", "0.5450096", "0.5448074", "0.5447043", "0.544703", "0.5442009", "0.5437101" ]
0.80437905
1
Creates a hash for all properties
def all_property_hash hash = {} items = @all_properties for prop in items hash[prop] = {} end return hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_properties_hash\n self.class.send(:property_list).inject({}) do |hash, property|\n hash.merge(property.to_hash(self))\n end\n end", "def property_objects\n hash = {}\n self.class.properties.each { |prop| hash[prop] = @properties[prop] }\n hash\n end", "def to_hash\n out = {}\n self.class.properties.each { |p| out[hash_key(p)] = hash_value(p) }\n out\n end", "def to_hash; @caesars_properties.to_hash; end", "def to_hash\n { name => properties.except(:name) }\n end", "def to_h\n data = {}\n\n self.class.properties.each_key do |prop|\n data[prop] = send(prop)\n end\n\n data\n end", "def properties\n @properties ||= Hash.new\n end", "def properties(hash)\n @properties_from_attributes.merge!(ensure_all_hash_keys_are_symbols(hash))\n end", "def hash\n [property_code, property_name, location, address, total_price, min_daily_rate, contacts, amenities, awards, images, rooms, more_rooms_at_this_hotel].hash\n end", "def properties\n @properties ||= {}\n end", "def properties\n @properties ||= {}\n end", "def props\n ret = {\"_neo_id\" => getId()}\n iter = getPropertyKeys.iterator\n while (iter.hasNext) do\n key = iter.next\n ret[key] = getProperty(key)\n end\n ret\n end", "def to_h\n return props.reduce(Hash.new) do |h, d|\n h[d.first] = send(d.first)\n h\n end\n end", "def properties\n @properties ||= {}\n end", "def hash\n [subject_property, proprietorship, surname, forename, middle_name, all_names, historical_match].hash\n end", "def to_h(&block)\n if block_given?\n @properties.each_with_object({}) do |(key, val), acc|\n k, v = *block.(key, val)\n acc[k] = v\n end\n else\n DeepDup.deep_dup(@properties)\n end\n end", "def to_hash\n JSON.parse(properties).to_h\n end", "def properties\n self.persistent_class.property_iterator.to_a.inject({}) do |h, value|\n if !value.respond_to?(:getRubyValue)\n h[value.name] = value\n end\n h\n end\n end", "def properties\n @properties ||= {}\n end", "def to_hash *args\n hsh = super(*args)\n hsh.each do |attr, val|\n hsh[attr] = val.to_hash if val.respond_to?(:to_hash)\n end\n hsh\n end", "def to_h\n self.class.list_of_attributes.each_with_object({}) do |key, hash|\n val = instance_variable_get :\"@#{key}\"\n hash[key] = Utils.hashify(val) unless val == Dry::Initializer::UNDEFINED\n end\n end", "def properties\n if @property_hash.empty?\n @property_hash[:ensure] = :failed if @property_hash.empty?\n end\n @property_hash.dup\n end", "def hash\n { hash: @hash, hashType: @hash_type }\n end", "def to_hash\n\t\t\th = {}\n\t\t\tself.class::PublicProperties.each { |p|\n\t\t\t\th[p] = send(p)\n\t\t\t\tif h[p].kind_of? Sequel::Model\n\t\t\t\t\th[p] = h[p].to_hash\n\t\t\t\tend\n\t\t\t}\n\t\t\th\n\t\tend", "def build_formatted_property_hash(property)\n property_hash = Hash.new\n property_hash = \n {\n \"address\"=> property[\"property_adress\"], \n \"apartment_number\"=> property[\"apartment_no\"],\n \"postal_code\"=> property[\"zip_code\"],\n \"city\"=> property[\"town\"],\n \"country\"=> property[\"country\"],\n \"description\"=> property[\"property_description\"],\n \"number_of_bedrooms\"=> property[\"bedrooms_no\"],\n \"max_guests\"=> property[\"max_people\"],\n \"internal_id\"=> property[\"source_id\"]\n }\n end", "def attributes\n unless(@attributes)\n @attributes = Hash.new()\n self.properties_.each do |property|\n @attributes[property.name] = property.value\n end\n end\n @attributes\n end", "def properties\n hash = {}\n Parser::PROPERTIES.each { |property| hash[property] = send(property) }\n hash\n end", "def properties\n map(element_type: :hash) { |v| v.properties }\n end", "def hashify\n hash = Hash.new\n self.instance_variables.each { |var| hash[var.to_s.delete(\"@\")] = self.instance_variable_get(var) }\n symbolize_keys(hash)\n end", "def create_hash\n hash = {}\n self.instance_variables.each {|var| hash[var.to_s.delete(\"@\")] = self.instance_variable_get(var) }\n return hash\n end", "def properties_and_identity\n (self.persistent_class.property_iterator.to_a + [self.persistent_class.identifier_property]).inject({}) do |h, value|\n if !value.respond_to?(:getRubyValue)\n h[value.name] = value\n end\n h\n end\n end", "def attributes_hash(object); end", "def create_attr_hash\n data = {}\n self.instance_variables.each do |attr|\n value = self.instance_variable_get(attr)\n key = attr.to_s.sub(%r{^\\@}, '').sub(%r{\\@}, '')\n if @attr_list.include?(key)\n data[key] = value\n end\n end\n\n data\n end", "def to_hash\n self.class.attributes.inject({}) { |memo, name| memo[name] = send(name); memo }\n end", "def props\n ret = {}\n property_names.each do |property_name|\n ret[property_name] = respond_to?(property_name) ? send(property_name) : send(:[], property_name)\n end\n ret\n end", "def hash\n attributes.hash\n end", "def hash\n attributes.hash\n end", "def hash\n attributes.hash\n end", "def hash\n [_hash, name, owner].hash\n end", "def hash\n \"#{self.class.name}-#{self.id}-#{@__metadata__.cas}-#{@__attributes__.hash}\".hash\n end", "def properties_from_hash(hash)\n hash.inject({}) do |newhash, (k, v)|\n k = k.gsub(\"-\", \"_\")\n k = \"_#{k.to_s}\" if k =~ /^\\d/\n self.class.property :\"#{k}\"\n newhash[k] = v\n newhash\n end\n end", "def properties_hash\n hash = {}\n password_keys = $SERVICE_TYPES[self.service_type][PrismeService::TYPE_PROPS].reject do |e| !e[PrismeService::TYPE_TYPE].eql? PrismeService::TYPE_PASSWORD end.map do |e| e['key'] end\n self.service_properties.each do |sp|\n key = sp.key\n value = sp.value\n if (password_keys.include?(key))\n value = CipherSupport.instance.decrypt(encrypted_string: value)\n end\n hash[key] = value unless (value.nil? || value.empty?)\n end\n inferred_properties(hash)\n hash\n end", "def properties\n pairs_properties = @pairs.map { |key, value| { 'key' => key.properties, 'value' => value.properties } }\n { 'object_type' => 'map', 'pairs' => pairs_properties }\n end", "def to_h\n { procs: procs, properties: properties }\n end", "def hash\n raw = [name, type, values.join('/')].join(' ')\n Digest::MD5.hexdigest(raw)\n end", "def hash\n model.hash + key.hash\n end", "def hash\n @hash ||= self.to_a.hash\n end", "def hash\r\n\t\treturn @name.hash() + @type.hash()\r\n\tend", "def make_hash\n variables = self.instance_variables\n attr_hash = {}\n variables.each do |var|\n attr_hash[\"#{var.slice(1..-1)}\"] = self.send(\"#{var.slice(1..-1)}\")\n end\n\n return attr_hash\n end", "def assign_properties\n self.properties ||= {}\n listing_properties.each do |prop|\n self.properties[prop.key] ||= prop.value\n end\n end", "def to_hash\n hash = {}\n self.instance_variables.each do |var| \n hash[var.to_s.delete(\"@\")] = self.instance_variable_get(var) \n end\n hash\n end", "def hash\n instance_variables.map do |var|\n instance_variable_get(var).hash\n end.reduce(:^)\n end", "def properties(memo = {}, path = '')\n keys.each do |key|\n if self[key].is_a?(Hash) || self[key].is_a?(Array)\n new_path = \"#{path}#{path.empty? ? '' : '.'}#{key}\"\n resource_type = self['Type']\n new_path = \"#{new_path}.#{resource_type}\" if resource_type && !resource_type.empty?\n self[key].properties(memo, new_path)\n else\n memo[\"#{path}.#{key}\"] = self[key]\n end\n end\n\n memo\n end", "def all_ant_properties\n _get_ant_properties_as_hash\n end", "def init_property_hash\n # make super()-safe so we can make liberal use of mixins\n end", "def assemble_hash(data, object)\n return if data[:property].blank?\n\n @result ||= {}\n if data[:multiple]\n @result[data[:property].to_sym] ||= []\n @result[data[:property].to_sym] += [object]\n else\n @result[data[:property].to_sym] = object\n end\n end", "def properties(keyvals = {})\n self.merge!(keyvals)\n end", "def to_hash() end", "def build_properties\n properties.each do |key,val|\n prop = listing_properties.find_or_initialize_by(key:key)\n prop.value = val\n\n end\n end", "def hash\n\t\treturn [ self.subject, self.predicate, self.object ].hash\n\tend", "def to_hash\n {:hashes => @hashes}\n end", "def to_hash\n attributes\n end", "def get_hash\n\t\treturn { name: self.name, email: self.email }\n\tend", "def to_h(persist: false)\n {}.tap do |hash|\n (persist ? properties - foreign_objects : properties).each do |property|\n value = self[property]\n if value == false || value.present?\n hash[property] = value\n end\n end\n end\n end", "def to_hash\n\t\tpure_hash = {}\n\t\[email protected] do |info|\n\t\t\tpure_hash[info.key] = info.value\n\t\tend\n\t\tpure_hash\n\tend", "def hash\n self.class.hash ^ key_attributes.hash\n end", "def to_s\n result = []\n all_properties_hash.each do |k, v|\n result << \"#{k} = #{v}\"\n end\n result.join(\"; \")\n end", "def make_hash\n variables = self.instance_variables\n attr_hash = {}\n \n variables.each do |var|\n attr_hash[\"#{var.slice(1..-1)}\"] = self.send(\"#{var.slice(1..-1)}\")\n end\n \n attr_hash\n end", "def property_map\n map = {}\n\n current_resource.class.state_properties.each do |property|\n name = property.options[:name]\n\n map[name] = current_resource.send(name)\n end\n\n map[id_property] = current_resource.send(id_property)\n\n map\n end", "def build_property\n property = Entities::Property.new(\n id: property_hash.get(\"ID\"),\n title: property_hash.get(\"Name\"),\n lat: property_hash.get(\"Coordinates.Latitude\").to_f,\n lng: property_hash.get(\"Coordinates.Longitude\").to_f,\n address: property_hash.get(\"Street\"),\n postal_code: property_hash.get(\"ZipCode\").to_s.strip,\n max_guests: property_hash.get(\"CanSleepMax\").to_i,\n bedroom_type_id: property_hash.get(\"PropertyTypeID\"),\n property_type_id: property_hash.get(\"ObjectTypeID\"),\n active: property_hash.get(\"IsActive\"),\n archived: property_hash.get(\"IsArchived\"),\n surface: property_hash.get(\"Space\").to_i,\n owner_id: property_hash.get(\"OwnerID\"),\n security_deposit_amount: property_hash.get(\"SecurityDeposit\").to_f,\n security_deposit_type: security_deposit_type,\n check_in_time: check_in_time,\n check_out_time: check_out_time,\n check_in_instructions: check_in_instructions,\n floor: floor,\n description: en_description(property_hash),\n images: build_images,\n amenities: build_amenities,\n number_of_bathrooms: number_of_bathrooms,\n number_of_single_beds: beds_count(SINGLE_BED_CODES),\n number_of_double_beds: beds_count(DOUBLE_BED_CODES),\n number_of_sofa_beds: beds_count(SOFA_BED_CODES),\n late_arrival_fees: late_arrival_fees,\n early_departure_fees: early_departure_fees,\n )\n\n property\n end", "def hash\n [name, type, sub_attributes, multi_valued, description, required, canonical_values, case_exact, mutability, returned, uniqueness, reference_types].hash\n end", "def properties\n {}\n end", "def to_hash\n Hash[instance_variables.map { |name| [name.to_s.gsub(\"@\",\"\").to_sym, instance_variable_get(name)] } ]\n end", "def properties\n object = orientdb.get_class_properties self\n {:properties => object['properties'], :indexes => object['indexes']}\n end", "def hash\n [active, additional_properties, author, authored, banned, category, comments, contributors, created_date, embed, extension, height, id, length, location, long_description, mime_type, name, priority, privacy, published, short_description, size, tags, template, thumbnail, updated_date, uploader, views, width].hash\n end", "def to_hash\n attributes.dup\n end", "def to_hash\n hash = {}; self.attributes.each { |k,v| hash[k] = v }\n end", "def to_hash\n hash = {}\n self.instance_variables.each do |var|\n symbol = var.to_s.gsub(\"@\",\"\").to_sym\n hash[symbol] = send symbol\n end\n return hash\n end", "def to_hash\n h = {}\n self.instance_variables.each do |variable|\n h[variable[1..-1].to_sym] = self.instance_variable_get(variable)\n end\n h\n end", "def __hash\n @hash\n end", "def to_hash\n hash = {}\n StoragePhysicalDiskAllOf.attribute_map.each_pair do |attr, param|\n value = self.send(attr)\n if value.nil?\n is_nullable = StoragePhysicalDiskAllOf.openapi_nullable.include?(attr)\n next if !is_nullable || (is_nullable && !instance_variable_defined?(:\"@#{attr}\"))\n end\n\n hash[param] = _to_hash(value)\n end\n hash\n end", "def properties\n {}\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 hash\n [principals, relation].hash\n end", "def to_hash\n rethash = {}\n\n @parameters.each do |name, obj|\n rethash[name] = obj.value\n end\n\n rethash\n end", "def to_hsh\n {name => {:columns => columns, :unqiue => unique}}\n end", "def to_hash\n hash = {}\n instance_variables.each do |i|\n key = i.to_s.delete('@').to_sym\n hash[key] = send(key)\n end\n hash\n end", "def to_hash\n @_hash_\n end", "def to_h\n each_with_object({}) { |attr, h| h[attr.name] = attr }\n end", "def to_hash\n instance_variables.each_with_object(Hash.new) do |var, h|\n var = var[1..-1]\n unless var.to_s.start_with?(\"__\")\n h[var] = self[var]\n end\n end\n end", "def hash\n @__hash || @__hash = keys.empty? ? super : keys.hash\n end", "def to_hash\n attribute_hash = {}\n simple_attributes.each do |att|\n attribute_hash[att] = self.send(att) unless self.send(att).nil?\n end\n \n attribute_hash\n end", "def hash\n to_h.hash ^ self.class.hash\n end", "def property_names\n properties.symbolize_keys.keys\n end", "def hash\n [additional_properties, currency_code, description, inventory, min_inventory_threshold, not_available, not_displayable, original_price, price, published, sale_id, sale_name, sku, start_date, stop_date].hash\n end", "def properties(ctx)\n properties = Properties.new()\n ctx.each { |key, value| properties.put(key, value) }\n return properties\n end", "def to_hash\n ret = HashWithIndifferentAccess.new\n ret.merge!(self.attributes_for_hash)\n ret.merge!(self.associations_for_hash)\n ret.merge!(self.add_on_data_for_hash)\n ret.merge!(self.association_foreign_keys_for_hash)\n ret\n end", "def attributes\n properties.map do |p|\n [p.name, send(p.getter)] if p.reader_visibility == :public\n end.compact.to_hash\n end", "def attribute_hash\n instance_vars = self.send(:instance_variables)\n values = {}\n instance_vars.each do |var|\n values[(var.to_s.delete('@')).to_sym] = self.instance_variable_get(var)\n end\n values\n end", "def hash\n @hash ||= Hash.new { |h, k| h[k] = Hash.new(&h.default_proc) }\n end" ]
[ "0.73561674", "0.7222284", "0.72018546", "0.7129041", "0.7120944", "0.71134275", "0.70107436", "0.69681937", "0.69446194", "0.6911096", "0.6911096", "0.6877544", "0.6867742", "0.6840477", "0.6783789", "0.67366326", "0.6720364", "0.66989625", "0.6696661", "0.66567147", "0.6656498", "0.6642911", "0.66420084", "0.6628992", "0.66246253", "0.66147447", "0.6603765", "0.6595508", "0.6559089", "0.6546748", "0.65365624", "0.6504236", "0.6499788", "0.64881", "0.64568526", "0.6442675", "0.6442675", "0.6442675", "0.6441258", "0.64090335", "0.6377424", "0.6373853", "0.6364967", "0.63605547", "0.6357399", "0.6356003", "0.63466173", "0.6326693", "0.6321065", "0.63079196", "0.6301981", "0.62914354", "0.6287336", "0.6286671", "0.6265221", "0.6265", "0.6257472", "0.6253136", "0.6224951", "0.6217633", "0.6211223", "0.6205477", "0.6203565", "0.62008923", "0.6195314", "0.6179003", "0.61745507", "0.6173472", "0.6166123", "0.6158017", "0.615033", "0.6150324", "0.61484754", "0.6146999", "0.6146092", "0.6143243", "0.6142526", "0.6140942", "0.613713", "0.6119645", "0.61194134", "0.611885", "0.611852", "0.6111983", "0.6106914", "0.6103702", "0.6100265", "0.60991096", "0.60970014", "0.6090454", "0.60902005", "0.6084677", "0.60769933", "0.60677844", "0.60551083", "0.6054928", "0.6051927", "0.604837", "0.6044915", "0.6043623" ]
0.83505917
0
Creates a hash for all products
def all_product_hash hash = {} items = @all_products for prod in items hash[prod] = {} end return hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash\n [name, product_ids_any, product_ids_all, quantity_exact, quantity_min, quantity_max, all_products].hash\n end", "def all_prod_comp_hash(item=nil)\n\n hash = {}\n\n if(!item.nil?)\n items = item.components\n else\n items = @all_products\n end\n\n for comp in items\n\n hash[comp] = all_prod_comp_hash(comp)\n\n end\n\n return hash\n\n end", "def hash\n raw = [name, type, values.join('/')].join(' ')\n Digest::MD5.hexdigest(raw)\n end", "def cart_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 [id, parent_id, sku, upc, ean, mpn, gtin, sort_order, created_time, modified_time, name, short_description, full_description, images, combination, default_price, list_price, wholesale_price, advanced_price, tax_class_id, avail_for_sale, allow_backorders, in_stock, manage_stock, inventory_level, inventory, min_quantity, default_qty_in_pack, is_qty_in_pack_fixed, weight_unit, weight, dimensions_unit, width, height, length, additional_fields, custom_fields].hash\n end", "def products\n @products ||= hash[\"Products\"].map { |p| Merchant::Product.new p }\n end", "def hash\n [description, filter, is_enabled, name, product_list].hash\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 hash\n [__meta, created_at, updated_at, name, slug, model, status, type, short_description, full_description, free_shipping, sku, price, cost_price, retail_price, sale_price, manage_inventory, stock_level, minimum_stock_level, maximum_sell_count, item_dimensions, package_dimensions, package_weight, require_shipping, availability, availability_date, allow_pre_order, brand, main_photo, photos, files, promotions, related_products, stock_status, categories, tax_class, option_set, variants].hash\n end", "def fill_in_products\n products = []\n @data.products.all_products.each_with_index do |p, i|\n prod = {}\n prod['index'] = i\n prod['qty'] = @data.product_qty[p.prd_id]\n prod['desc'] = p.prd_long_desc\n prod['price'] = \"$\" + p.fmt_total_price\n prod['prd_id'] = p.prd_id\n products << prod\n end\n \n products\n end", "def product_hash(hsh)\r\n attrs = hsh.values\r\n keys = hsh.keys\r\n product = attrs[0].product(*attrs[1..-1])\r\n product.map{ |p| Hash[keys.zip p] }\r\nend", "def hash\n [article_number, name, quantity, unit_price, discount_percent, vat_percent, unit, temporary_reference, row_number, merchant_data].hash\n end", "def hash(*) end", "def hash()\n #This is a stub, used for indexing\n end", "def products_data\n $products_hash[\"items\"].each do |toy|\n # toy_result = calculate_products_data(toy)\n print_products_data(toy)\n end\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 create_full_product\n generate_product_name\n generate_product_code\n generate_product_manufacturer\n generate_product_description\n generate_product_price\n end", "def create_products_hash\n toys = {}\n $products_hash[\"items\"].each do |product|\n toys[product[\"title\"]] = {}\n\t\ttoys[product[\"title\"]][\"retail_price\"] = product[\"full-price\"]\n\t\ttoys[product[\"title\"]][\"amount_sold\"] = product[\"purchases\"].length\n\t\ttoys[product[\"title\"]][\"total_sales\"] = 0.0\n toys[product[\"title\"]][\"average_discount\"] = 0.0\n\t\tproduct[\"purchases\"].each do |sales|\n toys[product[\"title\"]][\"total_sales\"] += sales[\"price\"]\n\t\tend # end total_sales loop\n toys[product[\"title\"]][\"average_price\"] =\n toys[product[\"title\"]][\"total_sales\"] /\n toys[product[\"title\"]][\"amount_sold\"]\n\n toys[product[\"title\"]][\"average_discount\"] = 100 -\n (toys[product[\"title\"]][\"average_price\"].to_f /\n toys[product[\"title\"]][\"retail_price\"].to_f * 100)\n end # end each loop to create_products_hash\n\treturn toys\nend", "def products\n @products ||= begin\n items = []\n\n for i in (1..params[\"NumItens\"].to_i)\n items << {\n :id => params[\"ProdID_#{i}\"],\n :description => params[\"ProdDescricao_#{i}\"],\n :quantity => params[\"ProdQuantidade_#{i}\"].to_i,\n :price => to_price(params[\"ProdValor_#{i}\"]),\n :shipping => to_price(params[\"ProdFrete_#{i}\"]),\n :fees => to_price(params[\"ProdExtras_#{i}\"])\n }\n end\n\n items\n end\n end", "def hash\n [beez_up_order_item_id, order_item_order_item_type, order_item_merchant_imported_product_id, order_item_merchant_imported_product_id_column_name, order_item_merchant_imported_product_url, order_item_merchant_product_id_column_name, order_item_beez_up_store_id, order_item_item_tax, order_item_title, order_item_image_url, order_item_merchant_product_id, order_item_market_place_product_id, order_item_item_price, order_item_quantity, order_item_total_price, order_item_shipping_price].hash\n 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\n shasum.hash\n end", "def hash\n shasum.hash\n end", "def hash\n shasum.hash\n end", "def hash; map{|el| \"#{el.name} @ #{el.hash}\"}; map(&:hash).reduce(:+) % 2**32; end", "def setup_catalog\n [\n {product_name: 'bamba', photo_url: 'dummy_url1', barcode: 'xxx1', sku: 111, price: 2.23, producer: 'Nestle'},\n {product_name: 'apple', photo_url: 'dummy_url2', barcode: 'xxx2', sku: 555, price: 4.66, producer: 'WFM'},\n {product_name: 'tapu chepse', photo_url: 'dummy_url3', barcode: 'xxx3', sku: 1111444, price: 7.33, producer: 'Nestle'}\n ].each do |data|\n Catalog.create(data)\n end\n 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 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, banco, agencia, conta_corrente, especie, numero_convenio, carteira, codigo_cedente, especie_tipo, especie_documento, aceite, instrucoes, local_pagamento1, local_pagamento2, endereco_cobranca_emissor, nome_beneficiario, cnpj_beneficiario, operador, data, maquina].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 [additional_properties, currency_code, description, inventory, min_inventory_threshold, not_available, not_displayable, original_price, price, published, sale_id, sale_name, sku, start_date, stop_date].hash\n end", "def generate_hash(*args)\n Digest::SHA3.hexdigest(args.join(''))\n end", "def generate_hash(*args)\n Digest::SHA3.hexdigest(args.join(''))\n\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\n [actor, artist, aspect_ratio, audience_rating, author, back_finding, band_material_type, binding, bluray_region, brand, cero_age_rating, chain_type, clasp_type, color, cpu_manufacturer, cpu_speed, cpu_type, creator, department, director, display_size, edition, episode_sequence, esrb_age_rating, feature, flavor, format, gem_type, genre, golf_club_flex, golf_club_loft, hand_orientation, hard_disk_interface, hard_disk_size, hardware_platform, hazardous_material_type, item_dimensions, is_adult_product, is_autographed, is_eligible_for_trade_in, is_memorabilia, issues_per_year, item_part_number, label, languages, legal_disclaimer, list_price, manufacturer, manufacturer_maximum_age, manufacturer_minimum_age, manufacturer_parts_warranty_description, material_type, maximum_resolution, media_type, metal_stamp, metal_type, model, number_of_discs, number_of_issues, number_of_items, number_of_pages, number_of_tracks, operating_system, optical_zoom, package_dimensions, package_quantity, part_number, pegi_rating, platform, processor_count, product_group, product_type_name, product_type_subcategory, publication_date, publisher, region_code, release_date, ring_size, running_time, shaft_material, scent, season_sequence, seikodo_product_code, size, size_per_pearl, small_image, studio, subscription_length, system_memory_size, system_memory_type, theatrical_release_date, title, total_diamond_weight, total_gem_weight, warranty, weee_tax_value].hash\n end", "def hash\n [allocated_to_placed_orders, allocated_to_shopping_carts, available_to_allocate, cogs, desired_inventory_level, distribution_center_code, distribution_center_oid, eta, handles, inventory_level, maximum_backorder, reorder_inventory_level, sku, stock_picking_location].hash\n end", "def hash\n model.hash + key.hash\n end", "def hash\n end", "def hash\n end", "def hash\n end", "def to_hash() end", "def hash_transactions\n tx_ids = transactions.map do |tx|\n tx.id\n end\n Digest::SHA256.hexdigest(tx_ids.join(''))\n end", "def init_vault\n @vault={}\n @products.each do |product|\n product.identifiers.each do |ident|\n @vault[ident.uniq_id]=product\n end\n end\n\n @products.each do |product|\n if product.related_material\n product.related_material.related_products.each do |rp|\n rp.identifiers.each do |ident|\n if @vault[ident.uniq_id]\n rp.product=@vault[ident.uniq_id]\n end\n\n end\n end\n\n product.related_material.related_works.each do |rw|\n rw.identifiers.each do |ident|\n if @vault[ident.uniq_id]\n rw.product=@vault[ident.uniq_id]\n end\n end\n end\n end\n\n product.descriptive_detail.parts.each do |prt|\n prt.identifiers.each do |ident|\n if @vault[ident.uniq_id]\n prt.product=@vault[ident.uniq_id]\n end\n end\n end\n end\n end", "def products\n @product_map.keys\n end", "def hash_hash(h)\n require 'digest/md5'\n Digest::MD5.hexdigest(Marshal::dump(h.sort))\n end", "def fill_catalogue()\n @@products.clear\n add_product(Fruit.new(\"Apples\", 10))\n add_product(Fruit.new(\"Oranges\", 5))\n add_product(Fruit.new(\"Banana\", 20))\n add_product(Fruit.new(\"Watermelon\", 1))\n add_product(Houseware.new(\"Vacuum cleaner\", 150))\n add_product(Product.new(\"Anchovies\",2))\n end", "def product_info\n {\n product_name: {\n default_value: 'similarity detection reference tool'\n },\n product_version: '1.0',\n description: {\n default_value: 'LTI 2.1 tool provider reference implementation'\n },\n product_family: {\n code: 'similarity detection reference tool',\n vendor: {\n code: 'Instructure.com',\n vendor_name: {\n default_value: 'Instructure'\n },\n description: {\n default_value: 'Canvas Learning Management System'\n }\n }\n }\n }\n end", "def serialize\r\n {\r\n affiliate_url: \"https://www.amazon.com/dp/#{product.asin}?tag=#{ENV['AMAZON_AFFILIATE_TAG']}\",\r\n asin: product.asin,\r\n id: product.id,\r\n images: {\r\n thumbnail_url: product.image_src\r\n },\r\n name: product.name,\r\n price: product.amazon_price,\r\n # rating: {\r\n # percentage: 85,\r\n # words: 'Excellent'\r\n # },\r\n teaser: product.teaser\r\n }\r\n end", "def hash\n [id, title, image, image_type, servings, ready_in_minutes, license, source_name, source_url, spoonacular_source_url, aggregate_likes, health_score, spoonacular_score, price_per_serving, analyzed_instructions, cheap, credits_text, cuisines, dairy_free, diets, gaps, gluten_free, instructions, ketogenic, low_fodmap, occasions, sustainable, vegan, vegetarian, very_healthy, very_popular, whole30, weight_watcher_smart_points, dish_types, extended_ingredients, summary, wine_pairing].hash\n end", "def create\n data = self.class.create_product(self)\n self.id = data.id\n data\n end", "def hash\n [ name, database, password ].hash\n end", "def products_cache_key\n [\n Product.count,\n Product.order(\"updated_at DESC\").first\n ]\n end", "def set_ids products\n products.each do |k, sp|\n size= Size.find_by_name sp[:size]\n color = Color.find_by_name sp[:color]\n if !size.nil? && !color.nil?\n p= Product.where(\"reference = ? and size_id = ? and color_id = ?\", sp[:reference], size.id, color.id)[0]\n sp[:product_id] = p.id if !p.nil?\n end\n end\n end", "def initialize (product_hash)\n @product_id = product_hash[:product_id]\n @product_name = product_hash[:product_name]\n @vendor_id = product_hash[:vendor_id]\n end", "def hash\n [client_id, secret, company_name, is_diligence_attested, products, create_link_customization, logo, legal_entity_name, website, application_name, technical_contact, billing_contact, customer_support_info, address, is_bank_addendum_completed, assets_under_management, redirect_uris].hash\n end", "def hash\n [accounting_code, activation_codes, arbitrary_unit_cost, auto_order_last_rebill_dts, auto_order_schedule, barcode, channel_partner_item_id, cogs, component_unit_value, cost, country_code_of_origin, customs_description, description, discount, discount_quantity, discount_shipping_weight, distribution_center_code, edi, exclude_coupon, free_shipping, hazmat, height, item_index, item_reference_oid, kit, kit_component, length, manufacturer_sku, max_days_time_in_transit, merchant_item_id, mix_and_match_group_name, mix_and_match_group_oid, no_shipping_discount, options, packed_by_user, parent_item_index, parent_merchant_item_id, perishable_class, pricing_tier_name, properties, quantity, quantity_refunded, quickbooks_class, refund_reason, return_reason, ship_separately, shipped_by_user, shipped_dts, shipping_status, special_product_type, tags, tax_free, tax_product_type, taxable_cost, total_cost_with_discount, total_refunded, transmitted_to_distribution_center_dts, unit_cost_with_discount, upsell, weight, width].hash\n end", "def hash\n [last_price, last_time, last_size, bid_price, bid_size, ask_price, ask_size, open_price, close_price, high_price, low_price, exchange_volume, market_volume, updated_on, source, listing_venue, sales_conditions, quote_conditions, market_center_code, is_darkpool, security].hash\n end", "def products_by_variant_id\n products\n .group_by { |product| product.variant_id.to_i }\n .reduce({}) do |hash, (variant_id, product_array)|\n product = product_array.first\n hash[variant_id] = ProductPresenter.new(product)\n hash\n end\n end", "def unique_products\n @products.uniq\n end", "def hash\r\n\t\treturn @name.hash() + @type.hash()\r\n\tend", "def as_json\n hash = {\n id: product.id.to_s,\n handle: product.slug,\n title: product.name,\n description: product.description,\n variants: variants_json\n }\n\n if url = self.url\n hash[:url] = url\n end\n\n if image_url = self.image_url\n hash[:image_url] = image_url\n end\n\n if product.available_on\n hash[:published_at_foreign] = product.available_on.utc.iso8601\n end\n\n hash\n end", "def hash\n [id, document_date, gl_class, gl_type_id, gl_item_id, sales_code, description, cost, memo, tax_note, vendor_number, account_number, cost_account_number, inventory_account_number, vendor_account_number, item, item_description, sales_description, taxable, item_price, item_cost, unit_of_measure, quantity, total, currency, serialized_flag, serial_numbers, drop_shipped_flag, line_number, warehouse_bin, warehouse_site, sub_category, shipment_method, item_type_xref, inventory_xref, cogs_xref, uom_schedule_xref, price_level_xref, location_xref, tax_code, purchase_header_tax_group, tax_code_xref, tax_rate, tax_agency_xref].hash\n end", "def hash\n @hash || calculate_hash!\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 shopping_list(product, url)\n\t\tinit(url)\n\t\t@product = product\n\t\tshopping_list = Hash.new # initialize hash for merge\n\t\t# Loop to parse data on all pages\n\t\twhile !@parsed_temp[\"products\"].empty?\n\t\t\t# gets all variants of a product and puts in a list of hashes with unique id as key and price and weight as value\n\t\t\tshopping_list.merge!((@parsed_temp[\"products\"].select{ |product| product[\"tags\"].include? @product }.map{ |product| product[\"variants\"]}.flatten.map{ |variant| [variant[\"id\"], [variant[\"price\"], variant[\"grams\"]]] }).to_h)\n\t\t\t@page_num += 1\n\t\t\t@parsed_temp = HTTParty.get(\"#{@url}#{@page_num}\").parsed_response\n\t\tend\n\t\treturn shopping_list\n\tend", "def load_products\n @products_type[\"watermelon\"] = Creator.createProduct(:watermelon, \"watermelon\")\n @products_type[\"watermelon\"].add_pack(3, 6.99)\n @products_type[\"watermelon\"].add_pack(5, 8.99)\n\n @products_type[\"pineapple\"] = Creator.createProduct(:pineapple, \"pineapple\")\n @products_type[\"pineapple\"].add_pack(2, 9.95)\n @products_type[\"pineapple\"].add_pack(5, 16.95)\n @products_type[\"pineapple\"].add_pack(8, 24.95)\n\n @products_type[\"rockmelon\"] = Creator.createProduct(:rockmelon, \"rockmelon\")\n @products_type[\"rockmelon\"].add_pack(3, 5.95)\n @products_type[\"rockmelon\"].add_pack(5, 9.95)\n @products_type[\"rockmelon\"].add_pack(9, 16.99)\n end", "def hash\n [dep_mgr_name, name, version, license].hash\n end", "def hash\n \"#{membership} #{formatted_price}\"\n end", "def hasher\n Hashids.new(@hash_id_state[:salt], @hash_id_state[:length])\n end", "def hash\n [id, auto_reorder, reorder_quantity, threshold_amount, url, raw_url, front_original_url, back_original_url, thumbnails, available_quantity, allocated_quantity, onhand_quantity, pending_quantity, projected_quantity, buckslip_orders, stock, weight, finish, status, object, description, size].hash\n end", "def hash\n [aws_elastic_block_store, azure_disk, azure_file, cephfs, cinder, config_map, downward_api, empty_dir, fc, flex_volume, flocker, gce_persistent_disk, git_repo, glusterfs, host_path, iscsi, name, nfs, persistent_volume_claim, photon_persistent_disk, portworx_volume, projected, quobyte, rbd, scale_io, secret, storageos, vsphere_volume].hash\n end", "def edit\n\t\t# @product = Product.new\n\t\tputs params\n @comparison = Comparison.find(params[:id])\n\t\t# @products_hash = Hash.new\n # @tributes_all_hash = Hash.new\n @user = current_user\n\t\[email protected] += [@comparison]\n\t\t# @product = Product.create(url: session[0][:url_hash][:url])\n\t\t# @product = Product.create(url: session[1][:url_hash][:url])\n\t\tputs 'showing the count below 888888888888888888888888888888888888888888888888'\n\t\tputs @comparison.products.count\n\t\tunless @comparison.products.count > 1\n\t\t\tsession[:url_hash].each do |a|\n\t\t\t\t# because this returns the numerical key as a string instead of a key and \"flattens\" the hash\n\t\t\t\t# we loop to access the actual hash that has the url value.\n\t\t\t\tputs 'showing the session a below 888888888888888888888888888888888888888888888888'\n\t\t\t\tputs a\n\t\t\t\ta.each do |b|\n\t\t\t\t\tif b.is_a? Hash\n\t\t\t\t\t\tputs 'showing the session b below 888888888888888888888888888888888888888888888888'\n\t\t\t\t\t\tputs b\n\t\t\t\t\t\t# so b here is {:url => \"google.com\"} for instance.\n\t\t\t\t\t\t# we push because @comparison.products is an array\n\t\t\t\t\t\t@product = Product.create(url: b[:url])\n\t\t\t\t\t\[email protected](@product)\n\t\t\t\t\t\t# crunchm!!!!!!!!!\n\t\t\t\t\t\tcrunchm(@comparison, @product, b[:url])\n\t\t\t\t\t\t# puts \"CRUNCHMCRUNCHMCRUNCHMCRUNCHMCRUNCHMCRUNCHMCRUNCHMCRUNCHMCRUNCHMCRUNCHM\"\n\t\t\t\t\t\t# # puts @crunchm.keys\n\t\t\t\t\t\t# puts \"CRUNCHMCRUNCHMCRUNCHMCRUNCHMCRUNCHMCRUNCHMCRUNCHMCRUNCHMCRUNCHMCRUNCHM\"\n\n\t\t\t\t\t\t\n\t\t\t\t\t\t# @comparison.tributes.push()\n\t\t\t\t\t\t\n\t\t\t\t\t\t# parseAmazon (b[:url])\n\t\t\t\t\t\t# p = Product.create (url: b[:url], name: name_from_nokogiri)\n\t\t\t\t\t\t# tributes_from_nokogiri.each do |tribute|\n\t\t\t\t\t\t# t = Tribute.create ( tribute attributes )\n\t\t\t\t\t\t# p.tributes.push(t)\n\t\t\t\t\t\t# end\n\t\t\t\t\t\t\n\t\t\t\t\t\t# end\n\n\t\t\t\t\tend\n\t\t\t\tend\t\n\t\t\tend\n\t\telse \n\t\t\tsession[:url_hash].each do |a|\n\t\t\t\t# because this returns the numerical key as a string instead of a key and \"flattens\" the hash\n\t\t\t\t# we loop to access the actual hash that has the url value.\n\t\t\t\tputs 'showing the session a below 888888888888888888888888888888888888888888888888'\n\t\t\t\tputs a\n\t\t\t\ta.each do |b|\n\t\t\t\t\tif b.is_a? Hash\n\t\t\t\t\t\tputs 'showing the session b below 888888888888888888888888888888888888888888888888'\n\t\t\t\t\t\tputs b\n\t\t\t\t\t\t@product = Product.new(url: b[:url])\n\t\t\t\t\t\t# so b here is {:url => \"google.com\"} for instance.\n\t\t\t\t\t\t# we push because @comparison.products is an array\t\t\t\t\t\t\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\t\n\t\t# @product = Product.new(url: 'just a placeholder for now')\n\t\tputs 'looks like it fails right here 888888888888888888888888888'\n\t\t@crunchm = create_table_hash(@comparison)\n\t\tputs 'looks like it fails right here 888888888888888888888888888'\n\t\t@products = current_comparison.products.all\t\t\n\tend", "def options_hash\n the_hash = self.product_id.to_s + self.is_discount.to_s\n \n self.options.order(:option_group_id).each do |o|\n the_hash += \"#{o.option_group_id}#{o.value}#{o.price}\"\n end\n \n the_hash\n end", "def create_product(prod)\n\n purchase_price = BigDecimal.new(\"0.0\")\n purchase_price = BigDecimal.new(prod['purchase_price'].to_s) unless prod['purchase_price'].nil?\n sales_price = nil\n sales_price = BigDecimal.new(prod['sales_price']) unless prod['sales_price'].nil?\n weight = 0\n weight = prod['weight'].to_f unless prod['weight'].nil?\n manufacturer_product_code = prod['manufacturer_product_code']\n stock = prod['stock'].to_i unless prod['stock'].nil?\n\n tax_percentage = prod['tax_percentage'] || 8.0\n tax_class = TaxClass.where(:percentage => tax_percentage).first unless tax_percentage.nil?\n if tax_class.nil?\n tax_class = TaxClass.create(:percentage => 8.0, :name => \"8.0\")\n end\n\n prod['description'].blank? ? description = \"No description\" : description = prod['description']\n \n is_featured = false\n is_featured = true if [\"yes\", \"true\", \"1\"].include?(prod['featured'])\n is_visible = true\n is_visible = false if [\"no\", \"false\", \"0\"].include?(prod['visible'])\n is_build_to_order = false\n is_build_to_order = true if [\"yes\", \"true\", \"1\"].include?(prod['build_to_order'])\n \n supplier = Supplier.find_by_name(prod['supplier'])\n\n product = Product.where(:name => prod['name'],\n :description => description,\n :weight => weight,\n :sales_price => sales_price,\n :supplier_id => supplier,\n :tax_class_id => tax_class,\n :purchase_price => purchase_price,\n :manufacturer_product_code => manufacturer_product_code,\n :is_featured => is_featured,\n :is_visible => is_visible,\n :is_build_to_order => is_build_to_order,\n :stock => stock).first\n if product.nil?\n product = Product.create(:name => prod['name'],\n :description => description,\n :weight => weight,\n :sales_price => sales_price,\n :supplier => supplier,\n :tax_class => tax_class,\n :purchase_price => purchase_price,\n :manufacturer_product_code => manufacturer_product_code,\n :is_featured => is_featured,\n :is_visible => is_visible,\n :is_build_to_order => is_build_to_order,\n :stock => stock)\n end\n if prod['category']\n category = Category.where(:name => prod['category']).first\n category = Category.create(:name => prod['category']) if category.nil?\n product.categories << category\n product.save\n end\n\n\n # Ugly, but at least it makes test authors know what went wrong\n if product.errors.empty?\n return product\n else\n puts \"Errors creating product: #{product.errors.full_messages}\"\n return false\n end\nend", "def products\n @products ||= [].tap { |prods| each { |prod| prods << prod } }\n end", "def enriched_key\n \"product.#{service.id}.#{id}\"\n end", "def hash\n [property_code, property_name, location, address, total_price, min_daily_rate, contacts, amenities, awards, images, rooms, more_rooms_at_this_hotel].hash\n end", "def hash\n [marketplace_technical_code, account_id, beez_up_order_id, beez_up_order_url, marketplace_business_code, order_marketplace_order_id, order_status_beez_up_order_status, order_status_marketplace_order_status, order_merchant_order_id, order_merchant_e_commerce_software_name, order_merchant_e_commerce_software_version, order_purchase_utc_date, order_last_modification_utc_date, order_marketplace_last_modification_utc_date, order_buyer_name, order_total_price, order_currency_code, processing, etag, links, order_market_place_channel, order_total_tax, order_total_commission, order_payment_method, order_paying_utc_date, order_comment, order_shipping_civility, order_shipping_company_name, order_shipping_address_name, order_shipping_email, order_shipping_address_line1, order_shipping_address_line2, order_shipping_address_line3, order_shipping_address_postal_code, order_shipping_address_city, order_shipping_address_state_or_region, order_shipping_address_country_name, order_shipping_address_country_iso_code_alpha2, order_shipping_phone, order_shipping_mobile_phone, order_shipping_price, order_shipping_method, order_shipping_shipping_tax, order_shipping_earliest_ship_utc_date, order_shipping_latest_ship_utc_date, order_buyer_identifier, order_buyer_civility, order_buyer_company_name, order_buyer_email, order_buyer_address_line1, order_buyer_address_line2, order_buyer_address_line3, order_buyer_address_postal_code, order_buyer_address_city, order_buyer_address_state_or_region, order_buyer_address_country_name, order_buyer_address_country_iso_code_alpha2, order_buyer_phone, order_buyer_mobile_phone, order_order_source_uri, order_order_items_source_uri, order_items, transition_links].hash\n end", "def create\n @product = Product.new(product_params)\n @product.user = current_api_v1_user\n respond_to do |format|\n if @product.save\n params[:product][:properties].try(:each) do |k,v|\n @product.product_properties.create(property: Property.find(k), value: v)\n end\n params[:product][:colors].try(:each) do |c|\n @product.colors.create(name: c[:name].downcase, code: c[:code])\n end\n params[:product][:photos].try(:each) do |c|\n @product.photos.create(image: c)\n end\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created}\n else\n format.html { render :new }\n format.json { render json: @product.errors.full_messages, status: :unprocessable_entity }\n end\n end\n end", "def diff_digests(old_products, new_products)\n # create maps of product sets\n old_map, new_map = [old_products, new_products].map do |products|\n return [] unless products\n Hash[*products.flat_map { |d| [d.product, d] }]\n end\n\n build_diff(new_map, old_map)\n end", "def calculate_hash!\n entry_hash = to_hash\n entry_hash['description']=nil\n @hash = entry_hash.hash\n end", "def hash\n [amount.hash, currency.hash].hash\n end", "def hash\n [amount.hash, currency.hash].hash\n end", "def hash\n @vector\n end" ]
[ "0.7073511", "0.6473979", "0.635769", "0.63136965", "0.62572646", "0.62572646", "0.62572646", "0.62572646", "0.62572646", "0.62572646", "0.62572646", "0.6239127", "0.6233616", "0.61678636", "0.6075923", "0.6047452", "0.6032454", "0.5996097", "0.5979352", "0.5918926", "0.59155416", "0.58803195", "0.5863524", "0.58607566", "0.5826505", "0.5824772", "0.5715186", "0.57083964", "0.5696415", "0.5696415", "0.5696415", "0.56877047", "0.5687286", "0.56735325", "0.56732684", "0.5654601", "0.565149", "0.56423855", "0.56394947", "0.5637213", "0.5632039", "0.5632039", "0.5632039", "0.5632039", "0.5632039", "0.5632039", "0.5632039", "0.5632039", "0.5632039", "0.5632039", "0.56314754", "0.56166655", "0.56152827", "0.56119597", "0.56119597", "0.56119597", "0.55995536", "0.5595769", "0.55881906", "0.55852145", "0.55607957", "0.555707", "0.5548207", "0.55442655", "0.55442566", "0.5540084", "0.55389357", "0.5529853", "0.55260026", "0.5525455", "0.55206066", "0.55123067", "0.5498736", "0.5494356", "0.5485137", "0.5484525", "0.5483812", "0.54756635", "0.54640573", "0.5463617", "0.5450598", "0.5440031", "0.54362065", "0.54353374", "0.5431708", "0.5431385", "0.54293764", "0.5427422", "0.54199433", "0.54104805", "0.540007", "0.53973013", "0.5394392", "0.53864706", "0.53806144", "0.53769314", "0.5376725", "0.53752226", "0.53752226", "0.53736305" ]
0.7736915
0
Creates a hash for all components
def all_component_hash(item=nil) hash = {} items = [] if(!item.nil?) items = item.components else for comp in @all_components if(comp.component_parents.empty?) items.push(comp) end end end for comp in items hash[comp] = all_component_hash(comp) end return hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash\n raw = [name, type, values.join('/')].join(' ')\n Digest::MD5.hexdigest(raw)\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; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash\n \"#{self.class.name}-#{self.id}-#{@__metadata__.cas}-#{@__attributes__.hash}\".hash\n end", "def hash; map{|el| \"#{el.name} @ #{el.hash}\"}; map(&:hash).reduce(:+) % 2**32; end", "def hash\n [_hash, name, owner].hash\n end", "def hash\r\n\t\treturn @name.hash() + @type.hash()\r\n\tend", "def hash()\n #This is a stub, used for indexing\n end", "def hash\n end", "def hash\n end", "def hash\n end", "def output_hash; end", "def all_prod_comp_hash(item=nil)\n\n hash = {}\n\n if(!item.nil?)\n items = item.components\n else\n items = @all_products\n end\n\n for comp in items\n\n hash[comp] = all_prod_comp_hash(comp)\n\n end\n\n return hash\n\n end", "def hash\n { hash: @hash, hashType: @hash_type }\n end", "def hash(*) end", "def hash\n [lac, cid, radio, mcc, mnc, signal, psc, asu, ta].hash\n end", "def to_hash() end", "def hash\n @hash ||= self.to_a.hash\n end", "def to_hash\n memoize(:to_hash) do\n _process_hashed(structures.inject({}) { |acc, elem| Utils.merge(acc, elem) })\n end\n end", "def hash\n [].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 generate_hash\n @groups.flatten.inject([]) {|hash, stone| hash << stone.to_s}.sort.hash\n end", "def hash_template\n template = {}\n \n info.each do | key, value |\n template[key] = generate_structure( value )\n end\n \n template\n end", "def hash\n swap\n scatter\n completed_string\n end", "def hash\r\n @_hash ||= _hash\r\n end", "def all_product_hash\n hash = {}\n items = @all_products\n for prod in items\n hash[prod] = {}\n end\n return hash\n end", "def hash\n model.hash + key.hash\n end", "def hash\n [class_id, object_type, action, cache_state, cached_time, last_access_time, md5sum, original_sha512sum, path, registered_workflows, used_count, file, network_element].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 data\n hash = default_data\n components.each do |component|\n hash[component.property] = component.data\n end\n if has_element_class?\n hash['elements'] = []\n elements.each do |element|\n hash['elements'] << element.data\n end\n end\n hash\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 hash\n [contact, extensions, external_resources, info, integrations, org, schema_version, tags].hash\n end", "def hash\n [aws_elastic_block_store, azure_disk, azure_file, cephfs, cinder, config_map, downward_api, empty_dir, fc, flex_volume, flocker, gce_persistent_disk, git_repo, glusterfs, host_path, iscsi, name, nfs, persistent_volume_claim, photon_persistent_disk, portworx_volume, projected, quobyte, rbd, scale_io, secret, storageos, vsphere_volume].hash\n end", "def hash\n [id, banco, agencia, conta_corrente, especie, numero_convenio, carteira, codigo_cedente, especie_tipo, especie_documento, aceite, instrucoes, local_pagamento1, local_pagamento2, endereco_cobranca_emissor, nome_beneficiario, cnpj_beneficiario, operador, data, maquina].hash\n end", "def hash\n to_h.hash ^ self.class.hash\n end", "def hash\n [author_email, author_name, author_time, branch, commit_time, committer_email, committer_name, default_branch, message, repository_url, sha, tag].hash\n end", "def hash\n [class_id, object_type, hardware_status, hcl_cimc_version, hcl_driver_name, hcl_driver_version, hcl_firmware_version, hcl_model, inv_cimc_version, inv_driver_name, inv_driver_version, inv_firmware_version, inv_model, reason, software_status, status, component, hcl_status].hash\n end", "def hash\n [color, cards, address_placement, custom_envelope, double_sided, extra_service, mail_type, return_envelope, bleed, file_original_url].hash\n end", "def hash\n @hash ||= Hash.new { |h, k| h[k] = Hash.new(&h.default_proc) }\n end", "def hash\n\t\t(language + type + klass + thing).hash\n\tend", "def hash\n code = 17\n code = 37 * code\n self.instance_variables.each do |v|\n code += self.instance_variable_get(v).hash\n end\n code\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 @hash\n end", "def initial_components\n {}\n end", "def hash\r\n return to_s.hash\r\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 to_a.hash\n end", "def hash\n self.atoms.hash\n end", "def hash\n name.hash ^ version.hash\n end", "def initial_late_components\n {}\n end", "def hash\n [compute, group_by, index, multi_compute, search].hash\n end", "def hash\n [sequence_number, corporate_number, process, correct, update_date, change_date, name, name_image_id, kind, prefecture_name, city_name, street_number, address_image_id, prefecture_code, city_code, post_code, address_outside, address_outside_image_id, close_date, close_cause, successor_corporate_number, change_cause, assignment_date, latest, en_name, en_prefecture_name, en_city_name, en_address_outside, furigana, hihyoji].hash\n end", "def hash\n [hint,name,ordinal,module_name].hash\n end", "def create_hash(&block); end", "def create_hash(&block); end", "def hash\n\t\treturn self.name.to_s.hash\n\tend", "def hash=(_arg0); end", "def consistent_hash\n Zlib.crc32(self.to_yaml, 0)\n end", "def hash\n @hash\n end", "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 hash\n [dep_mgr_name, name, version, license].hash\n end", "def hash\n @elements.hash\n end", "def hash\n @elements.hash\n end", "def hash\n return to_s.hash\n end", "def config_hash\n digest = Digest::MD5.hexdigest(\n \"#{@x}-#{@y}-#{@hires_factor}-#{@render_type}-#{@format}-#{CONVERTER_VERSION}\")\n digest\n end", "def hash\n Zlib.crc32(to_a.map(&:to_s).sort.to_s)\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 to_hash\n index_hash = {}\n index_hash['json_claz'] = self.class.name\n index_hash['id'] = id\n index_hash[\"asms_id\"] = asms_id\n index_hash['name'] = name\n index_hash['components'] = components\n index_hash['tosca_type'] = tosca_type\n index_hash['policies'] = policies\n index_hash['inputs'] = inputs\n index_hash['outputs'] = outputs\n index_hash['status'] = status\n index_hash['state'] = state\n index_hash['created_at'] = created_at\n index_hash\n end", "def hash\n self.class.name.hash\n end", "def hash\n @hash || calculate_hash!\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 name.hash ^ provider.hash\n end", "def hash\n self.class.hash ^ @ns.hash\n end", "def hash\n [specs, platform, requires_frameworks].hash\n end", "def hash\n [class_id, object_type, acs_control_gpu1state, acs_control_gpu2state, acs_control_gpu3state, acs_control_gpu4state, acs_control_gpu5state, acs_control_gpu6state, acs_control_gpu7state, acs_control_gpu8state, acs_control_slot11state, acs_control_slot12state, acs_control_slot13state, acs_control_slot14state, adjacent_cache_line_prefetch, advanced_mem_test, all_usb_devices, altitude, aspm_support, assert_nmi_on_perr, assert_nmi_on_serr, auto_cc_state, autonumous_cstate_enable, baud_rate, bme_dma_mitigation, boot_option_num_retry, boot_option_re_cool_down, boot_option_retry, boot_performance_mode, burst_and_postponed_refresh, c1auto_demotion, c1auto_un_demotion, cbs_cmn_apbdis, cbs_cmn_cpu_cpb, cbs_cmn_cpu_gen_downcore_ctrl, cbs_cmn_cpu_global_cstate_ctrl, cbs_cmn_cpu_l1stream_hw_prefetcher, cbs_cmn_cpu_l2stream_hw_prefetcher, cbs_cmn_cpu_smee, cbs_cmn_cpu_streaming_stores_ctrl, cbs_cmn_determinism_slider, cbs_cmn_efficiency_mode_en, cbs_cmn_fixed_soc_pstate, cbs_cmn_gnb_nb_iommu, cbs_cmn_gnb_smu_df_cstates, cbs_cmn_gnb_smucppc, cbs_cmn_mem_ctrl_bank_group_swap_ddr4, cbs_cmn_mem_map_bank_interleave_ddr4, cbs_cmnc_tdp_ctl, cbs_cpu_ccd_ctrl_ssp, cbs_cpu_core_ctrl, cbs_cpu_smt_ctrl, cbs_dbg_cpu_snp_mem_cover, cbs_dbg_cpu_snp_mem_size_cover, cbs_df_cmn_acpi_srat_l3numa, cbs_df_cmn_dram_nps, cbs_df_cmn_mem_intlv, cbs_df_cmn_mem_intlv_size, cbs_sev_snp_support, cdn_enable, cdn_support, channel_inter_leave, cisco_adaptive_mem_training, cisco_debug_level, cisco_oprom_launch_optimization, cisco_xgmi_max_speed, cke_low_policy, closed_loop_therm_throtl, cmci_enable, config_tdp, config_tdp_level, console_redirection, core_multi_processing, cpu_energy_performance, cpu_frequency_floor, cpu_perf_enhancement, cpu_performance, cpu_power_management, cr_qos, crfastgo_config, dcpmm_firmware_downgrade, demand_scrub, direct_cache_access, dram_clock_throttling, dram_refresh_rate, dram_sw_thermal_throttling, eadr_support, edpc_en, enable_clock_spread_spec, enable_mktme, enable_sgx, enable_tme, energy_efficient_turbo, eng_perf_tuning, enhanced_intel_speed_step_tech, epoch_update, epp_enable, epp_profile, execute_disable_bit, extended_apic, flow_control, frb2enable, hardware_prefetch, hwpm_enable, imc_interleave, intel_dynamic_speed_select, intel_hyper_threading_tech, intel_speed_select, intel_turbo_boost_tech, intel_virtualization_technology, intel_vt_for_directed_io, intel_vtd_coherency_support, intel_vtd_interrupt_remapping, intel_vtd_pass_through_dma_support, intel_vtdats_support, ioh_error_enable, ioh_resource, ip_prefetch, ipv4http, ipv4pxe, ipv6http, ipv6pxe, kti_prefetch, legacy_os_redirection, legacy_usb_support, llc_alloc, llc_prefetch, lom_port0state, lom_port1state, lom_port2state, lom_port3state, lom_ports_all_state, lv_ddr_mode, make_device_non_bootable, memory_bandwidth_boost, memory_inter_leave, memory_mapped_io_above4gb, memory_refresh_rate, memory_size_limit, memory_thermal_throttling, mirroring_mode, mmcfg_base, network_stack, numa_optimized, nvmdimm_perform_config, onboard10gbit_lom, onboard_gbit_lom, onboard_scu_storage_support, onboard_scu_storage_sw_stack, operation_mode, os_boot_watchdog_timer, os_boot_watchdog_timer_policy, os_boot_watchdog_timer_timeout, out_of_band_mgmt_port, package_cstate_limit, panic_high_watermark, partial_cache_line_sparing, partial_mirror_mode_config, partial_mirror_percent, partial_mirror_value1, partial_mirror_value2, partial_mirror_value3, partial_mirror_value4, patrol_scrub, patrol_scrub_duration, pc_ie_ras_support, pc_ie_ssd_hot_plug_support, pch_usb30mode, pci_option_ro_ms, pci_rom_clp, pcie_ari_support, pcie_pll_ssc, pcie_slot_mraid1link_speed, pcie_slot_mraid1option_rom, pcie_slot_mraid2link_speed, pcie_slot_mraid2option_rom, pcie_slot_mstorraid_link_speed, pcie_slot_mstorraid_option_rom, pcie_slot_nvme1link_speed, pcie_slot_nvme1option_rom, pcie_slot_nvme2link_speed, pcie_slot_nvme2option_rom, pcie_slot_nvme3link_speed, pcie_slot_nvme3option_rom, pcie_slot_nvme4link_speed, pcie_slot_nvme4option_rom, pcie_slot_nvme5link_speed, pcie_slot_nvme5option_rom, pcie_slot_nvme6link_speed, pcie_slot_nvme6option_rom, pcie_slots_cdn_enable, pop_support, post_error_pause, post_package_repair, processor_c1e, processor_c3report, processor_c6report, processor_cstate, psata, pstate_coord_type, putty_key_pad, pwr_perf_tuning, qpi_link_frequency, qpi_link_speed, qpi_snoop_mode, rank_inter_leave, redirection_after_post, sata_mode_select, select_memory_ras_configuration, select_ppr_type, serial_port_aenable, sev, sgx_auto_registration_agent, sgx_epoch0, sgx_epoch1, sgx_factory_reset, sgx_le_pub_key_hash0, sgx_le_pub_key_hash1, sgx_le_pub_key_hash2, sgx_le_pub_key_hash3, sgx_le_wr, sgx_package_info_in_band_access, sgx_qos, sha1pcr_bank, sha256pcr_bank, single_pctl_enable, slot10link_speed, slot10state, slot11link_speed, slot11state, slot12link_speed, slot12state, slot13state, slot14state, slot1link_speed, slot1state, slot2link_speed, slot2state, slot3link_speed, slot3state, slot4link_speed, slot4state, slot5link_speed, slot5state, slot6link_speed, slot6state, slot7link_speed, slot7state, slot8link_speed, slot8state, slot9link_speed, slot9state, slot_flom_link_speed, slot_front_nvme10link_speed, slot_front_nvme10option_rom, slot_front_nvme11link_speed, slot_front_nvme11option_rom, slot_front_nvme12link_speed, slot_front_nvme12option_rom, slot_front_nvme13option_rom, slot_front_nvme14option_rom, slot_front_nvme15option_rom, slot_front_nvme16option_rom, slot_front_nvme17option_rom, slot_front_nvme18option_rom, slot_front_nvme19option_rom, slot_front_nvme1link_speed, slot_front_nvme1option_rom, slot_front_nvme20option_rom, slot_front_nvme21option_rom, slot_front_nvme22option_rom, slot_front_nvme23option_rom, slot_front_nvme24option_rom, slot_front_nvme2link_speed, slot_front_nvme2option_rom, slot_front_nvme3link_speed, slot_front_nvme3option_rom, slot_front_nvme4link_speed, slot_front_nvme4option_rom, slot_front_nvme5link_speed, slot_front_nvme5option_rom, slot_front_nvme6link_speed, slot_front_nvme6option_rom, slot_front_nvme7link_speed, slot_front_nvme7option_rom, slot_front_nvme8link_speed, slot_front_nvme8option_rom, slot_front_nvme9link_speed, slot_front_nvme9option_rom, slot_front_slot5link_speed, slot_front_slot6link_speed, slot_gpu1state, slot_gpu2state, slot_gpu3state, slot_gpu4state, slot_gpu5state, slot_gpu6state, slot_gpu7state, slot_gpu8state, slot_hba_link_speed, slot_hba_state, slot_lom1link, slot_lom2link, slot_mezz_state, slot_mlom_link_speed, slot_mlom_state, slot_mraid_link_speed, slot_mraid_state, slot_n10state, slot_n11state, slot_n12state, slot_n13state, slot_n14state, slot_n15state, slot_n16state, slot_n17state, slot_n18state, slot_n19state, slot_n1state, slot_n20state, slot_n21state, slot_n22state, slot_n23state, slot_n24state, slot_n2state, slot_n3state, slot_n4state, slot_n5state, slot_n6state, slot_n7state, slot_n8state, slot_n9state, slot_raid_link_speed, slot_raid_state, slot_rear_nvme1link_speed, slot_rear_nvme1state, slot_rear_nvme2link_speed, slot_rear_nvme2state, slot_rear_nvme3link_speed, slot_rear_nvme3state, slot_rear_nvme4link_speed, slot_rear_nvme4state, slot_rear_nvme5state, slot_rear_nvme6state, slot_rear_nvme7state, slot_rear_nvme8state, slot_riser1link_speed, slot_riser1slot1link_speed, slot_riser1slot2link_speed, slot_riser1slot3link_speed, slot_riser2link_speed, slot_riser2slot4link_speed, slot_riser2slot5link_speed, slot_riser2slot6link_speed, slot_sas_state, slot_ssd_slot1link_speed, slot_ssd_slot2link_speed, smee, smt_mode, snc, snoopy_mode_for2lm, snoopy_mode_for_ad, sparing_mode, sr_iov, streamer_prefetch, svm_mode, terminal_type, tpm_control, tpm_pending_operation, tpm_support, tsme, txt_support, ucsm_boot_order_rule, ufs_disable, uma_based_clustering, upi_link_enablement, upi_power_management, usb_emul6064, usb_port_front, usb_port_internal, usb_port_kvm, usb_port_rear, usb_port_sd_card, usb_port_vmedia, usb_xhci_support, vga_priority, virtual_numa, vmd_enable, vol_memory_mode, work_load_config, xpt_prefetch, xpt_remote_prefetch, organization, profiles].hash\n end", "def hash\n [schema, name].hash\n end", "def hash\n [self.class, to_h].hash\n end", "def hash\n [self.class, to_h].hash\n end", "def hash\n [self.class, to_h].hash\n end", "def hash\n to_s.hash\n end", "def hash\n hash_args.hash\n end", "def hash\n\n self.h.fei.hash\n end" ]
[ "0.69795907", "0.6754393", "0.6754393", "0.6754393", "0.6754393", "0.6754393", "0.6754393", "0.6754393", "0.6622419", "0.6622419", "0.6622419", "0.6622419", "0.6622419", "0.6622419", "0.6622419", "0.6622419", "0.6622419", "0.6622419", "0.6587572", "0.65646434", "0.6564558", "0.65492123", "0.6545778", "0.65142584", "0.65142584", "0.65142584", "0.6510787", "0.6503525", "0.64962274", "0.6453713", "0.6423774", "0.63819873", "0.6374689", "0.6341467", "0.62873113", "0.6284967", "0.6279587", "0.62618214", "0.6247734", "0.6214158", "0.6202081", "0.61973387", "0.6195267", "0.6194343", "0.6194343", "0.6194343", "0.6191435", "0.6177996", "0.6170045", "0.6163049", "0.6161744", "0.6152212", "0.6130733", "0.61095774", "0.60935396", "0.6083205", "0.6080921", "0.60800165", "0.60780483", "0.60748893", "0.60685885", "0.60652816", "0.6063945", "0.6059637", "0.60539436", "0.605117", "0.6050122", "0.60470814", "0.6043076", "0.60409296", "0.60404015", "0.60404015", "0.6038338", "0.6030706", "0.60274065", "0.6023506", "0.60220104", "0.60220104", "0.60218537", "0.6015685", "0.6015685", "0.60135657", "0.6009484", "0.6009174", "0.60045624", "0.6002663", "0.60019386", "0.59896296", "0.5984942", "0.5979768", "0.5974247", "0.5965689", "0.596013", "0.5955087", "0.59544015", "0.59544015", "0.59544015", "0.5954194", "0.5946578", "0.5941663" ]
0.6586064
19
Creates a hash for all valuefields
def all_valuefield_hash hash = {} items = @all_valuefields for vf in items hash[vf] = {} end return hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def values_hash\n hashify(:value)\n end", "def fields_hash\n each_pair.to_h\n end", "def field_hash\n\n self.yattributes || fields.inject({}) { |r, f| r[f.fkey] = f.value; r }\n end", "def to_field_hash\n to_values_hash.flatten\n end", "def hash\n raw = [name, type, values.join('/')].join(' ')\n Digest::MD5.hexdigest(raw)\n end", "def hash\n [self.class, self.val, self.attribute].hash\n end", "def value_fields\n %w(fields value).freeze\n end", "def hash\n\t\tvalue.hash\n\tend", "def to_hash\n self.class.fields.each_with_object({}) do |key, hash|\n val = send(key)\n hash[key] = val if !val.nil?\n end\n end", "def hash\n [value].hash\n end", "def hash\n [value].hash\n end", "def hash\n value_id.hash\n end", "def to_h\n hash = {}\n self.class.field_definitions.each do |k, v|\n hash[k] = field_value k\n end\n hash\n end", "def hash\n fields.map { |field| instance_variable_get(field[:name]) }.hash\n end", "def values_hash\n @_values.dup\n end", "def hash\r\n\t\treturn @name.hash() + @type.hash()\r\n\tend", "def hash\n value.hash\n end", "def to_hash\n { type: type, value: value }\n end", "def to_h\n h = {}\n each { |f| h.store f.name, f.value }\n h\n end", "def hash\n [created, value, change_mode, invoicing_type, no_charge].hash\n end", "def hash\n @value.hash\n end", "def to_hash\n values\n end", "def to_hash\n\t\tpure_hash = {}\n\t\[email protected] do |info|\n\t\t\tpure_hash[info.key] = info.value\n\t\tend\n\t\tpure_hash\n\tend", "def to_hash() end", "def to_hash\n @fields\n end", "def recalculate_values_hashes\n vh = {}\n @values.each do |k,v|\n vh[k] = v.hash\n end\n @values_hashes = vh.freeze\n end", "def hash\n values.hash ^ known_data.hash\n end", "def to_h\n FieldsToHash.call(self)\n end", "def hash\n @hash || @hash = (value.hash * -1)\n end", "def to_hash\n {\n :name => @name,\n :value => @value\n }\n end", "def to_hash\n fields.inject({type: type}) do |table, name|\n table.tap do\n if val = send(name)\n val = val.iso8601(3) if name == :timestamp\n table[name] = val\n end\n end\n end\n end", "def add_to_hash hash = { }\n hash[self.class.value_name] = code\n if respond_to?(:uuid) \n hash[self.class.value_name_uuid] = initialize_uuid!\n end\n hash\n end", "def hash\n { hash: @hash, hashType: @hash_type }\n end", "def to_hash\n hash = {'id' => self.id.to_s}\n for name, field in self.class.fields\n if not name.end_with?(\"_id\")\n if self.has_attribute?(name)\n value = self[field.name]\n hash.store name, value if not value.nil?\n end\n end\n end\n hash.store 'total_employee', self.total_employee\n hash.store 'total_job', self.total_job\n # hash.store 'child_departments', self.child_departments\n hash\n end", "def hash\n [name, type, sub_attributes, multi_valued, description, required, canonical_values, case_exact, mutability, returned, uniqueness, reference_types].hash\n end", "def hash\n [name, value, timestamp, source_id, source_label, source, selected_by_user, selected_by_user_timestamp, source_vid, source_metadata, request_id, updated_by_user_id, persistence_timestamp, use_timestamp_as_persistence_timestamp].hash\n end", "def calculate_values_hashes\n @values_hashes || recalculate_values_hashes\n end", "def to_h\n { 'metadata' => { 'fieldName' => field },\n 'operator' => operator,\n 'values' => Array(value) }\n end", "def to_hash(clean = false)\n h = {}\n #h[:index] = index\n each_pair do |name, value|\n if !clean or !self.class.internal_field?(name)\n h[name] = value\n end\n end\n h\n end", "def hash\n [first_name, last_name, address_one, address_two, city, state, zip, phone, email, country_code].hash\n end", "def values\n record && record.to_hash(fields)\n end", "def hash\n [model, pk.nil? ? @values.sort_by{|k,v| k.to_s} : pk].hash\n end", "def to_hash\n { @name => @value }\n end", "def fields_hash\n @fields_hash ||=\n begin\n field_sets_hash = Hash.new { |h, k| h[k] = Set.new }\n @types.each do |type|\n Setup.for(type).fields.each do |field|\n field_sets_hash[field.name.to_sym] << field\n end\n end\n fields_hash = {}\n field_sets_hash.each_pair do |field_name, set|\n if set.length == 1\n fields_hash[field_name] = set.to_a.first\n end\n end\n fields_hash\n end\n end", "def hash\n model.hash + key.hash\n end", "def to_hash\n hash = {}\n\n instance_variables.each do |var|\n key = var.to_s.delete(\"@\").to_sym\n val = instance_variable_get(var)\n\n if authlete_model_simple_attribute?(key) or val.nil?\n hash[key] = val\n elsif TAGGED_VALUE_ARRAY_ATTRIBUTES.include?(key)\n hash[key] = val.map { |element| element.to_hash }\n elsif key == :extension\n # For attributes such as :extension\n hash[key] = val.to_hash\n end\n end\n\n hash\n end", "def entry_hash(values)\n assert_valid_field_list(values) unless @field_list_is_valid # just do it once\n raw_entry = values.shift\n hash = Hash[ *@entry_fields.zip( values ).flatten ]\n hash[:raw_entry] = raw_entry.strip\n hash\n end", "def attr_hash\n Digest::MD5.hexdigest(\"#{@name}:#{@ruby_type}\")\n end", "def hash\n [ data, type ].hash\n end", "def to_hash\n fattrs.inject({}){|h,a| h.update a => send(a)}\n end", "def hash\n attributes.hash\n end", "def hash\n attributes.hash\n end", "def hash\n attributes.hash\n end", "def to_hash *args\n hsh = super(*args)\n hsh.each do |attr, val|\n hsh[attr] = val.to_hash if val.respond_to?(:to_hash)\n end\n hsh\n end", "def to_hash\n call\n @hash = @value\n @hash\n end", "def to_hash\n {\n :name => self[:name],\n :cms_id => self[:cms_id],\n :nqf_id => self[:nqf_id],\n :hqmf_id => self[:hqmf_id],\n :hqmf_set_id => self[:hqmf_set_id],\n :hqmf_version_number => self[:hqmf_version_number],\n :value_sets => self.value_sets_to_hashes\n }\n end", "def hashed_fields_for_export\n hash = {}\n\n self.ordered_questions.map { |q| hash[q.answer_field] = q.text }\n\n hash.merge!({\n location_code: \"Location Code\",\n user_agent: \"User Agent\",\n page: \"Page\",\n referer: \"Referrer\",\n created_at: \"Created At\"\n })\n\n if self.organization.enable_ip_address?\n hash.merge!({\n ip_address: \"IP Address\"\n })\n end\n\n hash\n end", "def to_hash\n rethash = {}\n\n @parameters.each do |name, obj|\n rethash[name] = obj.value\n end\n\n rethash\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 to_hash\n hash = HashWithIndifferentAccess.new\n for index in 0..(size - 1)\n column = @grid.columns[index]\n field = column.field\n if field\n\n # Existing value logic is too messy ...\n value = self[index]\n if field == :notes and !value.blank? and value[/notes/].nil? and value[/Notes/].nil? and column.description[/notes/].nil? and column.description[/Notes/].nil?\n value = \"#{column.description}: #{value}\"\n end\n\n existing_value = hash[field]\n value = nil if value == $INPUT_RECORD_SEPARATOR\n if existing_value.blank?\n if value.blank?\n hash.delete(field)\n else\n hash[field] = value\n end\n else \n unless value.blank?\n hash[field] = \"#{existing_value}#{$INPUT_RECORD_SEPARATOR}#{value}\"\n end\n end\n\n end\n end\n RAILS_DEFAULT_LOGGER.debug(hash.inspect) if RAILS_DEFAULT_LOGGER.debug?\n hash\n end", "def hash\n [id, alternate_id, type, first_name, surname, date_of_brith, date_of_birth, shipping_address, mailing_address, home_phone, mobile_phone, email_address, mailing_address_active, accounts, classifications, member_photo, gender, receive_email, receive_sms, password].hash\n end", "def hash\n case primary_key\n when Array\n [model, !pk.all? ? @values : pk].hash\n when Symbol\n [model, pk.nil? ? @values : pk].hash\n else\n [model, @values].hash\n end\n end", "def hash\n case primary_key\n when Array\n [model, !pk.all? ? @values : pk].hash\n when Symbol\n [model, pk.nil? ? @values : pk].hash\n else\n [model, @values].hash\n end\n end", "def to_h\n self.class.list_of_attributes.each_with_object({}) do |key, hash|\n val = instance_variable_get :\"@#{key}\"\n hash[key] = Utils.hashify(val) unless val == Dry::Initializer::UNDEFINED\n end\n end", "def to_hash\n @data.map do |row|\n hsh = {}\n @field_names.each_with_index.map{ |fld, i| hsh[fld] = row[i] }\n hsh\n end\n end", "def to_hash\n h = {}\n self.all_redis_objects.each do |o|\n field = o[0]\n redis_type = o[1][:type] \n case redis_type\n when :value\n h[field] = try_a_number(self.method(field).call.value)\n when :set\n h[field] = self.method(field).call.members.map{ |x| try_a_number(x) }\n end\n end\n h\n end", "def value2keys\n h = Hash.new { |h,k| h[k] = [] }\n self.each do |k,v|\n h[v] << k\n end\n h \n end", "def to_hash\n hash = HashWithIndifferentAccess.new\n for index in 0..(size - 1)\n column = @grid.columns[index]\n field = column.field\n if field\n\n # Existing value logic is too messy ...\n value = self[index]\n if field == :notes and !value.blank? and value[/notes/].nil? and value[/Notes/].nil? and column.description[/notes/].nil? and column.description[/Notes/].nil?\n value = \"#{column.description}: #{value}\"\n end\n\n existing_value = hash[field]\n value = nil if value == $INPUT_RECORD_SEPARATOR\n if existing_value.blank?\n if value.blank?\n hash.delete(field)\n else\n hash[field] = value\n end\n else \n unless value.blank?\n hash[field] = \"#{existing_value}#{$INPUT_RECORD_SEPARATOR}#{value}\"\n end\n end\n\n end\n end\n hash\n end", "def to_hash\n memoize(:to_hash) do\n _process_hashed(structures.inject({}) { |acc, elem| Utils.merge(acc, elem) })\n end\n end", "def hash\n [id, field_type, mode, label, no_wrap, bold, required, appears_by_default, find_enabled, allow_new_choices, sort_as_given, carry_choices, foreign_key, unique, does_data_copy, field_help, audited, num_lines, max_length, append_only, allow_html, has_extension, units, decimal_places, comma_start, number_format, does_average, does_total, blank_is_zero, currency_symbol, currency_format, display_time, display_relative, display_month, default_today, display_day_of_week, display_timezone, work_week, start_field, duration_field, format, hours24, display_user, default_kind, default_value_luid, choices_luid, choices, composite_fields, target_table_id, target_field_id, source_field_id, use_new_window, link_text, exact, display_images, default_domain, display_email, appears_as, abbreviate, auto_save, target_table_name, display_as_link, sort_alpha, version_mode, max_versions, see_versions, width, xml_tag, formula, default_value, comments, master_choice_table_id, master_choice_field_id, snap_field_id, parent_field_id, lookup_target_field_id, lookup_reference_field_id, summary_reference_field_id, summary_target_field_id, summary_function, master_table_tag, permissions].hash\n end", "def to_hash\n @values\n end", "def hashed_fields_for_export\n raise InvalidArgument unless self.form\n\n hash = {}\n\n self.form.questions.map { |q| hash[q.answer_field] = q.text }\n\n hash.merge({\n ip_address: \"IP Address\",\n user_agent: \"User Agent\",\n page: \"Page\",\n referer: \"Referrer\",\n created_at: \"Created At\"\n })\n end", "def to_h\n @values.inject(Hash.new) do |h, a|\n tag, val = a\n h[Values.tag_map[tag]] = convert(Values.unify_tag(tag), val)\n h\n end\n end", "def hash\n [actual_value, additional_contact_client_first_name, additional_contact_client_id, additional_contact_client_is_primary, additional_contact_client_last_name, address_business_city, address_business_country, address_business_is_primary, address_business_line1, address_business_state, address_business_zip_code, address_other_city, address_other_country, address_other_is_primary, address_other_line1, address_other_state, address_other_zip_code, bill_rate, bonus, commission, company_id, company_name, compensation, compensation_details, custom_field1, custom_field10, custom_field11, custom_field12, custom_field13, custom_field14, custom_field15, custom_field16, custom_field17, custom_field18, custom_field19, custom_field2, custom_field20, custom_field21, custom_field22, custom_field23, custom_field24, custom_field25, custom_field26, custom_field27, custom_field28, custom_field29, custom_field3, custom_field30, custom_field4, custom_field5, custom_field6, custom_field7, custom_field8, custom_field9, description, discount, estimated_close_date, external_primary_key, fee, fee_percent, hourly_rate, is_lead, is_on_hold, job_title_id, job_title_name, job_types, lead_source_id, lead_source_name, margin, name, number_of_openings, opportunity_type_id, opportunity_type_name, parent_job_id, parent_job_name, pay_rate, potential_value, priority_id, priority_name, probability, salary, start_date, tags, total_hours, website_description, website_description_is_primary, website_other, website_other_is_primary].hash\n 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\n \"#{self.class.name}-#{self.id}-#{@__metadata__.cas}-#{@__attributes__.hash}\".hash\n end", "def to_hsh\n {name => {:columns => columns, :unqiue => unique}}\n end", "def hash() #:nodoc:\n prime = 31;\n result = 1;\n result = prime * result + @amount.to_i\n result = prime * result + @new_balance.to_i\n result = prime * result + (@date.nil? ? 0 : Bankjob.date_time_to_ofx(@date).hash);\n result = prime * result + (@raw_description.nil? ? 0 : @raw_description.hash);\n result = prime * result + (@type.nil? ? 0 : @type.hash);\n # don't use value date\n return result;\n end", "def to_hash\n {@tag => @value}\n end", "def to_hash(clean = false)\n h = {}\n h[:index] = index\n each_pair do |name, value|\n if !clean or !self.class.internal_field?(name)\n h[name] = value\n end\n end\n h\n end", "def to_hash\n @value\n end", "def to_hash\n @value\n end", "def to_hash\n { name_as_hash_key => @values }\n end", "def to_values_hash\n values_hash = inject(ValuesHash.new) do |hash,pair|\n k, v = pair\n hash[k] = case v\n when DescriptorHash then v.to_values_hash\n else v.try(:extracted_value)\n end\n hash\n end \n end", "def hash\n [subject_property, proprietorship, surname, forename, middle_name, all_names, historical_match].hash\n end", "def to_hash\n {\n field_name: @field_name,\n operator: @operator,\n values: @values\n }\n end", "def hash\n self.to_f.hash\n end", "def hash() end", "def hash() end", "def hash() end", "def hash() end" ]
[ "0.74033475", "0.7286386", "0.72832227", "0.71734506", "0.7046589", "0.6868515", "0.68565035", "0.6713206", "0.66925", "0.66783965", "0.66783965", "0.6637003", "0.6631829", "0.6589479", "0.65876424", "0.65799785", "0.6552264", "0.65461266", "0.6529494", "0.6504742", "0.6500536", "0.64949155", "0.64732856", "0.645676", "0.645464", "0.64456356", "0.643528", "0.64254016", "0.6401031", "0.63949865", "0.6390006", "0.6388087", "0.638333", "0.6373147", "0.6372664", "0.6369935", "0.63343906", "0.62936825", "0.6285204", "0.62817", "0.6261985", "0.6246024", "0.62454873", "0.6242572", "0.62368697", "0.6234057", "0.62272185", "0.62191164", "0.62023526", "0.620048", "0.6200452", "0.6200452", "0.6200452", "0.62001884", "0.6199946", "0.619842", "0.6189075", "0.6183164", "0.61618394", "0.61618394", "0.61618394", "0.61618394", "0.61618394", "0.61618394", "0.61618394", "0.61618394", "0.61618394", "0.61618394", "0.6155652", "0.6153338", "0.61517704", "0.61517704", "0.6140479", "0.6137", "0.6125345", "0.6124018", "0.6121958", "0.6111439", "0.61084735", "0.6092681", "0.60856223", "0.6082029", "0.6079749", "0.6074169", "0.6069248", "0.60689735", "0.6043274", "0.60413784", "0.60394347", "0.6031433", "0.6031433", "0.60164577", "0.60153663", "0.6008091", "0.6001276", "0.60000604", "0.5997651", "0.5997651", "0.5997651", "0.5997651" ]
0.84429306
0
Creates a hash for all images
def all_image_hash hash = {} items = @all_images for img in items hash[img] = {} end return hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def image_hash; end", "def populate_hash\n self.orig_image_url_hash = Digest::SHA1.hexdigest orig_image_url\n end", "def hash\n @real.hash ^ @image.hash\n end", "def images\n @images ||= Hash.new\n end", "def create_images\n imgNames = Hash[\n \tFile.join(Dir.home, 'Desktop/image1.png') => 0,\n \tFile.join(Dir.home, 'Desktop/image2.png') => 1,\n \tFile.join(Dir.home, 'Desktop/image3.png') => 2,\n \tFile.join(Dir.home, 'Desktop/image4.png') => 3,\n \tFile.join(Dir.home, 'Desktop/image5.png') => 4,\n \tFile.join(Dir.home, 'Desktop/image6.png') => 0,\n \tFile.join(Dir.home, 'Desktop/image7.png') => 1,\n \tFile.join(Dir.home, 'Desktop/image8.png') => 2,\n \tFile.join(Dir.home, 'Desktop/image9.png') => 3,\n \tFile.join(Dir.home, 'Desktop/image10.png') => 4 ]\n \t\n i = 0\n imgNames.each_key do |imgN|\n open(imgN, 'wb', 0666) do |file|\n puts \"Loading...\"\n file << open(@imageArray[i%5]).read\n end\n i += 1\n end\n end", "def image_hash(path, width, height)\n {\n 'path' => path,\n 'basename' => File.basename(path),\n 'filename' => File.basename(path, '.*'),\n 'extension' => File.extname(path).delete('.'),\n 'width' => width,\n 'height' => height,\n }\n end", "def hash_keys\n [:img_dir, :img_url_prefix]\n end", "def image_hash(config, image_path, width, height)\r\n {\r\n 'path' => image_path,\r\n 'dirname' => relative_dirname(config, image_path),\r\n 'basename' => File.basename(image_path),\r\n 'filename' => File.basename(image_path, '.*'),\r\n 'extension' => File.extname(image_path).delete('.'),\r\n 'width' => width,\r\n 'height' => height,\r\n }\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 file_ids_hash\n if @file_ids_hash.blank?\n # load the file sha's from cache if possible\n cache_file = File.join(self.path,'.loopoff')\n if File.exists?(cache_file)\n @file_ids_hash = YAML.load(File.read(cache_file))\n else\n # build it\n @file_ids_hash = {}\n self.loopoff_file_names.each do |f|\n @file_ids_hash[File.basename(f)] = Grit::GitRuby::Internal::LooseStorage.calculate_sha(File.read(f),'blob')\n end\n # write the cache\n File.open(cache_file,'w') do |f|\n f.puts YAML.dump(@file_ids_hash) \n end\n end \n end\n @file_ids_hash\n end", "def image_hash\n @image_hash ||= begin\n image_meta = page[\"image\"]\n\n case image_meta\n when Hash\n { \"path\" => nil }.merge!(image_meta)\n when String\n { \"path\" => image_meta }\n else\n { \"path\" => nil }\n end\n end\n end", "def image_hash\n @image_hash ||= begin\n image_meta = page[\"image\"]\n\n case image_meta\n when Hash\n { \"path\" => nil }.merge!(image_meta)\n when String\n { \"path\" => image_meta }\n else\n { \"path\" => nil }\n end\n end\n end", "def create_image_metadata\n {}\n end", "def images\n @images ||= {}\n end", "def get_images\n {}\n end", "def hash\n raw = [name, type, values.join('/')].join(' ')\n Digest::MD5.hexdigest(raw)\n end", "def digest\n image.ident\n end", "def store_images\n self.images.each_key do |k|\n if self.send(\"store_#{k}\") == \"1\"\n if self.send(\"#{k}?\")\n image = Image.new\n image.image = self.send(k).to_file\n image.save\n end\n end\n end\n end", "def hash\r\n # TODO what if file is empty?\r\n @hash ||= Digest::SHA1.file(File.join(@directory, @filename)).hexdigest\r\n end", "def job_hash\n [@image,@config].hash\n end", "def job_hash\n [@image,@config].hash\n end", "def hash(*) end", "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 fingerprint\n self.all_tags.to_s.md5\n end", "def hash()\n #This is a stub, used for indexing\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 prepare_images #:nodoc:\n count = 0\n images = []\n\n # We sort the images by row and column but that isn't strictly required.\n #\n rows = @images.keys.sort\n\n rows.each do |row|\n cols = @images[row].keys.sort\n cols.each do |col|\n images.push(@images[row][col])\n count += 1\n end\n end\n\n @images = {}\n @images_array = images\n\n return count\n end", "def hash\n [container_id, image, image_id, last_state, name, ready, restart_count, state].hash\n end", "def hash\n return (path + file_id.to_s).hash\n end", "def file_hashes\n @file_hashes ||= file_field_sets.map do |file_field_set|\n instantiation_fields, file_fields = file_field_set.partition do |field|\n instantiation_header?(field.header)\n end\n\n file_hash = fields_to_hash(file_fields)\n file_hash['files'] = [fields_to_hash(instantiation_fields)]\n\n file_hash\n end\n end", "def hash(pathname)\n ext = pathname.extname\n ext = ('' == ext || nil == ext) ? :none : ext.to_sym\n digest = Digest::MD5.hexdigest(File.read(pathname.to_s))\n @scanned[ext] ||= {}\n @scanned[ext][digest] ||= []\n @scanned[ext][digest] << pathname\n end", "def hash\n [file_id, output_version, image_quality, recompress_images, enable_color_detection, pack_document, pack_fonts, downscale_images, downscale_resolution, fast_web_view, remove_form_fields, remove_annotations, remove_bookmarks, remove_hyperlinks, remove_embedded_files, remove_blank_pages, remove_java_script, enable_jpeg2000, enable_jbig2, enable_char_repair, enable_mrc, preserve_smoothing, downscale_resolution_mrc, remove_metadata, remove_page_thumbnails, remove_page_piece_info, jbig2_pms_threshold].hash\n end", "def make_paperclip_mash(file_hash)\n mash = Mash.new\n mash['tempfile'] = file_hash[:tempfile]\n mash['filename'] = \"#{Time.now.to_s}.jpg\"\n mash['content_type'] = file_hash[:type]\n mash['size'] = file_hash[:tempfile].size\n mash\n end", "def hash\n Digest::MD5.hexdigest(abs_filepath)[0..5]\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 install_images(object)\n generated_name = Storage.generated_file_name(object)\n install_main_image(object.has_image_id, generated_name)\n generate_thumbnails(object.has_image_id, generated_name) if thumbnails_needed?\n return generated_name\n ensure \n @temp_file.close! if !@temp_file.closed?\n @temp_file = nil\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 buildCodeFilesHashFromFiles()\n\t\tdir = @cacheDirPath \n\t\tfilesList = Dir.glob(dir + \"**/*\").select{|e| File.file? e}\n\t\tfilesList.map.with_index{|file,index|\n\t\t\t#p \"cacheFile: \" + index.to_s if index % 1000 == 0\n\t\t\tp \"cacheFile: \" + index.to_s \n\t\t\tfilePath = dir + index.to_s + \".yaml\"\n\t\t\tfile = File.read(filePath)\n\t\t\tYAML.load(file)\n\t\t}.to_h\n\tend", "def all_images(albid)\n kept_images(albid) + deleted_images(albid)\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 uri_digest(image_uri)\n digest = SimpleEncryptor.encrypt(image_uri, Config.secret_key, Config.public_iv)\n Config.urls_memo[digest] = image_uri\n\n digest\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 hash\n [class_id, object_type, action, cache_state, cached_time, last_access_time, md5sum, original_sha512sum, path, registered_workflows, used_count, file, network_element].hash\n end", "def images\n if !@images\n @images = {}\n @images[:thumb] = self.thumb_image if self.thumb_image\n @images[:tiny_image] = self.tiny_image if self.tiny_image\n @images[:small] = self.small_image if self.small_image \n @images[:medium] = self.medium_image if self.medium_image\n @images[:large] = self.large_image if self.large_image\n end\n end", "def vote_hash # :nodoc:\n unless @vote_hash\n @vote_hash = {}\n image_votes.each do |vote|\n @vote_hash[vote.user_id.to_i] = vote.value.to_i\n end\n end\n @vote_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 add_image(image)\n # checking for duplicates\n unless @images.has_key?(image.id)\n # add to hash map\n @images[image.id] = image\n end\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 cache_image_attributes\n return if @cache_valid\n\n # make a hash -- hash[image id] = list of attributes defined for this image id\n # we use this for convenience later\n @attributes_by_id = {}\n @images.each do |img|\n proper_key = img.id.to_s\n @attributes_by_id[proper_key] = [] unless @attributes_by_id.key? proper_key\n @attributes_by_id[proper_key] << img.attribute\n end\n\n @cache_valid = true\n end", "def hash\n end", "def hash\n end", "def hash\n end", "def hash\n [aws_elastic_block_store, azure_disk, azure_file, cephfs, cinder, config_map, downward_api, empty_dir, fc, flex_volume, flocker, gce_persistent_disk, git_repo, glusterfs, host_path, iscsi, name, nfs, persistent_volume_claim, photon_persistent_disk, portworx_volume, projected, quobyte, rbd, scale_io, secret, storageos, vsphere_volume].hash\n end", "def contents_hash(paths)\n return if paths.nil?\n\n paths = paths.compact.select { |path| File.file?(path) }\n return if paths.empty?\n # rubocop:disable GitHub/InsecureHashAlgorithm\n paths.sort\n .reduce(Digest::XXHash64.new, :file)\n .digest\n .to_s(16) # convert to hex\n # rubocop:enable GitHub/InsecureHashAlgorithm\n end", "def image hash = {}\n hash = { :id => hash} if hash.is_a? String\n home hash.update :action => 'image', :trailing_slash => false\n end", "def imagga_images_info\n self.images.non_installation.collect do |image|\n image_options = { :image_url => image.filename.to_s }\n image_options.merge! pattern: image.pattern.name if image.pattern.present?\n image_options.merge! thumb_url: image.s3_path if image.s3_path.present?\n { :url => image.filename.to_s.gsub('https','http').gsub('-dev',''), :id => image.filename.path, :filepath => image.filename.path, :metadata => self.specifications_hash.merge(image_options) }\n end.flatten\n end", "def hash( *strs )\n return Digest::MD5.hexdigest( strs.join )\n end", "def hash\n raise NotImplementedError.new(\"hash() must be implemented by subclasses of AbstractVersionedFile.\")\n 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 to_hash\n hash = {}\n SoftwarerepositoryCachedImageAllOf.attribute_map.each_pair do |attr, param|\n value = self.send(attr)\n if value.nil?\n is_nullable = SoftwarerepositoryCachedImageAllOf.openapi_nullable.include?(attr)\n next if !is_nullable || (is_nullable && !instance_variable_defined?(:\"@#{attr}\"))\n end\n\n hash[param] = _to_hash(value)\n end\n hash\n end", "def hash\n [avatar, banner, created_at, description, handle, hidden_modules, link_count, modified_at, name, summary, user_count, visible_modules].hash\n end", "def hash\n [_hash, name, owner].hash\n end", "def images\n @images ||= begin\n json_file = File.join(\n File.dirname(__FILE__), %w(.. .. .. data), \"#{config[:compute_provider][:name]}.json\"\n )\n if File.exist?(json_file)\n Smash.new(JSON.load(IO.read(json_file)))\n else\n warn(\"Failed to load defaults for #{config[:compute_provider][:name]} provider.\")\n Smash.new\n end\n end\n end", "def to_h\n {\n :image_redirect_count => redirect_count,\n :image_not_found_count => not_found_count,\n :image_forbidden_count => forbidden_count,\n :image_server_error_count => server_error_count,\n }\n end", "def hash; map{|el| \"#{el.name} @ #{el.hash}\"}; map(&:hash).reduce(:+) % 2**32; end", "def hasher\n Hashids.new(@hash_id_state[:salt], @hash_id_state[:length])\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 files_hash\n @files_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 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 all_datafile_hash\n hash = {}\n items = @all_datafiles\n for df in items\n hash[df] = {}\n end\n return hash\n end", "def hash\n [id, title, image, image_type, servings, ready_in_minutes, license, source_name, source_url, spoonacular_source_url, aggregate_likes, health_score, spoonacular_score, price_per_serving, analyzed_instructions, cheap, credits_text, cuisines, dairy_free, diets, gaps, gluten_free, instructions, ketogenic, low_fodmap, occasions, sustainable, vegan, vegetarian, very_healthy, very_popular, whole30, weight_watcher_smart_points, dish_types, extended_ingredients, summary, wine_pairing].hash\n end", "def digests\n @digests ||= SidekiqUniqueJobs::Digests.new\n end", "def collection_hsh\n collections_hasherizer(source_collections)\n end", "def hash(key); end", "def hash\n @hash || calculate_hash!\n end", "def hash\n\n self.h.fei.hash\n end", "def files_digest(paths)\n self.digest(paths.map { |path| self.file_digest(path) })\n end", "def image_colors(input_image)\n image = ImageList.new(input_image)\n\n q = image.resize_to_fit(75, 75).quantize(8, Magick::RGBColorspace)\n\n palette = q.color_histogram.sort {|a, b| b[1] <=> a[1]}\n\n # width in px times height in px\n total_depth = image.columns * image.rows\n\n results = []\n\n palette.count.times do |i|\n p = palette[i]\n\n r1 = p[0].red / 256\n g1 = p[0].green / 256\n b1 = p[0].blue / 256\n\n r2 = r1.to_s(16).rjust(2, \"0\")\n g2 = g1.to_s(16).rjust(2, \"0\")\n b2 = b1.to_s(16).rjust(2, \"0\")\n\n # r2 += r2 unless r2.length == 2\n # g2 += g2 unless g2.length == 2\n # b2 += b2 unless b2.length == 2\n\n rgb = \"#{r1},#{g1},#{b1}\"\n hex = \"#{r2}#{g2}#{b2}\"\n depth = p[1]\n\n results << {\n rgb: rgb,\n hex: hex,\n percent: ((depth.to_f / total_depth.to_f) * 100).round(2)\n }\n end\n\n # q.write('../../assets/img/test/new_' + File.basename(input_image))\n\n # puts results\n\n results\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 fingerprint; 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" ]
[ "0.75077754", "0.69907784", "0.6733545", "0.6701184", "0.6669953", "0.6547589", "0.6434566", "0.64201224", "0.6400155", "0.6400155", "0.6400155", "0.6400155", "0.6400155", "0.6400155", "0.6400155", "0.63923895", "0.6360124", "0.6360124", "0.624349", "0.6210763", "0.6206685", "0.6189163", "0.6147323", "0.6107821", "0.60843134", "0.6076886", "0.6076886", "0.6052697", "0.6032721", "0.6002841", "0.5905439", "0.59049773", "0.58695215", "0.5859571", "0.5851759", "0.58418477", "0.5841608", "0.5829207", "0.58138496", "0.5788476", "0.5777507", "0.57689464", "0.5762209", "0.5757183", "0.57434255", "0.5739912", "0.5739912", "0.5739912", "0.5739912", "0.5739912", "0.5739912", "0.5739912", "0.5739912", "0.5739912", "0.5739912", "0.57367224", "0.57313246", "0.57238203", "0.57104105", "0.57056785", "0.57015985", "0.57000375", "0.56969553", "0.5683558", "0.56707346", "0.5640696", "0.5640696", "0.5640696", "0.5624515", "0.56093764", "0.56090254", "0.56037945", "0.56027365", "0.558941", "0.5588394", "0.55881906", "0.5564226", "0.5557276", "0.55487186", "0.5548356", "0.55428034", "0.5534946", "0.5532608", "0.5520951", "0.551899", "0.551899", "0.551899", "0.55180484", "0.55136365", "0.55135965", "0.549973", "0.5498446", "0.5494649", "0.54944235", "0.5489425", "0.5476827", "0.5470533", "0.5470457", "0.54695266", "0.5466938" ]
0.7829283
0
Creates a hash for all images
def all_datafile_hash hash = {} items = @all_datafiles for df in items hash[df] = {} end return hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_image_hash\n hash = {}\n items = @all_images\n for img in items\n hash[img] = {}\n end\n return hash\n end", "def image_hash; end", "def populate_hash\n self.orig_image_url_hash = Digest::SHA1.hexdigest orig_image_url\n end", "def hash\n @real.hash ^ @image.hash\n end", "def images\n @images ||= Hash.new\n end", "def create_images\n imgNames = Hash[\n \tFile.join(Dir.home, 'Desktop/image1.png') => 0,\n \tFile.join(Dir.home, 'Desktop/image2.png') => 1,\n \tFile.join(Dir.home, 'Desktop/image3.png') => 2,\n \tFile.join(Dir.home, 'Desktop/image4.png') => 3,\n \tFile.join(Dir.home, 'Desktop/image5.png') => 4,\n \tFile.join(Dir.home, 'Desktop/image6.png') => 0,\n \tFile.join(Dir.home, 'Desktop/image7.png') => 1,\n \tFile.join(Dir.home, 'Desktop/image8.png') => 2,\n \tFile.join(Dir.home, 'Desktop/image9.png') => 3,\n \tFile.join(Dir.home, 'Desktop/image10.png') => 4 ]\n \t\n i = 0\n imgNames.each_key do |imgN|\n open(imgN, 'wb', 0666) do |file|\n puts \"Loading...\"\n file << open(@imageArray[i%5]).read\n end\n i += 1\n end\n end", "def image_hash(path, width, height)\n {\n 'path' => path,\n 'basename' => File.basename(path),\n 'filename' => File.basename(path, '.*'),\n 'extension' => File.extname(path).delete('.'),\n 'width' => width,\n 'height' => height,\n }\n end", "def hash_keys\n [:img_dir, :img_url_prefix]\n end", "def image_hash(config, image_path, width, height)\r\n {\r\n 'path' => image_path,\r\n 'dirname' => relative_dirname(config, image_path),\r\n 'basename' => File.basename(image_path),\r\n 'filename' => File.basename(image_path, '.*'),\r\n 'extension' => File.extname(image_path).delete('.'),\r\n 'width' => width,\r\n 'height' => height,\r\n }\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 file_ids_hash\n if @file_ids_hash.blank?\n # load the file sha's from cache if possible\n cache_file = File.join(self.path,'.loopoff')\n if File.exists?(cache_file)\n @file_ids_hash = YAML.load(File.read(cache_file))\n else\n # build it\n @file_ids_hash = {}\n self.loopoff_file_names.each do |f|\n @file_ids_hash[File.basename(f)] = Grit::GitRuby::Internal::LooseStorage.calculate_sha(File.read(f),'blob')\n end\n # write the cache\n File.open(cache_file,'w') do |f|\n f.puts YAML.dump(@file_ids_hash) \n end\n end \n end\n @file_ids_hash\n end", "def image_hash\n @image_hash ||= begin\n image_meta = page[\"image\"]\n\n case image_meta\n when Hash\n { \"path\" => nil }.merge!(image_meta)\n when String\n { \"path\" => image_meta }\n else\n { \"path\" => nil }\n end\n end\n end", "def image_hash\n @image_hash ||= begin\n image_meta = page[\"image\"]\n\n case image_meta\n when Hash\n { \"path\" => nil }.merge!(image_meta)\n when String\n { \"path\" => image_meta }\n else\n { \"path\" => nil }\n end\n end\n end", "def create_image_metadata\n {}\n end", "def images\n @images ||= {}\n end", "def get_images\n {}\n end", "def hash\n raw = [name, type, values.join('/')].join(' ')\n Digest::MD5.hexdigest(raw)\n end", "def digest\n image.ident\n end", "def store_images\n self.images.each_key do |k|\n if self.send(\"store_#{k}\") == \"1\"\n if self.send(\"#{k}?\")\n image = Image.new\n image.image = self.send(k).to_file\n image.save\n end\n end\n end\n end", "def hash\r\n # TODO what if file is empty?\r\n @hash ||= Digest::SHA1.file(File.join(@directory, @filename)).hexdigest\r\n end", "def job_hash\n [@image,@config].hash\n end", "def job_hash\n [@image,@config].hash\n end", "def hash(*) end", "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 fingerprint\n self.all_tags.to_s.md5\n end", "def hash()\n #This is a stub, used for indexing\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 prepare_images #:nodoc:\n count = 0\n images = []\n\n # We sort the images by row and column but that isn't strictly required.\n #\n rows = @images.keys.sort\n\n rows.each do |row|\n cols = @images[row].keys.sort\n cols.each do |col|\n images.push(@images[row][col])\n count += 1\n end\n end\n\n @images = {}\n @images_array = images\n\n return count\n end", "def hash\n [container_id, image, image_id, last_state, name, ready, restart_count, state].hash\n end", "def hash\n return (path + file_id.to_s).hash\n end", "def file_hashes\n @file_hashes ||= file_field_sets.map do |file_field_set|\n instantiation_fields, file_fields = file_field_set.partition do |field|\n instantiation_header?(field.header)\n end\n\n file_hash = fields_to_hash(file_fields)\n file_hash['files'] = [fields_to_hash(instantiation_fields)]\n\n file_hash\n end\n end", "def hash(pathname)\n ext = pathname.extname\n ext = ('' == ext || nil == ext) ? :none : ext.to_sym\n digest = Digest::MD5.hexdigest(File.read(pathname.to_s))\n @scanned[ext] ||= {}\n @scanned[ext][digest] ||= []\n @scanned[ext][digest] << pathname\n end", "def hash\n [file_id, output_version, image_quality, recompress_images, enable_color_detection, pack_document, pack_fonts, downscale_images, downscale_resolution, fast_web_view, remove_form_fields, remove_annotations, remove_bookmarks, remove_hyperlinks, remove_embedded_files, remove_blank_pages, remove_java_script, enable_jpeg2000, enable_jbig2, enable_char_repair, enable_mrc, preserve_smoothing, downscale_resolution_mrc, remove_metadata, remove_page_thumbnails, remove_page_piece_info, jbig2_pms_threshold].hash\n end", "def make_paperclip_mash(file_hash)\n mash = Mash.new\n mash['tempfile'] = file_hash[:tempfile]\n mash['filename'] = \"#{Time.now.to_s}.jpg\"\n mash['content_type'] = file_hash[:type]\n mash['size'] = file_hash[:tempfile].size\n mash\n end", "def hash\n Digest::MD5.hexdigest(abs_filepath)[0..5]\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 install_images(object)\n generated_name = Storage.generated_file_name(object)\n install_main_image(object.has_image_id, generated_name)\n generate_thumbnails(object.has_image_id, generated_name) if thumbnails_needed?\n return generated_name\n ensure \n @temp_file.close! if !@temp_file.closed?\n @temp_file = nil\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 buildCodeFilesHashFromFiles()\n\t\tdir = @cacheDirPath \n\t\tfilesList = Dir.glob(dir + \"**/*\").select{|e| File.file? e}\n\t\tfilesList.map.with_index{|file,index|\n\t\t\t#p \"cacheFile: \" + index.to_s if index % 1000 == 0\n\t\t\tp \"cacheFile: \" + index.to_s \n\t\t\tfilePath = dir + index.to_s + \".yaml\"\n\t\t\tfile = File.read(filePath)\n\t\t\tYAML.load(file)\n\t\t}.to_h\n\tend", "def all_images(albid)\n kept_images(albid) + deleted_images(albid)\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 uri_digest(image_uri)\n digest = SimpleEncryptor.encrypt(image_uri, Config.secret_key, Config.public_iv)\n Config.urls_memo[digest] = image_uri\n\n digest\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 hash\n [class_id, object_type, action, cache_state, cached_time, last_access_time, md5sum, original_sha512sum, path, registered_workflows, used_count, file, network_element].hash\n end", "def images\n if !@images\n @images = {}\n @images[:thumb] = self.thumb_image if self.thumb_image\n @images[:tiny_image] = self.tiny_image if self.tiny_image\n @images[:small] = self.small_image if self.small_image \n @images[:medium] = self.medium_image if self.medium_image\n @images[:large] = self.large_image if self.large_image\n end\n end", "def vote_hash # :nodoc:\n unless @vote_hash\n @vote_hash = {}\n image_votes.each do |vote|\n @vote_hash[vote.user_id.to_i] = vote.value.to_i\n end\n end\n @vote_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 add_image(image)\n # checking for duplicates\n unless @images.has_key?(image.id)\n # add to hash map\n @images[image.id] = image\n end\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 cache_image_attributes\n return if @cache_valid\n\n # make a hash -- hash[image id] = list of attributes defined for this image id\n # we use this for convenience later\n @attributes_by_id = {}\n @images.each do |img|\n proper_key = img.id.to_s\n @attributes_by_id[proper_key] = [] unless @attributes_by_id.key? proper_key\n @attributes_by_id[proper_key] << img.attribute\n end\n\n @cache_valid = true\n end", "def hash\n end", "def hash\n end", "def hash\n end", "def hash\n [aws_elastic_block_store, azure_disk, azure_file, cephfs, cinder, config_map, downward_api, empty_dir, fc, flex_volume, flocker, gce_persistent_disk, git_repo, glusterfs, host_path, iscsi, name, nfs, persistent_volume_claim, photon_persistent_disk, portworx_volume, projected, quobyte, rbd, scale_io, secret, storageos, vsphere_volume].hash\n end", "def contents_hash(paths)\n return if paths.nil?\n\n paths = paths.compact.select { |path| File.file?(path) }\n return if paths.empty?\n # rubocop:disable GitHub/InsecureHashAlgorithm\n paths.sort\n .reduce(Digest::XXHash64.new, :file)\n .digest\n .to_s(16) # convert to hex\n # rubocop:enable GitHub/InsecureHashAlgorithm\n end", "def image hash = {}\n hash = { :id => hash} if hash.is_a? String\n home hash.update :action => 'image', :trailing_slash => false\n end", "def imagga_images_info\n self.images.non_installation.collect do |image|\n image_options = { :image_url => image.filename.to_s }\n image_options.merge! pattern: image.pattern.name if image.pattern.present?\n image_options.merge! thumb_url: image.s3_path if image.s3_path.present?\n { :url => image.filename.to_s.gsub('https','http').gsub('-dev',''), :id => image.filename.path, :filepath => image.filename.path, :metadata => self.specifications_hash.merge(image_options) }\n end.flatten\n end", "def hash( *strs )\n return Digest::MD5.hexdigest( strs.join )\n end", "def hash\n raise NotImplementedError.new(\"hash() must be implemented by subclasses of AbstractVersionedFile.\")\n 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 to_hash\n hash = {}\n SoftwarerepositoryCachedImageAllOf.attribute_map.each_pair do |attr, param|\n value = self.send(attr)\n if value.nil?\n is_nullable = SoftwarerepositoryCachedImageAllOf.openapi_nullable.include?(attr)\n next if !is_nullable || (is_nullable && !instance_variable_defined?(:\"@#{attr}\"))\n end\n\n hash[param] = _to_hash(value)\n end\n hash\n end", "def hash\n [avatar, banner, created_at, description, handle, hidden_modules, link_count, modified_at, name, summary, user_count, visible_modules].hash\n end", "def hash\n [_hash, name, owner].hash\n end", "def images\n @images ||= begin\n json_file = File.join(\n File.dirname(__FILE__), %w(.. .. .. data), \"#{config[:compute_provider][:name]}.json\"\n )\n if File.exist?(json_file)\n Smash.new(JSON.load(IO.read(json_file)))\n else\n warn(\"Failed to load defaults for #{config[:compute_provider][:name]} provider.\")\n Smash.new\n end\n end\n end", "def to_h\n {\n :image_redirect_count => redirect_count,\n :image_not_found_count => not_found_count,\n :image_forbidden_count => forbidden_count,\n :image_server_error_count => server_error_count,\n }\n end", "def hash; map{|el| \"#{el.name} @ #{el.hash}\"}; map(&:hash).reduce(:+) % 2**32; end", "def hasher\n Hashids.new(@hash_id_state[:salt], @hash_id_state[:length])\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 files_hash\n @files_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 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 [id, title, image, image_type, servings, ready_in_minutes, license, source_name, source_url, spoonacular_source_url, aggregate_likes, health_score, spoonacular_score, price_per_serving, analyzed_instructions, cheap, credits_text, cuisines, dairy_free, diets, gaps, gluten_free, instructions, ketogenic, low_fodmap, occasions, sustainable, vegan, vegetarian, very_healthy, very_popular, whole30, weight_watcher_smart_points, dish_types, extended_ingredients, summary, wine_pairing].hash\n end", "def digests\n @digests ||= SidekiqUniqueJobs::Digests.new\n end", "def collection_hsh\n collections_hasherizer(source_collections)\n end", "def hash(key); end", "def hash\n @hash || calculate_hash!\n end", "def hash\n\n self.h.fei.hash\n end", "def files_digest(paths)\n self.digest(paths.map { |path| self.file_digest(path) })\n end", "def image_colors(input_image)\n image = ImageList.new(input_image)\n\n q = image.resize_to_fit(75, 75).quantize(8, Magick::RGBColorspace)\n\n palette = q.color_histogram.sort {|a, b| b[1] <=> a[1]}\n\n # width in px times height in px\n total_depth = image.columns * image.rows\n\n results = []\n\n palette.count.times do |i|\n p = palette[i]\n\n r1 = p[0].red / 256\n g1 = p[0].green / 256\n b1 = p[0].blue / 256\n\n r2 = r1.to_s(16).rjust(2, \"0\")\n g2 = g1.to_s(16).rjust(2, \"0\")\n b2 = b1.to_s(16).rjust(2, \"0\")\n\n # r2 += r2 unless r2.length == 2\n # g2 += g2 unless g2.length == 2\n # b2 += b2 unless b2.length == 2\n\n rgb = \"#{r1},#{g1},#{b1}\"\n hex = \"#{r2}#{g2}#{b2}\"\n depth = p[1]\n\n results << {\n rgb: rgb,\n hex: hex,\n percent: ((depth.to_f / total_depth.to_f) * 100).round(2)\n }\n end\n\n # q.write('../../assets/img/test/new_' + File.basename(input_image))\n\n # puts results\n\n results\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 fingerprint; 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" ]
[ "0.7829283", "0.75077754", "0.69907784", "0.6733545", "0.6701184", "0.6669953", "0.6547589", "0.6434566", "0.64201224", "0.6400155", "0.6400155", "0.6400155", "0.6400155", "0.6400155", "0.6400155", "0.6400155", "0.63923895", "0.6360124", "0.6360124", "0.624349", "0.6210763", "0.6206685", "0.6189163", "0.6147323", "0.6107821", "0.60843134", "0.6076886", "0.6076886", "0.6052697", "0.6032721", "0.6002841", "0.5905439", "0.59049773", "0.58695215", "0.5859571", "0.5851759", "0.58418477", "0.5841608", "0.5829207", "0.58138496", "0.5788476", "0.5777507", "0.57689464", "0.5762209", "0.5757183", "0.57434255", "0.5739912", "0.5739912", "0.5739912", "0.5739912", "0.5739912", "0.5739912", "0.5739912", "0.5739912", "0.5739912", "0.5739912", "0.57367224", "0.57313246", "0.57238203", "0.57104105", "0.57056785", "0.57015985", "0.57000375", "0.56969553", "0.5683558", "0.56707346", "0.5640696", "0.5640696", "0.5640696", "0.5624515", "0.56093764", "0.56090254", "0.56037945", "0.56027365", "0.558941", "0.5588394", "0.55881906", "0.5564226", "0.5557276", "0.55487186", "0.5548356", "0.55428034", "0.5534946", "0.5532608", "0.5520951", "0.551899", "0.551899", "0.551899", "0.55180484", "0.55135965", "0.549973", "0.5498446", "0.5494649", "0.54944235", "0.5489425", "0.5476827", "0.5470533", "0.5470457", "0.54695266", "0.5466938" ]
0.55136365
89
Creates a hash for all images
def all_validation_hash hash = {} items = @all_validations for vd in items hash[vd] = {} end return hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_image_hash\n hash = {}\n items = @all_images\n for img in items\n hash[img] = {}\n end\n return hash\n end", "def image_hash; end", "def populate_hash\n self.orig_image_url_hash = Digest::SHA1.hexdigest orig_image_url\n end", "def hash\n @real.hash ^ @image.hash\n end", "def images\n @images ||= Hash.new\n end", "def create_images\n imgNames = Hash[\n \tFile.join(Dir.home, 'Desktop/image1.png') => 0,\n \tFile.join(Dir.home, 'Desktop/image2.png') => 1,\n \tFile.join(Dir.home, 'Desktop/image3.png') => 2,\n \tFile.join(Dir.home, 'Desktop/image4.png') => 3,\n \tFile.join(Dir.home, 'Desktop/image5.png') => 4,\n \tFile.join(Dir.home, 'Desktop/image6.png') => 0,\n \tFile.join(Dir.home, 'Desktop/image7.png') => 1,\n \tFile.join(Dir.home, 'Desktop/image8.png') => 2,\n \tFile.join(Dir.home, 'Desktop/image9.png') => 3,\n \tFile.join(Dir.home, 'Desktop/image10.png') => 4 ]\n \t\n i = 0\n imgNames.each_key do |imgN|\n open(imgN, 'wb', 0666) do |file|\n puts \"Loading...\"\n file << open(@imageArray[i%5]).read\n end\n i += 1\n end\n end", "def image_hash(path, width, height)\n {\n 'path' => path,\n 'basename' => File.basename(path),\n 'filename' => File.basename(path, '.*'),\n 'extension' => File.extname(path).delete('.'),\n 'width' => width,\n 'height' => height,\n }\n end", "def hash_keys\n [:img_dir, :img_url_prefix]\n end", "def image_hash(config, image_path, width, height)\r\n {\r\n 'path' => image_path,\r\n 'dirname' => relative_dirname(config, image_path),\r\n 'basename' => File.basename(image_path),\r\n 'filename' => File.basename(image_path, '.*'),\r\n 'extension' => File.extname(image_path).delete('.'),\r\n 'width' => width,\r\n 'height' => height,\r\n }\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 file_ids_hash\n if @file_ids_hash.blank?\n # load the file sha's from cache if possible\n cache_file = File.join(self.path,'.loopoff')\n if File.exists?(cache_file)\n @file_ids_hash = YAML.load(File.read(cache_file))\n else\n # build it\n @file_ids_hash = {}\n self.loopoff_file_names.each do |f|\n @file_ids_hash[File.basename(f)] = Grit::GitRuby::Internal::LooseStorage.calculate_sha(File.read(f),'blob')\n end\n # write the cache\n File.open(cache_file,'w') do |f|\n f.puts YAML.dump(@file_ids_hash) \n end\n end \n end\n @file_ids_hash\n end", "def image_hash\n @image_hash ||= begin\n image_meta = page[\"image\"]\n\n case image_meta\n when Hash\n { \"path\" => nil }.merge!(image_meta)\n when String\n { \"path\" => image_meta }\n else\n { \"path\" => nil }\n end\n end\n end", "def image_hash\n @image_hash ||= begin\n image_meta = page[\"image\"]\n\n case image_meta\n when Hash\n { \"path\" => nil }.merge!(image_meta)\n when String\n { \"path\" => image_meta }\n else\n { \"path\" => nil }\n end\n end\n end", "def create_image_metadata\n {}\n end", "def images\n @images ||= {}\n end", "def get_images\n {}\n end", "def hash\n raw = [name, type, values.join('/')].join(' ')\n Digest::MD5.hexdigest(raw)\n end", "def digest\n image.ident\n end", "def store_images\n self.images.each_key do |k|\n if self.send(\"store_#{k}\") == \"1\"\n if self.send(\"#{k}?\")\n image = Image.new\n image.image = self.send(k).to_file\n image.save\n end\n end\n end\n end", "def hash\r\n # TODO what if file is empty?\r\n @hash ||= Digest::SHA1.file(File.join(@directory, @filename)).hexdigest\r\n end", "def job_hash\n [@image,@config].hash\n end", "def job_hash\n [@image,@config].hash\n end", "def hash(*) end", "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 fingerprint\n self.all_tags.to_s.md5\n end", "def hash()\n #This is a stub, used for indexing\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 prepare_images #:nodoc:\n count = 0\n images = []\n\n # We sort the images by row and column but that isn't strictly required.\n #\n rows = @images.keys.sort\n\n rows.each do |row|\n cols = @images[row].keys.sort\n cols.each do |col|\n images.push(@images[row][col])\n count += 1\n end\n end\n\n @images = {}\n @images_array = images\n\n return count\n end", "def hash\n [container_id, image, image_id, last_state, name, ready, restart_count, state].hash\n end", "def hash\n return (path + file_id.to_s).hash\n end", "def file_hashes\n @file_hashes ||= file_field_sets.map do |file_field_set|\n instantiation_fields, file_fields = file_field_set.partition do |field|\n instantiation_header?(field.header)\n end\n\n file_hash = fields_to_hash(file_fields)\n file_hash['files'] = [fields_to_hash(instantiation_fields)]\n\n file_hash\n end\n end", "def hash(pathname)\n ext = pathname.extname\n ext = ('' == ext || nil == ext) ? :none : ext.to_sym\n digest = Digest::MD5.hexdigest(File.read(pathname.to_s))\n @scanned[ext] ||= {}\n @scanned[ext][digest] ||= []\n @scanned[ext][digest] << pathname\n end", "def hash\n [file_id, output_version, image_quality, recompress_images, enable_color_detection, pack_document, pack_fonts, downscale_images, downscale_resolution, fast_web_view, remove_form_fields, remove_annotations, remove_bookmarks, remove_hyperlinks, remove_embedded_files, remove_blank_pages, remove_java_script, enable_jpeg2000, enable_jbig2, enable_char_repair, enable_mrc, preserve_smoothing, downscale_resolution_mrc, remove_metadata, remove_page_thumbnails, remove_page_piece_info, jbig2_pms_threshold].hash\n end", "def make_paperclip_mash(file_hash)\n mash = Mash.new\n mash['tempfile'] = file_hash[:tempfile]\n mash['filename'] = \"#{Time.now.to_s}.jpg\"\n mash['content_type'] = file_hash[:type]\n mash['size'] = file_hash[:tempfile].size\n mash\n end", "def hash\n Digest::MD5.hexdigest(abs_filepath)[0..5]\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 install_images(object)\n generated_name = Storage.generated_file_name(object)\n install_main_image(object.has_image_id, generated_name)\n generate_thumbnails(object.has_image_id, generated_name) if thumbnails_needed?\n return generated_name\n ensure \n @temp_file.close! if !@temp_file.closed?\n @temp_file = nil\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 buildCodeFilesHashFromFiles()\n\t\tdir = @cacheDirPath \n\t\tfilesList = Dir.glob(dir + \"**/*\").select{|e| File.file? e}\n\t\tfilesList.map.with_index{|file,index|\n\t\t\t#p \"cacheFile: \" + index.to_s if index % 1000 == 0\n\t\t\tp \"cacheFile: \" + index.to_s \n\t\t\tfilePath = dir + index.to_s + \".yaml\"\n\t\t\tfile = File.read(filePath)\n\t\t\tYAML.load(file)\n\t\t}.to_h\n\tend", "def all_images(albid)\n kept_images(albid) + deleted_images(albid)\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 uri_digest(image_uri)\n digest = SimpleEncryptor.encrypt(image_uri, Config.secret_key, Config.public_iv)\n Config.urls_memo[digest] = image_uri\n\n digest\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 hash\n [class_id, object_type, action, cache_state, cached_time, last_access_time, md5sum, original_sha512sum, path, registered_workflows, used_count, file, network_element].hash\n end", "def images\n if !@images\n @images = {}\n @images[:thumb] = self.thumb_image if self.thumb_image\n @images[:tiny_image] = self.tiny_image if self.tiny_image\n @images[:small] = self.small_image if self.small_image \n @images[:medium] = self.medium_image if self.medium_image\n @images[:large] = self.large_image if self.large_image\n end\n end", "def vote_hash # :nodoc:\n unless @vote_hash\n @vote_hash = {}\n image_votes.each do |vote|\n @vote_hash[vote.user_id.to_i] = vote.value.to_i\n end\n end\n @vote_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 add_image(image)\n # checking for duplicates\n unless @images.has_key?(image.id)\n # add to hash map\n @images[image.id] = image\n end\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 cache_image_attributes\n return if @cache_valid\n\n # make a hash -- hash[image id] = list of attributes defined for this image id\n # we use this for convenience later\n @attributes_by_id = {}\n @images.each do |img|\n proper_key = img.id.to_s\n @attributes_by_id[proper_key] = [] unless @attributes_by_id.key? proper_key\n @attributes_by_id[proper_key] << img.attribute\n end\n\n @cache_valid = true\n end", "def hash\n end", "def hash\n end", "def hash\n end", "def hash\n [aws_elastic_block_store, azure_disk, azure_file, cephfs, cinder, config_map, downward_api, empty_dir, fc, flex_volume, flocker, gce_persistent_disk, git_repo, glusterfs, host_path, iscsi, name, nfs, persistent_volume_claim, photon_persistent_disk, portworx_volume, projected, quobyte, rbd, scale_io, secret, storageos, vsphere_volume].hash\n end", "def contents_hash(paths)\n return if paths.nil?\n\n paths = paths.compact.select { |path| File.file?(path) }\n return if paths.empty?\n # rubocop:disable GitHub/InsecureHashAlgorithm\n paths.sort\n .reduce(Digest::XXHash64.new, :file)\n .digest\n .to_s(16) # convert to hex\n # rubocop:enable GitHub/InsecureHashAlgorithm\n end", "def image hash = {}\n hash = { :id => hash} if hash.is_a? String\n home hash.update :action => 'image', :trailing_slash => false\n end", "def imagga_images_info\n self.images.non_installation.collect do |image|\n image_options = { :image_url => image.filename.to_s }\n image_options.merge! pattern: image.pattern.name if image.pattern.present?\n image_options.merge! thumb_url: image.s3_path if image.s3_path.present?\n { :url => image.filename.to_s.gsub('https','http').gsub('-dev',''), :id => image.filename.path, :filepath => image.filename.path, :metadata => self.specifications_hash.merge(image_options) }\n end.flatten\n end", "def hash( *strs )\n return Digest::MD5.hexdigest( strs.join )\n end", "def hash\n raise NotImplementedError.new(\"hash() must be implemented by subclasses of AbstractVersionedFile.\")\n 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 to_hash\n hash = {}\n SoftwarerepositoryCachedImageAllOf.attribute_map.each_pair do |attr, param|\n value = self.send(attr)\n if value.nil?\n is_nullable = SoftwarerepositoryCachedImageAllOf.openapi_nullable.include?(attr)\n next if !is_nullable || (is_nullable && !instance_variable_defined?(:\"@#{attr}\"))\n end\n\n hash[param] = _to_hash(value)\n end\n hash\n end", "def hash\n [avatar, banner, created_at, description, handle, hidden_modules, link_count, modified_at, name, summary, user_count, visible_modules].hash\n end", "def hash\n [_hash, name, owner].hash\n end", "def images\n @images ||= begin\n json_file = File.join(\n File.dirname(__FILE__), %w(.. .. .. data), \"#{config[:compute_provider][:name]}.json\"\n )\n if File.exist?(json_file)\n Smash.new(JSON.load(IO.read(json_file)))\n else\n warn(\"Failed to load defaults for #{config[:compute_provider][:name]} provider.\")\n Smash.new\n end\n end\n end", "def to_h\n {\n :image_redirect_count => redirect_count,\n :image_not_found_count => not_found_count,\n :image_forbidden_count => forbidden_count,\n :image_server_error_count => server_error_count,\n }\n end", "def hash; map{|el| \"#{el.name} @ #{el.hash}\"}; map(&:hash).reduce(:+) % 2**32; end", "def hasher\n Hashids.new(@hash_id_state[:salt], @hash_id_state[:length])\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 files_hash\n @files_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 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 all_datafile_hash\n hash = {}\n items = @all_datafiles\n for df in items\n hash[df] = {}\n end\n return hash\n end", "def hash\n [id, title, image, image_type, servings, ready_in_minutes, license, source_name, source_url, spoonacular_source_url, aggregate_likes, health_score, spoonacular_score, price_per_serving, analyzed_instructions, cheap, credits_text, cuisines, dairy_free, diets, gaps, gluten_free, instructions, ketogenic, low_fodmap, occasions, sustainable, vegan, vegetarian, very_healthy, very_popular, whole30, weight_watcher_smart_points, dish_types, extended_ingredients, summary, wine_pairing].hash\n end", "def digests\n @digests ||= SidekiqUniqueJobs::Digests.new\n end", "def collection_hsh\n collections_hasherizer(source_collections)\n end", "def hash(key); end", "def hash\n @hash || calculate_hash!\n end", "def hash\n\n self.h.fei.hash\n end", "def files_digest(paths)\n self.digest(paths.map { |path| self.file_digest(path) })\n end", "def image_colors(input_image)\n image = ImageList.new(input_image)\n\n q = image.resize_to_fit(75, 75).quantize(8, Magick::RGBColorspace)\n\n palette = q.color_histogram.sort {|a, b| b[1] <=> a[1]}\n\n # width in px times height in px\n total_depth = image.columns * image.rows\n\n results = []\n\n palette.count.times do |i|\n p = palette[i]\n\n r1 = p[0].red / 256\n g1 = p[0].green / 256\n b1 = p[0].blue / 256\n\n r2 = r1.to_s(16).rjust(2, \"0\")\n g2 = g1.to_s(16).rjust(2, \"0\")\n b2 = b1.to_s(16).rjust(2, \"0\")\n\n # r2 += r2 unless r2.length == 2\n # g2 += g2 unless g2.length == 2\n # b2 += b2 unless b2.length == 2\n\n rgb = \"#{r1},#{g1},#{b1}\"\n hex = \"#{r2}#{g2}#{b2}\"\n depth = p[1]\n\n results << {\n rgb: rgb,\n hex: hex,\n percent: ((depth.to_f / total_depth.to_f) * 100).round(2)\n }\n end\n\n # q.write('../../assets/img/test/new_' + File.basename(input_image))\n\n # puts results\n\n results\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 fingerprint; 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" ]
[ "0.7829283", "0.75077754", "0.69907784", "0.6733545", "0.6701184", "0.6669953", "0.6547589", "0.6434566", "0.64201224", "0.6400155", "0.6400155", "0.6400155", "0.6400155", "0.6400155", "0.6400155", "0.6400155", "0.63923895", "0.6360124", "0.6360124", "0.624349", "0.6210763", "0.6206685", "0.6189163", "0.6147323", "0.6107821", "0.60843134", "0.6076886", "0.6076886", "0.6052697", "0.6032721", "0.6002841", "0.5905439", "0.59049773", "0.58695215", "0.5859571", "0.5851759", "0.58418477", "0.5841608", "0.5829207", "0.58138496", "0.5788476", "0.5777507", "0.57689464", "0.5762209", "0.5757183", "0.57434255", "0.5739912", "0.5739912", "0.5739912", "0.5739912", "0.5739912", "0.5739912", "0.5739912", "0.5739912", "0.5739912", "0.5739912", "0.57367224", "0.57313246", "0.57238203", "0.57104105", "0.57056785", "0.57015985", "0.57000375", "0.56969553", "0.5683558", "0.56707346", "0.5640696", "0.5640696", "0.5640696", "0.5624515", "0.56093764", "0.56090254", "0.56037945", "0.56027365", "0.558941", "0.5588394", "0.55881906", "0.5564226", "0.5557276", "0.55487186", "0.5548356", "0.55428034", "0.5534946", "0.5532608", "0.5520951", "0.551899", "0.551899", "0.551899", "0.55180484", "0.55136365", "0.55135965", "0.549973", "0.5498446", "0.5494649", "0.54944235", "0.5489425", "0.5476827", "0.5470533", "0.5470457", "0.54695266", "0.5466938" ]
0.0
-1
Creates a hash for all products and components
def all_prod_comp_hash(item=nil) hash = {} if(!item.nil?) items = item.components else items = @all_products end for comp in items hash[comp] = all_prod_comp_hash(comp) end return hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_product_hash\n hash = {}\n items = @all_products\n for prod in items\n hash[prod] = {}\n end\n return hash\n end", "def hash\n [name, product_ids_any, product_ids_all, quantity_exact, quantity_min, quantity_max, all_products].hash\n end", "def hash\n [description, filter, is_enabled, name, product_list].hash\n end", "def hash\n [id, parent_id, sku, upc, ean, mpn, gtin, sort_order, created_time, modified_time, name, short_description, full_description, images, combination, default_price, list_price, wholesale_price, advanced_price, tax_class_id, avail_for_sale, allow_backorders, in_stock, manage_stock, inventory_level, inventory, min_quantity, default_qty_in_pack, is_qty_in_pack_fixed, weight_unit, weight, dimensions_unit, width, height, length, additional_fields, custom_fields].hash\n end", "def hash\n [__meta, created_at, updated_at, name, slug, model, status, type, short_description, full_description, free_shipping, sku, price, cost_price, retail_price, sale_price, manage_inventory, stock_level, minimum_stock_level, maximum_sell_count, item_dimensions, package_dimensions, package_weight, require_shipping, availability, availability_date, allow_pre_order, brand, main_photo, photos, files, promotions, related_products, stock_status, categories, tax_class, option_set, variants].hash\n end", "def hash\n [article_number, name, quantity, unit_price, discount_percent, vat_percent, unit, temporary_reference, row_number, merchant_data].hash\n end", "def cart_hash\n end", "def hash\n [dep_mgr_name, name, version, license].hash\n end", "def hash\n raw = [name, type, values.join('/')].join(' ')\n Digest::MD5.hexdigest(raw)\n end", "def hash\n [contact, extensions, external_resources, info, integrations, org, schema_version, tags].hash\n end", "def hash\n [additional_properties, currency_code, description, inventory, min_inventory_threshold, not_available, not_displayable, original_price, price, published, sale_id, sale_name, sku, start_date, stop_date].hash\n end", "def product_info\n {\n product_name: {\n default_value: 'similarity detection reference tool'\n },\n product_version: '1.0',\n description: {\n default_value: 'LTI 2.1 tool provider reference implementation'\n },\n product_family: {\n code: 'similarity detection reference tool',\n vendor: {\n code: 'Instructure.com',\n vendor_name: {\n default_value: 'Instructure'\n },\n description: {\n default_value: 'Canvas Learning Management System'\n }\n }\n }\n }\n end", "def products\n @products ||= hash[\"Products\"].map { |p| Merchant::Product.new p }\n end", "def init_vault\n @vault={}\n @products.each do |product|\n product.identifiers.each do |ident|\n @vault[ident.uniq_id]=product\n end\n end\n\n @products.each do |product|\n if product.related_material\n product.related_material.related_products.each do |rp|\n rp.identifiers.each do |ident|\n if @vault[ident.uniq_id]\n rp.product=@vault[ident.uniq_id]\n end\n\n end\n end\n\n product.related_material.related_works.each do |rw|\n rw.identifiers.each do |ident|\n if @vault[ident.uniq_id]\n rw.product=@vault[ident.uniq_id]\n end\n end\n end\n end\n\n product.descriptive_detail.parts.each do |prt|\n prt.identifiers.each do |ident|\n if @vault[ident.uniq_id]\n prt.product=@vault[ident.uniq_id]\n end\n end\n end\n end\n end", "def hash\n [allocated_to_placed_orders, allocated_to_shopping_carts, available_to_allocate, cogs, desired_inventory_level, distribution_center_code, distribution_center_oid, eta, handles, inventory_level, maximum_backorder, reorder_inventory_level, sku, stock_picking_location].hash\n end", "def all_component_hash(item=nil)\n hash = {}\n items = []\n if(!item.nil?)\n items = item.components\n else\n for comp in @all_components\n if(comp.component_parents.empty?)\n items.push(comp)\n end\n end\n end\n for comp in items\n hash[comp] = all_component_hash(comp)\n end\n return hash\n end", "def hash\n [client_id, secret, company_name, is_diligence_attested, products, create_link_customization, logo, legal_entity_name, website, application_name, technical_contact, billing_contact, customer_support_info, address, is_bank_addendum_completed, assets_under_management, redirect_uris].hash\n end", "def hash\n [property_code, property_name, location, address, total_price, min_daily_rate, contacts, amenities, awards, images, rooms, more_rooms_at_this_hotel].hash\n end", "def hash\n [accounting_code, activation_codes, arbitrary_unit_cost, auto_order_last_rebill_dts, auto_order_schedule, barcode, channel_partner_item_id, cogs, component_unit_value, cost, country_code_of_origin, customs_description, description, discount, discount_quantity, discount_shipping_weight, distribution_center_code, edi, exclude_coupon, free_shipping, hazmat, height, item_index, item_reference_oid, kit, kit_component, length, manufacturer_sku, max_days_time_in_transit, merchant_item_id, mix_and_match_group_name, mix_and_match_group_oid, no_shipping_discount, options, packed_by_user, parent_item_index, parent_merchant_item_id, perishable_class, pricing_tier_name, properties, quantity, quantity_refunded, quickbooks_class, refund_reason, return_reason, ship_separately, shipped_by_user, shipped_dts, shipping_status, special_product_type, tags, tax_free, tax_product_type, taxable_cost, total_cost_with_discount, total_refunded, transmitted_to_distribution_center_dts, unit_cost_with_discount, upsell, weight, width].hash\n end", "def hash\n [actor, artist, aspect_ratio, audience_rating, author, back_finding, band_material_type, binding, bluray_region, brand, cero_age_rating, chain_type, clasp_type, color, cpu_manufacturer, cpu_speed, cpu_type, creator, department, director, display_size, edition, episode_sequence, esrb_age_rating, feature, flavor, format, gem_type, genre, golf_club_flex, golf_club_loft, hand_orientation, hard_disk_interface, hard_disk_size, hardware_platform, hazardous_material_type, item_dimensions, is_adult_product, is_autographed, is_eligible_for_trade_in, is_memorabilia, issues_per_year, item_part_number, label, languages, legal_disclaimer, list_price, manufacturer, manufacturer_maximum_age, manufacturer_minimum_age, manufacturer_parts_warranty_description, material_type, maximum_resolution, media_type, metal_stamp, metal_type, model, number_of_discs, number_of_issues, number_of_items, number_of_pages, number_of_tracks, operating_system, optical_zoom, package_dimensions, package_quantity, part_number, pegi_rating, platform, processor_count, product_group, product_type_name, product_type_subcategory, publication_date, publisher, region_code, release_date, ring_size, running_time, shaft_material, scent, season_sequence, seikodo_product_code, size, size_per_pearl, small_image, studio, subscription_length, system_memory_size, system_memory_type, theatrical_release_date, title, total_diamond_weight, total_gem_weight, warranty, weee_tax_value].hash\n end", "def data\n hash = default_data\n components.each do |component|\n hash[component.property] = component.data\n end\n if has_element_class?\n hash['elements'] = []\n elements.each do |element|\n hash['elements'] << element.data\n end\n end\n hash\n end", "def hash\n [type, id, updated_at, version, is_deleted, catalog_v1_ids, present_at_all_locations, present_at_location_ids, absent_at_location_ids, item_data, category_data, item_variation_data, tax_data, discount_data, modifier_list_data, modifier_data].hash\n end", "def hash\n [accounting, amember, auto_order, ccbill, channel_partner_item_mappings, chargeback, checkout, content, creation_dts, description, description_translated_text_instance_oid, digital_delivery, ebay, email_notifications, enrollment123, fulfillment_addons, gift_certificate, google_product_search, identifiers, inactive, instant_payment_notifications, internal, kit, kit_component_only, kit_definition, last_modified_dts, merchant_id, merchant_item_id, merchant_item_oid, options, parent_category_id, parent_category_path, payment_processing, physical, pricing, properties, realtime_pricing, recommend_replenishment_days, related, reporting, restriction, revguard, reviews, salesforce, shipping, tags, tax, third_party_email_marketing, variant_items, variations, wishlist_member].hash\n end", "def hash\n [specs, platform, requires_frameworks].hash\n end", "def hash\n [class_id, object_type, contract, contract_status, contract_status_reason, contract_updated_time, covered_product_line_end_date, device_id, device_type, end_customer, end_user_global_ultimate, is_valid, item_type, maintenance_purchase_order_number, maintenance_sales_order_number, platform_type, product, purchase_order_number, reseller_global_ultimate, sales_order_number, service_description, service_end_date, service_level, service_sku, service_start_date, state_contract, warranty_end_date, warranty_type, registered_device, source].hash\n end", "def product_hash(hsh)\r\n attrs = hsh.values\r\n keys = hsh.keys\r\n product = attrs[0].product(*attrs[1..-1])\r\n product.map{ |p| Hash[keys.zip p] }\r\nend", "def hash\n [class_id, object_type, hardware_status, hcl_cimc_version, hcl_driver_name, hcl_driver_version, hcl_firmware_version, hcl_model, inv_cimc_version, inv_driver_name, inv_driver_version, inv_firmware_version, inv_model, reason, software_status, status, component, hcl_status].hash\n end", "def hash\r\n\t\treturn @name.hash() + @type.hash()\r\n\tend", "def fill_in_products\n products = []\n @data.products.all_products.each_with_index do |p, i|\n prod = {}\n prod['index'] = i\n prod['qty'] = @data.product_qty[p.prd_id]\n prod['desc'] = p.prd_long_desc\n prod['price'] = \"$\" + p.fmt_total_price\n prod['prd_id'] = p.prd_id\n products << prod\n end\n \n products\n end", "def hash\n [aws_elastic_block_store, azure_disk, azure_file, cephfs, cinder, config_map, downward_api, empty_dir, fc, flex_volume, flocker, gce_persistent_disk, git_repo, glusterfs, host_path, iscsi, name, nfs, persistent_volume_claim, photon_persistent_disk, portworx_volume, projected, quobyte, rbd, scale_io, secret, storageos, vsphere_volume].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 \"#{self.class.name}-#{self.id}-#{@__metadata__.cas}-#{@__attributes__.hash}\".hash\n end", "def hash\n [additional_line_item_data, allow_invoice_download, allowed_payment_method_configurations, currency, id, integrated_payment_form_enabled, language, login_name, name, payment_app_version, payment_installed, payment_proxy_path, planned_purge_date, replace_payment_method_image, shop_name, show_payment_information, show_subscription_information, space_id, space_view_id, state, subscription_app_version, subscription_installed, subscription_proxy_path, version].hash\n end", "def build_initial_hash\n new_hash = {}\n\n # Release context\n release_context = Contexts::Release.from_env\n if release_context\n add_to!(new_hash, release_context)\n end\n\n # System context\n hostname = Socket.gethostname\n pid = Process.pid\n system_context = Contexts::System.new(hostname: hostname, pid: pid)\n add_to!(new_hash, system_context)\n\n # Runtime context\n thread_object_id = Thread.current.object_id\n runtime_context = Contexts::Runtime.new(vm_pid: thread_object_id)\n add_to!(new_hash, runtime_context)\n\n new_hash\n end", "def catalog_data_hash\n Puppet[:code] = resource.to_manifest\n catalog.to_data_hash\n end", "def hash\n [id, banco, agencia, conta_corrente, especie, numero_convenio, carteira, codigo_cedente, especie_tipo, especie_documento, aceite, instrucoes, local_pagamento1, local_pagamento2, endereco_cobranca_emissor, nome_beneficiario, cnpj_beneficiario, operador, data, maquina].hash\n end", "def hash\n [id, to, from, carrier, thumbnails, size, expected_delivery_date, date_created, date_modified, deleted, front_template_id, back_template_id, front_template_version_id, back_template_version_id, tracking_events, object, url, description, metadata, mail_type, merge_variables, send_date, use_type].hash\n end", "def hash\n [created, next_subscription_name, next_subscription_description, product, product_rate_plan, invoicing_type, mappings, pricing_behaviour, dry_run].hash\n end", "def hash\n [id, document_date, gl_class, gl_type_id, gl_item_id, sales_code, description, cost, memo, tax_note, vendor_number, account_number, cost_account_number, inventory_account_number, vendor_account_number, item, item_description, sales_description, taxable, item_price, item_cost, unit_of_measure, quantity, total, currency, serialized_flag, serial_numbers, drop_shipped_flag, line_number, warehouse_bin, warehouse_site, sub_category, shipment_method, item_type_xref, inventory_xref, cogs_xref, uom_schedule_xref, price_level_xref, location_xref, tax_code, purchase_header_tax_group, tax_code_xref, tax_rate, tax_agency_xref].hash\n end", "def hash\n [beez_up_order_item_id, order_item_order_item_type, order_item_merchant_imported_product_id, order_item_merchant_imported_product_id_column_name, order_item_merchant_imported_product_url, order_item_merchant_product_id_column_name, order_item_beez_up_store_id, order_item_item_tax, order_item_title, order_item_image_url, order_item_merchant_product_id, order_item_market_place_product_id, order_item_item_price, order_item_quantity, order_item_total_price, order_item_shipping_price].hash\n end", "def products_data\n $products_hash[\"items\"].each do |toy|\n # toy_result = calculate_products_data(toy)\n print_products_data(toy)\n end\n end", "def hash\n model.hash + key.hash\n end", "def hash\n [company_id, company_type, compnay_name, company_name_en, company_address, company_address_en, company_zip_code, company_tax_id, company_branch, company_branch_en, company_branch_code, company_phone, company_mobile, company_fax, company_website].hash\n end", "def hash_template\n template = {}\n \n info.each do | key, value |\n template[key] = generate_structure( value )\n end\n \n template\n end", "def hash\n [lac, cid, radio, mcc, mnc, signal, psc, asu, ta].hash\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 hash\n [is_blueprint_copy, is_included, item_id, material_efficiency, quantity, record_id, runs, time_efficiency, type_id].hash\n end", "def hash\n [inventory_code, plu, name, host_id, size, category, group, master_group, price_level, clerk, location, quantity, total_ex, total_inc, counter, barcode, normal_price, item_cost, tax, tax_free, is_discount, is_refund, is_void, is_surcharge, is_promotion, reason].hash\n end", "def hash\n [client_id, secret, client_name, language, country_codes, user, products, additional_consented_products, required_if_supported_products, webhook, access_token, link_customization_name, redirect_uri, android_package_name, institution_data, account_filters, eu_config, institution_id, payment_initiation, deposit_switch, employment, income_verification, base_report, consumer_report_permissible_purpose, auth, transfer, update, identity_verification, statements, user_token, investments, investments_auth, hosted_link].hash\n end", "def hash\n [color, cards, address_placement, custom_envelope, double_sided, extra_service, mail_type, return_envelope, bleed, file_original_url].hash\n end", "def hash\n [class_id, object_type, description, name, type, system].hash\n end", "def as_json\n hash = {\n id: product.id.to_s,\n handle: product.slug,\n title: product.name,\n description: product.description,\n variants: variants_json\n }\n\n if url = self.url\n hash[:url] = url\n end\n\n if image_url = self.image_url\n hash[:image_url] = image_url\n end\n\n if product.available_on\n hash[:published_at_foreign] = product.available_on.utc.iso8601\n end\n\n hash\n end", "def setup_catalog\n [\n {product_name: 'bamba', photo_url: 'dummy_url1', barcode: 'xxx1', sku: 111, price: 2.23, producer: 'Nestle'},\n {product_name: 'apple', photo_url: 'dummy_url2', barcode: 'xxx2', sku: 555, price: 4.66, producer: 'WFM'},\n {product_name: 'tapu chepse', photo_url: 'dummy_url3', barcode: 'xxx3', sku: 1111444, price: 7.33, producer: 'Nestle'}\n ].each do |data|\n Catalog.create(data)\n end\n end", "def hash()\n #This is a stub, used for indexing\n end", "def products\n @product_map.keys\n end", "def serialize\r\n {\r\n affiliate_url: \"https://www.amazon.com/dp/#{product.asin}?tag=#{ENV['AMAZON_AFFILIATE_TAG']}\",\r\n asin: product.asin,\r\n id: product.id,\r\n images: {\r\n thumbnail_url: product.image_src\r\n },\r\n name: product.name,\r\n price: product.amazon_price,\r\n # rating: {\r\n # percentage: 85,\r\n # words: 'Excellent'\r\n # },\r\n teaser: product.teaser\r\n }\r\n end", "def output_hash; end", "def hash\n [id, title, image, image_type, servings, ready_in_minutes, license, source_name, source_url, spoonacular_source_url, aggregate_likes, health_score, spoonacular_score, price_per_serving, analyzed_instructions, cheap, credits_text, cuisines, dairy_free, diets, gaps, gluten_free, instructions, ketogenic, low_fodmap, occasions, sustainable, vegan, vegetarian, very_healthy, very_popular, whole30, weight_watcher_smart_points, dish_types, extended_ingredients, summary, wine_pairing].hash\n end", "def hash; map{|el| \"#{el.name} @ #{el.hash}\"}; map(&:hash).reduce(:+) % 2**32; end", "def hash\n [hardware_baseboard, public_key, memory, processors, cpu_logical_count, connection_url, operating_system, cpu_physical_cores, status, operating_system_uptime, cpu_model, owner, cpu_family, cpu_frequency, hardware_firmware].hash\n end", "def hash\n [unit_id, name, archived, type, enable_pos_targets, menu_id, ac_area_id, ac_area_exit_id, menu_item_id, enable_payout, tickets_use_cart, tickets_cart_max_size, tickets_allow_barcode_by_keyboard, ticket_site_mapping_label_config, tickets_swap_to_chip, tickets_allow_search, tickets_emit_access_check, ac_check_sell_product, ac_check_use_turnstyle, self_service_card_payment_type_id, self_service_cash_payment_type_id, self_service_cashless_payment_type_id, payment_type_ids, chip_ids].hash\n end", "def hash\n { hash: @hash, hashType: @hash_type }\n end", "def load_products\n @products_type[\"watermelon\"] = Creator.createProduct(:watermelon, \"watermelon\")\n @products_type[\"watermelon\"].add_pack(3, 6.99)\n @products_type[\"watermelon\"].add_pack(5, 8.99)\n\n @products_type[\"pineapple\"] = Creator.createProduct(:pineapple, \"pineapple\")\n @products_type[\"pineapple\"].add_pack(2, 9.95)\n @products_type[\"pineapple\"].add_pack(5, 16.95)\n @products_type[\"pineapple\"].add_pack(8, 24.95)\n\n @products_type[\"rockmelon\"] = Creator.createProduct(:rockmelon, \"rockmelon\")\n @products_type[\"rockmelon\"].add_pack(3, 5.95)\n @products_type[\"rockmelon\"].add_pack(5, 9.95)\n @products_type[\"rockmelon\"].add_pack(9, 16.99)\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\n [_hash, name, owner].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 to_hash\n index_hash = {}\n index_hash['json_claz'] = self.class.name\n index_hash['id'] = id\n index_hash[\"asms_id\"] = asms_id\n index_hash['name'] = name\n index_hash['components'] = components\n index_hash['tosca_type'] = tosca_type\n index_hash['policies'] = policies\n index_hash['inputs'] = inputs\n index_hash['outputs'] = outputs\n index_hash['status'] = status\n index_hash['state'] = state\n index_hash['created_at'] = created_at\n index_hash\n end", "def create_full_product\n generate_product_name\n generate_product_code\n generate_product_manufacturer\n generate_product_description\n generate_product_price\n end", "def hash\n [id, auto_reorder, reorder_quantity, threshold_amount, url, raw_url, front_original_url, back_original_url, thumbnails, available_quantity, allocated_quantity, onhand_quantity, pending_quantity, projected_quantity, buckslip_orders, stock, weight, finish, status, object, description, size].hash\n end", "def hash\n [class_id, object_type, accessibility_summary, creation_time, datastore_kind, datastore_status, dsconfig, free_capacity_in_bytes, host_mount_status, is_encrypted, last_access_time, last_modified_time, mount_summary, parent_uuid, site, total_capacity_in_bytes, un_compressed_used_bytes, unshared_used_bytes, uuid, data_protection_peer, src_cluster, tgt_cluster].hash\n end", "def hash\n [store_id, client_locale, transaction_amount, transaction_type, order_id, billing, shipping, transaction_notification_url, expiration, authenticate_transaction, dynamic_merchant_name, invoice_number, purchase_order_number, hosted_payment_page_text, ip, revolving_options, installment_options, basket].hash\n end", "def hash\n [class_id, object_type, block_size, bootable, configuration_checkpoint, configuration_state, discovered_path, disk_id, disk_state, drive_firmware, drive_state, fde_capable, hot_spare_type, link_speed, link_state, num_blocks, oper_power_state, oper_qualifier_reason, operability, physical_block_size, pid, protocol, raw_size, secured, size, thermal, type, variant_type, inventory_device_info, locator_led, physical_disk_extensions, registered_device, running_firmware, sas_ports, storage_controller, storage_enclosure].hash\n end", "def to_hash\n r = ATTR_NAMES.inject({}) { |m,e|\n m[e] = self.send(e)\n m\n }\n r[:product_identity_id] = product_identity_id\n r[:langcode] = lang_code_3_chars\n r[:mappings] = mappings\n r\n end", "def hash\n end", "def hash\n end", "def hash\n end", "def products\n @products ||= begin\n items = []\n\n for i in (1..params[\"NumItens\"].to_i)\n items << {\n :id => params[\"ProdID_#{i}\"],\n :description => params[\"ProdDescricao_#{i}\"],\n :quantity => params[\"ProdQuantidade_#{i}\"].to_i,\n :price => to_price(params[\"ProdValor_#{i}\"]),\n :shipping => to_price(params[\"ProdFrete_#{i}\"]),\n :fees => to_price(params[\"ProdExtras_#{i}\"])\n }\n end\n\n items\n end\n end", "def hash\n name.hash ^ version.hash\n end", "def hash\n [id, name, address, timezone, capabilities, status, created_at, merchant_id, country, language_code, currency, phone_number, business_name, type, website_url].hash\n end", "def create_products_hash\n toys = {}\n $products_hash[\"items\"].each do |product|\n toys[product[\"title\"]] = {}\n\t\ttoys[product[\"title\"]][\"retail_price\"] = product[\"full-price\"]\n\t\ttoys[product[\"title\"]][\"amount_sold\"] = product[\"purchases\"].length\n\t\ttoys[product[\"title\"]][\"total_sales\"] = 0.0\n toys[product[\"title\"]][\"average_discount\"] = 0.0\n\t\tproduct[\"purchases\"].each do |sales|\n toys[product[\"title\"]][\"total_sales\"] += sales[\"price\"]\n\t\tend # end total_sales loop\n toys[product[\"title\"]][\"average_price\"] =\n toys[product[\"title\"]][\"total_sales\"] /\n toys[product[\"title\"]][\"amount_sold\"]\n\n toys[product[\"title\"]][\"average_discount\"] = 100 -\n (toys[product[\"title\"]][\"average_price\"].to_f /\n toys[product[\"title\"]][\"retail_price\"].to_f * 100)\n end # end each loop to create_products_hash\n\treturn toys\nend", "def enriched_key\n \"product.#{service.id}.#{id}\"\n end", "def hash\n [title_code, _class, tenure, commonhold, addresses, is_not_main_title, is_scottish, purchase_register_entry_date, purchase_prices, purchase_dates].hash\n end", "def hash\n [account_id, product, product_rate_plan, organization_id, name, description, start, _end, state, trial_end, type, parent_id, aggregate_all_subscriptions_on_account, align_period_with_aggregating_subscription, pricing_component_quantities, metadata, payment_terms, purchase_order, contract_start, failed_payment_behaviour, prepayment_amount].hash\n end", "def hash\n\t\t(language + type + klass + thing).hash\n\tend", "def fill_catalogue()\n @@products.clear\n add_product(Fruit.new(\"Apples\", 10))\n add_product(Fruit.new(\"Oranges\", 5))\n add_product(Fruit.new(\"Banana\", 20))\n add_product(Fruit.new(\"Watermelon\", 1))\n add_product(Houseware.new(\"Vacuum cleaner\", 150))\n add_product(Product.new(\"Anchovies\",2))\n end" ]
[ "0.7531119", "0.71283114", "0.6604469", "0.65833277", "0.636211", "0.62478995", "0.6161364", "0.61421555", "0.6138925", "0.6083583", "0.60561466", "0.6051967", "0.60285294", "0.6009138", "0.6007196", "0.5990676", "0.5913872", "0.5902172", "0.5900502", "0.5890153", "0.5877546", "0.58510363", "0.58496153", "0.5835926", "0.58266985", "0.5821805", "0.580309", "0.57996756", "0.5794489", "0.57917273", "0.578627", "0.578627", "0.578627", "0.578627", "0.578627", "0.578627", "0.578627", "0.57554585", "0.5749964", "0.5725535", "0.57094425", "0.5705004", "0.5698368", "0.5681337", "0.5681012", "0.5677367", "0.56599474", "0.564913", "0.56482524", "0.5647977", "0.56445396", "0.5642131", "0.5638517", "0.563629", "0.5630273", "0.562611", "0.56214124", "0.5613009", "0.5610061", "0.55916405", "0.55896986", "0.5589143", "0.558803", "0.558432", "0.55807155", "0.55796164", "0.55758", "0.5574852", "0.5572526", "0.5568199", "0.5568199", "0.5568199", "0.5568199", "0.5568199", "0.5568199", "0.5568199", "0.5568199", "0.5568199", "0.5568199", "0.55611414", "0.5553617", "0.5552457", "0.55483323", "0.5547132", "0.5538026", "0.55323344", "0.5531092", "0.55270416", "0.5525515", "0.5525515", "0.5525515", "0.55238825", "0.5513269", "0.55124635", "0.55093616", "0.5507199", "0.55067873", "0.5504761", "0.5503457", "0.55026144" ]
0.7326326
1
displays the board layout to the user in the command line
def display_board(board) rows = [" #{board[0]} | #{board[1]} | #{board[2]} ", "-----------", " #{board[3]} | #{board[4]} | #{board[5]} ", "-----------", " #{board[6]} | #{board[7]} | #{board[8]} "] puts rows[0] puts rows[1] puts rows[2] puts rows[3] puts rows[4] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_board\n puts \" \" + board_spaces[1] + \" | \" + board_spaces[2] + \" | \" + board_spaces[3] + \" \"\n puts \"-----------\"\n puts \" \" + board_spaces[4] + \" | \" + board_spaces[5] + \" | \" + board_spaces[6] + \" \"\n puts \"-----------\"\n puts \" \" + board_spaces[7] + \" | \" + board_spaces[8] + \" | \" + board_spaces[9] + \" \"\n end", "def display_board\n\t board =\" | | \\n-----------\\n | | \\n-----------\\n | | \"\n\t puts board\n\tend", "def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end", "def display_board\n puts \" \" \"|\" \" \" \"|\" \" \"\n puts \"-----------\"\n puts \" \" \"|\" \" \" \"|\" \" \"\n puts \"-----------\"\n puts \" \" \"|\" \" \" \"|\" \" \"\nend", "def display_board\n\n puts \" #{@board[0].mark} | #{@board[1].mark} | #{@board[2].mark} \"\n puts \"-----------\"\n puts \" #{@board[3].mark} | #{@board[4].mark} | #{@board[5].mark} \"\n puts \"-----------\"\n puts \" #{@board[6].mark} | #{@board[7].mark} | #{@board[8].mark} \"\n end", "def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"---------------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"---------------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end", "def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \" ----------- \"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \" ----------- \"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end", "def display_board\n\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \" ----------- \"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \" ----------- \"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n\n end", "def display_board\n puts \" | | \"\n puts\"-----------\"\n puts \" | | \"\n puts\"-----------\"\n puts \" | | \"\nend", "def display_board\n puts \" | | \"\n puts \"-----------\"\n puts \" | | \"\n puts \"-----------\"\n puts \" | | \"\nend", "def display_board\n puts \" | | \"\n puts \"-----------\"\n puts \" | | \"\n puts \"-----------\"\n puts \" | | \"\nend", "def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end", "def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end", "def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end", "def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end", "def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end", "def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end", "def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end", "def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end", "def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end", "def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end", "def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end", "def show()\n\t\tputs (' \t|\t' + ' \t|\t')\n\t\tputs (@@board[7] + '\t|\t' + @@board[8] + '\t|\t' + @@board[9])\n\t\tputs ('------------------------------------')\n\t\tputs (@@board[4] + '\t|\t' + @@board[5] + '\t|\t' + @@board[6])\n\t\tputs (' \t|\t' + ' \t|\t')\n\t\tputs ('------------------------------------')\n\t\tputs (@@board[1] + '\t|\t' + @@board[2] + '\t|\t' + @@board[3])\n\t\tputs (' \t|\t' + ' \t|\t')\n\tend", "def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end", "def display\n\t\tbreakline = \"---- --- ----\"\n\t\tputs breakline.center(@linewidth)\n\t\tputs \"| #{@board[:one]} | #{@board[:two]} | #{@board[:three]} |\".center(@linewidth)\n\t\tputs breakline.center(@linewidth)\n\t\tputs \"| #{@board[:four]} | #{@board[:five]} | #{@board[:six]} |\".center(@linewidth)\n\t\tputs breakline.center(@linewidth)\n\t\tputs \"| #{@board[:seven]} | #{@board[:eight]} | #{@board[:nine]} |\".center(@linewidth)\n\t\tputs breakline.center(@linewidth)\n\t\tputs \"\".center(@linewidth)\n\tend", "def display_board()\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end", "def display_board()\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end", "def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts '---------------'\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts '---------------'\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end", "def display_board\r\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\r\n puts \"-----------\"\r\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\r\n puts \"-----------\"\r\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\r\n end", "def display_board\r\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\r\n puts \"-----------\"\r\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\r\n puts \"-----------\"\r\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\r\n end", "def display_board\n puts \" | | \" \n puts \"-----------\"\n puts \" | | \"\n puts \"-----------\"\n puts \" | | \"\nend", "def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end", "def display\n\t\tputs \"\\n\"\n\t\t(0..2).each do |row|\n\t\t\t(0..2).each do |col|\n\t\t\t\tprint \" \" + @board[row][col].to_s + \" \"\n\t\t\t\tprint \"|\" unless col == 2\n\t\t\tend\n\t\t\tputs row == 2 ? \"\\n\\n\" : \"\\n-----------\\n\"\n\t\tend\n\tend", "def display_board\n\t\t\tsystem(\"cls\")\n\t\t\tprint \"\\n\"\n\t\t\t 7.downto(0).each_with_index{|x|\n\t\t\t\t print \"#{x+1}| \"\n\t\t\t\t\t8.times{|y|\n\t\t\t\t\tif y%2==0 && x%2 == 0 || y%2==1 && x%2 == 1\n\t\t\t\t\t\tif @board[y][x] != nil && @board[y][x].color == \"white\"\n\t\t\t\t\t\t\tprint @board[y][x].class.to_s[0].white.bold.on_red, \" \".on_red\n\t\t\t\t\t\telsif @board[y][x] != nil && @board[y][x].color == \"black\"\n\t\t\t\t\t\t\tprint @board[y][x].class.to_s[0].green.bold.on_red, \" \".on_red\n\t\t\t\t\t\telse \n\t\t\t\t\t\t\tprint \" \".on_red\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\tif @board[y][x] != nil && @board[y][x].color == \"white\"\n\t\t\t\t\t\t\tprint @board[y][x].class.to_s[0].white.bold, \" \"\n\t\t\t\t\t\telsif @board[y][x] != nil && @board[y][x].color == \"black\"\n\t\t\t\t\t\t\tprint @board[y][x].class.to_s[0].green.bold, \" \"\n\t\t\t\t\t\telse \n\t\t\t\t\t\t\tprint \" \", \" \"\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\t}\n\t\t\t\tprint \"\\n\"\n\t\t\t\t }\n\t\t\t print \"------------------\\n\"\n\t\t\t print \" a b c d e f g h\\n\\n\"\n\tend", "def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end", "def display_board\n\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n\n end", "def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \" \n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end", "def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n\n end", "def display_board\n row1 = \" #{@board[0]} | #{@board[1]} | #{@board[2]}\\n\"\n row2 = \" #{@board[3]} | #{@board[4]} | #{@board[5]}\\n\"\n row3 = \" #{@board[6]} | #{@board[7]} | #{@board[8]}\\n\"\n spacer = \"-----------\\n\"\n\n row1 + spacer + row2 + spacer + row3\n end", "def print_board\n puts \"\\n[#{@spaces[1]}][#{@spaces[2]}][#{@spaces[3]}]\\n[#{@spaces[4]}][#{@spaces[5]}][#{@spaces[6]}]\\n[#{@spaces[7]}][#{@spaces[8]}][#{@spaces[9]}]\\n\\n\"\n end", "def show_board\n\t\ttop_left = \"\\u250c\"\n\t\thorizontal = \"\\u2500\"\n\t\ttop_right = \"\\u2510\"\n\t\tbot_left = \"\\u2514\"\n\t\tbot_right = \"\\u2518\"\n\t\tvertical = \"\\u2502\"\n\t\tcross = \"\\u253c\"\n\t\ttop_cross = \"\\u252c\"\n\t\tbot_cross = \"\\u2534\"\n\t\tleft_vertical = \"\\u251c\"\n\t\tright_vertical = \"\\u2524\"\n\n\t\ttop_board = \" \" + top_left + (horizontal*3 + top_cross)*7 + horizontal*3 + top_right\n\t\tmid_board = vertical + (\" \" + vertical)*7 + \" \" + vertical\n\t\tseparator_board = \" \" + left_vertical + (horizontal*3 + cross)*7 + horizontal*3 + right_vertical\n\t\tbot_board = \" \" + bot_left + (horizontal*3 + bot_cross)*7 + horizontal*3 + bot_right\n\n\t\tputs \"\\n\" + top_board\n\n\t\t(2..8).reverse_each do |num|\n\t\t\tmid_test = num.to_s + vertical\n\t\t\t(\"a\"..\"h\").each do |letter|\n\t\t\t\tpair = letter + num.to_s \n\t\t\t\tmid_test += \" #{@board[pair].view} \" + vertical\n\t\t\tend\n\t\t\tputs mid_test\n\t\t\tputs separator_board\n\t\tend\n\n\t\tmid_test = 1.to_s + vertical\n\t\t(\"a\"..\"h\").each do |letter|\n\t\t\tpair = \"#{letter}1\"\n\t\t\tmid_test += \" #{@board[pair].view} \" + vertical\n\t\tend\n\n\t\tputs mid_test\n\t\tputs bot_board\n\t\tputs \" a b c d e f g h\\n\"\t\t\n\tend", "def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"---+----+----\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"---+----+----\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\n end", "def display\n system('clear')\n puts\n # show board with pieces\n print \"\\t\\tA\\tB\\tC\\tD\\tE\\tF\\tG\\tH\\n\\n\"\n print \"\\t +\", \" ----- +\"*8,\"\\n\\n\"\n 8.downto(1) do |rank|\n print \"\\t#{rank} |\\t\"\n 'A'.upto('H') do |file|\n if board[\"#{file}#{rank}\".to_cell] then piece = board[\"#{file}#{rank}\".to_cell]\n else piece = \" \"\n end\n print \"#{piece} |\\t\"\n end\n print \"#{rank}\\n\\n\\t +\", \" ----- +\"*8,\"\\n\\n\"\n end\n print \"\\t\\tA\\tB\\tC\\tD\\tE\\tF\\tG\\tH\"\n puts \"\\n\\n\"\n # show occupancy\n print \" White occupancy: \"\n puts whitePieces.to_cells.map{ |cell| cell.to_square}.join(\", \")\n print \" Black occupancy: \"\n puts blackPieces.to_cells.map{ |cell| cell.to_square}.join(\", \")\n puts\n # show whose move it is\n case @whitesMove\n when true\n puts \" WHITE to move.\"\n when false\n puts \" BLACK to move.\"\n end\n puts\n end", "def display_board\n puts\n puts \"Here is the current board:\"\n puts \n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"---+---+---\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"---+---+---\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n puts \n end", "def display_board\n\t\tsystem \"clear\" or system \"cls\"\n\t\tprint \" 1 2 3 4 5 6 7 8 \\n\\n\"\n\t\t(0..7).each do |row|\n\t\t\tprint \"#{(row+97).chr} \"\n\t\t\t(0..7).each do |collumn|\n\t\t\t\tprint \"#{@board[row][collumn]} \" if @board[row][collumn] == \"X\"\n\t\t\t\tprint @board[row][collumn].to_s + \" \" if @board[row][collumn].is_a?(Piece)\n\t\t\tend\n\t\t\tprint \" #{(row+97).chr} \"\n\t\t\tputs\n\n\t\tend\n\t\tprint \"\\n 1 2 3 4 5 6 7 8 \\n\"\n\tend", "def display_board\r\nprint \" #{@board[0]} | #{@board[1]} | #{@board[2]} \\n\"\r\nprint \"-----------\\n\"\r\nprint \" #{@board[3]} | #{@board[4]} | #{@board[5]} \\n\"\r\nprint \"-----------\\n\"\r\nprint \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\r\nend", "def display_board\n puts \"#{@board[0].value} | #{@board[1].value} | #{@board[2].value}\"\n puts \"-\"*10\n puts \"#{@board[3].value} | #{@board[4].value} | #{@board[5].value}\"\n puts \"-\"*10\n puts \"#{@board[6].value} | #{@board[7].value} | #{@board[8].value}\"\n end", "def display_board(board)\n line = ''\n 0.upto(board.length - 1) do |lane|\n 0.upto(5) do |row|\n line += fig('pad')\n 0.upto(board[lane].length - 1) do |col|\n line += board[lane][col][row]\n line += fig('vbar') unless col == 2\n line += \"\\n\" unless col < 2\n end\n line += (fig('pad') + fig('hbar')) if row == 5 && lane < 2\n end\n end\n print line\n end", "def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\n end", "def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\n end", "def show_board\n \tputs \"-\"*16\n \tputs \"| #{@case_array[0].symbol} | #{@case_array[1].symbol} | #{@case_array[2].symbol} |\"\n \tputs \"-\"*16\n \tputs \"| #{@case_array[3].symbol} | #{@case_array[4].symbol} | #{@case_array[5].symbol} |\"\n \tputs \"-\"*16\n \tputs \"| #{@case_array[6].symbol} | #{@case_array[7].symbol} | #{@case_array[8].symbol} |\"\n \tputs \"-\"*16\n\tend", "def display_board\n puts \" \" + (\"_\" * 47)\n 8.downto(1) do |l|\n puts \" \" +(\"| \" * 8 ) + \"|\"\n puts \" #{l} | \" + @board[l-1].join(\" | \") + \" |\"\n puts \" \" +(\"|_____\" * 8 ) + \"|\"\n end\n puts (\" \" * 8) + ('a'..'h').to_a.join(\" \")\n end", "def display\n p \"#{@grid[0..2].join(\" | \")}\"\n p \"--|---|--\"\n p \"#{@grid[3..5].join(\" | \")}\"\n p \"--|---|--\"\n p \"#{@grid[6..8].join(\" | \")}\"\n\n end", "def display_board\n print \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n print \"-----------\"\n print \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n print \"-----------\"\n print \" #{@board[6]} | #{@board[7]} | #{@board[8]} \" \nend", "def display_board(brd)\n # system 'clear'\n puts \"\"\n puts \".....|.....|\"\n puts \"..#{brd[1]}..|..#{brd[2]}..|. #{brd[3]}\"\n puts \".....|.....|\"\n puts \"-----+-----+-----\"\n puts \".....|.....|\"\n puts \"..#{brd[4]}..|..#{brd[5]}..|. #{brd[6]}\"\n puts \".....|.....|\"\n puts \"-----+-----+-----\"\n puts \".....|.....|\"\n puts \"..#{brd[7]}..|..#{brd[8]}..|. #{brd[9]}\"\n puts \".....|.....|\"\n puts \"\"\nend", "def display_board(brd)\n puts \"\"\n puts \" | |\"\n puts \" #{brd[1]} | #{brd[2]} | #{brd[3]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{brd[4]} | #{brd[5]} | #{brd[6]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{brd[7]} | #{brd[8]} | #{brd[9]}\"\n puts \" | |\"\n puts \"\"\nend", "def display_board\n cell = \" \"\n print cell+\"|\"+cell+\"|\"+cell+\"\\n-----------\\n\"+cell+\"|\"+cell+\"|\"+cell+\"\\n-----------\\n\"+cell+\"|\"+cell+\"|\"+cell+\"\\n\"\n\nend", "def display_board\n system(\"clear\")\n puts \" #{@board[0]}|#{@board[1]}|#{@board[2]}\"\n puts ' -----'\n puts \" #{@board[3]}|#{@board[4]}|#{@board[5]}\"\n puts ' -----'\n puts \" #{@board[6]}|#{@board[7]}|#{@board[8]}\"\n end", "def show\n 1.upto(width).each { |x| print \" \" + \"#{x}\"}\n print \"\\n\"\n\n grid.each_with_index do |row, index|\n print \"#{index + 1} #{row} \\n\"\n end\n end", "def display_board\n puts \" #{@letter[0]} | #{@letter[1]} | #{@letter[2]} \"\n puts \" -------------\"\n puts \" #{@number[0]}| #{@board_array[0]} | #{@board_array[1]} | #{@board_array[2]} |\"\n puts \" |-----------|\"\n puts \" #{@number[1]}| #{@board_array[3]} | #{@board_array[4]} | #{@board_array[5]} |\"\n puts \" |-----------|\"\n puts \" #{@number[2]}| #{@board_array[6]} | #{@board_array[7]} | #{@board_array[8]} |\"\n puts \" ------------\"\n end", "def display_board\r\n divider = \"-\" *11\r\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\r\n puts divider\r\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\r\n puts divider\r\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\r\n end", "def display_board(board)\n puts \" #{board[0]} \" \"|\" \" #{board[1]} \" \"|\" \" #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} \" \"|\" \" #{board[4]} \" \"|\" \" #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} \" \"|\" \" #{board[7]} \" \"|\" \" #{board[8]} \"\nend", "def show_board(spaces)\nputs \"\\n\n\n _______ _______ _______ \n | 1 | 2 | 3 |\n | \" + spaces[0] + \" | \" + spaces[1] + \" | \" + spaces[2] + \" |\n |_______|_______|_______|\n | 4 | 5 | 6 |\n | \" + spaces[3] + \" | \" + spaces[4] + \" | \" + spaces[5] + \" |\n |_______|_______|_______|\n | 7 | 8 | 9 |\n | \" + spaces[6] + \" | \" + spaces[7] + \" | \" + spaces[8] + \" |\n |_______|_______|_______| \\n\\n\\n\"\n\nend", "def display_board(board)\n separator = \"|\"\n lines = \"-----------\"\n \n puts \" #{board[0]} #{separator} #{board[1]} #{separator} #{board[2]} \"\n puts \"#{lines}\"\n puts \" #{board[3]} #{separator} #{board[4]} #{separator} #{board[5]} \"\n puts \"#{lines}\"\n puts \" #{board[6]} #{separator} #{board[7]} #{separator} #{board[8]} \"\nend", "def display_board(board)\n cell1 = \" #{board[0]} \"\n cell2 = \" #{board[1]} \"\n cell3 = \" #{board[2]} \"\n cell4 = \" #{board[3]} \"\n cell5 = \" #{board[4]} \"\n cell6 = \" #{board[5]} \"\n cell7 = \" #{board[6]} \"\n cell8 = \" #{board[7]} \"\n cell9 = \" #{board[8]} \"\n box = \"|\"\n line = \"-----------\"\n print cell1, box, cell2, box, cell3\n print \"\\n\",line\n print \"\\n\",cell4, box, cell5, box, cell6\n print \"\\n\",line\n print \"\\n\",cell7, box, cell8, box, cell9, \"\\n\"\nend", "def display_board(board)\n\tputs \" #{board[0]} | #{board[1]} | #{board[2]} \"\n\tputs \"-----------\"\n\tputs \" #{board[3]} | #{board[4]} | #{board[5]} \"\n\tputs \"-----------\"\n\tputs \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend", "def display_board(brd)\n system 'clear'\n puts ''\n puts ' | |'\n puts \" #{brd[1]} | #{brd[2]} | #{brd[3]} \"\n puts ' | |'\n puts '-----+-----+-----'\n puts ' | |'\n puts \" #{brd[4]} | #{brd[5]} | #{brd[6]}\"\n puts ' | |'\n puts '-----+-----+-----'\n puts ' | |'\n puts \" #{brd[7]} | #{brd[8]} | #{brd[9]}\"\n puts ' | |'\n puts ''\nend", "def display_board\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend", "def display_board(board)\n system 'clear'\n puts \"Player : #{PLAYER_MARKER}\"\n puts \"Computer: #{COMPUTER_MARKER}\"\n puts \"\"\n puts \" | |\"\n puts \" #{board[1]} | #{board[2]} | #{board[3]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{board[4]} | #{board[5]} | #{board[6]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{board[7]} | #{board[8]} | #{board[9]}\"\n puts \" | |\"\n puts \"\"\nend", "def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\nend", "def display_board(brd)\n puts\n puts \" #{brd[1]} | #{brd[2]} | #{brd[3]} \"\n puts \"---+---+---\"\n puts \" #{brd[4]} | #{brd[5]} | #{brd[6]} \"\n puts \"---+---+---\"\n puts \" #{brd[7]} | #{brd[8]} | #{brd[9]} \"\n puts\nend", "def show_board\n \n puts \" 1 2 3\"\n puts \" a #{@A1.content} | #{@A2.content} | #{@A3.content}\"\n puts \" ---------\"\n puts \" b #{@B1.content} | #{@B2.content} | #{@B3.content}\"\n puts \" ---------\"\n puts \" c #{@C1.content} | #{@C2.content} | #{@C3.content}\"\n\n end", "def display_board\n board =\n \" _______ _______ _______\n | | | |\n A| #{@state[:A1]} | #{@state[:A2]} | #{@state[:A3]} |\n |_______|_______|_______|\n | | | |\n B| #{@state[:B1]} | #{@state[:B2]} | #{@state[:B3]} |\n |_______|_______|_______|\n | | | |\n C| #{@state[:C1]} | #{@state[:C2]} | #{@state[:C3]} |\n |_______|_______|_______|\n 1 2 3\n \"\n puts board\n end", "def display_board(board)\n horiz_line = \"-----------\"\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts horiz_line\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts horiz_line\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend", "def display_board\n\t\tputs \"\\n\\n\"\n\t\tprint \"|\\u2460 |\\u2461 |\\u2462 |\\u2463 |\\u2464 |\\u2465 |\\u2466 |\"\n\t\[email protected] do |row|\n\t\t\tprint \"\\n|\"\n\t\t\trow.each {|x| print \"#{x.to_c} |\"} \t\t\t\n\t\tend\n\t\tputs \"\"\n\tend", "def display_board(brd)\n system 'clear'\n puts \"\"\n puts \" | |\"\n puts \" #{brd[1]} | #{brd[2]} | #{brd[3]}\"\n puts \" | |\"\n puts \"-----|-----|-----\"\n puts \" | |\"\n puts \" #{brd[4]} | #{brd[5]} | #{brd[6]}\"\n puts \" | |\"\n puts \"-----|-----|-----\"\n puts \" | |\"\n puts \" #{brd[7]} | #{brd[8]} | #{brd[9]}\"\n puts \" | |\"\n puts \"\"\nend", "def show_board\n puts\n @board.each_with_index do |square, i|\n print \" #{square} \"\n puts \"\\n\\n\" if (i == 2 || i == 5 || i == 8)\n end\n end", "def display_board\n board = \" | | \n-----------\n | | \n-----------\n | | \"\n puts board\nend", "def show_board(board)\n\n puts \"\n #{board[0]} | #{board[1]} | #{board[2]}\n #{board[3]} | #{board[4]} | #{board[5]}\n #{board[6]} | #{board[7]} | #{board[8]}\n \"\nend", "def print_board\n\t\tprint \"\\n\"\n\t\t(0..2).each do |row|\n\t\t\t(0..2).each do |column|\n\t\t\t\tprint @board[row][column]\n\t\t\t\tprint \" | \" unless column == 2\n\t\t\tend\n\t\t\t\n\t\t\tprint \"\\n---------\\n\" unless row == 2\n\t\tend\n\t\tprint \"\\n\\n\"\n\tend", "def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\\n\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\\n\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend", "def game_board_display(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\n\n end", "def show_board\n @display.each do |row|\n puts row.join(' ')\n end\n end", "def display_board(board)\n puts \" #{board[0] } | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3] } | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6] } | #{board[7]} | #{board[8]} \"\nend", "def display\n puts \"+-------------------+\"\n\n for row in 0..BOARD_MAX_INDEX\n print '|'\n for col in 0..BOARD_MAX_INDEX\n s=@board[row][col]\n if s==EMPTY_POS\n print col+(row*3)+1\n else\n print s\n end\n print \"|\"\n end\n puts \"\"\n end\n print \"\\n+--------------+\"\n\n end", "def show_board(spaces)\n\nputs \"\\n\n\n _______ _______ _______ \n | 1 | 2 | 3 |\n | \" + spaces[0] + \" | \" + spaces[1] + \" | \" + spaces[2] + \" |\n |_______|_______|_______|\n | 4 | 5 | 6 |\n | \" + spaces[3] + \" | \" + spaces[4] + \" | \" + spaces[5] + \" |\n |_______|_______|_______|\n | 7 | 8 | 9 |\n | \" + spaces[6] + \" | \" + spaces[7] + \" | \" + spaces[8] + \" |\n |_______|_______|_______| \\n\\n\\n\"\n\nend", "def show_board(spaces)\n\nputs \"\\n\n\n _______ _______ _______ \n | 1 | 2 | 3 |\n | \" + spaces[0] + \" | \" + spaces[1] + \" | \" + spaces[2] + \" |\n |_______|_______|_______|\n | 4 | 5 | 6 |\n | \" + spaces[3] + \" | \" + spaces[4] + \" | \" + spaces[5] + \" |\n |_______|_______|_______|\n | 7 | 8 | 9 |\n | \" + spaces[6] + \" | \" + spaces[7] + \" | \" + spaces[8] + \" |\n |_______|_______|_______| \\n\\n\\n\"\n\nend", "def display_board\n cell_one = \" \"\n cell_two = \" \"\n cell_three = \" \"\n cell_four = \" \"\n cell_five = \" \"\n cell_six = \" \"\n cell_seven = \" \"\n cell_eight = \" \"\n cell_nine = \" \"\n divider = \"|\"\n row = \"-----------\"\n puts cell_one + divider + cell_two + divider + cell_three\n puts row\n puts cell_four + divider + cell_five + divider + cell_six\n puts row\n puts cell_seven + divider + cell_eight + divider + cell_nine\nend", "def display_board(brd)\n puts \"You are #{PLAYER_MARKER}. Computer is #{COMPUTER_MARKER}.\"\n puts \"\"\n puts \" | |\"\n puts \" #{brd[1]} | #{brd[2]} | #{brd[3]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{brd[4]} | #{brd[5]} | #{brd[6]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{brd[7]} | #{brd[8]} | #{brd[9]}\"\n puts \" | |\"\n puts \"\"\nend", "def display_board(board)\n system('cls')\n puts \"Player is #{PLAYER_MARKER}. Computer is #{COMPUTER_MARKER}.\"\n puts \"\"\n puts \" | |\"\n puts \" #{board[1]} | #{board[2]} | #{board[3]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{board[4]} | #{board[5]} | #{board[6]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{board[7]} | #{board[8]} | #{board[9]}\"\n puts \" | |\"\n puts \"\"\nend", "def display_board\n col_separator = ' | '\n row_separator = '--+---+--'\n\n @rows.each_with_index do |row, row_number|\n row.each_with_index do |col, col_number|\n print col.to_s\n print col_separator unless col_number + 1 >= row.length\n end\n puts ''\n puts row_separator unless row_number + 1 >= @rows.length\n end\n end", "def display_board(stuff)\n print \"\\t|\\s#{stuff[1]}\\s\".colorize(:cyan)\n print \"|\\s#{stuff[2]}\\s\".colorize(:cyan)\n puts \"|\\s#{stuff[3]}\\s|\".colorize(:cyan)\n puts \"\\t-------------\".colorize(:cyan)\n print \"\\t|\\s#{stuff[4]}\\s\".colorize(:cyan)\n print \"|\\s#{stuff[5]}\\s\".colorize(:cyan)\n puts \"|\\s#{stuff[6]}\\s|\".colorize(:cyan)\n puts \"\\t-------------\".colorize(:cyan)\n print \"\\t|\\s#{stuff[7]}\\s\".colorize(:cyan)\n print \"|\\s#{stuff[8]}\\s\".colorize(:cyan)\n puts \"|\\s#{stuff[9]}\\s|\".colorize(:cyan)\nend", "def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend", "def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend", "def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend", "def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend", "def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend", "def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend", "def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend", "def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend", "def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend" ]
[ "0.7842623", "0.7756422", "0.77560467", "0.7733877", "0.7674787", "0.7668915", "0.7629692", "0.76278996", "0.7612285", "0.7595042", "0.7595042", "0.7591571", "0.7591571", "0.7591571", "0.7591571", "0.7591571", "0.7591571", "0.7591571", "0.7591571", "0.7591571", "0.7591571", "0.7591571", "0.7591054", "0.75660515", "0.7563977", "0.75588006", "0.75588006", "0.7553961", "0.75452405", "0.75452405", "0.75415605", "0.754021", "0.75201166", "0.751154", "0.74950784", "0.74914145", "0.7480814", "0.7473653", "0.7442974", "0.7424269", "0.74100727", "0.73823786", "0.736487", "0.73625326", "0.7362331", "0.73595405", "0.7356754", "0.7350075", "0.73283696", "0.73283696", "0.7310617", "0.73071975", "0.72993284", "0.72966814", "0.7287743", "0.7283472", "0.727952", "0.7270754", "0.725462", "0.7248149", "0.724206", "0.72290736", "0.7223117", "0.7213402", "0.7212545", "0.72054935", "0.7204461", "0.72013724", "0.7195953", "0.71927994", "0.7184063", "0.7179834", "0.71780217", "0.71676636", "0.7163459", "0.7160928", "0.71577233", "0.71279615", "0.7125681", "0.7121269", "0.71204835", "0.71156114", "0.7115053", "0.71126014", "0.7107652", "0.71052295", "0.71052295", "0.70994395", "0.70979637", "0.70969343", "0.7091147", "0.7088127", "0.70869344", "0.70869344", "0.70869344", "0.70869344", "0.70869344", "0.70869344", "0.70869344", "0.70869344", "0.70869344" ]
0.0
-1
converts string input from gets to an integer so it can be used to access array indices
def input_to_index(user_input) user_input.to_i - 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def input_to_index(user_input)\n # user_input = gets.strip\n converted_input = user_input.to_i\n converted_input - 1 \nend", "def input_to_index(user_input) #this method takes one argument (the users input)\n new_user_input = user_input.to_i #this specific .to converts the string into an intergeer\n new_user_input -= 1 #this subtracts it by 1 since arrays start with 0\nend", "def input_to_index(input)\n #converts the user's input (a string) into an integer\n #converts the user's input from the user-friendly format (on a 1-9 scale) to the array-friendly format (where the first index starts at 0)\n input.to_i - 1\n end", "def input_to_index(user_input) \n #converts the user's input (a string) into an integer / would use .to_i\n #converts the user's input from the user-friendly format (on a 1-9 scale) to the array-friendly format (where the first index starts at 0) \n user_input.to_i - 1\n end", "def input_to_index(user_input)\n user_input = user_input.to_i # converts string into integer\n index = user_input - 1 # Change user input to array index.\nend", "def input_to_index(string)\r\n input = string.to_i\r\n user_input = input - 1\r\nend", "def input_to_index(string_input)\n\n #coverting string input to an integer and subtracting it by 1\n (string_input.to_i) - 1\n\nend", "def input_to_index(user_input) #this method converts the user_input into the 0-8 index, AKA the position on the board\n user_input = user_input.to_i # assign user_input to (user_input.to_i), which converts the user_input to an integer\n user_input = user_input-1 # assign user_input to (user_input-1), which substracts 1 from the user_input\n #the above line with the (user_input-1) also returns -1 for strings without integers\n end", "def input_to_index(user_input)\n return \"#{user_input}\".to_i - 1\nend", "def input_to_index(user_input)\n user_input.to_i - 1 # user_input converted to an integer\nend", "def getInput\n gets.strip.to_i\nend", "def input_to_index(user_input)\n #take the user's input (\"1\"-\"9\") and convert it to the index of the board array (0-8)\n user_input.to_i - 1\nend", "def input_to_index(string)\n string.to_i - 1\nend", "def input_to_index(string)\nstring.to_i-1\nend", "def get_input_i\n\tgets.chomp.to_i\nend", "def input_to_index(str)\nstr.to_i - 1\nend", "def input_to_index(user_input)\n user_input.to_i - 1 # user_input converted to an integer\n end", "def input_to_index(user_input)\nindex = user_input.to_i - 1 #convert to integer and covert to index\nreturn index #return index for use in other methods\nend", "def input_to_index(num)\n input = num.strip\n int = input.to_i\n input = int - 1\n return input\nend", "def input_to_index( user_input )\n user_input.to_i - 1\n end", "def input_to_index(user_input)\n index = user_input.to_i - 1\n end", "def input_to_index(user_input)\n index = user_input.to_i - 1\n end", "def input_to_index(user_input)\n index = user_input.to_i - 1\nend", "def input_to_index(user_input)\n index = user_input.to_i - 1\nend", "def input_to_index(user_input)\n index = user_input.to_i - 1\nend", "def input_to_index(user_input)\n index = user_input.to_i - 1\nend", "def geti\n gets.split.map(&:to_i)\nend", "def input_to_index(user_input)\r\n user_input.to_i - 1\r\nend", "def input_to_index(user_input)\n user_input.to_i - 1\n end", "def input_to_index(user_input)\n user_input.to_i - 1\n end", "def input_to_index(user_input)\n user_input.to_i - 1\n end", "def input_to_index(user_input)\n index = user_input.to_i - 1\nend", "def input_to_index(user_input)\n user_input.to_i - 1\n end", "def input_to_index(user_input)\n user_input.to_i - 1\n end", "def input_to_index(user_input)\n user_input.to_i - 1\n end", "def input_to_index(user_input)\n user_input.to_i - 1\n end", "def input_to_index(user_input)\n user_input.to_i - 1\n end", "def input_to_index(user_input)\n user_input.to_i - 1\n end", "def input_to_index(user_input)\n user_input.to_i - 1\n end", "def input_to_index(user_input)\n (user_input).to_i - 1 \nend", "def input_to_index(user_input)\n user_input.to_i- 1\nend", "def input_to_index(user_input)\n index = (user_input.to_i - 1)\nend", "def input_to_index(user_input)\nconverted_input = user_input.to_i - 1\nend", "def input_to_index(user_input)\n user_input.to_i - 1\nend", "def input_to_index(user_input)\n user_input.to_i - 1\nend", "def input_to_index(user_input)\n index = (user_input.to_i - 1)\n end", "def input_to_index(userinput)\n userinput.to_i - 1\nend", "def input_to_index(input)\n user_input=input.to_i\n user_input - 1\nend", "def input_to_index(user_input)\n index=(user_input .to_i) -1\nend", "def input_to_index(user_input)\n user_input.to_i - 1 \nend", "def input_to_index(user_input)\n user_input.to_i - 1 \nend", "def input_to_index(user_input)\n arr_index = user_input.to_i - 1\n return arr_index\nend", "def input_to_index(input)\n input_int = input.to_i\n index = input_int - 1\nend", "def input_to_index(user_input)\n user_input.to_i - 1\n end", "def input_to_index(user_input)\n user_input.to_i - 1\n end", "def input_to_index(user_input)\n\n user_input.to_i - 1\n\n\nend", "def input_to_index(user_input)\n index = user_input.to_i - 1\n return index\nend", "def input_to_index(user_input)\n index = user_input.to_i - 1\n return index\n end", "def input_to_index(user_input)\n return user_input.to_i() - 1\n end", "def input_to_index(user_input)\n user_input = user_input.to_i\n index = user_input - 1\n return index\nend", "def get_input\n gets.chomp.to_i\nend", "def input_to_index(user_input = 0)\n index = (user_input.to_i - 1)\nend", "def input_to_index(user_input)\n user_input.to_i-1\nend", "def input_to_index(user_input)\n user_input = user_input.to_i - 1;\n user_input;\nend", "def input_to_index(user_input)\n user_input = user_input.to_i\n user_input = user_input-1\nend", "def input_to_index(user_input)\n user_input.to_i - 1\n return index\nend", "def input_to_index(user_input)\n\tactual_input = user_input.to_i - 1\n\nend", "def input_to_index(user_input)\n user_input = user_input.to_i\n user_input = user_input - 1\nend", "def input_to_index(input_text)\n user_input = input_text.to_i\n user_input -= 1\n return user_input\nend", "def input_to_index(user_input)\n user_input = user_input.to_i - 1\nend", "def input_to_index(input)\n if input >= \"1\" && input <=\"9\"\n return input.to_i-1\n else\n return -1\n end\nend", "def input_to_index(input)\n if input >= \"1\" && input <=\"9\"\n return input.to_i-1\n else\n return -1\n end\nend" ]
[ "0.7873866", "0.7829953", "0.78160214", "0.7812294", "0.781009", "0.7790098", "0.7571401", "0.7422521", "0.741129", "0.7411127", "0.73129356", "0.72873694", "0.72816634", "0.72775126", "0.7259597", "0.72487044", "0.72482264", "0.7241566", "0.7230029", "0.7227227", "0.72139543", "0.72139543", "0.71986234", "0.71986234", "0.71986234", "0.71986234", "0.7192015", "0.71897286", "0.71891797", "0.71891797", "0.71891797", "0.71836", "0.7178956", "0.7178956", "0.7178956", "0.7178956", "0.7178956", "0.7178956", "0.7178956", "0.717363", "0.7154899", "0.71505886", "0.71489584", "0.7146233", "0.7146233", "0.7145883", "0.7136799", "0.7130186", "0.7124254", "0.71210873", "0.71210873", "0.71163577", "0.7086845", "0.7085337", "0.7085337", "0.70793355", "0.70781344", "0.7062042", "0.70585734", "0.7050472", "0.704004", "0.70257723", "0.7015121", "0.7008104", "0.70034295", "0.69868547", "0.6982441", "0.69749767", "0.6968797", "0.69359124", "0.6923986", "0.6923986" ]
0.7168639
62
moves player marker (X or O) to their desired position on the board
def move(board, position, current_player) board[position] = current_player end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def player_move(board, index, marker)\n board[index] = marker\n end", "def place_marker(x, y)\n val = x.to_i - 1\n key = y\n row_arry = @grid_hash[key]\n if row_arry[val] == ' '\n if @@counter.odd?\n # player 1 #\n row_arry[val] = 'x'\n end_turn\n else\n # player 2 #\n row_arry[val] = 'o'\n end_turn\n end\n else\n p 'location taken'\n end\n end", "def move(board, position, marker='X')\n board[position.to_i - 1] = marker.upcase\nend", "def move(marker)\n column = 0\n until column > 0 && column < 8\n column = play_column.to_i\n end\n @position = place_marker(marker, column)\n end", "def move(board, pos, mark=\"X\")\n board[pos.to_i-1] = mark\nend", "def move(board, position, current_player= \"X\")\n board[position.to_i - 1] = current_player\nend", "def move(board, converted_input, user_marker = \"X\")\n board[converted_input] = user_marker\nend", "def move(board, position , player= \"X\" )\n\tposition = position.to_i\n\tboard[position -1] = player\n\tdisplay_board(board)\nend", "def move(board, location, current_player = \"X\")\n board[location.to_i-1] = current_player\nend", "def move(board, location, current_player = \"X\")\n board[location.to_i-1] = current_player\nend", "def move(board, position, current_player = \"X\")\n board[position.to_i-1] = current_player\nend", "def move(board, index, marker)\n board[index] = marker\nend", "def move(move_position, player=\"X\")\n @board[move_position] = player\n end", "def move(position,player_letter = \"X\")\r\n #input logic here\r\n @board[position] = player_letter\r\n end", "def move_piece(coord)\n @game.move_piece_to(coord)\n end", "def place_marker(position)\n indexes = num_to_idx(position)\n return false if @board[indexes[0]][indexes[1]] != 0\n @board[indexes[0]][indexes[1]] = next_player\n true\n end", "def move(position, player=current_player)\n position = position.to_i\n @board[position-1]=player\n end", "def move(board , location , player_character = \"X\")\n location = location.to_i\n board[location-1] = player_character\n return board\nend", "def move(board , location , player_character = \"X\")\n location = location.to_i\n board[location-1] = player_character\n return board\nend", "def switch_player_position\n if @position == 1\n @symbol = \"\\u{274C}\"\n @position = 2\n elsif @position == 2\n @symbol = \"\\u{2705}\"\n @position = 1\n end\n end", "def turn\n marker = @turn_count.even? ? marker = \"X\" : marker = \"O\"\n move\n print \"Current board: \"\n show_board\n @player +=1\n end", "def move_to who, ox, oy, nx, ny\n if oy != nil and ox != nil\n @monster[oy][ox] = nil\n end\n @monster[ny][nx] = who\n return 10, nx, ny\n end", "def move pos\n new_board = nil\n next_player = @current_player == :x ? :o : :x\n new_board = @board.make_move @current_player, pos\n State.new new_board, next_player, @computer_player\n end", "def move(location, token =\"X\")\r\n @board[(location.to_i) -1 ]=token\r\n end", "def place_marker(spot, mark)\n board[spot - 1] = mark\n end", "def move(board, position, player=current_player(board))\n position = position.to_i\n board[position-1]=player\nend", "def move( index, current_player = \"X\" )\n @board[index] = current_player\n end", "def move(board, location, char=\"X\")\n location = location.to_i\n board[location - 1] = char\nend", "def update_board(board, position, marker)\n\tboard[position] = marker\n\tboard\nend", "def update_move(board, player, position)\n\tboard[position.to_i - 1] = player\n\tboard\nend", "def move(player, x, y)\n\n end", "def put_marker(choice, player)\n i = 0\n i += 1 while i < ROWS && @positions[i][choice] == EMPTY\n @positions[i - 1][choice] = player.marker\n @choices.delete(choice) if (i - 1).zero?\n end", "def move(position, token='X')\n @board[position] = token\n end", "def move(position, player_token)\n @board[position] = player_token\n end", "def move_to who, ox, oy, nx, ny\n @current_level.move_to who, ox, oy, nx, ny\n end", "def move(board, position, player = 'X')\n #player = current_player(board) #w/o this line, tictactoe spec will run properly\n position = position.to_i - 1\n board[position] = player\nend", "def move(board_index, player_token = \"X\")\n @board[board_index] = player_token\n end", "def move(location, token=\"X\") # move( 0 , O ) \n @board[location] = token\n #binding.pry\n end", "def move(position,token=\"X\")\n position=position.to_i - 1\n @board[position]=token\n end", "def mark (input)\n @@board = mark_input(@@board, input, @@player_turn)\n #switch player after input\n @@player_turn == \"O\" ? @@player_turn = \"X\" : @@player_turn = \"O\"\n end", "def player_move\n player_position = gets.chomp\n player_position = player_position.split(' ')\n if player_position[0] == 'flag'\n flag_map(player_position[1], player_position[2])\n elsif player_position[0] == 'unflag'\n unflag_map(player_position[1], player_position[2])\n else\n player_choice(player_position[0], player_position[1])\n end\n display_board\n \n show_board if game_over == true \n\n end", "def move(board, position, token=\"X\")\n board[position.to_i - 1] = token \nend", "def play_turn\n move = @current_player.get_move\n switch_players!\n @board.place_mark(move, :X)\n end", "def move(index, current_player = \"X\")\n @board[index] = current_player\n end", "def set_move move\n@board[move] = @player\nend", "def move_to(x, y); end", "def winning_move(board)\n winning_spot = nil\n \n board.empty_position.each do |spot|\n board.place_mark(*spot, marker)\n winning_spot = spot if board.won?\n board[*spot] = nil\n end\n \n winning_spot\n end", "def move(index, character = \"X\")\n if character == \"X\"\n @board[index] = \"X\"\n else character == \"O\"\n @board[index] = \"O\"\nend\nend", "def set_player_positions\n self.print_grid\n\n xy = self.ask_for_x_y do\n \"Player 1: Where would you like to place your flag?\"\n end\n\n @player1_x = xy[0]\n @player1_y = xy[1]\n \n xy = self.ask_for_x_y do\n \"Player 2: Where would you like to place your flag?\"\n end\n\n @player2_x = xy[0]\n @player2_y = xy[1]\n end", "def position(player_input)\n cells[move_to_index(player_input)]\n end", "def set_position\n if @player_correct[-1] == true\n @player_pos << (@player_pos[-1]) - 5\n else\n @player_pos << @player_pos[-1]\n end\n if @computer_correct[-1] == true\n @computer_pos << (@computer_pos[-1]) - 5\n else\n @computer_pos << @computer_pos[-1]\n end\n end", "def move(board, position, char=\"X\")\n board[position] = char\nend", "def move!(row, column, icon)\n @row, @column, @icon = row, column, icon\n\n make_move!\n end", "def move(location, token = \"X\")\n #this sets the correct index value of the chosen position on the board equal to the token \n #(i.e., puts an X or O where you chose, if valid)\n @board[location.to_i-1]= token\n end", "def move(board, index, character)\n character = \"X\"\nend", "def position_character(c,i)\n return if $game_variables[Yuki::Var::FM_Sel_Foll] > 0\n c1 = (i == 0 ? $game_player : @followers[i - 1].character)\n x = c1.x\n y = c1.y\n if $game_switches[Sw::Env_CanFly] || $game_switches[Sw::FM_NoReset]\n case c1.direction\n when 2\n y -= 1\n when 4\n x += 1\n when 6\n x -= 1\n else\n y += 1\n end\n end\n c.through = false\n if c.passable?(x, y, 0) # c1.direction)) #$game_map\n c.moveto(x, y)\n else\n c.moveto(c1.x, c1.y)\n end\n c.through = true\n c.direction = $game_player.direction\n c.update\n end", "def move(board,position,choice=\"X\")\n iPosition = position.to_i\n board[iPosition-1] = choice\nend", "def move(board, position, character= current_player(board))\nboard[position.to_i - 1] = character\nend", "def update_markers\n board.flatten.map do |marker|\n case marker\n when \"X\"\n update_x\n when \"O\"\n update_o\n else\n update_empty\n end\n end\n end", "def move(board, index, current_player = 'X')\n board[index] = current_player\nend", "def move(board, position, xo = \"X\")\n board[position] = xo\nend", "def place_marker(marker, column)\n column -= 1 #index 0\n z = @board.length - 1\n until @board[z][column] == \"_\"\n z -= 1\n end\n @board[x][column] = marker\n end", "def current_player\n x_moves = @board.select {|position| position == \"X\"}\n o_moves = @board.select {|position| position == \"O\"}\n\n if x_moves.size == o_moves.size\n character = \"X\"\n else\n character = \"O\"\n end\n end", "def do_move x,y\n return unless is_valid_move(x,y)\n @field[x][y].player = @player\n unless (w = check_winner).nil?\n on_game_won w.first.player, w\n end\n\n @player = @player == 1 ? 2 : 1\n if gameover?\n @player = 0\n on_gameover\n end\n end", "def move(user_input, character = \"X\")\n @board[user_input] = character\n end", "def update_board(mark, position)\n position = position.to_i\n\n @play_area[position] = mark\n end", "def move_piece fr, fc, tr, tc\r\n puts \"Moving X from #{fr}, #{fc} to #{tr}, #{tc}\"\r\n current = @board[fr][fc]\r\n @board[fr][fc]= 0\r\n @board[tr][tc]=current\r\n\r\n end", "def o_player_turn\n print \"Player O:\"\n @o_player_choice = gets.chomp\n #Make sure that the player inputs a correct input\n if check_coord_marked?(@o_player_choice)\n print \"Already marked please try again\\n\"\n self.o_player_turn\n elsif @coordinates.any?{|i| i==@o_player_choice}\n self.place_mark(@o_player_choice, \"o\")\n else\n print \"Not a valid Coordinate try again \\n\"\n self.o_player_turn\n end\n end", "def place_pos(queen, x, y)\r\n @map[x][y].leave()\r\n queen.goto( @map[x][y], @map[x][y] )\r\n end", "def move (board, position, character = \"X\")\n board[(position.to_i - 1)] = character\n return board\nend", "def move(board, input_to_index, player_character = \"X\")\n board[input_to_index] = player_character\nend", "def update(position, player)\n self.cells[position.to_i-1] = player.token\n end", "def move(board, location, character = \"X\")\n int_location = location.to_i - 1\n board[int_location] = character\nend", "def move(index, current_player = \"X\")\n @board[index] = current_player\nend", "def move\n @leading_x = coordinate_array[0]\n @leading_y = coordinate_array[1]\n end", "def move(move_index, player_token = \"X\")\r\n @board[move_index] = player_token\r\n end", "def mark_position\n \t@game_board.print_board\n\t\tprintf \"Make your move: \"\n\t\tinput = gets.chomp\n\t\tfrom = input[0..1]\n\t\tto = input[2..3]\n\n\t\tuntil input.length == 4 && @game_board.update_board(from, to, @color)\n\t\t\tputs \"#{input} is either not a valid input or unavailable. Please try again.\"\n\t\t\tprintf \"Make your move: \"\n\t\t\tinput = gets.chomp\n\t\t\tfrom = input[0..1]\n\t\t\tto = input[2..3]\n\t\tend\n end", "def advance_player(player)\n if @player_positions[player] > 79\n return player\n end\n @board.slice!(@player_positions[player])\n @board.insert(@player_positions[player], \"~\")\n @player_positions[player] += Die.new.roll\n\n @board.slice!(@player_positions[player])\n @board.insert(@player_positions[player], player)\n # puts @board\n @board = @board\n # p \"Player a: #{@player_positions[\"a\"]}\"\n # p \"Player b: #{@player_positions[\"b\"]}\"\n \n end", "def move(current_position, desired_square)\n board.move(current_position, desired_square, current_player)\n end", "def move\n\tputs \"Where would you like to move this king? Enter the coords as a 2-digit number\"\n\tnew_pos=gets.chomp\n\tx=new_pos[0].to_i\n\ty=new_pos[1].to_i\n\tif @moves.include? ([x,y])\n\t board[x][y]=self.sym\n\t board[self.pos[0]][self.pos[1]]=\"___\"\n\t self.pos=[x,y]\n\telse\t \n\t move\n\tend\nend", "def set_piece(player,location) #takes the arguments player and location\n\t\t@piece=player.piece #defines piece as the player's number (either 1 or 2)\n\t\trow=(location-1)/4 #takes the value of location (1-16) and converts it into a row coordinate 0, 1, 2, or 3\n\t\tcolumn=(location+3)%4 #takes the value of location (1-16) and converts it into a column coordinate 0, 1, 2, or 3\n\t\t@board[row][column]=@piece #defines the cell that the player has just selected as the player's number (1 or 2)\n\t\t@size+=1 #we count each move after its been made which is used in the function below, check_full?\n\tend", "def move_to(pos)\n if (@current_pos != nil && @current_pos == pos)\n return\n end\n if pos == 5\n self.x = (Graphics.width - self.width) / 2\n self.y = (Graphics.height - self.height) / 2\n end\n if [1, 2, 3].include?(pos)#bottom\n self.y = Graphics.height - self.height\n if @win_help != nil\n self.y -= @win_help.height\n end\n end\n if [1, 4, 7].include?(pos)#left\n self.x = 0\n end\n if [7, 8, 9].include?(pos)#top\n self.y = 0\n end\n if [3, 6, 9].include?(pos)#right\n self.x = Graphics.width - self.width\n end\n @current_pos = pos\n end", "def move(board, place, char=\"X\")\n board[place] = char\nend", "def move(board, position)\n board.place_move(position, @play_symbol)\n end", "def move(position, char)\n @board[position] = char\n end", "def play_turn\n @board.place_mark(@current_player.get_move, @current_player.mark)\n switch_players!\n end", "def move_player (start, stop, piece)\r\n $board[stop[0]][stop[1]] = piece\r\n $board[start[0]][start[1]] = nil \r\n $board[stop[0]][stop[1]].turn += 1\r\n @prev_coord= [stop[0], stop[1]]\r\n @prev_delta_y = (stop[1] - start[1]).abs\r\n if piece.class == Pawn and (stop[1] == 7 or stop[1] == 0)\r\n promotion(stop, piece)\r\n end \r\n end", "def move(board, index, character = \"X\")\n if character == \"X\"\n board[index] = \"X\"\n else character == \"O\"\n board[index] = \"O\"\nend\nend", "def move_friendly_piece(x,y)\n update_attributes(position_x: x, position_y: y)\n end", "def move_friendly_piece(x,y)\n update_attributes(position_x: x, position_y: y)\n end", "def move(board, index, current_player = \"X\")\n board[index] = current_player(board)\nend", "def move(board, pos, character= \"X\")\n update_array_at_with(board, pos, character)\nend", "def computer_move\n \tc_move = open_spots.sample\n \t@board[c_move] = @computer_symbol.to_s\n \t\t@turn = :player\n\tend", "def move\n case @rover_facing\n when 'N'\n @coordinates[1] += 1\n when 'E'\n @coordinates[0] += 1\n when 'S'\n @coordinates[1] -= 1\n when 'W'\n @coordinates[0] -= 1\n end\n end", "def record_move(row, col, value)\n tile = @rows[row-1][col-1]\n tile.value = value\n tile\n end", "def set_move(player, square_number)\n board_iterate do |element, row, col|\n @board[row][col] = player.piece if element == square_number\n end\n end", "def move(location, token)\n @board[location.to_i-1] = token\nend", "def move(board, input, player = \"X\")\n input = input.to_i - 1\n board[input] = player\nend", "def win(board, marker)\n\t\t#horizontal top\n\t\tif board[0] && board[1] == marker\n\t\t\tboard[2] == perfect_move\n\t\telsif board[0] && board[2] == marker\n\t\t\tboard[1] == perfect_move\n\t\telsif board[1] && board[2] == marker\n\t\t\tboard[0] == perfect_move\n\t\t#horiz middle\n\t\telsif board[3] && board[4] == marker\n\t\t\tboard[5] == perfect_move\n\t\telsif board[3] && board[5] == marker\n\t\t\tboard[4] == perfect_move\n\t\telsif board[4] && board[5] == marker\n\t\t\tboard[3] == perfect_move\n\t\t#horiz bottom\n\t\telsif board[6] && board[7] == marker\n\t\t\tboard[8] == perfect_move\n\t\telsif board[6] && board[8] == marker\n\t\t\tboard[7] == perfect_move\n\t\telsif board[7] && board[8] == marker\n\t\t\tboard[6] == perfect_move\n\t\t#vertical left\n\t\telsif board[0] && board[3] == marker\n\t\t\tboard[6] == perfect_move\n\t\telsif board[3] && board[6] == marker\n\t\t\tboard[0] == perfect_move\n\t\telsif board[0] && board[6] == marker\n\t\t\tboard[3] == perfect_move\n\t\t#vert middle\n\t\telsif board[1] && board[4] == marker\n\t\t\tboard[7] == perfect_move\n\t\telsif board[1] && board[7] == marker\n\t\t\tboard[4] == perfect_move\n\t\telsif board[4] && board[7] == marker\n\t\t\tboard[1] == perfect_move\n\t\t#vert right\n\t\telsif board[2] && board[5] == marker\n\t\t\tboard[8] == perfect_move\n\t\telsif board[2] && board[8] == marker\n\t\t\tboard[5] == perfect_move\n\t\telsif board[5] && board[8] == marker\n\t\t\tboard[2] == perfect_move\n\t\t#diaginal top left \n\t\telsif board[0] && board[4] == marker\n\t\t\tboard[8] == perfect_move\n\t\telsif board[0] && board[8] == marker\n\t\t\tboard[4] == perfect_move\n\t\telsif board[4] && board[8] == marker\n\t\t\tboard[0] == perfect_move\n\t\t#diag bottom left\n\t\telsif board[2] && board[4] == marker\n\t\t\tboard[6] == perfect_move\n\t\telsif board[2] && board[6] == marker\n\t\t\tboard[4] == perfect_move\n\t\telsif board[4] && board[6] == marker\n\t\t\tboard[2] == perfect_move\n\t\telse\n\n\t\tend\n\tend", "def move(board, index, current_player)\n board[index] = current_player\n if current_player = \"X\" || \"O\"\n return true\n else\n return false\n end\nend" ]
[ "0.81977737", "0.78285253", "0.7800867", "0.77579075", "0.7605531", "0.74125504", "0.73591495", "0.7332739", "0.73271185", "0.73271185", "0.7293614", "0.7265896", "0.71612835", "0.71385115", "0.7136487", "0.7114003", "0.7072028", "0.69810545", "0.69810545", "0.6974722", "0.69650435", "0.69591904", "0.69551593", "0.6949777", "0.6944512", "0.6941274", "0.6922019", "0.6919687", "0.69048774", "0.6897123", "0.68910056", "0.6878013", "0.6860624", "0.6858388", "0.6856502", "0.6851232", "0.6848056", "0.6845484", "0.6838588", "0.6832574", "0.6827876", "0.6824719", "0.68066883", "0.68001384", "0.6785231", "0.67824155", "0.67816335", "0.6771346", "0.6767667", "0.67635626", "0.6761757", "0.67558557", "0.67543286", "0.6748814", "0.6740409", "0.6732503", "0.67274946", "0.671867", "0.6700843", "0.66917634", "0.6688797", "0.6687309", "0.66811454", "0.66786075", "0.6675184", "0.6673347", "0.6670516", "0.6665431", "0.66592366", "0.66549903", "0.6648894", "0.66447306", "0.6642782", "0.6637521", "0.66345936", "0.66307217", "0.66263795", "0.6618696", "0.66137505", "0.6610944", "0.66060126", "0.66037023", "0.66003513", "0.65992045", "0.65920085", "0.6584129", "0.65792125", "0.65679383", "0.65661365", "0.65661365", "0.65641785", "0.65634006", "0.6553519", "0.65492976", "0.65466833", "0.65395516", "0.6532809", "0.6525261", "0.65249306", "0.6523923" ]
0.6744049
54
checks if the position is taken
def position_taken?(board, position) board[position] != " " && board[position] != "" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def position_taken?\nend", "def position_taken?(position)\n @board[position] != \" \"\n end", "def position_taken?(position)\n @board[position] != nil && @board[position] != \" \"\n end", "def position_taken?(index)\n @board[index] == \"X\" || @board[index] == \"O\"\n end", "def position_taken?(index)\n ((@board[index] == \"X\") || (@board[index] == \"O\"))\n end", "def position_taken?(position)\n @board[position] != \" \"\n end", "def position_taken?(location)\n @board[location] != \" \" && @board[location] != \"\"\n end", "def position_taken?(location)\n @board[location] != \" \" && @board[location] != \"\"\n end", "def position_taken?(location)\n @board[location] != \" \" && @board[location] != \"\"\n end", "def position_taken?(position)\r\n if @board[position] == \"\" || @board[position] == \" \" || @board[position] == nil\r\n return false\r\n elsif @board[position] == \"X\" || @board[position] == \"O\"\r\n return true\r\n end\r\n end", "def position_taken?(index)\n if @board[index] == nil or @board[index] == \"\" or @board[index] == \" \"\n return false\n elsif @board[index] == \"X\" or @board[index] == \"O\"\n return true\n end\n end", "def position_taken?(position)\n if @board[position] == \" \" || @board[position] == \"\" || @board[position] == nil\n false\n elsif @board[position] == \"X\" || @board[position] == \"O\"\n true\n end\n end", "def taken?(input)\n\t\tif position(input) == \"X\" || position(input) == \"O\"\n\t\t\ttrue # Position is taken\n\t\telse\n\t\t\tfalse # Position is free\n\t\tend\n\tend", "def position_taken?(index)\n\t\t!@board[index].include?(\" \")\n\tend", "def position_taken?(position)\n !(@board[position].nil? || @board[position] == \" \")\n end", "def position_taken?(board, position)\n\tif board[position] == \"X\" || board[position] == \"0\"\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend", "def position_taken?(index)\n if @board[index] == \" \" || @board[index] == \"\" || @board[index] == nil\n return false\n elsif @board[index] == \"X\" || @board[index] == \"O\"\n return true\n end\n end", "def position_taken?(board, pos)\n if board[pos]==\"X\" || board[pos]==\"O\"\n taken = true\n else\n taken = false\n end\n taken\nend", "def position_taken?(board,position)\n pos = position.to_i\n val = board[pos-1]\n if val == \"X\" || val ==\"O\"\n true\n else\n false\n end\nend", "def position_taken?(index)\n @board[index] != \" \" && @board[index] != \"\"\n end", "def position_taken?(board, position)\n return true if board[position - 1] == \"X\" || board[position - 1] == \"O\"\n false\nend", "def valid_move?(position)\n index=position.to_i - 1\n index.between?(0, 8) && !(position_taken?(index))\n end", "def valid_move?(position)\r\n @index = position.to_i-1\r\n if @index.between?(0,8) && !position_taken?(@index)\r\n return true\r\n else\r\n return false\r\n end\r\n end", "def taken?(position)\n #board position -1 because of test using range 1-9 (user input numbers)\n self.cells[position.to_i-1] == \"X\" || \n self.cells[position.to_i-1] == \"O\"\n end", "def taken?(location)\n position(location) != \" \"\n end", "def position_taken?(board,position)\n position = position.to_i - 1\n if board[position] == \"X\" || board[position] == \"O\"\n return true\n else\n return false\n end\nend", "def position_taken?(pos)\r\n #true if space is empty and false if filled\r\n if @board[pos] == \" \"\r\n return false\r\n else\r\n return true\r\n end\r\n end", "def position_taken?(index)\n if @board[index] == \"X\"\n true\n elsif @board[index] == \"O\"\n true\n else\n false\n end\nend", "def position_taken?(index)\n @board[index]==\"X\" || @board[index] == \"O\"\nend", "def position_taken?(index)\n ! ( @board[index].nil? || @board[index] == \" \" )\n end", "def position_taken?(board, position)\n if !(board[position.to_i - 1] == \"X\" || board[position.to_i - 1] == \"O\")\n return true\n else \n return false\n end\nend", "def position_taken?(board,pos)\n if board[pos.to_i]==\"X\" || board[pos.to_i] ==\"O\"\n return true\n else\n return false\n end\nend", "def position_taken?( index )\n !(@board[index].nil? || @board[index] == \" \")\n end", "def position_taken?(board, position)\n\tx = board[position -1]\n\tcase x \n\twhen \"\", \" \"\n\t\t return false \n\telse\n\t\t return true \n\tend\nend", "def position_taken?(board, position)\n return false if valid_move?(board, position)\n return true unless valid_move?(board, position)\nend", "def position_taken?(index_i)\n ((@board[index_i] == \"X\") || (@board[index_i] == \"O\"))\n end", "def position_taken?(board, position)\n position = position.to_i - 1\n if board[position] == \"X\" || board[position] == \"O\"\n true\n end\nend", "def position_taken?(board, index)\n board[index] == \"X\" || board[index] == \"O\"\n end", "def position_taken? (index)\n @board[index] != \" \" ? true : false\n end", "def position_taken?(board, index)\n space = board[index]\n if space == 'X' || space == \"O\"\n return true\n else\n return false\n end\nend", "def valid_move?(position)\n position.between?(0,8) && !position_taken?(position)\n end", "def taken?(input_position)\n self.position(input_position) == \"X\" || self.position(input_position) == \"O\"\n end", "def position_taken?(position)\n if @board[position] == \" \" || @board[position] == \"\" || @board[position] == nil\n false\n else\n true\n end\n end", "def position_taken?(index)\n !(@board[index].nil? || @board[index] == \" \")\n end", "def position_taken?(index)\n !(@board[index].nil? || @board[index] == \" \")\n end", "def position_taken?(index)\n !(@board[index].nil? || @board[index] == \" \")\n end", "def position_taken?(index_i)\n ((@board[index_i] == \"X\") || (@board[index_i] == \"O\"))\n end", "def position_taken?(index)\n position = @board[index]\n \n if !(position.nil? || position.eql?(\" \") || position.empty?)\n return (position.eql?(\"X\") || position.eql?(\"O\"))\n else\n return false\n end\n end", "def not_in_place?\r\n @position.nil?\r\n end", "def position_taken?(board, position)\n return true if (board[position-1] == \" \" || board[position-1] == \"\" || board[position-1] == nil)\n return false if (board[position-1] == \"X\" || board[position-1] == \"O\")\nend", "def position_taken?(board, position)\n if board[(position.to_i) - 1] == \" \" || board[(position.to_i) - 1] == \"\" || board[(position.to_i) - 1] == nil\n false\n elsif board[(position.to_i) - 1] == \"X\" || board[(position.to_i) - 1] == \"O\"\n \tfalse\n end\nend", "def position_taken?(board, position)\n p_taken = false\n if (board[position] == \"\" || board[position] == \" \" || board[position] == nil)\n p_taken = false\n else\n p_taken = true\n end\n p_taken\nend", "def position_taken?(board, position)\n if board[position.to_i-1] == \" \" || board[position.to_i-1] == \"\" || board[position.to_i-1] == nil # if the position is empty like so \" \" or like so \"\", or if the position has a value of nil, it has not been taken\n false\n else # otherwise, it is unavailable\n true\n end\nend", "def position_taken?(board, position)\n \n if board[position.to_i-1] == \" \"\n then false\n elsif board[position.to_i-1] == \"\" \n then false\n elsif board[position.to_i-1] == nil\n then false\n elsif board[position.to_i-1] == \"X\"\n then true\n elsif board[position.to_i-1] == \"O\"\n then true\n end\nend", "def position_taken?(board, position)\n if board[position] == \"X\" || board[position] == \"O\"\n return true\n end\n false\nend", "def position_taken?(position)\n !(@board[position.to_i] == \" \") \n end", "def position_taken?(board, position)\n if (board[position.to_i - 1] == \"X\" || board[position.to_i - 1] == \"O\")\n return true\n elsif !(board[position.to_i - 1] == \" \" || board[position.to_i - 1] == nil )\n return true\n else\n return false\n end\nend", "def position_taken?(board, index_to_validate)\n if (board[index_to_validate] == \"X\" || board[index_to_validate] == \"O\")\n return true\n end\n return false # NOTE: if we arrive here, the position is definitely not taken\nend", "def position_taken?(board, idx)\n\tif board[idx] == nil || board[idx] == \"\" || board[idx] == \" \" \n\t\tfalse\n\telsif board[idx] == \"X\" || board[idx] == \"O\"\n\t\ttrue\n\telse\n\t\tfalse\n\tend\nend", "def valid_move?(index)\n\t\tindex < 9 && !position_taken?(index) ? true : false\n\tend", "def position_taken?(index)\n if (@board[index] == \" \")\n return false\n else\n return true\n end\n end", "def position_taken?(board, position)\n value = position.to_i - 1\n if board[value] == \"X\" || board[value] == \"0\"\n true\n end\nend", "def position_taken? index_position \n board[index_position] != \" \"\n end", "def position_taken?(board, location)\n board[location] != \" \" && board[location] != \"\"\n end", "def position_taken?(board,position)\n return true if board[position]==\"X\" || board[position]==\"O\"\n return false\nend", "def position_taken? (board,index)\n if ( board[index] == \"X\" || board[index] == \"O\" )\n return true\n else\n return false\n end\nend", "def position_taken?(board, position)\n\tif board[position] == \" \" || board[position] == \"\" || board[position] == nil \n\t\treturn true\n\telse board[position] == \"O\" || \"X\"\n\t\treturn false\n\tend\nend", "def position_taken?(board, position)\n\tif board[position] == \" \" || board[position] == \"\" || board[position] == nil \n\t\treturn true\n\telse board[position] == \"O\" || \"X\"\n\t\treturn false\n\tend\nend", "def position_taken?(board, position)\n if (board[position] == \"X\" || board[position] == \"O\")\n true\n end\nend", "def position_taken?(location)\n !(board[location] == \" \" || board[location].nil?)\nend", "def position_taken?(board, index)\n board[index] === \"X\" || board[index] ===\"O\" ? true : false\nend", "def position_taken?(board, index)\n board[index] === \"X\" || board[index] ===\"O\" ? true : false\nend", "def position_taken?(board,index)\n if board[index] == \"X\" || board[index] == \"O\"\n TRUE\n else\n FALSE\n end\nend", "def position_taken?(board, position)\n if !board.empty? && board[position] && (board[position].include?(\"X\") || board[position].include?(\"O\"))\n true\n else\n false\n end\nend", "def position_taken?(input)\n @board[input] == \"X\" || @board[input] == \"O\"\n end", "def position_taken?(board, new_index)\n if board[new_index] == \"X\" || board[new_index] == \"O\"\n return true\n else\n return false\n end\nend", "def position_taken?(board, position)\n\ta = board[position.to_i - 1]\n\tif a != \" \"\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend", "def valid_move?(position)\n !taken?(position) && position.to_i >0 && position.to_i <=9\n end", "def position_taken?(board, position)\n board[position] == 'X' || board[position] == 'O'\nend", "def position_taken?(index)\n !(@board[index].nil? || @board[index] == \" \")\nend", "def position_taken?(index)\n !(@board[index].nil? || @board[index] == \" \")\nend", "def position_taken?(move_index)\r\n if @board[move_index] == \" \"\r\n false\r\n else\r\n true\r\n end\r\n end", "def position_taken?(board, index) \n\tboard[index] != \" \"\nend", "def position_taken?(board, index)\n board[index]== \"X\" || board[index] == \"O\"\nend", "def position_taken?(board, index)\n if (board[index] == \" \" || board[index] == \"\" || board[index] == nil)\n taken = false\n else\n taken = true\n end\ntaken\nend", "def position_taken?(board, position)\n if ((board[position] == \"X\") || (board[position] == \"O\" ))\n return true\n elsif board[position] == nil\n false\n else\n false\n end\nend", "def position_taken?(board, position)\n if (board[position]==\" \") || (board[position]==\"\")\n return false\n elsif (board[position]==\"X\") || (board[position]==\"O\")\n return true\n elsif (board[position]==nil)\n return false\n end\nend", "def position_taken?(board, position)\n if board[position] == \"X\" || board[position] == \"O\"\n true\n else\n false\n end\nend", "def position_taken?(board, position)\n if (board[position] == \"X\" || board[position] == \"O\")\n true\n else\n false\n end\n\nend", "def position_is_valid?(position)\r\n position.x < @col &&\r\n position.y < @row &&\r\n position.x >= 0 &&\r\n position.y >= 0\r\n end", "def position_taken?(board, position)\n\n position = board[position.to_i]\n if board[position.to_i] == \" \" || board[position.to_i] == \"\" || board[position.to_i] == nil\n false\n else board[position.to_i] == \"X\" || board[position.to_i] == \"O\"\n true\n end\nend", "def position_taken?(board, index)\n position = nil\n if (board[index] == \" \" || board[index] == \"\" || board[index] == nil)\n position = true\n else\n position = false\n end\n position\nend", "def position_taken?(board, position)\n taken = nil\n\n if (board[position] == \" \" || board[position] == \"\" || board[position] == nil)\n taken = false\n else\n taken = true\n end\n taken\nend", "def position_taken?(board, position)\n if board[position] == \"X\" || board[position] == \"O\"\n return true\n end\nend", "def position_taken?(board,position)\n if board[position]== \"\" || board[position]== \" \" || board[position]== nil\n return false\n\n elsif board[position]==\"X\" || board[position]==\"O\"\n return true\n end\nend", "def position_taken?(board, index)\n if board[index] == \"X\" || board[index] == \"O\"\n true\n else\n false\n end\nend", "def position_taken?(board, index)\n if board[index] == \"X\" || board[index] == \"O\"\n true\n else\n false\n end\nend", "def position_taken?(board, index)\n if board[index] == \"X\" || board[index] == \"O\"\n true\n else\n false\n end\nend", "def position_taken? (board, index)\n if (board[index] == \" \")\n false\n\n elsif (board[index] == \"X\") || (board[index] == \"O\")\n true\n\n else\n false\n\n end\n end", "def position_taken?(board,index)\n (!(board[index] == \" \" || board[index] == \"\" || !nil) || (board[index] == \"X\" || board[index] == \"O\"))\nend", "def position_taken?(board, index)\n if board[index] == \"X\" || board[index] == \"O\"\n return true\n else\n return false\n end\nend" ]
[ "0.8109093", "0.7775881", "0.7759322", "0.77533996", "0.77317727", "0.77210087", "0.77174985", "0.77020574", "0.77020574", "0.7670469", "0.7647033", "0.7645927", "0.76266325", "0.76205945", "0.7614181", "0.75997615", "0.75933087", "0.7582109", "0.7561027", "0.7550584", "0.75436395", "0.75265855", "0.752486", "0.751704", "0.7515149", "0.7512024", "0.75100297", "0.75063455", "0.74943674", "0.749059", "0.74902976", "0.74792445", "0.747113", "0.74683785", "0.7464724", "0.74621075", "0.7457209", "0.7452553", "0.7452397", "0.74511236", "0.74399054", "0.74366003", "0.74224675", "0.74140394", "0.74140394", "0.74111426", "0.7409231", "0.74004924", "0.739445", "0.7389338", "0.7386903", "0.7385979", "0.7385182", "0.73819697", "0.73781645", "0.736656", "0.7362565", "0.7360883", "0.73446876", "0.7342161", "0.733592", "0.73324937", "0.73294127", "0.73274016", "0.73273534", "0.732433", "0.73223996", "0.73223996", "0.7319619", "0.7313841", "0.7313775", "0.7313775", "0.73133564", "0.7306874", "0.73064816", "0.7306183", "0.730607", "0.7301754", "0.72976637", "0.72921205", "0.72921205", "0.7291154", "0.72894883", "0.72831833", "0.7279882", "0.7277215", "0.72770244", "0.7273872", "0.7273004", "0.72719467", "0.72716725", "0.72699577", "0.7265723", "0.7262511", "0.72600853", "0.7259444", "0.7259444", "0.7259444", "0.7259409", "0.7257208", "0.7256313" ]
0.0
-1
checks if move is on the board or if the position is taken
def valid_move?(board, position) position.between?(0, 8) && !position_taken?(board, position) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_move?(board, index)\n # Is the position taken?\n pos_taken = position_taken?(board, index)\n # Is the position on the board?\n on_board = index.between?(0, board.length - 1)\n # If position is open and on the board, return true,\n if !pos_taken && on_board\n return true\n else\n return false\n end\nend", "def valid_move?(board, position)\n !position_taken?(board, position) && position.between?(0,8)\nend", "def valid_move?(board, position)\n position_taken?(board, position) == false && position.between?(0, 8) ? true : false\nend", "def valid_move?(board, position)\n indexed_position = position.to_i - 1\n indexed_position.between?(0,8) && !position_taken?(board, indexed_position)\nend", "def valid_move? (board, position)\n position = position.to_i - 1\n (position.between?(0,8)) && (position_taken?(board, position) == false)\nend", "def valid_move?(board, position)\n position = position.to_i - 1\n if position.between?(0, 8) && !position_taken?(board, position)\n true\n end\nend", "def valid_move?(board,position)\n position=position.to_i-1\n if position.between?(0,8) && !position_taken?(board, position)\n true\n else\n false\n end\nend", "def valid_move?(board, position)\n position = (position.to_i - 1)\n\n if position.between?(0, 8) && !position_taken?(board, position)\n true\n else false\n end\nend", "def valid_move? (board, index)\n if index.between?(0, 8) && !position_taken?(board, index)\n true \n end \nend", "def valid_move?(board, index)\n index.between?(0, 8) && position_taken?(board, index) == false\n\nend", "def valid_move?(board, position)\n position = position.to_i - 1\n position_taken?(board, position) == false && position.between?(0,8) == true\nend", "def valid_move? move\n@board[move] == PIECE[:blank]\nend", "def valid_move?(board, position)\n if position_taken?(board, position) == false && position.to_i.between?(0,8)\n true\n else\n false\n end\n end", "def valid_move?(move)\n # Array of all posiible moves , check the board and map out the possible moves from there.\n end", "def valid_move?(board, position)\n if !(position_taken?(board, position)) && position.between?(0, 8)\n return true\n else\n return false\n end\nend", "def valid_move?(board, position)\n position.to_i.between?(1,9) && !position_taken?(board, position.to_i-1)\nend", "def valid_move?(board, position)\n position = position.to_i - 1\n if position_taken?(board, position)\n return false\n else\n if position.between?(0,8) && (board[position] != \"X\" || board[position] != \"O\")\n return true\n else\n return false \n end\n end\nend", "def legal_move?(board,from,to)\n\t\treturn false unless super(board,to)\n\t\tfrom_y = from[1]\n\t\tfrom_x = from[0]\n\t\tto_y = to[1]\n\t\tto_x = to[0]\n\t\t#when trying to move diagonally\n\t\tif from_x != to_x\n\t\t\t#checks colour of pawn\n\t\t\tif colour == \"white\"\n\t\t\t\t#checks only 1 vertical move away\n\t\t\t\tif (from_y-to_y) == 1\n\t\t\t\t\treturn true\n\t\t\t\telse\n\t\t\t\t\tputs \"No enemy pawn there\"\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif (to_y-from_y) == 1\n\t\t\t\t\treturn true\n\t\t\t\telse\n\t\t\t\t\tputs \"No enemy pawn there\"\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t#when trying to move straight\n\t\tif colour == \"white\"\n\t\t\tif from_y == 6\n\t\t\t\tif (from_y-to_y) <= 2 && board.get_piece(to) == \"_\"\n\t\t\t\t\treturn true\n\t\t\t\telse\n\t\t\t\t\tputs \"Can only move 1 or 2 spaces from here and or another piece already there\"\n\t\t\t\t\treturn false\n\t\t\t\tend\t\t\t\t\t\n\t\t\telse\n\t\t\t\tif (from_y-to_y) == 1 && board.get_piece(to) == \"_\"\n\t\t\t\t\treturn true\n\t\t\t\telse\n\t\t\t\t\tputs \"Can only move 1 space from here and or another piece already there\"\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\tif from_y == 1\n\t\t\t\tif (to_y-from_y) <= 2 && board.get_piece(to) == \"_\"\n\t\t\t\t\treturn true\n\t\t\t\telse\n\t\t\t\t\tputs \"Can only move 1 or 2 spaces from here and or another piece already there\"\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif (to_y-from_y) == 1 && board.get_piece(to) == \"_\"\n\t\t\t\t\treturn true\n\t\t\t\telse\n\t\t\t\t\tputs \"Can only move 1 space from here and or another piece already there\"\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def valid_move?(board,index)\n if index.between?(0,8) && position_taken?(board,index)\n true\n end\nend", "def position_taken?(board,move)\n if board[move]!=\" \"\n return false\n end\nreturn true\nend", "def position_taken?(board,pos)\n if board[pos.to_i]==\"X\" || board[pos.to_i] ==\"O\"\n return true\n else\n return false\n end\nend", "def valid_move?(board, i)\n if i.between?(0,8) && !position_taken?(board, i)\n true\n end\n end", "def valid_move?(board, position)\n # position = position.to_i \n position.to_i. between?(1, 9) && !position_taken?(board, position.to_i-1)\nend", "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index) #if the position isn't taken and is on the board, the move must be valid\nend", "def valid_move?(board, index)\r\n index.between?(0,8) && !position_taken?(board, index)\r\nend", "def valid_move?(board, position)\n position.to_i.between?(1,9) && !position_taken?(board,position.to_i-1)\n\nend", "def valid_move?(board,position)\n valid = nil\n if position >= 0 && position <=8\n case position_taken?(board,position)\n when true\n valid = false\n when false\n valid = true\n end\n end\n\n return valid\nend", "def possible_move?(coords)\n if @board.exists_at?(coords)\n piece = @board.at(coords)\n return (piece.nil? || piece.color != @current_color)\n end\n return false\n end", "def position_taken?(board, position)\n return false if valid_move?(board, position)\n return true unless valid_move?(board, position)\nend", "def valid_move?(board,index)\n index.between?(0,8) && !position_taken?(board,index)\nend", "def valid_move?(board, index)\n if index.between?(0, 8) && position_taken?(board, index) == false\n true\n else\n false\n end\nend", "def valid_move?(board, index)\n if index.between?(0, 8) && (position_taken?(board, index) == false)\n true\n elsif (index.between?(0,8) == false) || (position_taken?(board, index) == true)\n false\n end\nend", "def position_taken?(board, pos)\n if board[pos]==\"X\" || board[pos]==\"O\"\n taken = true\n else\n taken = false\n end\n taken\nend", "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\n end", "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\n end", "def valid_move? (board, index)\n if index.between?(0,8) && !position_taken?(board, index)\n true\n end\nend", "def valid_move? (board, index)\n index.between?(0, 8) && !position_taken?(board, index)\nend", "def valid_move?(board, index)\r\n if index.between?(0, 8) && ! position_taken?(board, index)\r\n return TRUE\r\n else \r\n return FALSE\r\n end\r\nend", "def valid_move? (board, index)\n def position_taken? (board, index)\n if board[index] == \"\" || board[index] == \" \" ||board[index] == nil\n return false\n else board[index] == \"O\" || board[index] == \"X\"\n return true\n end\n end\n\n def on_board? (index)\n if index.between?(0,8) == true\n return true\n else\n return false\n end\n end\n\n if (position_taken?(board, index) == false && on_board?(index) == true)\n return true\n else\n return false\n end\nend", "def valid_move?(board,index)\n if index.between?(0, 8) && !(position_taken?(board, index))\n true\n else \n false\n end\nend", "def valid_move?(board, index)\r\n index.between?(0, 8) && !position_taken(board, index) ? true : false \r\nend", "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board,index)\nend", "def position_taken?(board, position)\n if !board.empty? && board[position] && (board[position].include?(\"X\") || board[position].include?(\"O\"))\n true\n else\n false\n end\nend", "def valid_move?(board, index)\n if position_taken?(board, index)\n false\n elsif index > 8 || index < 0\n false\n else\n true\n end\nend", "def valid_move?(board, position)\n position = position.to_i - 1\n if position_taken?(board, position) == false && position.to_i.between?(0, 8)\n return true\nelsif position_taken?(board, position) == true\n return false\nelse \n return false\nend\nend", "def valid_move?(board,index)\n if position_taken?(board,index)\n false\n elsif index.between?(0, 8)\n true\n end\nend", "def valid_move?(board, index)\n index.between?(0, 8) && !position_taken?(board, index)\nend", "def valid_move?(board, index)\n index.between?(0, 8) && !position_taken?(board, index)\nend", "def valid_move?(board, index)\n index.between?(0, 8) && !position_taken?(board, index)\nend", "def taken?(position)\n #board position -1 because of test using range 1-9 (user input numbers)\n self.cells[position.to_i-1] == \"X\" || \n self.cells[position.to_i-1] == \"O\"\n end", "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend", "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend", "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend", "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend", "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend", "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend", "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend", "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend", "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend", "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend", "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend", "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend", "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend", "def valid_move?(board,index)\n if position_taken?(board,index) == false && index.between?(0,8)\n true\n end \n end", "def valid_move?(board, index)\nif index.between?(0,8) && !position_taken?(board, index)\n true\nelse\n false\nend\nend", "def valid_move?(board, index)\n if position_taken?(board, index) == true\n false\n elsif index > 8 || index < 0\n false\n else\n true\n end\nend", "def position_taken?(board, position)\n board[position] == 'X' || board[position] == 'O'\nend", "def position_taken?(board,position)\n return false if [\" \", \"\", nil].include?(board[position])\n return true if [\"X\", \"O\"].include?(board[position])\n raise \"#{board[position]} is not a valid move\"\nend", "def valid_move?(board, index)\n# binding.pry\n index.between?(0,8) && !position_taken?(board, index)\nend", "def valid_move?(board, index)\n if index.between?(0,8) && !position_taken?(board, index)\n true\n end\nend", "def taken?(move)\n \t# Subtract 1 from move to correctly correspond with index\n if @board[move - 1] == \"X\" || @board[move - 1] == \"O\"\n return true\n end\n return false\n end", "def valid_move? (board, index)\n if index.between?(0,8) && position_taken?(board, index) == true\n #position is between 0-8 (1-9) AND the position is available (#position_taken)\n true\n else\n false\n end\nend", "def valid_move?(board, index)\n if board[index].nil? || position_taken?(board, index) || board[index] == \"X\" || board[index] == \"O\"\n false\n else\n true\n end\nend", "def valid_move?(board, position)\n position = position.to_i\n return false if !valid_position?(position)\n return false if position_taken?(board, position)\n return true\nend", "def valid_move?(board,pos)\n if !position_taken?(board,pos.to_i-1) && pos.to_i.between?(1,9)\n return true\n elsif position_taken?(board,pos.to_i-1) && pos.to_i.between?(1,9)\n return false\n end\nend", "def valid_move?(board,position)\n if position.to_i.between?(1,9) && !position_taken?(board,position.to_i-1)\n true\n else\n end\nend", "def valid_move?(board,index)\n if index.between?(0,8) && !position_taken?(board,index)\n true\n else\n false\n end\n\nend", "def valid_move?(board,index)\n if index.between?(0,8)\n return !position_taken?(board,index)\n end\n end", "def position_taken?(board, position)\n position = position.to_i - 1\n if board[position] == \"X\" || board[position] == \"O\"\n true\n end\nend", "def valid_move?(board, index)\nif index.between?(0,8) && !position_taken?(board, index)\n true\n else\n false\n end\nend", "def position_taken?(board, position)\n if (board[position] == \"X\" || board[position] == \"O\")\n true\n end\nend", "def valid_move?(board, index)\n if index.between?(0, 8) && !position_taken?(board, index)\n true\n else\n false\n end\nend", "def position_taken?(board, position)\n if !(board[position.to_i - 1] == \"X\" || board[position.to_i - 1] == \"O\")\n return true\n else \n return false\n end\nend", "def valid_move?(board, index)\n if position_taken?(board, index)\n false\n elsif index.between?(0, 8)\n true\n end\nend", "def valid_move?(board,index)\n if position_taken?(board,index) == FALSE && index.between?(0, 8) == TRUE\n TRUE\n else\n FALSE\n end\nend", "def position_taken?(board, position)\n board[position] == \"X\" || board[position] == \"O\"\nend", "def position_taken?(board, position)\n board[position] == \"X\" || board[position] == \"O\"\nend", "def valid_move?(board, position)\n index = position.to_i\n if position_taken?(board, index) == false && index.between?(0, 8)\n return true\n else\n return false\n end\nend", "def valid_move?(board,index)\n if index < 0\n false\n else\n if index > 8\n false\n else\n !position_taken?(board,index)\n end\n end\nend", "def valid_move?(board, index)\n if index.between?(0, 8) && position_taken?(board, index) == false\n true\n else position_taken?(board, index) == true\n nil\n end\nend", "def position_taken?(board,position)\n return true if board[position]==\"X\" || board[position]==\"O\"\n return false\nend", "def valid_move?(board, ix)\n if position_taken?(board, ix) == false && move_val?(ix) == true\n return true\n else\n false\n end\nend", "def move_valid?(pos)\n return false unless board.in_bounds?(pos)\n return false if board.occupied?(pos) && board.grid[pos[0]][pos[1]].color == self.color\n true\n end", "def valid_move?(board, index)\n if index.between?(0,8)\n if !position_taken?(board, index)\n true\n end\n end\nend", "def valid_move?(board, index)\n if !(index.between?(0,8))\n return false\n end\n if (position_taken?(board,index))\n return false\n end\n true\nend", "def position_taken?(board, position)\n if board[position] == \"X\" || board[position] == \"O\"\n return true\n end\n false\nend", "def valid_move?(board, index)\n if index.between?(0, 8) and not position_taken?(board, index)\n return true\n else\n return false\n end\nend", "def valid_move?(board, index)\n position_taken?(board, index) == false && index.between?(0, 8) ? true : false\nend", "def valid_move?(board, index)\n return index.between?(0,8) && !position_taken?(board, index)\nend", "def position_taken?(board, position)\n if board[position] == \"X\" || board[position] == \"O\"\n true\n else\n false\n end\nend" ]
[ "0.80792993", "0.8067555", "0.8067508", "0.7998108", "0.7997551", "0.7996043", "0.79471105", "0.7938306", "0.7933517", "0.79316616", "0.79257625", "0.7919123", "0.7918614", "0.79119545", "0.7911005", "0.7904976", "0.78985584", "0.7890923", "0.7885436", "0.7882803", "0.78803045", "0.7873787", "0.78703094", "0.78689677", "0.7866926", "0.7860303", "0.7858937", "0.7851716", "0.7849128", "0.7848451", "0.7844489", "0.78373206", "0.7834497", "0.7832459", "0.7832459", "0.78313065", "0.7831105", "0.7820129", "0.782", "0.7818278", "0.7817333", "0.781307", "0.7806546", "0.78045803", "0.7799977", "0.7795922", "0.7795399", "0.7795399", "0.7795399", "0.77931905", "0.77901745", "0.77901745", "0.77901745", "0.77901745", "0.77901745", "0.77901745", "0.77901745", "0.77901745", "0.77901745", "0.77901745", "0.77901745", "0.77901745", "0.77901745", "0.7782525", "0.77815735", "0.7781516", "0.77805674", "0.77805614", "0.7779814", "0.7779434", "0.7776472", "0.77761614", "0.7772043", "0.7767274", "0.77670914", "0.7766385", "0.77658075", "0.77656263", "0.77651113", "0.7765064", "0.77611786", "0.77557296", "0.7751715", "0.7749778", "0.77457994", "0.7745214", "0.7745214", "0.77448326", "0.7744453", "0.77429444", "0.7742617", "0.77389497", "0.7732046", "0.7726495", "0.7724581", "0.7720849", "0.77197576", "0.7717597", "0.77137846", "0.77121854" ]
0.8196325
0
counts the number of turns that have been taken
def turn_count(board) count = 0 board.each do |index| index == "X" || index == "O" ? count += 1 : nil end return count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def turn_count\n x_turns = @board.count(\"X\")\n o_turns = @board.count(\"O\")\n turn_count = x_turns + o_turns\n return turn_count\nend", "def turn_count\n turns = 0\n @board.each do |spot|\n if spot==\"X\" || spot==\"O\"\n turns += 1\n end\n end\n return turns\n end", "def turn_count(board)\n counter = 0\n board.each do | move |\n if move == \"X\" || move == \"O\"\n puts counter += 1\n end\n end\n counter #This should be the number of turns\nend", "def turn_count()\n count = 0\n index = 0\n loop do\n if position_taken?(index)\n count += 1\n end\n index += 1\n if index > 9 \n break\n end\n end\n return count\n end", "def turn_count()\n turns = 0\n \n @board.each do |position|\n if position.eql?(\"X\") || position.eql?(\"O\")\n turns += 1\n end\n end\n \n return turns\n end", "def turn_count\n count = 0\n @board.each do |space|\n if space == \"X\" || space == \"O\"\n count +=1\n end\n end\n count\n end", "def turn_count\n turns_played = 0\n @board.each do |index|\n if index != \" \"\n turns_played += 1\n end\n end\n return turns_played\n end", "def turn_count\n counter = 0\n @board.each do |space|\n if space == \"X\" || space == \"O\"\n counter += 1\n end\n end\n counter\n end", "def turn_count\n @board.count{|token| token == \"X\" || token == \"O\"}\n end", "def turn_count\n counter = 0\n @board.each do |index_taken|\n if index_taken == \"X\" || index_taken == \"O\"\n counter += 1\n end\n end\n counter\n end", "def turn_count\n @board.count{|token| token == \"X\" || token == \"O\"} # << tweaked\n end", "def turn_count\n\t\[email protected]{|token| token == \"X\" || token == \"O\"}\n\tend", "def turn_count\n num_turns = 0\n @board.each do |space|\n if space == \"X\" || space == \"O\"\n num_turns += 1\n end\n end\n return num_turns\n end", "def turn_count \n count = 0\n @board.each do |board_item|\n if board_item != \" \"\n count += 1\n end\n end\n count\n end", "def turns(count)\n puts count\nend", "def turn_count\n @board.count{|value| (value==\"X\" || value==\"O\")}\n #counter = 0\n #@board.each do |value|\n # if value ==\"X\" || value == \"O\"\n # counter+=1\n # end\n #end\n #counter\n end", "def turn_count\r\n turn_count = 0\r\n @board.each do |space|\r\n if space != \" \"\r\n turn_count += 1\r\n end\r\n end\r\n turn_count\r\n end", "def turn_count\n count = 0\n @board.each do |player|\n if player == 'X' || player == 'O'\n count += 1\n end\n end\n return count\n end", "def turn_count\n turns = 0\n @board.each do |position|\n if position == \"X\" || position == \"O\"\n turns += 1\n end\n end\n return turns\n end", "def turn_count\n @board.count{|token| token == \"X\" || token == \"O\"}\n end", "def number_of_turns_taken(board)\r\n counter = 0\r\n board.each do |token|\r\n if token == \"X\" || token ==\"O\"\r\n counter +=1\r\n end\r\n end\r\n counter\r\nend", "def turn_count\n counter = 0\n @board.each do |positions|\n if positions == \"X\" || positions == \"O\"\n counter += 1\n end\n end\n counter.to_i\n end", "def turn_count\r\n turns_so_far = 0\r\n @board.each do |arr_item|\r\n if arr_item == \"X\" || arr_item ==\"O\"\r\n turns_so_far += 1\r\n end\r\n end\r\n return turns_so_far\r\n end", "def turn_count\n count = 0\n @board.each do |token|\n if token.downcase == \"x\" || token.downcase == \"o\"\n count += 1\n end\n end\n count\nend", "def turn_count\n turns = @board.count { |i| i == 'X' || i == 'O' }\n turns\nend", "def turn_count\n @board.count{|position| position != \" \"}\n end", "def turn_count(board)\n\n\toccupied_spaces = 0\n\n\tcounter = 0\n\twhile counter < board.size\n\t if position_taken?(board, counter)\n\t\t occupied_spaces += 1\t\t \nend \ncounter += 1\nend\noccupied_spaces\nend", "def turn_count(board)\n turn_counter = 0\n (board.length).times do |i|\n if position_taken?(board, i)\n turn_counter += 1\n end\n end\n\n return turn_counter\nend", "def turn_count\n turns = 0\n @board.each do |position| #can use .count here: board.count{|token| token == \"X\" || token == \"O\"}\n if position == \"X\" || position == \"O\"\n turns += 1\n end\n end\n turns\n end", "def turn_count(board)\n counter = 0;\n board.each do |slot|\n if(slot == \"X\" || slot == \"O\")\n counter += 1;\n end\n end\n return counter;\nend", "def turn_count\n counter = 0\n @board.each do |position|\n\n if position == \"X\" || position == \"O\"\n counter += 1\n end\n\n end\n counter\n end", "def turn_count()\n current_turn = 0\n @board.each do |space|\n if space != \" \"\n current_turn += 1\n end\n end\n return current_turn\n end", "def turn_count\n turn = @board.reject {|position| position == \" \"}\n turn.size\n end", "def tbs_turn_count\n $game_troop.turn_count\n end", "def turn_count(board)\n count = 0;\n board.each do |square|\n if square == \"X\" || square == \"O\"\n count +=1\n end\n end\n return count #return number of turns that have been played\nend", "def turn_count\n count = 0\n cells.each {|pos| count += 1 if pos == \"X\" || pos == \"O\"}\n count\n end", "def turn_count\n @board.count{|i| i != \" \"}\n end", "def turn_count(board)\n count = 0\n\n board.each_with_index do |location, index|\n if position_taken?(board, index)\n count = count + 1\n end\n end\n\n count\nend", "def turn_count\n\t\tcells.count {|cell| cell == \"X\" || cell == \"O\"}\t\n\tend", "def turn_count(board)\r\n #returns the number of of turns that have been played\r\n counter = 0\r\n board.each do|element|\r\n if (element == \"X\") || (element == \"O\")\r\n counter += 1 \r\n end\r\n end\r\n return counter\r\nend", "def turn_count\n counter = 0\n @board.each do|element|\n\tif (element == \"X\") || (element == \"O\")\n \tcounter += 1\n\tend\n end\n return counter\nend", "def turn_count\n counter = 0\n @board.each do|position|\n if position == \"X\" || position == \"O\"\n counter += 1 \n end\n end\n return counter\nend", "def turn_count(board)\n turns = 0\n board.each do |spot|\n if spot==\"X\" || spot==\"O\"\n turns += 1\n end\n end\n return turns\nend", "def turn_count(board)\n spaces_taken = 0\n board.each do |board_space|\n if board_space == \"X\" || board_space == \"O\"\n spaces_taken += 1 \n end\n end\n return spaces_taken\nend", "def number_correct\n turns.count do |each_turn|\n each_turn.correct?\n end\n end", "def turn_count(board)\n #this counter keeps track of how many occupied spcaes there are\n counter = 0\n board.each do |turn|\n if turn == \"X\" || turn == \"O\"\n counter += 1\n end\n end\nreturn counter\nend", "def turn_count\n self.cells.count(\"X\") + self.cells.count(\"O\")\n end", "def turn_count\n cells.count{|token| token == \"X\" || token == \"O\"}\n end", "def turn_count(board)\n counter = 0\n board.each do |turns|\n if turns == \"X\" || turns == \"O\"\n counter += 1\n end\n end\n counter\nend", "def turn_count\n counter = 0\n @cells.each do |cell|\n if cell != \" \"\n counter += 1\n end\n end\n counter\n end", "def turn_count\n counter = 0\n cells.each do |index|\n if index != \" \"\n counter += 1\n end\n end\n counter\n end", "def turn_count(board)\n num_of_turns = 0\n board.each do |spot|\n if (spot == 'X' || spot == 'O')\n num_of_turns += 1\n end\n end\n num_of_turns\nend", "def turn_count(board)\n count = 0\n board.each do |space|\n if (space == 'X' || space == 'O')\n count += 1\n end\n end\n return count\nend", "def turn_count(board)\n counter = 0\n board.each do |box|\n if box == \"X\" || box == \"O\"\n counter += 1\nend\nend\n return counter\nend", "def turn_count(cells = @cells)\n cells.count {|taken| taken == \"X\" || taken == \"O\"}\n end", "def turn_count(board)\n count = 0\n board.each do |occupied|\n if occupied == \"X\" || occupied == \"O\"\n #if count is =< to 9\n count = count + 1\n end\n end\n return count\nend", "def turn_count\n cells.count{ |space| space ==\"X\" || space ==\"O\" }\n end", "def turn_count (board)\n counter = 0\n board.each do |space|\n if space == \"X\" || space == \"O\"\n counter += 1\n end\n end\n return counter\nend", "def turn_count(board)\n turn_count = 0\n \n board.each do |counter|\n if counter == \"X\" || counter == \"O\"\n turn_count += 1\n end\n end\n \n turn_count\n end", "def turn_count\n count = 0\n @cells.each do |element|\n count += 1 if element != \" \"\n end\n count\n end", "def number_correct\n count_of_correct_turns = 0\n\n @turns.each do |turn|\n if turn.correct? == true\n count_of_correct_turns += 1\n end\n end\n count_of_correct_turns\n end", "def turn_count(board)\n count=0\n board.each do |position|\n if(position==\"X\"||position==\"O\")\n count+=1\n end\n end\n return count\nend", "def turn_count\n cells.count {|value| value == \"X\" || value == \"O\"}\n end", "def turn_count(board)\n counter = 0\n board.each do |count_turn|\n if count_turn == \"X\" || count_turn == \"O\"\n counter += 1\n end\n end\n counter\nend", "def turn_count(board)\n turns = 0\n board.each do | space |\n if space == \"X\" || space == \"O\"\n turns += 1\n end\n end\n return turns\nend", "def turn_count(board)\n counter = 0\n board.each do |move|\n if move == \"X\" || move == \"O\"\n counter += 1\nend\nend\ncounter\nend", "def turn_count(board)\n counter = 0\n board.each do |turn|\n if turn == \"X\" || turn == \"O\"\n counter +=1\n end\n end\n return counter\nend", "def turn_count(board)\n counter = 0\n board.each do |space|\n if space == \"X\" || space == \"O\";\n counter += 1;\n end\n end\n counter\nend", "def turn_count(board)\n counter = 0\n board.each do |space|\n if space == \"X\" || space == \"O\"\n counter += 1\n end\n end\n return counter\nend", "def turn_count(board)\n count = 0\n board.each do |entry|\n if (entry == \"X\" || entry == \"O\")\n count += 1\n end\n end\n count\nend", "def turn_count(board)\n counter = 0\n board.each do |token|\n if token == \"X\" || token == \"O\"\n counter += 1\n end\n end\n counter\nend", "def turn_count\r\n cells.count {|cell| cell == \"X\" || cell == \"O\"}\r\n end", "def turn_count\n cells.count {|cell| cell == \"X\" || cell == \"O\"}\n end", "def turn_count\n cells.count { |cell| cell == \"X\" || cell == \"O\" }\n end", "def turn_count(board)\n counter = 0\n board.each do |turn|\n if turn == \"X\" || turn == \"O\"\n counter += 1\n puts \"#{counter}\"\n end\n end\n counter\nend", "def turn_count(board)\n turn_counter = 0\n board.each do |turn|\n if turn == \"X\" || turn == \"O\"\n turn_counter += 1\n end\n end\n turn_counter\nend", "def turn_count(board)\n # We need a variable that establishes an initial value, otherwise, it won't\n # know where to start\n counter = 0\n board.each do |character|\n if character == \"X\" || character == \"O\"\n counter += 1\n else\n end\n end\n# This return is necessary because methods NEED to return something (tell us what\n# it is doing, instead of just telling us it does know the answer)\n return counter\nend", "def turn_count(board)\n # We need a variable that establishes an initial value, otherwise, it won't\n # know where to start\n counter = 0\n board.each do |character|\n if character == \"X\" || character == \"O\"\n counter += 1\n else\n end\n end\n# This return is necessary because methods NEED to return something (tell us what\n# it is doing, instead of just telling us it does know the answer)\n return counter\nend", "def turn_count(board)\n count=0\n board.each do |pos|\n if(pos==\"X\"||pos==\"O\")\n count+=1\n end\n end\n count\nend", "def turn_count #\[email protected]{|token| token == \"X\" || token == \"O\"}\nend", "def turn_count(board)\n count= 0\n board.each do |token|\n if token == \"X\" || token == \"O\"\n count +=1\n end\n end\nreturn count\nend", "def turn_count(board)\n counter = 0\n board.each do |q| \n if q != \" \"\n counter += 1\n #if q == \"X\" \n #count_x = count_x + 1 \n#elsif q == \"O\"\n #count_o = count_o + 1 \nend\nend\n#return count_x\n#return count_o\nreturn counter\nend", "def turn_count(board)\n count = 0\n board.each do |value|\n if value ==\"X\" || value == \"O\"\n count +=1\n end\n end\n return count\nend", "def turn_count(board)\r\n counter = 0\r\n board.each do |token|\r\n if token == \"X\" || token ==\"O\"\r\n counter +=1\r\n end\r\n end\r\n counter\r\nend", "def turn_count(board)\n board.count {|token| token == \"X\" || token == \"O\"}\n end", "def turn_count(board)\n counter = 0\n board.each do |board_element|\n if board_element == \"X\" || board_element == \"O\"\n counter += 1\n # puts \"Board element is: #{board_element}. Occupied elements are #{counter}\"\n end\n end\n return counter\nend", "def turn_count(board)\n x_counter = 0\n o_counter = 0\n board.each do |spot|\n\n if spot == \"X\"\n x_counter += 1\n\n elsif spot == \"O\"\n o_counter += 1\n end\n end\n\nreturn x_counter + o_counter\nend", "def turn_count(board)\n counter = 0\n turns = 0\n board.each do |idx|\n if idx != \" \" && idx != \"\"\n turns += 1\n end\n counter += 1\n end\n return turns\nend", "def turn_count\n #@cells.select {|cell| cell == \"X\" || cell == \"O\"}.size\n counter = 0\n @cells.each do |cell|\n if cell != \" \" && cell != \"\"\n counter += 1\n end\n end\n counter\n end", "def turn_count(board)\ncounter = 0\nboard.each do |board_x|\n if board_x == \"X\" || board_x == \"O\"\ncounter += 1\n end\n end\nreturn counter\nend", "def number_correct\n @turns.count do |turn|\n turn.correct?\n end\n end", "def turn_count(board)\n play_count = 0\n board.each do |play|\n if play == \"X\" || play == \"O\"\n play_count += 1\n end\n end\n play_count\nend", "def turn_count(board)\n turn_counter = 0\n board.each do |spot|\n if spot == \"X\" || spot.upcase == \"O\"\n turn_counter +=1\n end\n end\n return turn_counter\nend", "def turn_count #counts occupied positions!\n turn = 0 #start at position 0.\n @board.each do |index| #iterating through each spot on the board. Is it occupied?\n if index == \"X\" || index == \"O\" #if there is an X or O in that spot,\n turn += 1 #then you must turn!\n end\n end\n return turn #if there is not an X or O in that spot, take your turn and put your X or O there.\nend", "def turn_count(board)\n counter = 0\n board.each do |element|\n if element == \"O\" || element == \"X\"\n counter += 1\n end\n end\n return counter\nend", "def turn_count(board)\n counter = 0\n board.each do |index|\n if (index == \"X\" or index == \"O\")\n counter+=1\n end\n end\n return counter\nend", "def turn_count(board)\n\n count = 0\n board.each do |cell|\n if cell == \"X\" || cell == \"O\"\n count += 1\n end\n end\n \n return count\nend", "def turn_count(board)\n board.count{|token| token == \"X\" || token == \"O\"}\nend", "def turn_count(board)\n count = 0\n board.each do |cell|\n if cell == \"X\" || cell == \"O\"\n count += 1\n end\n end\n return count\nend", "def turn_count(board)\n counter = 0\n board.each do |i|\n if i == \"X\" || i == \"O\"\n counter += 1\n end\n end\n puts counter\n return counter\nend" ]
[ "0.7852378", "0.78406787", "0.7825711", "0.7753982", "0.771505", "0.7713799", "0.7707615", "0.7705293", "0.7696642", "0.76965386", "0.76959246", "0.768735", "0.7686482", "0.7680617", "0.76797384", "0.76612693", "0.7659563", "0.7654922", "0.7646134", "0.7642822", "0.7636247", "0.7630721", "0.7608335", "0.75787324", "0.7527696", "0.7519895", "0.7516469", "0.7515822", "0.7512792", "0.7500833", "0.7475466", "0.7465807", "0.74641806", "0.74621296", "0.7454971", "0.74237907", "0.7423665", "0.7399793", "0.7386692", "0.73864037", "0.73739386", "0.7341462", "0.7335649", "0.7330174", "0.73167646", "0.7295409", "0.728001", "0.72782886", "0.7268458", "0.7259811", "0.7255118", "0.7246821", "0.7236723", "0.72343194", "0.72203845", "0.7219727", "0.72061455", "0.7204776", "0.72001654", "0.7198216", "0.7188447", "0.7186161", "0.7178443", "0.7175232", "0.7168561", "0.71681374", "0.7164669", "0.7164271", "0.71620077", "0.7149289", "0.714377", "0.7142444", "0.714005", "0.71399564", "0.7139447", "0.7126315", "0.71217924", "0.71217924", "0.71182185", "0.7109963", "0.7108766", "0.7091672", "0.709098", "0.708615", "0.708577", "0.7072236", "0.70446736", "0.70387894", "0.7037431", "0.703635", "0.7030914", "0.70200443", "0.70131654", "0.7009744", "0.7007998", "0.7006965", "0.69812626", "0.69811666", "0.69673055", "0.6956803" ]
0.72318727
54
determines the current player (X or O) because X always goes first, turn_count will always be uneven before X's go
def current_player(board) count = turn_count(board) if count.even? return "X" else return "O" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_player\r\n turn_count\r\n if turn_count % 2 == 0\r\n return \"X\"\r\n else\r\n return \"O\"\r\n end\r\n end", "def current_player\n turn_count == 0 || turn_count % 2 == 0 ? \"X\" : \"O\"\n end", "def current_player\n turn = turn_count\n if turn%2 == 0\n return \"X\"\n else\n return 'O'\n end\n end", "def current_player\n turn_count.even? ? \"X\" : \"O\"\n end", "def current_player\n turn_count.even? ? \"X\" : \"O\"\n end", "def current_player\r\n if self.turn_count == 0\r\n return \"X\"\r\n elsif self.turn_count.odd?\r\n return \"O\"\r\n else\r\n return \"X\"\r\n end\r\n end", "def current_player\n turn_count%2==0 ? \"X\" : \"O\"\n end", "def current_player()\n # Assume player X goes first\n return turn_count() % 2 == 0 ? \"X\" : \"O\"\n end", "def current_player\n turn_count.even? ? \"X\" : \"O\"\n end", "def current_player\n turn_count.even? ? \"X\" : \"O\"\n end", "def current_player\n turn_count.even? ? \"X\" : \"O\"\n end", "def current_player\n turns_played = turn_count()\n if turns_played % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\n end", "def current_player(board)\n #is turn count divisible by 2 then return X, if not, return O. \n turn_count(@board) % 2 == 0? \"X\" : \"O\"\n end", "def current_player\r\n if turn_count % 2 != 0\r\n return \"O\"\r\n else\r\n return \"X\"\r\n end\r\n end", "def current_player\n\n @number = turn_count\n\n if (@number % 2 == 0)\n return \"X\"\n else\n return \"O\"\n end\n\n end", "def current_player()\n current_turn = turn_count()\n if current_turn == 0 || current_turn % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\n end", "def current_player\n return turn_count%2==0 ? \"X\" : \"O\"\n end", "def current_player\n return turn_count.even? ? \"X\" : \"O\"\n end", "def current_player\n if turn_count % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\n end", "def current_player\n turn_count.even? ? \"X\" : \"O\"\n end", "def current_player \n turn_count % 2 == 0 ? \"X\" : \"O\"\n end", "def current_player\n turn_count.even? ? \"X\" : \"O\"\n\n end", "def current_player\n turn_count \n if turn_count%2 != 0 \n \"O\"\n else\n \"X\"\n end\nend", "def current_player\n turn_count % 2 == 0 ? \"X\" : \"O\"\n end", "def current_player\n turn_count % 2 == 0 ? \"X\" : \"O\"\n end", "def current_player\n turn_count % 2 == 0 ? \"X\" : \"O\"\n end", "def current_player\n turn_count % 2 == 0 ? \"X\" : \"O\" # << tweaked\n end", "def current_player\n x_count = self.board.cells.count {|token| token == \"X\"}\n o_count = self.board.cells.count {|token| token == \"O\"}\n if (x_count + o_count).even?\n player_1\n elsif (x_count + o_count).odd?\n player_2\n end\n end", "def current_player(board)\n if turn_count(board) == 0\n return \"X\"\n elsif\n turn_count(board) % 2 == 0 \n return \"X\"\n else\n return \"O\"\n end \n end", "def current_player(board)\n if turn_count(board) == 0\n return \"X\"\n elsif\n turn_count(board) % 2 == 0 \n return \"X\"\n else\n return \"O\"\n end \n end", "def get_next_turn\n\n # Using an X?\n if @current_player == 'X'\n\n # Yes, change to O\n @current_player = 'O'\n\n else\n\n # No, change to X\n @current_player = 'X'\n\n end\n\n return @current_player\n\n end", "def current_player\n\t\tturn_count % 2 == 0 ? \"X\" : \"O\"\n\tend", "def current_player\n turn_count % 2 == 0 ? \"X\" : \"O\"\nend", "def current_player\n player = nil\n if turn_count() % 2 == 0\n player = 'X'\n else\n player = 'O'\n end\n return player\n end", "def current_player\n if turn_count % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\nend", "def current_player(board)\n count = turn_count(board)\n return count.odd? ? \"O\" : \"X\"\nend", "def current_player\n if (turn_count % 2) == 0\n player = \"X\"\n elsif (turn_count % 2) != 0\n player = \"O\"\n end\nend", "def current_player(board)\n turn = turn_count(board)\n if turn == 0\n return \"X\"\n elsif turn == 1\n return \"O\"\n elsif turn == 2\n return \"X\"\n end\nend", "def current_player(board)\n turn_count(board).even? ? \"X\" : turn_count(board).odd? ? \"O\" : \"X\"\n end", "def current_player(board)\n turn_count(board) % 2 == 0 ? \"X\" : \"O\"\n end", "def current_player\n (turn_count % 2 == 0)? \"X\" : \"O\"\nend", "def current_player(board)\n \n num_turns = turn_count(board)\n \n if num_turns % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\n\nend", "def current_player\n if turn_count % 2 == 0\n \"X\"\n else\n \"O\"\n end\nend", "def current_player\n if turn_count % 2 == 0\n \"X\"\n else\n \"O\"\n end\nend", "def current_player(board)\n next_turn = turn_count(board)\n if next_turn % 2 == 0 \n return 'X'\n else \n return 'O'\n end\nend", "def current_player\n if board.turn_count.odd?\n player_2\n elsif board.turn_count.even?\n player_1\n end\n end", "def current_player(board)\n count = turn_count(board)\n count.even? ? \"X\" : \"O\"\nend", "def current_player(board)\n if turn_count(board) % 2 == 0\n return \"X\" #even turn count == X\n end \n return \"O\" #odd turn count == O \nend", "def current_player(board)\n current_turn = turn_count(board)\n if current_turn == 0 || current_turn % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\nend", "def current_player(board)\n if turn_count(board) % 2 == 0\n \"X\"\n elsif turn_count(board) % 2 == 1\n \"O\"\n end\nend", "def current_player(board)\n#player = \"X\"\nif (turn_count(board) % 2) == 0\n player = \"X\"\nelsif (turn_count(board) % 2) != 0\n player = \"O\"\nend\nend", "def current_player(board)\n return turn_count(board)%2==0 ? \"X\" : \"O\"\nend", "def current_player(board)\n counter = turn_count(board)\n if counter % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\nend", "def current_player(board)\n return turn_count(board) % 2 == 0 ? \"X\" : \"O\";\nend", "def current_player(board)\n turn_count(board).odd? ? \"O\" : \"X\"\nend", "def current_player(board)\n turn_count(board).odd? ? \"O\" : \"X\"\nend", "def current_player(board)\n if turn_count(board).odd?\n \"O\"\n else\n \"X\"\n end\nend", "def current_player(board)\n count = turn_count(board)\n \n player = count.even? ? \"X\" : \"O\"\n \n return player\nend", "def current_player(board)\n if turn_count(board)&1==0 || turn_count(board) == 0;\n return \"X\"\n else\n return \"O\"\n end\nend", "def current_player(board)\n if (turn_count(board) % 2) == 0\n player = \"X\"\n elsif (turn_count(board) % 2) != 0\n player = \"O\"\n end\nend", "def current_player(board)\nif turn_count(board) % 2 == 0\n \"X\"\nelsif turn_count(board) % 2 == 1\n \"O\"\n end\nend", "def current_player\n turn_count.even? ? \"X\" : \"O\"\nend", "def current_player(board)\n counter_turn = turn_count(board)\n if counter_turn % 2 == 0\n \"X\"\n else\n \"O\"\n end\n end", "def current_player(board)\n\tcount = turn_count(board)\n\tcount % 2 == 0 ? \"X\" : \"O\"\nend", "def current_player(board)\n return turn_count(board).odd? ? \"O\" : \"X\"\n\nend", "def current_player(board)\n turns = turn_count(board)\n if turns.odd?\n return \"O\"\n else\n return \"X\"\n end\nend", "def current_player(board)\n turns = turn_count(board) % 2\n if turns == 0\n return \"X\"\n else\n return \"O\"\nend\nend", "def current_player(board)\n if turn_count(board) % 2 ==0\n return \"X\"\n else\n return \"O\"\n end\nend", "def current_player(board)\n turn_count(board)\n if turn_count(board) % 2 == 0\n \"X\"\n else\n \"O\"\n end\nend", "def current_player(board)\r\n (turn_count(board) % 2 == 0)? \"X\" : \"O\"\r\nend", "def current_player(board)\n if turn_count(board) % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\nend", "def current_player(board)\n if turn_count(board) % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\nend", "def current_player(board)\n if turn_count(board) % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\nend", "def current_player(board)\n if turn_count(board) % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\nend", "def current_player(board)\n if turn_count(board) % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\nend", "def current_player(board)\n if turn_count(board) % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\nend", "def current_player(board)\n if turn_count(board) % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\nend", "def current_player(board)\n if turn_count(board) % 2 == 0\n return \"X\"\n else \n return \"O\"\n end\nend", "def current_player(board)\n turn_count(board) % 2 == 0 ? \"X\" : \"O\"\nend", "def current_player(board)\n turn_count(board) % 2 == 0 ? \"X\" : \"O\"\nend", "def current_player(board)\n turn_count(board) % 2 == 0 ? \"X\" : \"O\"\nend", "def current_player(board)\n turn_count(board) % 2 == 0 ? \"X\" : \"O\"\nend", "def current_player(board)\n turn_count(board)%2 == 0 ? \"X\" : \"O\"\nend", "def current_player(board)\n turns=turn_count(board)\n if(turns%2==0)\n \"X\"\n else\n \"O\"\n end\nend", "def current_player(board)\n player = turn_count(board).even? ? \"X\" : \"O\"\nend", "def current_player(board)\n if turn_count(board).even?\n current_player = \"X\"\n else\n current_player = \"O\"\n end\nend", "def current_player(board)\n (turn_count(board) % 2 == 0) ? \"X\" : \"O\"\nend", "def current_player(board)\n if turn_count(board) % 2 == 0 \n \"X\"\n else\n \"O\"\n end\nend", "def current_player(board)\n current_pla = turn_count(board)\n if current_pla %2==0\n return \"X\"\n else\n return \"O\"\n end\n \nend", "def current_player(board)\n if (turn_count(board) % 2 == 0)\n return \"X\"\n elsif !(turn_count(board) % 2 == 0)\n return \"O\"\n end\nend", "def current_player(board)\n if turn_count(board)%2 == 0\n current_player = \"X\"\n else\n current_player = \"O\"\n end\n return current_player\nend", "def current_player(board)\n if turn_count(board) % 2 == 0\n \"X\"\n else\n \"O\"\n end\nend", "def current_player(board)\n current_player = turn_count(board) % 2 == 0 ? \"X\" : \"O\"\n\nend", "def current_player(board)\r\n if (turn_count(board) + 1) %2 == 0\r\n \"O\"\r\n else\r\n \"X\"\r\n end\r\nend", "def current_player #player 1 goes first because 0 is even. so first turn is player 1, second is player 2, 3rd is player 1\n @board.turn_count.even? ? @player_1 : @player_2\n end", "def current_player(board)\n#takes #turn_count and checks if even, then(?) gives value of X, else(:) it is O\n turn_count(board) % 2 == 0 ? \"X\" : \"O\"\nend", "def current_player(board)\n\t\tif board.turn_count.odd?\n\t\t\t\"O\" # If the number of turns is an odd number it is Player two with the \"O\" token\n\t\telse\n\t\t\t\"X\" # If the number of turns is an even number it is Player one with the \"X\" token\n\t\tend\n\tend", "def current_player\n x_moves = @board.select {|position| position == \"X\"}\n o_moves = @board.select {|position| position == \"O\"}\n\n if x_moves.size == o_moves.size\n character = \"X\"\n else\n character = \"O\"\n end\n end", "def current_player(board)\n return (turn_count(board).even? ? \"X\" : \"O\")\nend", "def determine_turn\n @player = if @player1_turn\n puts \"It is #{@player1}'s turn\"\n \"X\"\n\n else\n puts \"It is #{@player2}'s turn\"\n \"O\"\n\n end\n\n end" ]
[ "0.8397943", "0.8391056", "0.8257192", "0.825642", "0.825642", "0.82500273", "0.8230087", "0.8208399", "0.8198374", "0.8198374", "0.8198374", "0.8188007", "0.81862175", "0.8175277", "0.8159379", "0.8155124", "0.81500787", "0.81462485", "0.8143556", "0.8143064", "0.81369144", "0.81019425", "0.81005263", "0.8089893", "0.8089893", "0.8075134", "0.8049183", "0.8010562", "0.8001858", "0.8001858", "0.79967976", "0.7913122", "0.7902004", "0.79011035", "0.790091", "0.78919435", "0.7889577", "0.7860662", "0.7834735", "0.782567", "0.78162277", "0.7796223", "0.7794687", "0.7794687", "0.7793723", "0.77910787", "0.7789216", "0.7771917", "0.7764204", "0.77464265", "0.774279", "0.7729246", "0.77286875", "0.7728243", "0.77266276", "0.77266276", "0.7724975", "0.7721796", "0.7720012", "0.77197486", "0.77181494", "0.77157354", "0.7711151", "0.7706645", "0.7691174", "0.7689021", "0.7683877", "0.7681285", "0.7680061", "0.7676071", "0.76750565", "0.76750565", "0.76750565", "0.76750565", "0.76750565", "0.76750565", "0.76750565", "0.7667815", "0.76456785", "0.76456785", "0.76456785", "0.76456785", "0.76354384", "0.76252633", "0.7617303", "0.76086384", "0.76083505", "0.7601939", "0.76012003", "0.75996435", "0.7598497", "0.7597493", "0.75944287", "0.7585271", "0.75802904", "0.75731033", "0.7548558", "0.7548122", "0.7537292", "0.75308645" ]
0.75441116
98
turn calls on the above helper methods to get input from the user and record a turn
def turn(board) player = current_player(board) got_valid = false puts "Please choose a position between 1-9:" while got_valid == false user_input = gets.strip position = input_to_index(user_input) if valid_move?(board, position) move(board, position, player) display_board(board) got_valid = true end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def play\n\t\twelcome\n\t\task_name\n\t\task_name2 \n\t\task_input\n\t\tturns\n\tend", "def input\n puts \"It's #{@player_turn.capitalize}'s turn. Please enter your move/ command.\"\n @input = gets.chomp.upcase\n end", "def input\n\t\tprint_word\n\t\tprint \"\\n>> \"\n\t\tinput = gets.chomp\n\t\tif @player.word_to_guess.include? input\n\t\t\[email protected]_letters << input\n\t\telsif input == \"save game\"\n\t\t\toutput = File.new('save.yml', 'w')\n\t\t\toutput.puts YAML.dump(@player)\n\t\t\toutput.close\n\t\t\tputs \">game saved<\"\n\t\t\tgame_loop\n\t\telsif input == \"exit\"\n\t\t\texit\n\t\telse\n\t\t\[email protected] += 1\n\t\tend\n\tend", "def get_user_input\n\n\tputs \"What is your name\"\n\t@name = gets\n\tputs \"You are about to enter the world of wrestling, if you want to step foot in it then you will be remembered with your ring name, not as #{@name}\"\n\tputs \"So speaking about ring names, What is your Ring name?\"\n\t@ring_name = gets\n\tputs \"A catchphrase is a thing that you like to say?\"\n\tputs \"What is your catchphrase?\"\n\t@catchphrase = gets\n\tputs \"What is your insult?\"\n\t@insult = gets\n\tputs \"What is your theme song\"\n\t@theme_song = gets\n\tputs \"What are the lyrics of your theme song\"\n\t@lyrics_of_theme_song = gets\n\tputs \"The Indie Circuit is where most people start, if you get promoted to the big leagues maybe you need to change your gimmick.\"\n\tputs \"If you decide to be in the Indies, What will the company be called?\"\n\t@company_indies = gets\n\tputs \"The big leagues are the places where very few people start, it is the main place of wrestling\"\n\tputs \"If you decide to be in the big leagues, you can choose either real or fictional companies, what will the fictional one be called?\"\n\t@company_big_leagues = gets\n\tputs \"If you want to be in a team, what will it be called. if you want to be a singles competitor then just put enter and select\n\tthe choice that you don't want to be in a tag team.\"\n\t@team_name = gets\n\tputs \"Who is your partner, just put a random name if you dont want to be in the tag team\n\tand do the same thing as the last question told you.\"\n\t@partner_tag_first = gets\n\tputs \"Getting back to the fictional company, what will your boss be called?\"\n\t@boss_name = gets\n\tputs \"who is the interviewer for the indies?\"\n\t@interviewername = gets\n\tputs \"If you are a heel during your debut in indies or big leagues, who will be your rival?\"\n\t@rival_name = gets\n\tputs \"but If you are a face during your debut in the indies or big leagues, who will be your rival?\"\n\t@rival_name_face = gets\n\tputs \"Ok so lets get to the story\"\n\n\nend", "def get_input\n puts \"Input [L] to turn Left, [R] to turn right and [M] to move your Mars rover forward. Type [Q] to leave. See you, Space Cowboy\"\n @input = gets.chomp.downcase\n # Loops through the array of inputs to specify commands for each specific instruction with a case statement\n @input.each_char do |i|\n case i\n # If l is inputted, make the Rover face left\n when \"l\"\n turn_left\n # If r is inputted, make the Rover face right\n when \"r\"\n turn_right\n # Get the rover to move forward in the direction it's facing.\n when \"m\"\n move\n # Exit the game when q is typed\n when \"q\"\n exit\n end\n # Convert the results to a string\n to_s\n end\n end", "def user_input\n\tgets\nend", "def take_turn\n puts \"Pick a space, #{@name}\"\n space = gets\n parse_input(space)\n end", "def run\n puts \"------------------ NEW TURN ------------------\"\n ask_question\n get_answer\n validate_answer\n end", "def runner\n welcome\n deal_card\n display_card_total\n prompt_user\n get_user_input\nend_game\ninitial_round\nhit\ninvalid_command\nend", "def fetch_input(question_to_user)\n print question_to_user\n gets.chomp # return not needed\nend", "def get_move\n\t\tputs \"Your current bankroll is $#{bankroll}, and your hand is:\"\n\t\[email protected] \n\t\tputs \"Do you wish to fold, see the bet, or raise?\"\n\t\tbegin\n\t\t\tinput = gets.chomp.downcase\n\t\t\traise BadInputError unless ['fold', 'see', 'raise'].include?(input)\n\t\t\tinput.to_sym\n\t\trescue\n\t\t\tputs \"You must input 'fold', 'see', or 'raise'.\"\n\t\t\tretry\n\t\tend\n\tend", "def start \n puts \"Welcome to \" + blue(\"Apeture Science TicTacToe\") + \", were we screen the test \" + blue(\"test subjects\") + \" from the \" + pink(\"cake ingredients\") \n # Get input from player on game mode\n valid = false\n until valid == true\n puts \"To play against another pathetic test \\\"participant\\\", \" + blue(\"press P\") + \". If you dare challenge a cyber god, \" + blue(\"press A\") + \". On a relevant note, \" + pink(\"please don't spill tears into any Apeture Science equipement.\")\n @input = STDIN.gets.chomp.downcase\n\n valid = \"pa\".split(\"\")\n if valid.include?(@input)\n valid = true\n else\n puts \"Seems you could not manage that simple task. Well at least you can rest assured that \" + pink(\"you will burn well.\")\n end\n end\n # Set game mode\n if @input == \"p\"\n @game_mark = \"player\"\n elsif @input == \"a\"\n @AI = AI.new(@game, self) \n @game_mark = \"AI\" \n if @game.current_player == \"X\" \n @AI.make_move\n end\n end\n start_turn \n end", "def get_input\n story = gets.chomp\nend", "def request_input(turn)\r\n if turn === true\r\n puts \"Player 1\"\r\n puts \"=\" * 8\r\n puts \"Put in your first coordinate:\"\r\n first_coor = gets.chomp.to_i\r\n puts \"Put in your second coordinate:\"\r\n second_coor = gets.chomp.to_i\r\n end\r\n return [first_coor, second_coor]\r\nend", "def get_input\n #Get input from the user\nend", "def user_input_capture\n print \">>: \"\n response = gets.chomp\n response\n end", "def ask_input\n\t\tputs \"Take a look at the board, please.\"\n\t\[email protected]_board\n\t\tputs \"#{@player1.name}, make your move please (pick a number from 1 to 9).\"\n\t\tmove = gets.chomp\n\n\t\tif move == \"a1\"\n\t\t \[email protected][move] = @player1.mark\n\t\t \[email protected]_board\n\t\t \ttaking_turns\n\t\t \t\n\t\t# elsif move == \"a2\"\n\t\t# \[email protected][move] = @player1.mark\n\t\t# \[email protected]_board\n\t\t# \task_input\n\t\t# elsif move == \"a3\"\n\t\t# \[email protected][move] = @player1.mark\n\t\t# \[email protected]_board\n\t\t# \task_input\n\t\t end\n\tend", "def takeTurn(string)\n#your logic goes here.\nend", "def prepare_input(prompt); end", "def user_input\n puts \"Let's play rock, paper, scissors\"\n gets.chomp\nend", "def replay\n @board.reset!\n puts \"Would you like to play again?\";\n input = STDIN.gets.strip #I need to ask about this method.\n puts \"\"\n input == \"yes\" || input == \"Yes\" ? start : puts(\"Goodbye!\")\n end", "def input_move(db, cur_position)\r\n\tprint \"Enter a move for #{cur_player(db, cur_position)} in standard chess notation, or HELP for help: \"\r\n\tmove = gets.chomp.downcase\r\n\treturn move\r\nend", "def get_input \n puts \"to save this game, input 's,filename'\"\n puts \"to load a game, input 'l,filename'\"\n puts \"input a coordinate to access. prefix with r for reveal or f for flag\"\n puts \"example 'f,1,2' places a flag at 1,2\"\n input = gets.chomp\n \n args = input.split(',')\n end", "def input(account_id, accounts)\n require 'io/console'\n if accounts[account_id]\n show_message(\"successful..account number exists\")\n show_message(\"Enter your password plzzzz...\")\n encript_to_match=encript(STDIN.noecho(&:gets).chomp.to_s)\n match(account_id, encript_to_match, accounts)\n #operations(account_id)\n else\n show_message \"new account..needs to register..\"\n show_message \"enter details to be stored ..\"\n show_message \"Enter your name ...\"\n name = gets.chomp.to_s\n show_message \"enter your password..\"\n pass_encripted= encript(STDIN.noecho(&:gets).chomp.to_s)\n end\n show_message \"Enter the balance amount :depositing..\"\n balance = gets.chomp.to_i\n details_store(name,pass_encripted, balance, accounts, account_id,[])\n create_history( account_id,accounts,\"deposit\",balance,accounts[account_id][:balance])\n operations(account_id, accounts)\nend", "def play\n display_welcome\n puts \"\"\n display_rules\n puts \"\"\n print \"Enter your name: \"\n player_name = STDIN.gets.strip\n self.player = Player.new(player_name) # get the user\n puts \"Welcome #{self.player.name}!\"\n puts \"\"\n\n #play until user has maximum points or user inputs exit (breaks until)\n until over?\n puts \"\"\n self.board.display_board # puts the board on each turn\n print \"Enter word: \"\n user_input = STDIN.gets.strip\n puts \"\"\n # TODO: implement using Thor\n case user_input\n when \"-q\" || \"-quit\" || \"-exit\"\n self.player.display_word_list\n self.player.display_total\n puts \"Bye!\"\n break\n when \"-h\" || \"-help\"\n display_rules\n when \"-t\" || \"-total\"\n self.player.display_total\n when \"-w\" || \"--word-list\"\n self.player.display_word_list\n when \"-r\" || \"-rearrange\"\n self.board.rearrange_board\n when \"--c-b\" || \"--cheater-bee\"\n self.board.display_word_list\n else #\n check_word(user_input.upcase)\n end\n end\n\n end", "def present_test(challenge)\n\n\tConsole_Screen.cls #clear the display area\n\tprint challenge + \"\\n\\n: \" #display the challenge sentence\n\tresult = STDIN.gets #collect the player's input\n\tresult.chop! #remove the end of line marker\n\n\t#analyze the player input and see if it is correct\n\tif challenge == result then\n\n\t#keep track of the number of corretly retyped challenge sentences \n\t$noRight += 1\n\tConsole_Screen.cls #clear the display area\n\t#keep player informed\n\tprint \"Correct!\\n\\nPress Enter to continue.\"\n\tConsole_Screen.pause #pause the game\n\nelse \n\n\tConsole_Screen.cls #clear the diplay area\n\t#keep the player informed\n\tprint \"Incorrect!\\n\\nPress Enter to continue\"\n\tprint \" Correct sentence: \" + challenge.to_s + \"\\tYour sentence: \" + result.to_s \n\tConsole_Screen.pause #clear the game\n\nuntil result != \" \"\n\n\tConsole_Screen.cls #clear the diplay area\n \n #prompt the playwer for permission to bein the test\n print \"You have to type something \"\n\n result = STDIN.gets #collect the player's response \n result.chop! #remove any extra characters appended to the string\t\nend\nend\nend", "def ask_input\n\t\tputs \"where do you want to go ? N, S, W, E\"\n\t\tuser_input = gets.chomp\n\tend", "def take_turn\n puts \"#{player.name}'s turn. Enter 0-9:\"\n input = gets.strip\n if board.valid_move?(input)\n board.move(input, player)\n else\n puts \"Please enter valid move:\"\n take_turn(board, player)\n end\n board.display\n end", "def mad_lib\n user_inputs = []\n required_data = %w(noun verb adjective adverb)\n required_data.each do |question|\n puts \"Enter a #{question}:\"\n user_inputs << gets.chomp\n end\n puts \"Do you #{user_inputs[1]} your #{user_inputs[2]} #{user_inputs[0]} #{user_inputs[3]}? That's hilarious!\"\nend", "def input(thing)\n print \"Enter #{thing}: \"\n gets.chomp\nend", "def handle_input\n # Takes user input\n input = STDIN.gets.chomp\n system('clear')\n\n # Single word commands\n # QUIT\n if input == 'quit'\n @run_game = false\n puts \"Thanks for playing!\"\n sleep(3)\n system('clear')\n\n # BACKPACK\n elsif input == 'backpack'\n @player.print_backpack\n\n # HELP\n elsif input == 'help'\n puts \"Use the commands to move around the AirBnB and use items to help you escape.\"\n\n else\n # Double word commands \n input_arr = input.split(\" \")\n # User has only entered one word\n if input_arr.size > 1\n command1 = input_arr[0]\n command2 = input_arr[1]\n # TAKE ITEM\n if command1 == \"take\"\n take_item(command2)\n # USE ITEM\n elsif command1 == \"use\"\n use_item(command2)\n # GO ROOM\n elsif command1 == \"go\"\n go_room(command2)\n else\n # User doesn't specify second command\n puts \"I'll need more information than that!\"\n end\n else\n # User enters invalid command word\n puts \"That isn't a valid command\"\n end\n end\n end", "def get_user_input\n gets.chomp\nend", "def get_user_input\n gets.chomp\nend", "def get_input\n gets.chomp\n end", "def print_result(user_input, computer_input, who_win)\n puts ''\n puts '================================================='\n puts ''\n puts \"You choose: #{transfer_input_string(user_input)}\"\n puts \"The computer chooses: #{transfer_input_string(computer_input)}\"\n puts \"***** #{who_win} ******\"\n puts ''\n puts '================================================='\n puts ''\nend", "def captureInput\n return gets.chomp\n end", "def begin_input\n\t\tinput = nil\n\t\tuntil input != nil\n\t\t\tinput = case gets.chomp.downcase\n\t\t\twhen \"hard\", \"h\" then :hard\n\t\t\twhen \"medium\", \"m\" then :medium\n\t\t\twhen \"mom\" then :mom\n\t\t\telse nil\n\t\t\tend\n\t\t\tputs \"That is not a valid input!\" if not input\n\t\tend\n\t\tinput\n\tend", "def try_turn\n print \"\\nPlayer #{@player.to_s.capitalize}'s command: \"\n input = gets.chomp\n outcome = if is_raw_command?(input) then try_command(input) # Returns :(no_)load, :(no_)save, :(no_)draw, :quit\n elsif is_raw_move?(input) then try_move(input) # Returns :(no_)move, :check(mate), :stalemate, :draw\n else :unknown_input end\n end", "def get_user_input\n input = gets.chomp\n #input\nend", "def turn \n puts \"Make a move compadre\"\n input = gets.strip\n location = input_to_index(input)\n if valid_move?(location)\n tictac = current_player\n move(location, tictac)\n display_board\n else\n turn\n end\n end", "def user_assistance(direction_hash)\n print 'Please enter Transit Route: '\n input_route = gets.chomp.gsub(/\"/, \"\")\n print 'Please enter Transit Stop: '\n input_stop = gets.chomp.gsub(/\"/, \"\")\n print 'Please enter your desired direction: '\n input_direction = gets.chomp.gsub(/\"/, \"\")\n if input_route.empty? || input_stop.empty? || input_direction.empty?\n puts 'Empty input detected. Please try again'\n user_assistance(direction_hash)\n end\n nextBus(input_route, input_stop, input_direction, direction_hash)\n puts ''\n print 'Would you like to check another? [Y]es or [N]o?: '\n entry = gets.chomp\n case entry\n when 'Y', 'y'\n user_assistance(direction_hash)\n when 'N', 'n'\n puts 'Thanks! Exiting...'\n exit\n else\n puts 'Invalid entry! Exiting...'\n end\nend", "def user_input\n gets.chomp\nend", "def user_input\n gets.chomp\nend", "def get_input\n gets.strip #chomp was also used..\nend", "def turn(board)\n # ask the user for input:\n puts \"Please enter 1-9:\"\n # gets the user input\n input = gets.strip\n # calls the input_to_index method\n index = input_to_index(input)\n #validates the input correctly\n if valid_move?(board, index)\n # makes valid move\n move(board, index, \"X\")\n else\n # asks for input again after a failed validation\n turn(board)\n end\n # displays a correct board after a valid turn\n display_board(board)\nend", "def intro(data)\r\n\tputs\"\r\n╔═════════════════════════════════════════════════════════════════════════╗\r\n║ ║\r\n║#{\"WELCOME TO HABIT TRACKER\".center(73)}║\r\n║ ║\"\r\ninsertquote()\r\nputs\"║ ║\r\n║ ║\r\n║ ║\r\n║ 1. Create New Account ║\r\n║ 2. Login to Existing Account ║\r\n║ 3. Learn More About Habit Tracker ║\r\n║ ║\r\n╚═════════════════════════════════════════════════════════════════════════╝\"\r\n\tvalidinput = false\r\n\r\n\tuntil validinput\r\n\t \tinput = gets.chomp\r\n\t\tif input == \"1\"\r\n\t\t\tvalidinput = true\r\n\t\t\tnewuser(data)\t\t\r\n\t\telsif input == \"2\"\r\n\t\t\tvalidinput = true\r\n\t\t\tlogin(data)\r\n\t\telsif input == \"3\"\r\n\t\t\tvalidinput = true\r\n\t\t\tlearnmore()\r\n\t\telse\r\n\t\t\tputs \"Enter 1 to create an account, 2 to log into your account, or 3 to learn about how Habit Tracker works.\"\r\n\t\tend\t\t\r\n\tend \r\nend", "def get_input\n gets.chomp \nend", "def ask_question(player)\n\n puts \"Player #{player+1}: What is #{generate_question}?\"\n input = gets.strip.to_i\n\n if verify_answer?(input)\n score(player)\n else\n lose_life(player)\n end\nend", "def turn\n\t\t\t@turns += 1\n\t\t\t@guess_letter = gets[0].downcase\n\t\t\tshow_matches\n\t\t\tcheck_win\n\t\tend", "def user_input\n\tuser_selection = gets.strip.to_i\n\tinput_logic(user_selection)\nend", "def get_input\n\t#Get input from the user.\n return gets.chomp\nend", "def put_in_user\n #setting variables\n name, cohort, city, hobby = placeholder\n #prompting the user for input and receiving it\n puts \"Hey there, type your name\".center(50)\n name = STDIN.gets.chomp\n\n puts \"Put your cohort\".center(50)\n cohort_input = STDIN.gets.chomp\n cohort = cohort_input.downcase\n\n puts \"Put your city\".center(50)\n city = STDIN.gets.chomp\n\n puts \"Put your hobby\".center(50)\n hobby = STDIN.gets.chomp\n\n validation_of_user_input(name, cohort, city, hobby)\n\nend", "def user_input\n input = gets.chomp\n end", "def get_user_input\n user_input_valid gets.chomp\n end", "def user_input\n puts \"* * * *RULES* * * *\"\n puts \"In this game Health Points or HP is the basis for dealing damage. Each\n attack will hit as hard as 33% to 66% of your charachters MAX Health Points.\n Recovery Rate heals each turn based on how high it is. It doesn't allow you\n to play out each turn yet but for now just put in the values and have fun!\"\n print \"Enter Name 1: \"\n n1 = gets.chomp\n print \" Enter Name 2: \"\n n2 = gets.chomp\n puts \" \"\n print \"Enter #{n1}'s Health Points: \"\n hp1 = gets.to_i\n print \" Enter #{n2}'s Health Points: \"\n hp2 = gets.to_i\n puts \" \"\n print \"Enter #{n1}'s Recovery Rate: \"\n rr1 = gets.to_i\n print \" Enter #{n2}'s Recovery Rate: \"\n rr2 = gets.to_i\n puts \" \"\n @name1 = n1\n @name2 = n2\n @health_points = hp1\n @health_points2 = hp2\n @recovery_rate1 = rr1\n @recovery_rate2 = rr2\n\n battle\n end", "def get_user_input(prompt)\n print \"#{prompt}: \"\n gets.chomp\nend", "def get_player_info(db)\r\n puts \"\\nPlayer's name:\"\r\n name = gets.chomp\r\n puts \"\\nPlayer's location (state if American, country otherwise):\"\r\n location = gets.chomp\r\n add_player(db, name, location)\r\nend", "def get_input\n @input = gets.strip\n end", "def interface()\r\n\tputs \"Do you want to encrypt or decrypt?\"\r\n\tanswer = gets\r\n\tputs \"What is the password?\"\r\n\tpassword = gets\r\n\tif answer == \"encrypt\"\r\n\t\tputs encrypt(password)\r\n\telse\r\n\t\tputs decrypt(password)\r\n\tend\r\n\texit\r\nend", "def get_user_input\n puts\n puts \"Type your question below or select from the following:\"\n puts\n puts \"1) Type Q to exit program\"\n puts\n puts \"2) Type P to print all answers\"\n puts\n puts \"3) Type R to reset answers to originals\"\n puts\n puts \"4) Type A to add your own answers to the originals\"\n puts\n question = gets.strip.to_s.downcase\n puts\n handle_user_input(question)\n end", "def main\n welcome\n card1, card2, upcard = ask_user\n advice(card1, card2, upcard)\n # puts \"card1: \" + card1.to_s\n # puts \"card2: \" + card2.to_s\n # puts \"upcard: \" + upcard.to_s\nend", "def launch!\n\t\tintroduction\n\t\t\taction = nil\n\t\t\tuntil action == :quit\n\t\t\t# action loop\n\t\t\t# what do you want to do? (list, find, add, quit)\n\t\t\tprint \"> \"\n\t\t\tuser_response = gets.downcase.strip!.split(' ')\n\t\t\t# do that action\n\t\t\taction,args = do_action(user_response[0],user_response[1])\n\t\tend\n\t\tconclusion\n\tend", "def next_input\n print '>> '\n gets.chomp.strip.downcase\n end", "def user_input\n user_input = gets.chomp\nend", "def ask_for_action\n puts 'Log Me In Calculator test'\n puts 'Please select your test type (enter the corresponding number)'\n puts '[1]- Operational'\n puts '[2]- Functionnal'\n puts '[3]- All'\n test_to_run = gets.strip\n recreate_default_config(test_to_run)\n read_config\n run_tests\nend", "def read_turn\n ret=false\n [email protected]\n\n if rd=='end'\n #@turn_number=:game_over\n\n [email protected]\n _, players = *rd.match(/\\Aplayers (\\d+)\\Z/)\n @players = players.to_i\n\n [email protected]\n _, score = *rd.match(/\\Ascore (\\d+(?: \\d+)+)\\Z/)\n @score = score.split(' ').map{|s| s.to_i}\n\n ret=true\n else\n _, num = *rd.match(/\\Aturn (\\d+)\\Z/)\n @turn_number=num.to_i\n log \"Starting turn #{@turn_number}\"\n @start_time = Time.now.to_f\n end\n\n # reset the map data\n Square.reset!\n log \"Reset map data\"\n\n # update the expected position of each ant - as a side-effect,\n # also updates the Square -> Ant links\n Ant.advance_turn!\n log \"Advanced all ant positions\"\n\n until(([email protected])=='go')\n _, type, row, col, owner = *rd.match(/(w|f|h|a|d) (\\d+) (\\d+)(?: (\\d+)|)/)\n row, col = row.to_i, col.to_i\n owner = owner.to_i if owner\n\n square = Square.at(row, col)\n\n case type\n when 'w'\n square.destroy!\n when 'f'\n if square.has_food?\n square.item.sense!\n else\n food = Food.new(square)\n log \"Sensed #{food}\"\n end\n when 'h'\n if square.has_hill?\n square.item.sense!\n else\n hill = Hill.new(owner, square)\n log \"Sensed #{hill}\"\n end\n when 'a', 'd'\n alive = (type == 'a')\n\n if owner == 0\n ant = square.ant\n\n if ant.nil?\n if square.has_hill? && square.item.mine?\n ant = Ant.new(square)\n log \"Sensed new #{ant}\"\n else\n # maybe a newborn ant, but I haven't received the hill message yet?\n # it looks like hill messages always come first, but that may not be guaranteed\n raise \"[BUG] no record of my ant at #{square}\"\n end\n else\n log \"Sensed exisiting #{ant}\"\n end\n\n ant.die! unless alive\n else\n if square.has_enemy_ant?\n square.item.sense!\n else\n enemy_ant = EnemyAnt.new(owner, square)\n log \"Sensed #{enemy_ant}\"\n end\n end\n when 'r'\n # pass\n else\n warn \"unexpected: #{rd}\"\n end\n end\n\n # clean up missing items\n Item.all.each(&:destroy_if_unsensed!)\n\n log \"Got go! signal from game\"\n\n return ret\n end", "def ask_play \n\tputs \" - Bon, tu joues quoi #{@name} ? je n'est pas que ca a faire !!! (Donne les coordonnees, ex : a1, b3, c2, etc.) \"\n\t@answer_play = gets.chomp \t\n end", "def tictactoe\n g = Game.new\n puts `clear`\n puts \"Please enter the name of player1\"\n g.player1 = gets.chomp\n puts \"Please enter the name of player2\"\n g.player2 = gets.chomp\n\n until g.finished?\n puts `clear`\n puts\n print_board(g)\n puts\n puts \"#{g.whose_turn}'s turn\"\n input = gets.chomp.downcase\n if input.to_i.to_s == input\n g.make_move(g.whose_turn, input.to_i)\n else \n until input.is_a?(Fixnum) do\n print \"Please enter a number: \"\n input = Integer(gets) rescue nil\n end\n end\n end\n\n puts `clear`\n puts g.result\n puts \"\\n Would you like a (r)ematch?\"\n case gets.chomp.downcase\n when 'r'\n tictactoe\n end\nend", "def get_input(question)\n\t\tputs \"What's your #{question}?\"\n\t\tgets.chomp\nend", "def get_user_input(message)\n puts message\n gets.chomp\n end", "def get_input\n @input = gets.chomp\n end", "def fetch_input(prompt)\n\tprint prompt\n\tgets.chomp #implicit return again\nend", "def user_input\n print \"Say your thang\"\n user_comment = get.chomp.downcase\nend", "def turn\n # Asks user for input.\n puts \"Please enter 1-9:\"\n # Places the user's answer into the variable 'input'.\n input = gets.strip\n # Uses the conversion method to place it into variable 'index'.\n index = input_to_index(input)\n # Goes through an if/else loop to check if move is valid.\n if valid_move?(index)\n # Adds the player's input if valid.\n move(index, current_player)\n # Displays the board back to the player in the CLI afterwards.\n display_board()\n else\n # Recursively calls the turn method if an incorrect move is played.\n turn()\n end\n end", "def ask_player_for_move(current_player)\n puts\n puts \"#{@current_player.name}, it's your move:\"\n @move = gets.chomp.capitalize.to_s\n # puts @move\n self.validate_move(@move)\n next_turn\n end", "def give_me_instructions\n #Asking for the size of the plateau\n puts \"What is the size of the plateau?\"\n @plateau_size = gets.chomp.split(\" \")\n @position_x = @plateau_size[0].to_i\n @position_y = @plateau_size[1].to_i\n #Asking for the start position of the rover\n puts \"What coordinate position would you like to start in?\"\n @start_position = gets.chomp.split(\" \")\n @position_x = @start_position[0].to_i\n @position_y = @start_position[1].to_i\n @current_direction = @start_position[2]\n\n read_instructions\n end", "def get_input message\n\n puts message\n input = gets.chomp.downcase\n\nend", "def play(board)\n input = gets.strip\nend", "def turn()\n puts \"Coins: #{@current_player.get_coin_count}\"\n @current_player.show_active_cards\n puts Action.show_all_actions.join \"\\n\"\n\n # If a player ahs more than 10 coins he must stage a coup\n if (@current_player.get_coin_count > 10)\n action_id = \"2\"\n else\n puts \"#{@current_player} what is your action\"\n action_id = gets.strip\n end\n\n current_action = Action.new(action_id)\n if current_action.requires_target\n target_player = nil\n while target_player == nil || target_player == @current_player\n puts \"Select a target\"\n target_id = gets.strip\n target_player = get_player_by_id(target_id)\n end\n current_action.set_target(target_player)\n end\n\n turn_over = false\n action_failed = false\n\n @@turn += 1\n\n puts \"#{@current_player} moves: #{current_action}\"\n\n if (current_action.can_be_challenged?)\n puts \"Enter Y to challenge\"\n challenge = gets.strip\n if challenge == 'Y'\n puts \"Challenger enter your id\"\n player_challenging_id = gets.strip\n\n if (challenge && player_challenging_id)\n if @current_player.has_claimed_action_character?(current_action)\n @player_challenging = get_player_by_id(player_challenging_id)\n @player_challenging.loses_influence\n @current_player.swap_influence(current_action, @deck)\n else\n @current_player.loses_influence\n action_failed = true\n end\n end\n end\n turn_over = true\n end\n\n if (!turn_over && current_action.can_be_countered?)\n puts \"Enter Y to counteract\"\n counteraction = gets.strip\n\n if counteraction == 'Y'\n puts \"Counteractor enter your id\"\n counteracting_player_id = gets.strip\n if counteracting_player_id\n @counteracting_player = get_player_by_id(counteracting_player_id)\n puts \"Current player enter Y to challenge this counteraction\"\n challenge_counteraction = gets.strip\n if challenge_counteraction\n if @counteracting_player.has_claimed_counteraction_character?(current_action)\n @current_player.loses_influence\n @counteracting_player.swap_influence(current_action, @deck)\n else\n @counteracting_player.loses_influence\n end\n turn_over = true\n else\n turn_over = true\n action_failed = true\n end\n end\n end\n end\n\n if !action_failed\n current_action.succeed(@current_player, current_action, @deck)\n end\n\n next_player()\n\n if is_game_over()\n puts \"game over\"\n puts \"#{get_winner} wins\"\n else\n turn()\n end\n\n end", "def madlib_inputs\n print \"Enter a noun: \" \n noun = gets.chomp\n print \"Enter a verb: \" \n verb = gets.chomp\n print \"Enter an adjective: \" \n adjective = gets.chomp\n print \"Enter an adverb: \" \n adverb = gets.chomp\n madlib_line(noun, verb, adjective, adverb)\nend", "def computer\r\n tab(4, \"Press Enter for AI move.\")\r\n input = gets\r\n end", "def take_turn\n valid_input = false\n puts \"\"\n puts \"Current text is: #{@fragment}\"\n\n until valid_input\n player_char = @current_player.guess\n valid_input = valid_play?(player_char)\n unless valid_input\n @current_player.alert_invalid_guess\n end\n end\n\n @fragment += player_char\n end", "def read_input\n end", "def ask_for(detail)\n puts \"Enter #{detail}\"\n STDIN.gets.chomp \nend", "def run\n choose_game(prompt)\nend", "def action(input)\n # This will be where the game's moves come from; at the time of writing, it\n # is simply the string 'Random Winning Move'. This is assigned to the action\n # variable\n # input.last will be the time limit in milliseconds to complete a move\n action = @bot.play(@status, input.last)\n # This prints the action to the IO stream\n Io.post(action)\n run\n end", "def manual_input # {{{\n\n # Convenience shorthand \n yellow = Proc.new { |m| @log.colorize( \"Yellow\", m.to_s ) }\n\n STDOUT.flush\n #$/ = '\\r\\n'\n\n # Aquire data\n puts yellow.call( \"\\n>> Please type your [[ JOKE ]] here and after you are finished hit CTRL+D twice\\n\" )\n\n # The method over the re-def over $/ = \"END\" works too, but mangles later STDIN.gets somehow - why?\n joke = \"\"\n while true\n begin\n input = STDIN.sysread(1)\n joke += input\n rescue EOFError\n break\n end\n end\n\n puts yellow.call( \">> TITLE of this joke: \" )\n title = STDIN.readline.chomp\n\n puts yellow.call( \">> URL where you found this joke (Press enter to accept previous URL: #{@_prev_url.to_s}): \" )\n url = STDIN.readline\n if( url =~ %r{^\\n$} )\n puts yellow.call( \">> Using previous URL ( #{@_prev_url.to_s} )\" )\n url = @_prev_url \n else\n url = url.chomp\n end\n\n @_prev_url = url\n\n puts yellow.call( \">> Who posted or authored this joke: \" )\n author = STDIN.readline.chomp\n\n new = Joke.new\n new.content = joke.chomp\n new.title = title\n new.url = url\n new.author = author\n\n puts \"\"\n puts \"-\"*30\n puts \"Joke object:\"\n puts \"\"\n p new\n puts \"-\"*30\n answer = get_choice_from_bipolar( \"Do you want to store this joke to Database? \" )\n\n if( answer ) \n res = new.save!\n answer = ( res ) ? ( \"Success !\" ) : ( \"Failure !\" )\n puts yellow.call( answer )\n end\n\n new\n end", "def read_input; end", "def input_move\n input = gets.chomp.downcase\n case input\n when /[a-h][1-8][a-h][1-8]/\n process_input(input)\n when '0-0-0'\n castle(false)\n when '0-0'\n castle(true)\n when /s/, /save/\n save_game\n when 'h', 'help'\n print_in_game_help\n when 'q', 'quit', 'exit'\n quit_game\n else\n puts \"I don't understand that. Please input a move in format [starting square][destination]\n I.e. to move the piece at A1 to D4, type A1D4\"\n input_move\n end\n end", "def get_input\n input = gets\n return input\nend", "def get_user_input\n gets.strip\nend", "def view_fight_input\n puts \"Would you like to view a specific fight? (y/n)\"\n input = gets.strip.downcase\n end", "def turn(board)\n#This is the initial prompt telling our user to input\n puts \"Please enter 1-9:\"\n#this gets our user input\n user_input= gets.strip\n#I set the index variable for later methods to = the outcome of the input to index method\n index = input_to_index(user_input)\n#If the outcome of the valid move method is true then run the board method and display the board\n if valid_move?(board, index) == true\n move(board, index, char = \"X\")\n display_board(board)\n#if not run the turn method again\n else\n turn(board)\n end\nend", "def gets_user_guess\n @guess = gets.strip.downcase\n generate_new_card\n end", "def asks_question(question)\n puts question\n gets.chomp\nend", "def capture_name\n # puts \"Please type in your first name\" => add outside of testing\n name = $stdin.gets.chomp\n \"Hello, #{name}\"\nend", "def handle_user_input(user_input)\n clean_input = clean_user_input(user_input)\n\n if system_message?(clean_input)\n handle_system_message(clean_input)\n\n # If action exists:\n elsif aprox_trigger?(clean_input)\n action = aprox_trigger?(clean_input)\n handle_action(action)\n\n else\n state_id = session[:state_id]\n update_state_log('system', 'Sorry I don\\'t know what that means')\n end\n\n if not performed?\n redirect_to \"/games/#{session[:game_id]}\"\n end\n end", "def getGuess\n puts \"It is your turn.\"\n puts \"Which person do you want to suggest?\"\n guessSuspect = getUserInputFromArray(@suspects)\n puts \"Which location do you want to suggest?\"\n guessLocation = getUserInputFromArray(@locations)\n puts \"Which weapon do you want to suggest?\"\n guessWeapon = getUserInputFromArray(@weapons)\n\n puts \"Is this an accusation (Y/[N])?\"\n accuse = nil\n while accuse == nil\n input = gets.chomp.to_s\n if input == \"Y\" or input == \"y\"\n accuse = true\n elsif input == \"N\" or input == \"n\"\n accuse = false\n else\n accuse = nil\n puts \"Invalid input, please try again.\"\n end\n end\n return Guess.new(guessSuspect, guessLocation, guessWeapon, accuse)\n end", "def checkpoint\n ask_user_for_input\n user_input = gets.chomp.downcase\n center_focus_simulation if user_input == 'c'\n user_choice_simulation if user_input == 't'\n instructions if user_input == 'i'\n return if user_input == 'q'\n end", "def get_turn\n @pos, @action = @player.prompt\n end", "def ask(question)\n puts question\n gets.chomp\nend" ]
[ "0.73128885", "0.70781195", "0.6933419", "0.68737465", "0.6823643", "0.6783372", "0.675757", "0.673608", "0.6708569", "0.67057467", "0.6662589", "0.6653658", "0.663074", "0.6614861", "0.66137695", "0.65876985", "0.6568625", "0.65269", "0.6505233", "0.64932114", "0.6485892", "0.6475332", "0.6457167", "0.645378", "0.6438086", "0.6437934", "0.64313996", "0.6428589", "0.64192027", "0.6411813", "0.6397927", "0.6397178", "0.6397178", "0.6393679", "0.6381463", "0.63696927", "0.6366585", "0.63665664", "0.6355942", "0.63464254", "0.6344207", "0.6337718", "0.6337718", "0.633752", "0.6333932", "0.6318464", "0.6310785", "0.63037705", "0.62978804", "0.6296471", "0.6280804", "0.6269918", "0.6268733", "0.626687", "0.6263178", "0.6261095", "0.6249912", "0.62395513", "0.62334263", "0.62275034", "0.6219453", "0.62188786", "0.62114", "0.62110674", "0.62079984", "0.62079585", "0.62077624", "0.6206774", "0.62035143", "0.62034625", "0.6199745", "0.6197915", "0.61968505", "0.61938626", "0.6185431", "0.6179738", "0.6168465", "0.61639297", "0.61627483", "0.6158955", "0.61558515", "0.61545813", "0.6143576", "0.6138466", "0.61352444", "0.61343604", "0.6130998", "0.6128214", "0.61169493", "0.61168945", "0.61039877", "0.6101101", "0.6100428", "0.6094448", "0.6092265", "0.60871744", "0.6084995", "0.6083004", "0.60823494", "0.607845", "0.6070764" ]
0.0
-1
determines whether or not a player has won and returns the winning combination if there is a win and false if there isn't
def won?(board) WIN_COMBINATIONS.each do |win_combo| pos_one = win_combo[0] pos_two = win_combo[1] pos_three = win_combo[2] if board[pos_one] != " " && board[pos_one] == board[pos_two] && board[pos_two] == board[pos_three] return win_combo end end false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def won?()\n\n # loops through the 2D array WIN_COMBINATIONS\n WIN_COMBINATIONS.each do |combination|\n\n # flags\n x_win = 0\n o_win = 0\n\n combination.each do |index|\n\n # checks if player X wins\n if @board[index] == \"X\"\n x_win += 1\n\n if x_win == 3\n return combination\n end\n else\n x_win = 0\n end\n\n # checks if player O wins\n if @board[index] == \"O\"\n o_win += 1\n\n if o_win == 3\n return combination\n end\n else\n o_win = 0\n end\n\n end\n end\n\n # return false if there is no winner\n return false\n end", "def won?\n WIN_COMBINATIONS.detect { |combo|\n @board.cells[combo[0]] == @board.cells[combo[1]] &&\n @board.cells[combo[0]] == @board.cells[combo[2]] &&\n @board.taken?(combo[0] + 1)\n }\n # x = \"X\";\n # o = \"O\";\n #\n # WIN_COMBINATIONS.each do |win_combination|\n # win_index_1 = win_combination[0];\n # win_index_2 = win_combination[1];\n # win_index_3 = win_combination[2];\n #\n # position_1 = @board.cells[win_index_1];\n # position_2 = @board.cells[win_index_2];\n # position_3 = @board.cells[win_index_3];\n #\n # if ((position_1 == x && position_2 == x && position_3 == x) ||\n # (position_1 == o && position_2 == o && position_3 == o))\n # return win_combination;\n # else\n # false;\n # end\n # end\n # false; #explicitly tell ruby to return false if we've cycled through the board and no win combinations can be found\n end", "def won?\n TicTacToe::WIN_COMBINATIONS.each do |combinations|\n position_1 = @board[combinations[0]]\n position_2 = @board[combinations[1]]\n position_3 = @board[combinations[2]]\n\n if (position_1 == \"X\" && position_2 == \"X\" && position_3 == \"X\") || \n (position_1 == \"O\" && position_2 == \"O\" && position_3 == \"O\")\n return combinations\n else\n false\n end\n end\n false\n end", "def check_win(player)\n winning_combos.each do |winning_combo|\n if three_in_a_row(winning_combo, player)\n @winner = player\n return true\n end\n end\n \n false\n \n end", "def won?\n WIN_COMBINATIONS.each do |triple|\n if(winning?(triple))\n return triple\n end\n end\n return false\n end", "def won?\n WIN_COMBINATIONS.each {|win_combo|\n position_1 = @board.cells[win_combo[0]]\n position_2 = @board.cells[win_combo[1]]\n position_3 = @board.cells[win_combo[2]]\n return win_combo if ((position_1 == \"X\" && position_2 == \"X\" && position_3 == \"X\") ||\n (position_1 == \"O\" && position_2 == \"O\" && position_3 == \"O\"))\n }\n return false\n end", "def won?\n WIN_COMBINATIONS.each do |win_combination|\n win_index_1 = win_combination[0]\n win_index_2 = win_combination[1]\n win_index_3 = win_combination[2]\n\n position_1 = @board[win_index_1]\n position_2 = @board[win_index_2]\n position_3 = @board[win_index_3]\n\n if position_1 == position_2 && position_2 == position_3 && position_taken?(win_index_1)\n return win_combination\n end\n end\n return false\n end", "def won?\n WIN_COMBINATIONS.each do |comb|\n if (@board[comb[0]] == \"X\") && (@board[comb[1]] == \"X\") && (@board[comb[2]] == \"X\")\n @winner = \"X\"\n return true\n elsif (@board[comb[0]] == \"O\") && (@board[comb[1]] == \"O\") && (@board[comb[2]] == \"O\")\n @winner = \"O\"\n return true\n end\n end\n\n return false\n end", "def won?\n the_win_combination = false\n WIN_COMBINATIONS.each do |win_combination|\n win_index_1 = win_combination[0]\n win_index_2 = win_combination[1]\n win_index_3 = win_combination[2]\n\n position_1 = @board[win_index_1]\n position_2 = @board[win_index_2]\n position_3 = @board[win_index_3]\n\n if (position_1 == \"X\" && position_2 == \"X\" && position_3 == \"X\") ||\n (position_1 == \"O\" && position_2 == \"O\" && position_3 == \"O\")\n the_win_combination = win_combination\n break\n end\n end\n the_win_combination\n end", "def won?\n WIN_COMBINATIONS.detect do |combo|\n @board.cells[combo[0]] == @board.cells[combo[1]] &&\n @board.cells[combo[1]] == @board.cells[combo[2]] &&\n @board.taken?(combo[0]+1)\n end\n end", "def won?\n ::WIN_COMBINATIONS.detect do |combo|\n board.cells[combo[0]] == @board.cells[combo[1]] &&\n board.cells[combo[1]] == @board.cells[combo[2]] &&\n board.taken?(combo[0]+1)\n end\n end", "def won? # shows winning combination\n WIN_COMBINATIONS.detect do |win_combo|\n if (@board[win_combo[0]]) == \"X\" && (@board[win_combo[1]]) == \"X\" && (@board[win_combo[2]]) == \"X\"\n return win_combo\n elsif (@board[win_combo[0]]) == \"O\" && (@board[win_combo[1]]) == \"O\" && (@board[win_combo[2]]) == \"O\"\n return win_combo\n end\n false\n end\nend", "def won?\n # for each win_combo in WIN_COMBINATIONS\n WIN_COMBINATIONS.each do |win_combo|\n # win_combination is a 3 element array of indexes that compose a win, eg. [0,1,2]\n # grab each index from the win_combo that composes a win.\n win_index_1 = win_combo[0]\n win_index_2 = win_combo[1]\n win_index_3 = win_combo[2]\n # If/else that declares a winner if all three spots in a winning array have\n # either an \"X\" or an \"O\", respectively.\n if @board[win_index_1] == \"X\" && @board[win_index_2] == \"X\" && @board[win_index_3] == \"X\"\n puts \"Congratulations X!\"\n puts \"You won!\"\n return win_combo\n elsif @board[win_index_1] == \"O\" && @board[win_index_2] == \"O\" && @board[win_index_3] == \"O\"\n puts \"Congratulations O!\"\n puts \"You won!\"\n return win_combo\n end\n end\n return false\n end", "def won?\n if @board.all?{|position|position == \" \"}\n return false\n end\n no_combinations = true\n WIN_COMBINATIONS.each do |combination|\n if combination1 = @board[combination[0]] == \"X\" && @board[combination[1]] == \"X\" && @board[combination[2]] == \"X\" ||\n combination2 = @board[combination[0]] == \"O\" && @board[combination[1]] == \"O\" && @board[combination[2]] == \"O\"\n no_combinations = false\n return combination\n end\n end\n if no_combinations == true\n return false\n end\n end", "def win (player)\n wins = [[0,1,2],[3,4,5],[6,7,8],[0,3,6],[1,4,7],[2,5,8],[0,4,8],[2,4,6]]\n wins.each do |w|\n temp = player.picked & w # \"&\" compares and returns same values '[1,2,3] & [1,2,5,6] #=> [1, 2]''\n temp.length == 3 ? (return true) : false\n end\n end", "def won?(board)\n WIN_COMBINATIONS.each do | winning_combination |\n if board[winning_combination[0]] == \"X\" &&\n board[winning_combination[1]] == \"X\" &&\n board[winning_combination[2]] == \"X\" ||\n board[winning_combination[0]] == \"O\" &&\n board[winning_combination[1]] == \"O\" &&\n board[winning_combination[2]] == \"O\"\n return winning_combination\n end\n end\n false\nend", "def won?(board)\n WIN_COMBINATIONS.each do |win_combination|\n if board[win_combination[0]]==board[win_combination[1]]&&board[win_combination[0]]==board[win_combination[2]]&&board[win_combination[0]]!=\" \"\n return win_combination\n end\n end\n false\nend", "def won?(board)\n \n WIN_COMBINATIONS.each do |win_combo|\n p1 = board[win_combo[0]]\n p2 = board[win_combo[1]]\n p3 = board[win_combo[2]]\n \n if (p1 == \"X\" && p2 == \"X\" && p3 == \"X\") || (p1 == \"O\" && p2 == \"O\" && p3 == \"O\")\n return win_combo\n end\n \n end\n return false\n end", "def won?\n WIN_COMBINATIONS.find do |win_combo|\n if position_taken?(win_combo[0]) && @board[ win_combo[0] ] == @board[ win_combo[1] ] && @board[ win_combo[1] ] == @board[ win_combo[2] ]\n return win_combo\n else\n false\n end\n end\n end", "def won?\n\n WIN_COMBINATIONS.find do |win_combination|\n # puts \"This is win combination #{win_combination}\"\n win_index_1 = win_combination[0]\n win_index_2 = win_combination[1]\n win_index_3 = win_combination[2]\n\n position_1 = @board[win_index_1]\n position_2 = @board[win_index_2]\n position_3 = @board[win_index_3]\n\n position_1 == position_2 && position_2 == position_3 && position_taken?(win_index_1)\n end\n end", "def won?\n WIN_COMBINATIONS.detect do |combo|\n @board[combo[0]] == @board[combo[1]] &&\n @board[combo[1]] == @board[combo[2]] &&\n position_taken?(combo[0])\n end\n end", "def won?\n WIN_COMBINATIONS.detect do |combo|\n @board[combo[0]] == @board[combo[1]] &&\n @board[combo[1]] == @board[combo[2]] &&\n position_taken?(combo[0])\n end\n end", "def won?(board)\n WIN_COMBINATIONS.each do |triple|\n if(winning?(board, triple))\n return triple\n end\n end\n return false\nend", "def won?(board)\n WIN_COMBINATIONS.each do |triple|\n if(winning?(board, triple))\n return triple\n end\n end\n return false\nend", "def won?\n WIN_COMBINATIONS.find do |winning_combo|\n winning_index_1 = winning_combo[0]\n winning_index_2 = winning_combo[1]\n winning_index_3 = winning_combo[2]\n \n position_1 = @board[winning_index_1]\n position_2 = @board[winning_index_2]\n position_3 = @board[winning_index_3]\n \n (position_1 == \"X\" && position_2 == \"X\" && position_3 == \"X\") || (position_1 == \"O\" && position_2 == \"O\" && position_3 == \"O\")\n end\n end", "def won?\n # iteration returns 3 winning cells as win_combo array; or nil\n win_combo = WIN_COMBINATIONS.detect do |combo|\n board.cells[combo[0]] == board.cells[combo[1]] &&\n board.cells[combo[1]] == board.cells[combo[2]] &&\n board.cells[combo[2]] != \" \"\n end\n # won? returns winning array if found; or false\n win_combo == nil ? false : win_combo\n end", "def won?(board)\n res = false\n WIN_COMBINATIONS.each do |win_combination|\n board_entries = [board[win_combination[0]], board[win_combination[1]], board[win_combination[2]]]\n board_entries == [\"X\", \"X\", \"X\"] || board_entries == [\"O\", \"O\", \"O\"] ? res = win_combination : false\n end\n res\n\nend", "def won?\n \n # Iterates through WIN_COMBINATIONS and finds first matching win_combination and returns the winning array.\n WIN_COMBINATIONS.detect do |win_combination|\n \n # Each 'win_index' returns the first, second, and third elements of each winning combo array.\n win_index_1 = win_combination[0]\n win_index_2 = win_combination[1]\n win_index_3 = win_combination[2]\n \n # Each 'position' uses the indices from the winning combos and applies them to the 'board' array.\n position_1 = @board[win_index_1]\n position_2 = @board[win_index_2]\n position_3 = @board[win_index_3]\n \n # Takes first win_combination and checks to see if they are all \"X\"'s or \"O\"'s and that the string is not empty.\n position_1 == position_2 && position_2 == position_3 && position_taken?(win_index_1)\n end\n end", "def won?\r\n WIN_COMBINATIONS.each do |combination|\r\n occupied = true\r\n if @board[combination[0]] == \" \" || @board[combination[1]] == \" \" ||\r\n @board[combination[2]] == \" \"\r\n occupied = false\r\n end\r\n if occupied\r\n if @board[combination[0]] == @board[combination[1]] && \r\n @board[combination[1]] == @board[combination[2]]\r\n return combination\r\n end\r\n end\r\n end\r\n false\r\n end", "def won?\n WIN_COMBINATIONS.detect do |win_combination|\n @board[win_combination[0]] == @board[win_combination[1]] &&\n @board[win_combination[1]] == @board[win_combination[2]] &&\n position_taken?(win_combination[0])\n end\nend", "def won?(board)\n # for each win_combo in WIN_COMBINATIONS\n WIN_COMBINATIONS.each do |win_combo|\n # win_combination is a 3 element array of indexes that compose a win, eg. [0,1,2]\n # grab each index from the win_combo that composes a win.\n win_index_1 = win_combo[0]\n win_index_2 = win_combo[1]\n win_index_3 = win_combo[2]\n # If/else that declares a winner if all three spots in a winning array have\n # either an \"X\" or an \"O\", respectively.\n if board[win_index_1] == \"X\" && board[win_index_2] == \"X\" && board[win_index_3] == \"X\"\n return win_combo\n elsif board[win_index_1] == \"O\" && board[win_index_2] == \"O\" && board[win_index_3] == \"O\"\n return win_combo\n end\n end\n return false\nend", "def won?\n WIN_COMBINATIONS.find do |combination|\n win_index_1 = combination[0]\n win_index_2 = combination[1]\n win_index_3 = combination[2]\n position_1 = @board[win_index_1]\n\n position_2 = @board[win_index_2]\n position_3 = @board[win_index_3]\n\n position_taken?(win_index_1) && position_1 == position_2 && position_2 == position_3\n end\n end", "def won?(board)\n WIN_COMBINATIONS.each do |win|\n if [board[win[0]], board[win[1]], board[win[2]]] == [\"X\", \"X\", \"X\"] ||\n [board[win[0]], board[win[1]], board[win[2]]] == [\"O\", \"O\", \"O\"]\n return win\n end\n end\n return false\nend", "def won?(board)\n WIN_COMBINATIONS.each do |win_combo|\n if (board[win_combo[0]] == \"X\" && board[win_combo[1]] == \"X\" && board[win_combo[2]] == \"X\") || (board[win_combo[0]] == \"O\" && board[win_combo[1]] == \"O\" && board[win_combo[2]] == \"O\")\n return win_combo\n end\n end\n return false\nend", "def won?\n\n WIN_COMBINATIONS.each do |win_combination|\n # win_combination is a 3 element array of indexes that compose a win, [0,1,2]\n # grab each index from the win_combination that composes a win.\n win_index_1 = win_combination[0]\n win_index_2 = win_combination[1]\n win_index_3 = win_combination[2]\n\n position_1 = @board.cells[win_index_1] # load the value of the board at win_index_1\n position_2 = @board.cells[win_index_2] # load the value of the board at win_index_2\n position_3 = @board.cells[win_index_3] # load the value of the board at win_index_3\n\n if position_1 == \"X\" && position_2 == \"X\" && position_3 == \"X\"\n return win_combination # return the win_combination indexes that won.\n elsif position_1 == \"O\" && position_2 == \"O\" && position_3 == \"O\"\n return win_combination\n end\n end\n false\n end", "def won?(board)\n WIN_COMBINATIONS.each do|win|\n if (board[win[0]] == 'X' && board[win[1]] == 'X' && board[win[2]] == 'X') || (board[win[0]] == 'O' && board[win[1]] == 'O' && board[win[2]] == 'O')\n return win\n end\n end\n false\nend", "def won?\n answer = true\n WIN_COMBINATIONS.each do |win_combination|\n win_index_1 = win_combination[0]\n win_index_2 = win_combination[1]\n win_index_3 = win_combination[2]\n \n position_1 = board[win_index_1] \n position_2 = board[win_index_2] \n position_3 = board[win_index_3]\n\n\n if position_1 == \"X\" && position_2 == \"X\" && position_3 == \"X\"\n return answer = win_combination\n elsif position_1 == \"O\" && position_2 == \"O\" && position_3 == \"O\"\n return answer = win_combination\n else\n answer = false\n end\n end\n answer\nend", "def won?\n WIN_COMBINATIONS.detect do |win_combination|\n\n # win_combination is a 3 element array of indexes that compose a win, [0,1,2]\n # grab each index from the win_combination that composes a win, and load the value of the board at position x\n\n position_1 = self.board.cells[win_combination[0]] # load the value of the self.class at win_index_1\n position_2 = self.board.cells[win_combination[1]] # load the value of the self.class at win_index_2\n position_3 = self.board.cells[win_combination[2]] # load the value of the self.class at win_index_3\n\n position_1 == position_2 && position_2 == position_3 && (position_1 == self.player_1.token || position_1 == self.player_2.token)\n end\n end", "def won?\n\n WIN_COMBINATIONS.each do |current_combo|\n\n win_x = current_combo.all? { |position| @board[position] == \"X\" }\n win_o = current_combo.all? { |position| @board[position] == \"O\"}\n\n if win_x || win_o\n return current_combo\n\n end\n end\n false\n end", "def won?(board)\n WIN_COMBINATIONS.each do |combo|\n if board[combo[0]] == \"X\" && board[combo[1]] == \"X\" && board[combo[2]] == \"X\"\n # x wins\n return combo\n end\n \n if board[combo[0]] == \"O\" && board[combo[1]] == \"O\" && board[combo[2]] == \"O\"\n # o wins\n return combo\n end\n end\n\n return false\nend", "def won?\n WIN_COMBINATIONS.detect do |combo|\n combo.all? { |c| position_taken?( c ) && @board[c] == @board[ combo[0] ] }\n end\n end", "def won?\r\n WIN_COMBINATIONS.detect do |combo|\r\n @board[combo[0]] == @board[combo[1]] &&\r\n @board[combo[1]] == @board[combo[2]] && @board[combo[0]] != \" \"\r\n end\r\n end", "def won?\n WIN_COMBINATIONS.detect do |win_combo|\n if (@board[win_combo[0]]) == \"X\" && (@board[win_combo[1]]) == \"X\" && (@board[win_combo[2]]) == \"X\"\n return win_combo\n elsif (@board[win_combo[0]]) == \"O\" && (@board[win_combo[1]]) == \"O\" && (@board[win_combo[2]]) == \"O\"\n return win_combo\n end\n false\n end\n end", "def won?\n WIN_COMBINATIONS.any? do |win_array|\n board.cells[win_array[0]] == \"X\" && board.cells[win_array[1]] == \"X\" && board.cells[win_array[2]] == \"X\" ||\n board.cells[win_array[0]] == \"O\" && board.cells[win_array[1]] == \"O\" && board.cells[win_array[2]] == \"O\"\n end\n end", "def won?\n won = false\n WIN_COMBINATIONS.each do |win_combination|\n board_entries = [@board.cells[win_combination[0]], @board.cells[win_combination[1]], @board.cells[win_combination[2]]]\n board_entries == [\"X\", \"X\", \"X\"] || board_entries == [\"O\", \"O\", \"O\"] ? won = win_combination : false\n end\n won\n end", "def won?\n WIN_COMBINATIONS.detect do |wc|\n @board[wc[0]] == @board[wc[1]] && @board[wc[1]] == @board[wc[2]] && position_taken?(wc[0])\n end \n end", "def won?\n WIN_COMBINATIONS.each do |combination|\n win_index_1 = combination[0]\n win_index_2 = combination[1]\n win_index_3 = combination[2]\n \n position_1 = @board[win_index_1] # load the value of the board at win_index_1\n position_2 = @board[win_index_2] # load the value of the board at win_index_2\n position_3 = @board[win_index_3] # load the value of the board at win_index_3\n \n if position_1 == \"X\" && position_2 == \"X\" && position_3 == \"X\"\n return combination # return the win_combination indexes that won.\n elsif position_1 == \"O\" && position_2 == \"O\" && position_3 == \"O\"\n return combination # return the win_combination indexes that won.\n end\n end\n false\n end", "def won?(board)\n WIN_COMBINATIONS.each do |combination|\n if board[combination[0]] == \"X\" && board[combination[1]] == \"X\" && board[combination[2]] == \"X\" || board[combination[0]] == \"O\" && board[combination[1]] == \"O\" && board[combination[2]] == \"O\"\n return combination\n end\n end\n return false\nend", "def won?\ntokens = [\"X\", \"O\"]\nwon = false\n@x_win = false\n@o_win = false\nwinning_combo = []\n\nWIN_COMBINATIONS.each do |combination|\n @x_win = combination.all?{|index| @board[index] == tokens[0]} if true\n @o_win = combination.all?{|index| @board[index] == tokens[1]} if true\n if @x_win || @o_win\n won = true\n winning_combo = combination\n end\nend\n\nif won #what should we return\n winning_combo\nelse\n false\nend\nend", "def player_win?(n)\n self.wins.each do |win| \n return true if (player_moves(\"#{n}\") & win).count == self.win_length\n end\n return false\n end", "def won?(board)\n game = false\n WIN_COMBINATIONS.each do |win_combination|\n if !game\n if win_combination.all?{|i| board[i]==\"X\"} || win_combination.all?{|i| board[i]==\"O\"}\n game = win_combination\n end\n end\n end\n game\n end", "def won?\n if empty?\n return false\n end\n\n WIN_COMBINATIONS.each do |win_combination|\n win_index_1 = win_combination[0]\n win_index_2 = win_combination[1]\n win_index_3 = win_combination[2]\n\n position_1 = @board[win_index_1] # load the value of the board at win_index_1\n position_2 = @board[win_index_2] # load the value of the board at win_index_2\n position_3 = @board[win_index_3] # load the value of the board at win_index_3\n\n if position_1 == \"X\" && position_2 == \"X\" && position_3 == \"X\"\n return win_combination # return the win_combination indexes that won.\n elsif position_1 == \"O\" && position_2 == \"O\" && position_3 == \"O\"\n return win_combination # return the win_combination indexes that won.\n else\n false\n end\n end\n\n if full?\n return false\n end\n end", "def won?\n WIN_COMBINATIONS.detect do |combo|\n @board[combo[0]] == @board[combo[1]] &&\n @board[combo[1]] == @board[combo[2]] &&\n position_taken?(combo[0])\n end\nend", "def won?\n WIN_COMBINATIONS.any? do |win_combo|\n win_index_1 = win_combo[0]\n win_index_2 = win_combo[1]\n win_index_3 = win_combo[2]\n\n position_1 = @board[win_index_1]\n position_2 = @board[win_index_2]\n position_3 = @board[win_index_3]\n\n if position_taken?(win_index_1) && position_1 == position_2 && position_2 == position_3\n #binding.pry\n return win_combo\n end\n end\n end", "def won?(board)\n for win_combination in WIN_COMBINATIONS\n if (board[win_combination[0]] == 'X' && board[win_combination[1]] == 'X' && board[win_combination[2]] == \"X\")\n return win_combination\n elsif (board[win_combination[0]] == 'O' && board[win_combination[1]] == 'O' && board[win_combination[2]] == \"O\")\n return win_combination\n end\n end\n return false\nend", "def won? (board)\n #for each row, column and diagnonal combination\n WIN_COMBINATIONS.each do | win_combination |\n #grab the winning combinaation of indices we are looking for\n win_index_1 = win_combination[0]\n win_index_2 = win_combination[1]\n win_index_3 = win_combination[2]\n\n #extract the value of these winning indices from the board\n position_1 = board[win_index_1]\n position_2 = board[win_index_2]\n position_3 = board[win_index_3]\n\n\n #check if either team has won\n if (position_1 == \"X\" && position_2 == \"X\" && position_3 == \"X\") ||\n (position_1 == \"O\" && position_2 == \"O\" && position_3 == \"O\")\n #we break out of here if we have a winning row, col, or diagnonal\n return win_combination\n end #end if\n end #end for each\n\n #if we get here the board may be empty\n #if we get here the board may be filled, but no winning combos\n return false\nend", "def won?\n WIN_COMBINATIONS.detect{|win| @board[win[0]] == @board[win[1]] && @board[win[1]] == @board[win[2]] && position_taken?(win[2])}\nend", "def won?\n WIN_COMBINATIONS.any? do |combo|\n @board.cells[combo[0]] == @board.cells[combo[1]] && @board.cells[combo[0]] == @board.cells[combo[2]] && @board.cells[combo[0]] != \" \"\n end\n end", "def won?(board)\n WIN_COMBINATIONS.each {|win_combo|\n index_0 = win_combo[0]\n index_1 = win_combo[1]\n index_2 = win_combo[2]\n\n position_1 = board[index_0]\n position_2 = board[index_1]\n position_3 = board[index_2]\n\n if position_1 == \"X\" && position_2 == \"X\" && position_3 == \"X\"\n final_winner = \"X\"\n return win_combo\n elsif position_1 == \"O\" && position_2 == \"O\" && position_3 == \"O\"\n final_winner = \"O\"\n return win_combo\n end\n }\n return false\nend", "def won?(board)\n WIN_COMBINATIONS.each do |combo|\n win_combination = [combo[0], combo[1], combo[2]]\n windex1 = win_combination[0]\n windex2 = win_combination[1]\n windex3 = win_combination[2]\n\n pos1 = board[windex1]\n pos2 = board[windex2]\n pos3 = board[windex3]\n win_combo = [pos1,pos2,pos3]\n\n if pos1 == \"X\" && pos2 == \"X\" && pos3 == \"X\" || pos1 ==\"O\" && pos2 == \"O\" && pos3 == \"O\"\n return win_combination\n end\nend\n return false\nend", "def won?(board)\n x = \"X\";\n o = \"O\";\n\n WIN_COMBINATIONS.each do |win_combination|\n win_index_1 = win_combination[0];\n win_index_2 = win_combination[1];\n win_index_3 = win_combination[2];\n\n position_1 = board[win_index_1];\n position_2 = board[win_index_2];\n position_3 = board[win_index_3];\n\n if ((position_1 == x && position_2 == x && position_3 == x) ||\n (position_1 == o && position_2 == o && position_3 == o))\n return win_combination;\n else\n false\n end\n end\n return false;\nend", "def won?(board)\n WIN_COMBINATIONS.detect do |win_combo|\n board[win_combo[0]] == board[win_combo[1]] &&\n board[win_combo[0]] == board[win_combo[2]] &&\n position_taken?(board, win_combo[0])\n end\nend", "def won?(board)\n WIN_COMBINATIONS.detect do | win_combination |\n (board[win_combination[0]] == \"X\" && board[win_combination[1]] == \"X\" && board[win_combination[2]] == \"X\")||\n (board[win_combination[0]] == \"O\" && board[win_combination[1]] == \"O\" && board[win_combination[2]] == \"O\")\n end\nend", "def won?(board)\n WIN_COMBINATIONS.each do |win_combination|\n if board[win_combination[0]] == \"X\" && board[win_combination[1]] == \"X\" && board[win_combination[2]] == \"X\"\n return win_combination\n elsif board[win_combination[0]] == \"O\" && board[win_combination[1]] == \"O\" && board[win_combination[2]] == \"O\"\n return win_combination\n end\n end\n return false\nend", "def won?(board)\n WIN_COMBINATIONS.detect do |combination|\n board[combination[0]] == board[combination[1]] &&\n board[combination[1]] == board[combination[2]] &&\n position_taken?(board, combination[0])\n end\nend", "def won?(board)\n # cycle through WIN_COMBINATIONS\n WIN_COMBINATIONS.detect { |winning_combo|\n # print win_index\n # print '\\n'\n position_taken?(board,winning_combo[0]) &&\n position_taken?(board,winning_combo[1]) &&\n position_taken?(board,winning_combo[2]) &&\n board[winning_combo[0]] == board[winning_combo[1]] &&\n board[winning_combo[1]] == board[winning_combo[2]]\n }\nend", "def won?(board)\n WIN_COMBINATIONS.detect do |combo|\n board[combo[0]] == board[combo[1]] &&\n board[combo[1]] == board[combo[2]] &&\n position_taken?(board, combo[0])\n end\nend", "def won?(board)\n WIN_COMBINATIONS.detect do |combo|\n board[combo[0]] == board[combo[1]] &&\n board[combo[1]] == board[combo[2]] &&\n position_taken?(board, combo[0])\n end\nend", "def won?(board)\n WIN_COMBINATIONS.detect do |combo|\n board[combo[0]] == board[combo[1]] &&\n board[combo[1]] == board[combo[2]] &&\n position_taken?(board, combo[0])\n end\nend", "def won?(board)\n\n WIN_COMBINATIONS.each do |win_combination|\n win_index_1 = win_combination[0]\n win_index_2 = win_combination[1]\n win_index_3 = win_combination[2]\n \n position_1 = board[win_index_1]\n position_2 = board[win_index_2]\n position_3 = board[win_index_3]\n \n if ((position_1 == \"X\" && position_2 == \"X\" && position_3 == \"X\") || (position_1 == \"O\" && position_2 == \"O\" && position_3 == \"O\"))\n return win_combination\n end\n end\n return FALSE\nend", "def won?(board)\n WIN_COMBINATIONS.each do |win_combo|\n win_in_1 = win_combo[0]\n win_in_2 = win_combo[1]\n win_in_3 = win_combo[2]\n\n position_1 = board[win_in_1]\n position_2 = board[win_in_2]\n position_3 = board[win_in_3]\n\n if position_1 == position_2 && position_2 == position_3 && position_taken?(board, win_in_1)\n return win_combo\n end\n end\n return false\nend", "def won?\n WIN_COMBINATIONS.find do |combo|\n board.cells[combo[0]] == board.cells[combo[1]] && board.cells[combo[1]] == board.cells[combo[2]] && board.cells[combo[0]] != \" \"\n end\n end", "def won?(board)\n WIN_COMBINATIONS.each do |combo|\n if position_taken?(board,combo[0]) && position_taken?(board,combo[1]) && position_taken?(board,combo[2])\n if board[combo[0]] == board[combo[1]] && board[combo[1]] == board[combo[2]]\n return combo\n end\n end\n end\n return false\nend", "def won?\r\n WIN_COMBINATIONS.find do |combo|\r\n combo.all? {|i| board.cells[i] == \"X\"} || combo.all? {|i| board.cells[i] == \"O\"}\r\n end\r\n end", "def won?(board)\n tanda=0\n WIN_COMBINATIONS.each do |ok|\n if board[ok[0]]== \"X\" && board[ok[1]]== \"X\" && board[ok[2]]==\"X\"\n tanda=2\n return ok\n elsif board[ok[0]]== \"O\" && board[ok[1]]== \"O\" && board[ok[2]]==\"O\"\n tanda=2\n return ok\n end\n end\n if tanda==0\n return false\n end\nend", "def won?(board)\n WIN_COMBINATIONS.detect do |win_combination|\n board[win_combination[0]] == board[win_combination[1]] &&\n board[win_combination[1]] == board[win_combination[2]] &&\n position_taken?(board, win_combination[0])\n end\nend", "def won?(board)\n WIN_COMBINATIONS.detect do |win_combination|\n\n # check each win combination for win\n win_X = win_combination.all? {|cell| board[cell] == \"X\"}\n win_O = win_combination.all? {|cell| board[cell] == \"O\"}\n\n if win_X or win_O\n return win_combination\n else\n false\n end\n end\nend", "def won?(board)\n WIN_COMBINATIONS.detect do |combo|\n board[combo[0]] == board[combo[1]] && board[combo[2]] == board[combo[1]] && position_taken?(board,combo[0])\n end\nend", "def victory?\n won = false\n @board.winning_combos.each do |combo|\n won = true if (combo & @other_player.squares) == combo\n end\n won\n end", "def won?(board)\n return false if board.all?{|x| x == \" \"}\n WIN_COMBINATIONS.each do |wincombo|\n if wincombo.all?{|idx| board[idx] == \"X\"} || wincombo.all?{|idx| board[idx] == \"O\"}\n return wincombo\n end\n end\n false\nend", "def won?(board)\n WIN_COMBINATIONS.detect do | combination |\n board[combination[0]] == board[combination[1]] &&\n board[combination[1]] == board[combination[2]] &&\n position_taken?(board,combination[0])\n end\nend", "def won?\r\n WIN_COMBINATIONS.detect do | win_combination |\r\n # win_combination = [0,1,2], [3,4,5], [0,4,8], ... [2,4,6]\r\n\r\n win_index_1 = win_combination[0] # 0, 3\r\n win_index_2 = win_combination[1] # 1, 4\r\n win_index_3 = win_combination[2] # 2, 5\r\n\r\n position_1 = @board[win_index_1] # \"X\", \"O\"\r\n position_2 = @board[win_index_2] # \"O\", \"X\"\r\n position_3 = @board[win_index_3] # \"X\", \"O\"\r\n\r\n if position_1 == position_2 && position_2 == position_3 && position_1 != \" \"\r\n return win_combination # return the win_combination indexes that won.\r\n else\r\n false\r\n end\r\n end\r\n end", "def won?(board)\n WIN_COMBINATIONS.each do |win_combination|\n # get indices of each win_combination\n win_index_1 = win_combination[0]\n win_index_2 = win_combination[1]\n win_index_3 = win_combination[2]\n # get values from board that map to each index in each win_combination\n position_1 = board[win_index_1]\n position_2 = board[win_index_2]\n position_3 = board[win_index_3]\n # Are all values X's?\n if (position_1 == \"X\" && position_2 == \"X\" && position_3 == \"X\") || (position_1 == \"O\" && position_2 == \"O\" && position_3 == \"O\")\n return win_combination\n end # else not a win_combination\n\n end # WIN_COMBINATIONS.each iteration\n\n return false\nend", "def won?(board_array)\r\n #logic to check for a winning combination\r\n WIN_COMBINATIONS.detect do |combo|\r\n board_array[combo[0]] == board_array[combo[1]] && board_array[combo[2]] == board_array[combo[1]]&&position_taken?(board_array,combo[0])\r\n #winner_for_game = board_array[combo[0]]\r\n #return true\r\n end\r\n end", "def won?(board)\n WIN_COMBINATIONS.each do |win_index| #interates thru list of win combinations array\n\n x_win = win_index.all? do |spot| #interates thru individual win array\n\n board[spot] == \"X\"\n\n end\n\n o_win = win_index.all? do |spot|\n\n board[spot] == \"O\"\n\n end\n\n if x_win || o_win\n\n return win_index\n\n end\n end\n else\n return false\nend", "def won?(board)\n WIN_COMBINATIONS.each do |combo|\n if board[combo[0]] == board[combo[1]] && board[combo[1]] == board[combo[2]]\n return combo unless board[combo[0]] == \" \"\n end\n end\n false\nend", "def won?()\n WIN_COMBINATIONS.detect do |e|\n @board[e[0]] == @board[e[1]] && @board[e[1]] == @board[e[2]] && position_taken?( e[0])\n end\nend", "def won?(board)\nempty_board = board.all? {|empty| empty == \" \"}\ndraw = board.all? {|token| token == \"X\" || token == \"O\"}\nWIN_COMBINATIONS.any? do |win_combo|\n if win_combo.all? {|index| board[index] ==\"X\" } || win_combo.all? {|index| board[index] ==\"O\"}\n return win_combo\n else empty_board || draw\n false\n end\n end\nend", "def won?(board)\nempty_board = board.all? {|empty| empty == \" \"}\ndraw = board.all? {|token| token == \"X\" || token == \"O\"}\nWIN_COMBINATIONS.any? do |win_combo|\n if win_combo.all? {|index| board[index] ==\"X\" } || win_combo.all? {|index| board[index] ==\"O\"}\n return win_combo\n else empty_board || draw\n false\n end\n end\nend", "def won?(board)\n WIN_COMBINATIONS.detect do |win|\n board[win[0]] == board[win[1]] && board[win[0]] == board[win[2]] &&\n position_taken?(board, win[0])\n end\nend", "def won?(board)\n WIN_COMBINATIONS.detect do |win|\n board[win[0]] == board[win[1]] && board[win[0]] == board[win[2]] &&\n position_taken?(board, win[0])\n end\nend", "def won?(board)\n WIN_COMBINATIONS.each do |c|\n if c.all?{|pos| board[pos]==\"X\"} || c.all?{|pos| board[pos]==\"O\"}\n return c\n else\n false\n end\n end\n false #If win combo not found return false\nend", "def win\n # horizontal win\n winner = horizontal_win?\n if winner\n victory(winner)\n return winner\n end\n\n # Vertical win (way harder to test for)\n winner = vertical_win?\n if winner\n victory(winner)\n return winner\n end\n\n # Diagonal win\n winner = diagonal_win?\n if winner\n victory(winner)\n return winner\n end\n\n # If the board is full and there are no declared winners\n\n if full?\n victory(\"Nobody\")\n return \"tie\"\n end\n return false\n end", "def won?\n WIN_COMBINATIONS.detect do |combo|\n if combo.all? {|c| @board.cells[c] == \"X\"}\n @winner = \"X\"\n return combo\n elsif combo.all?{|c| @board.cells[c] == \"O\"}\n @winner = \"O\"\n return combo\n end\n end\n nil\n end", "def won?(board)\n WIN_COMBINATIONS.each do |combo|\n if (board[combo[0]] == board[combo[1]] && board[combo[0]] == board[combo[2]] && board[combo[0]] != \" \" && board[combo[0]] != \"\" && !board[combo[0]].nil?)\n return combo\n break\n end\n end\n return false\nend", "def won?(board)\n WIN_COMBINATIONS.each do |combo|\n if position_taken?(board,combo[0]) && position_taken?(board,combo[1]) && position_taken?(board,combo[2])\n if board[combo[0]] == board[combo[1]] && board[combo[1]] == board[combo[2]]\n return combo\n end\n end #if\n end #WIN_COMBINATIONS\n return nil\nend", "def won?(board)\n WIN_COMBINATIONS.each do |combination| #iterate over WIN_COMBINATIONS\n if position_taken?(board, combination[0]) #only check for a win if the position is taken\n if board[combination[0]] == board[combination[1]] && board[combination[0]] == board[combination[2]]\n return combination\n end\n end\n end\n nil\nend", "def won?(board)\n WIN_COMBINATIONS.find do |winning_combo|\n board[winning_combo[0]] == board[winning_combo[1]] &&\n board[winning_combo[1]] == board[winning_combo[2]] &&\n position_taken?(board, winning_combo[0])\n end\nend", "def won?(board)\n WIN_COMBINATIONS.detect do |combo|\n board[combo[0]] == board[combo[1]] &&\n board[combo[1]] == board[combo[2]] &&\n position_taken?(board, combo[0])\n end\nend", "def won?(board)\nWIN_COMBINATIONS.each do |combination|\n combination.all? do |occupied|\n if position_taken?(board, occupied) == true\n if board[combination[0]] == board[combination[1]] && board[combination[0]] == board[combination[2]]\n return combination\n end\n end\n end\nend\n return false\nend", "def won?\n WIN_COMBINATIONS.any? { |currentBoard| \n if position_taken?( currentBoard[0] ) && @board[currentBoard[0]] == @board[currentBoard[1]] && @board[currentBoard[1]] == @board[currentBoard[2]]\n return currentBoard\n end\n }\n end" ]
[ "0.8327102", "0.83234674", "0.822097", "0.8198454", "0.81779665", "0.8173098", "0.8168596", "0.8116829", "0.81163055", "0.81070983", "0.8103316", "0.8083907", "0.80714333", "0.80579615", "0.80477935", "0.8036691", "0.80156755", "0.80153245", "0.8014955", "0.8003463", "0.7994066", "0.7994066", "0.79930454", "0.79930454", "0.7982579", "0.7979527", "0.7978708", "0.7975716", "0.79750437", "0.7958656", "0.7942022", "0.79419726", "0.79390633", "0.79336125", "0.7928473", "0.79268885", "0.7925266", "0.79246455", "0.7923163", "0.79195577", "0.790943", "0.7909425", "0.79017735", "0.7892847", "0.78845793", "0.7880004", "0.78769404", "0.7874294", "0.7874123", "0.78729475", "0.7867091", "0.78511554", "0.7849575", "0.784735", "0.7833356", "0.7825174", "0.7824675", "0.78231394", "0.782148", "0.78174263", "0.78141147", "0.78137034", "0.78131896", "0.78076595", "0.7803552", "0.780003", "0.77965164", "0.77965164", "0.77965164", "0.77963996", "0.7790608", "0.7784398", "0.7775533", "0.7769281", "0.7765952", "0.77650106", "0.776454", "0.77574503", "0.77559364", "0.77540946", "0.7753619", "0.77515495", "0.7747864", "0.7747813", "0.774724", "0.77458", "0.7743412", "0.7741884", "0.7741884", "0.77415204", "0.77415204", "0.7741203", "0.77402914", "0.7738105", "0.7734302", "0.7730489", "0.77287966", "0.7724673", "0.7719707", "0.7718686", "0.77171594" ]
0.0
-1
returns true if the board is full (draw)
def full?(board) !board.include?(" ") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def board_full?(brd)\n empty_squares(brd).empty?\n end", "def isBoardFull()\n #\n # TO DO: add your code below\n #\n for i in 0...@size\n for j in 0...@size\n if (@board[i][j]==EMPTY)\n return false\n end\n end\n end\n\n # DO NOT DELETE THE LINE BELOW\n\t\treturn true;\n\tend", "def isBoardFull()\n #\n # TO DO: add your code below\n\t\t#\n\t\tfor i in ([email protected])\n\t\t\tfor j in ([email protected])\n\t\t\t\tif @board[i][j] == EMPTY\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n # DO NOT DELETE THE LINE BELOW\n\t\treturn true;\n\tend", "def board_full?\r\n @game_board.count(\"\") == 0\r\n end", "def draw?\n board.full_board?\n end", "def full?\n @board.all?{|occupied| occupied != \" \"}\n end", "def board_full?(brd)\n empty_squares(brd).empty?\nend", "def board_full?(brd)\n empty_squares(brd).empty?\nend", "def full? #if theres no winning combos and the board is full? check to see\n @board.all?{|square| square!= \" \" }\n end", "def draw?\n !won? && board.full?\n end", "def board_full?\n @board.flatten.all?\n @turn == 9 \n end", "def draw?\n @board.full? && !won?\n end", "def board_full?\n @board.each do |row|\n row.each do |col|\n if col == @empty_square\n #stop at first empty space found\n return nil\n end\n end\n end\n return true\n end", "def draw?\n @board.full? && !won?\n end", "def draw?\n @board.full? && !won?\n end", "def full_board?\n @board.cells.each do |row|\n row.each do |cell|\n return false if cell.state == \" \"\n end\n end\n true\n end", "def full?\r\n @board.none? do | position |\r\n position == \" \"\r\n end\r\n end", "def isBoardFull()\n\n # TO DO: COMPLETE THIS PART OF THE METHOD\n\n counter = 0\n totalSpaces = @size * @size\n\n for i in 0..@size-1\n for j in 0..@size-1\n if @board[i][j] != \"-\"\n counter = counter + 1\n end\n end\n end\n\n if counter == totalSpaces\n return true\n end\n\n\t\treturn false\n end", "def draw?\n @board.full? && !won?;\n end", "def full?\n @board.all? do |position|\n position != \" \"\n end\n end", "def full?\n @board.all? do |position|\n position != \" \"\n end\n end", "def full?\n is_full = @board.all? do |space|\n space ==\"X\" || space == \"O\"\n end\n if is_full\n true\n end\n end", "def draw?\n board.full? && self.won? == false\n end", "def draw?\n self.board.full? && !self.won?\n end", "def full?\n # If no 'board_position'/s are empty, returns 'true'. If 'board_position'/s remain empty, returns 'false'.\n if @board.none? {|board_position| board_position == \" \"}\n true\n end\n end", "def is_full?\n\t\t@game_board.each do |x|\n\t\t\tx.each do |y|\n\t\t\t\tif y == \"\"\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\ttrue\n\tend", "def draw?\n # board is full, but not won\n if full? && !won?\n true\n # board is not full and not won\n elsif full? == false\n false\n # false for game won in first row or game won diagonally\n # elsif won?(board) == [0,1,2] || won?(board) == [0,4,8] || won?(board) == [2,4,6]\n # false\n end\n end", "def full?\n @board.all? {|space| space == \"X\" || space == \"O\"}\n end", "def full?\n @board.all?{|occupied| occupied != \" \"}\nend", "def full?\n @board.all?{|occupied| occupied != \" \"}\nend", "def full?\n return @board.all?{|pos| pos == \"X\" or pos == \"O\"}\n end", "def draw?\n incomplete_board = !full?\n is_game_won = won?\n if incomplete_board == true\n return false\n elsif is_game_won.is_a?(Array)\n return false\n else\n return true\n end\n end", "def full?\r\n @board.each do |space|\r\n if space == \" \"\r\n return false\r\n end\r\n end\r\n true\r\n end", "def full?\n result = @board.none? {|mark| mark==\" \"}\n return result\n end", "def full?\n\t\[email protected]? { |e|\n\t\t\te == \"X\" || e == \"O\"\n\t\t}\n\tend", "def draw?(board)\n !won?(board) && full?(board)\n end", "def draw? (board)\n if !won?(board) #returns true if no win\n if full?(board) #but board is full\n return true\n end\n end\n return false\nend", "def full?\n @board.all? {|position| position == \"X\" or position == \"O\"}\n end", "def draw?(board)\n\tif won?(board) == nil && full?(board) == true\n\t\treturn true\n\tend\nend", "def full?\n @board.all? { |location| location != \" \"}\n end", "def full?\n answer= @board.each {|box| return false if taken?(box) == false }\n unless answer ==false \n true\n end\n end", "def full_board?\n (@turn_played > @turn_max) ? true : false\n end", "def board_full?(board)\n !board.include?(\"\")\n end", "def board_full\n\n # Assume the board is full\n result = true\n\n # Outer loop through each row\n for row in 0..BOARD_MAXIMUM_INDEX\n\n # Inner loop through each column\n for column in 0..BOARD_MAXIMUM_INDEX\n\n # Is this cell occupied?\n if @board[row][column] == EMPTY_POSITION\n\n # No, the board is not full and the game must continue\n result = false\n\n end\n\n end\n\n end\n\n # Since we found no open positions, the board is full\n return result\n\n end", "def full?\n [email protected]{|i| i == \" \"}\n end", "def full?\n @board.cells.include?(\"\") || @board.cells.include?(\" \") ? false : true\n end", "def full?\n @board.all? {|i| i == \"X\" || i == \"O\"}\n end", "def is_full?\n\t @grid.all? { |col| col.length == @rows }\n\tend", "def draw?\n if self.won? == nil && self.board.full?\n true\n elsif self.won? != nil || !self.board.full?\n false\n end\n end", "def check_full? \n \t\treturn true if @size==16 #size increase by 1 with every turn so when it reaches 16 we know that all cells are full\n\tend", "def full?\n any_spaces = @board.any?{|element| element == \" \"}\n if any_spaces == true\n return false\n else\n return true\n end\n end", "def draw?(board)\n if won?(board) || !full?(board)\n false\n else\n true\n end\nend", "def full?\n #if there is a blank space, returns false, otherwise true\n !(@board.detect {|posit| posit == \" \"})\n end", "def full?(board_array)\r\n board_check = board_array.all? do |space|\r\n space != \" \"\r\n end\r\n \r\n if board_check\r\n return true #situation for a draw\r\n else\r\n return false #situation for an in-progress game\r\n end\r\nend", "def board_full?(board)\n false\n true unless board.include?(INITIAL_MARKER)\nend", "def full?(board)\n filled_tiles = 0\n board.each { |tile| tile == \"X\" || tile == \"O\" ? (filled_tiles += 1) : ()}\n filled_tiles == 9 ? (return true) : (return false)\nend", "def full?(board_array)\n board_check = board_array.all? do |space|\n space != \" \"\n end\n \n if board_check\n return true #situation for a draw\n else\n return false #situation for an in-progress game\n end\nend", "def full?(board)\n if @board.any? {|index| index == nil || index == \" \"}\n return false\n else\n return true\n end\n end", "def full? \n\[email protected]? {|a| a.include?(\" \")} ? false : true\n\tend", "def draw?(board)\n if (!won?(board)) && (full?(board))\n return true\n end\n return false\nend", "def full?(board)\n if won?(board) == false && board.all? {|element| element != \" \"}\n return true\n else\n false\n end\nend", "def draw?(board)\n\t if !won?(board) && full?(board)\n\t return true\n\t else\n\t return false\n\t end\nend", "def draw?\n !victory? && @board.flatten.compact.size == 9\n end", "def draw?(board)\n if won?(board)\n false\n elsif full?(board)\n true\n else\n false\n end\nend", "def draw?(board)\n if won?(board)\n false\n elsif full?(board)\n true\n else\n false\n end\nend", "def draw?(board_array)\r\n full?(board_array) && !won?(board_array)\r\nend", "def full?\n if @board.include?(\" \")\n false\n else\n true\n end\nend", "def draw?(board)\n if !won?(board) && full?(board)\n return true\n end\nend", "def full?\n @board.all? {|value| value == \"X\" || value ==\"O\"}\n end", "def full?\n if @board.detect{|i| i == \"\" || i == \" \"}\n return false\n else\n return true\n end\n end", "def draw?(board)\n (full?(board)) && !(won?(board))\nend", "def draw?(board)\n return !won?(board) && full?(board)\nend", "def draw?(board)\n if won?(board)\n return false\n elsif full?(board)\n return true\n end\nend", "def draw?(board)\nfull?(board) && !won?(board)\nend", "def draw?(board)\n if won?(board) == false && full?(board) == true\n return true\n end\nend", "def draw?(board)\n !won?(board) && full?(board)\nend", "def draw?(board)\n !won?(board) && full?(board)\nend", "def draw?(board)\n !won?(board) && full?(board)\nend", "def draw?(board)\n !won?(board) && full?(board)\nend", "def draw?(board)\n !won?(board) && full?(board)\nend", "def draw?(board)\n !won?(board) && full?(board)\nend", "def draw?(board)\n !won?(board) && full?(board)\nend", "def draw?(board)\n !won?(board) && full?(board)\nend", "def draw?(board)\n won?(board) == nil && full?(board) == true\nend", "def is_board_full(board)\n for i in 1..10\n if is_space_free(board, i)\n return false\n end\n end \n\n return true\nend", "def draw?(board)\n if !won?(board) && full?(board)\n return true\n end\nend", "def draw?(board)\n if !won?(board) && full?(board)\n return true\n end\nend", "def draw?(board)\n if won?(board) == nil && full?(board) == true\n return true\n end\nend", "def draw?(board)\n if won?(board) == nil && full?(board) == true\n true\n else\n false\n end\nend", "def draw?(board)\n if won?(board) == nil && full?(board) == true\n true\n else\n false\n end\nend", "def draw? (board)\n if full?(board) == true\n !won?(board)\n end\nend", "def full?(board)\n turn_count(board) == 9 ? true : false\nend", "def draw?(board)\n if (full?(board) == false)\n return false\n else\n if (won?(board) != false)\n return false\n else\n return true\n end\n end\n end", "def draw?(board)\n if !(won?(board)) && full?(board)\n return true\n end\nend", "def draw?(board)\n if (!full?(board) && !won?(board)) || won?(board)\n false\n elsif full?(board) == true\n true\n end\nend", "def draw?\n !won? && full?\n end", "def draw?(board)\n (full?(board) && !won?(board)) ? true : false\nend", "def full?(board) #check if the board is full\n board.each_with_index do |position, index|\n if position_taken?(board, index) == false \n return false\n end\n end\n return true\nend", "def draw?(board)\n return full?(board) && !won?(board)\nend", "def full?()\n @board.each do |values|\n if values == \" \" || values == \"\"\n return false\n end\n end\n return true\n end", "def full?\n @board.all? { |token| token == \"X\" || token == \"O\" }\n end" ]
[ "0.881816", "0.87224096", "0.8705429", "0.86755717", "0.86513954", "0.8632615", "0.85844284", "0.85844284", "0.8558072", "0.8542994", "0.8522764", "0.84886265", "0.8480673", "0.84772813", "0.84772813", "0.84048176", "0.8396499", "0.837035", "0.83687645", "0.8363026", "0.8363026", "0.83558345", "0.83412004", "0.8327475", "0.8245601", "0.8221005", "0.8206275", "0.81915534", "0.8181133", "0.8181133", "0.8177275", "0.81703705", "0.8158771", "0.8152906", "0.81197596", "0.81157273", "0.8113277", "0.81025726", "0.8075338", "0.8066321", "0.8065405", "0.8041502", "0.8024877", "0.8023241", "0.8013696", "0.8012899", "0.80008", "0.79997474", "0.79866993", "0.79775035", "0.79747003", "0.7964746", "0.7964561", "0.7952726", "0.79519194", "0.7949248", "0.7948414", "0.79404986", "0.7914961", "0.79076725", "0.79073274", "0.7887563", "0.7877242", "0.7868133", "0.7868133", "0.78603166", "0.7855623", "0.7851907", "0.7848228", "0.78446305", "0.7843367", "0.78353244", "0.78241426", "0.78220433", "0.78203183", "0.7818212", "0.7818212", "0.7818212", "0.7818212", "0.7818212", "0.7818212", "0.7818212", "0.78147244", "0.7810532", "0.7808993", "0.7803477", "0.7803477", "0.77959603", "0.779119", "0.779119", "0.77887726", "0.7779083", "0.77771586", "0.7773657", "0.7764598", "0.77645266", "0.7758927", "0.77584726", "0.77498233", "0.774508", "0.77445066" ]
0.0
-1
returns true if the board has not been won but is full, false if the board is not won and the board is not full, and false if the board is won
def draw?(board) if won?(board) false elsif full?(board) true else false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full? #if theres no winning combos and the board is full? check to see\n @board.all?{|square| square!= \" \" }\n end", "def over?(board)\n if(!!won?(board))\n return true\n elsif(full?(board))\n return true\n end\n return false\nend", "def full?\n @board.all?{|occupied| occupied != \" \"}\n end", "def over?(board)\n if draw?(board)\n true\n elsif won?(board) != nil && full?(board) == true\n true\n elsif won?(board) != nil && full?(board) == false\n true\n else\n false\n end\nend", "def over?(board)\n if draw?(board)\n true\n elsif won?(board) != nil && full?(board) == true\n true\n elsif won?(board) != nil && full?(board) == false\n true\n else\n false\n end\nend", "def over?(board)\n if draw?(board)\n return true\n \n elsif won?(board) && full?(board)\n return true\n \n elsif won?(board) && !full?(board)\n return true\n \n elsif !(won?(board) && full?(board))\n return false\n end \nend", "def board_full?\n @board.flatten.all?\n @turn == 9 \n end", "def won?\n board.all_non_mines_cells_revealed?\n end", "def over?(board)\n won?(board) || full?(board)\n end", "def over?(board)\n if draw?(board) || full?(board)\n true\n elsif won?(board) != false && won?(board) != []\n true\n else\n false\n end\nend", "def board_full?\r\n @game_board.count(\"\") == 0\r\n end", "def over?(board)\n if won?(board) || full?(board)\n return true\n end\nend", "def over?(board)\n if won?(board) || full?(board)\n return true\n end\nend", "def over?(board)\n if full?(board) || won?(board)\n return true\n else\n return false\n end\nend", "def full?(board)\n if won?(board) == false && board.all? {|element| element != \" \"}\n return true\n else\n false\n end\nend", "def over?\n won? || board.full? || draw?\n end", "def full?(board)\n if !(won?(board))\n board.each do |e|\n if (e != \"X\" && e != \"O\")\n return false\n end\n end\n end\n return true\nend", "def board_full?(brd)\n empty_squares(brd).empty?\n end", "def full?\n answer= @board.each {|box| return false if taken?(box) == false }\n unless answer ==false \n true\n end\n end", "def over?(board)\n #board that has been won and the board is NOT full --> true\n if won?(board) != false && full?(board) == false\n return true\n #board that has been won and the board is full --> true\n elsif won?(board) != false && full?(board) == true\n return true\n #board that is still in-progress --> false\n elsif won?(board) == false && full?(board) == false\n return false\n #board that's a draw --> true\n elsif draw?(board) == true\n return true\n end\nend", "def over?(board)\n if (won?(board) || full?(board) || draw?(board)) || (won?(board) && !full?(board))\n return true\n else\n return false\n end\nend", "def draw? (board)\n if !won?(board) #returns true if no win\n if full?(board) #but board is full\n return true\n end\n end\n return false\nend", "def over?(board)\n if (full?(board) == true || draw?(board) == true || won?(board) != false) then\n true\n end\nend", "def draw?\n !won? && board.full?\n end", "def over?(board)\n if won?(board) != false\n puts \"won board is not false\"\n end\n\n if full?(board) == true || draw?(board) == true || won?(board) != false\n true\n end\nend", "def board_full?(brd)\n empty_squares(brd).empty?\nend", "def board_full?(brd)\n empty_squares(brd).empty?\nend", "def draw?\n @board.full? && !won?\n end", "def draw?\n @board.full? && !won?\n end", "def draw?\n @board.full? && !won?\n end", "def game_over?\n @board.pieces['black'].empty? || @board.pieces['white'].empty? || (@board.moves(HUMAN_PLAYER).empty? && @board.moves(CPU_PLAYER).empty?)\n end", "def full?\n @board.all?{|occupied| occupied != \" \"}\nend", "def full?\n @board.all?{|occupied| occupied != \" \"}\nend", "def over?(board)\n if draw?(board) || won?(board) || full?(board)\n return true\n end\nend", "def over?(board_array)\n if full?(board_array) || won?(board_array)\n return true\n else\n return false\n end\nend", "def over?(board)\n if won?(board) != nil || draw?(board) == true || full?(board) == true\n return true\n end\nend", "def full?\n return @board.all?{|pos| pos == \"X\" or pos == \"O\"}\n end", "def over?(board)\n if won?(board) || draw?(board) || full?(board)\n return true\n else\n return false\n end\nend", "def over?(board)\n if won?(board) || draw?(board) || full?(board)\n return true\n else\n return false\n end\nend", "def over?(board)\n if won?(board) || draw?(board) || full?(board)\n true\n else\n false\n end\nend", "def over?(board)\n if draw?(board) || full?(board) || won?(board)\n return true\n else\n false\n end\nend", "def over?(board)\n if (won?(board) != FALSE)\n return TRUE\n \n elsif (draw?(board) == TRUE)\n return TRUE\n \n elsif (full?(board) == TRUE)\n return TRUE\n \n else \n return FALSE\n end\nend", "def over?(board)\n if won?(board) || draw?(board) || full?(board)\n return true\n end\nend", "def over?(board)\n if won?(board) || draw?(board) || full?(board)\n return true\n end\nend", "def draw?\n board.full? && self.won? == false\n end", "def over?(board)\n if draw?(board) || won?(board) || full?(board)\n return true\n end\nend", "def over?(board)\n if draw?(board) || won?(board) || full?(board)\n return true\n end\nend", "def draw?\n # board is full, but not won\n if full? && !won?\n true\n # board is not full and not won\n elsif full? == false\n false\n # false for game won in first row or game won diagonally\n # elsif won?(board) == [0,1,2] || won?(board) == [0,4,8] || won?(board) == [2,4,6]\n # false\n end\n end", "def over?(board)\r\n if ( won?(board) || draw?(board) || full?(board))\r\n return true\r\n else\r\n return false\r\n end\r\nend", "def over?(board)\n\n if won?(board) != nil || draw?(board) == true || full?(board) == true\n return true\n else\n return false\n end\n\nend", "def over?(board)\n if draw?(board) == true || full?(board) == true || won?(board)\n return true\n else\n return false\n end\n end", "def draw?\n @board.full? && !won?;\n end", "def full?\n is_full = @board.all? do |space|\n space ==\"X\" || space == \"O\"\n end\n if is_full\n true\n end\n end", "def over?(board)\n if won?(board) != nil || draw?(board) == true || full?(board) == true\n return true\n end\nend", "def over?(board)\n full?(board) || won?(board)\nend", "def full_board?\n (@turn_played > @turn_max) ? true : false\n end", "def isBoardFull()\n #\n # TO DO: add your code below\n\t\t#\n\t\tfor i in ([email protected])\n\t\t\tfor j in ([email protected])\n\t\t\t\tif @board[i][j] == EMPTY\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n # DO NOT DELETE THE LINE BELOW\n\t\treturn true;\n\tend", "def over?(board)\n if won?(board)\n true\n elsif full?(board)\n true\n elsif !full?(board)\n false\n else draw?(board)\n true\n end\nend", "def won?\n if @board.all? { |i| i == \"\" || i == \" \"} == true\n return false\n end\n WIN_COMBINATIONS.detect do |win_cond|\n @board[win_cond[0]] == @board[win_cond[1]]&&\n @board[win_cond[0]] == @board[win_cond[2]]&&\n position_taken?(win_cond[0])\n end\n end", "def isBoardFull()\n #\n # TO DO: add your code below\n #\n for i in 0...@size\n for j in 0...@size\n if (@board[i][j]==EMPTY)\n return false\n end\n end\n end\n\n # DO NOT DELETE THE LINE BELOW\n\t\treturn true;\n\tend", "def over?(board)\n if won?(board) or draw?(board) or full?(board)\n return true\n else\n return false\n end\nend", "def over?(board)\n if won?(board) || full?(board) || draw?(board)\n true\n else\n false\n end\nend", "def over?(board)\n if won?(board) || full?(board) || draw?(board)\n true\n else\n false\n end\nend", "def full?\n @board.all? {|position| position == \"X\" or position == \"O\"}\n end", "def full?\n\t\[email protected]? { |e|\n\t\t\te == \"X\" || e == \"O\"\n\t\t}\n\tend", "def full?\n @board.all? {|value| value == \"X\" || value ==\"O\"}\n end", "def draw?\n incomplete_board = !full?\n is_game_won = won?\n if incomplete_board == true\n return false\n elsif is_game_won.is_a?(Array)\n return false\n else\n return true\n end\n end", "def full?\n @board.all? {|i| i == \"X\" || i == \"O\"}\n end", "def draw?\n self.board.full? && !self.won?\n end", "def over?(board)\n #if board won, draw, or full = true\n #if board !won, !draw, or !full = false\n if won?(board) == true || draw?(board) == true || full?(board) == true\n return true\n end\nend", "def board_full?\n @board.each do |row|\n row.each do |col|\n if col == @empty_square\n #stop at first empty space found\n return nil\n end\n end\n end\n return true\n end", "def is_full?\n\t\t@game_board.each do |x|\n\t\t\tx.each do |y|\n\t\t\t\tif y == \"\"\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\ttrue\n\tend", "def full?(board)\n turn_count(board) == 9 ? true : false\nend", "def full?(board)\n if board.all? {|i| i == \"X\" || i == \"O\"}\n else\n return false\nend\n\n# Build a method #draw? that accepts a board and returns true if the board has\n# not been won but is full, false if the board is not won and the board is not\n# full, and false if the board is won. You should be able to compose this method\n# solely using the methods you used above with some ruby logic.\ndef draw?(board)\n if !won?(board) && full?(board)\n return true\n elsif !won?(board) && !full?(board)\n return false\n else won?(board)\n return false\n end\n end\nend", "def over?(board)\n if won?(board) || full?(board) || draw?(board)\n return true\n end\nend", "def draw?(board)\n if won?(board) || !full?(board)\n false\n else\n true\n end\nend", "def over?(board)\n full = full?(board) == true\n won = won?(board) != false\n draw = draw?(board) == true\n\n if ( won )\n return true\n\n elsif ( won && full )\n return true\n\n elsif ( draw )\n return true\n end\nend", "def over?(board)\n \n if draw?(board) || won?(board) || full?(board)\n return true\n else\n return false\n end\n \n end", "def over?(board)\n if won?(board) || full?(board) || draw?(board)\n true\n end\nend", "def over?(board)\n over = !(won?(board).nil?) || draw?(board) || full?(board)\n # puts \"won #{!(won?(board).nil?)}\" #no value if not won\n # puts \"full #{full?(board)}\"\n # puts \"draw #{draw?(board)}\"\nend", "def full?\n @board.all? {|space| space == \"X\" || space == \"O\"}\n end", "def draw?(board)\n if (!full?(board) && !won?(board)) || won?(board)\n false\n elsif full?(board) == true\n true\n end\nend", "def full_board?\n @board.cells.each do |row|\n row.each do |cell|\n return false if cell.state == \" \"\n end\n end\n true\n end", "def draw?(board)\n if won?(board) == nil && full?(board) == true\n true\n else\n false\n end\nend", "def draw?(board)\n if won?(board) == nil && full?(board) == true\n true\n else\n false\n end\nend", "def draw?(board)\n won?(board) == nil && full?(board) == true\nend", "def draw?(board)\nfull?(board) && !won?(board)\nend", "def draw?(board)\n board_complete = full?(board)\n board_won = won?(board)\n board_complete && !board_won ? true : false\nend", "def over?(board)\n return won?(board) || draw?(board) || full?(board)\nend", "def over?(board)\n if full?(board) || won?(board) || draw?(board) then return true\n end\nend", "def draw?(board)\n if won?(board) == nil && full?(board) == true\n return true\n end\n\nend", "def draw?(board)\n if !(won?(board)) && full?(board)\n return true\n end\nend", "def draw?(board)\n if !won?(board) && full?(board)\n return true\n end\nend", "def over?(board)\n if draw?(@board) || won?(@board) || full?(@board)\n return true\n else\n return false\n end\n end", "def over?(board)\n won?(board) || full?(board)\n\n # draw?(board) || !(won?(board) == nil)\n\n # true if draw?(board) == true || !(won?(board) == nil)\nend", "def draw?(board)\n (full?(board)) && !(won?(board))\nend", "def draw?(board)\n \n full?(board) && !won?(board)\n \n # if won?(board) == true\n # return false\n # elsif won?(board) == false && full?(board) == true\n # return true\n # elsif !won?(board) && !full?(board)\n # return false\n\n\n\n\nend", "def draw?(board)\n if won?(board) == nil && full?(board) == true\n return true\n end\nend", "def over?(board)\n draw?(board) || won?(board) || full?(board)\nend", "def board_full?(board)\n !board.include?(\"\")\n end", "def draw?(board)\n if full?(board) && !(won?(board))\n true\n else\n false\n end\nend" ]
[ "0.8715606", "0.8457652", "0.83887273", "0.8347352", "0.8345908", "0.83393186", "0.83294684", "0.8325962", "0.8307551", "0.8295115", "0.8286204", "0.82818896", "0.82818896", "0.82378095", "0.8233255", "0.8222889", "0.8210484", "0.82100296", "0.8202207", "0.81741947", "0.8168208", "0.81663436", "0.8151808", "0.81415427", "0.8140254", "0.81346714", "0.81346714", "0.8109915", "0.8095422", "0.8095422", "0.80851626", "0.8069008", "0.8069008", "0.806589", "0.805576", "0.80495197", "0.8047296", "0.8047073", "0.8047073", "0.8043888", "0.8043566", "0.8034414", "0.8033507", "0.8033507", "0.80285645", "0.80247515", "0.80247515", "0.80247086", "0.80226576", "0.80181366", "0.8013392", "0.8002549", "0.80006576", "0.80002445", "0.79954696", "0.79908496", "0.7989037", "0.7987503", "0.7987011", "0.79851604", "0.7968554", "0.7956719", "0.7956719", "0.79534084", "0.7951321", "0.7949692", "0.79485023", "0.79453903", "0.79446304", "0.79378515", "0.79364455", "0.7935293", "0.7935252", "0.7934953", "0.793168", "0.79267335", "0.7923985", "0.7921018", "0.7919571", "0.791054", "0.79079896", "0.7905478", "0.79011345", "0.79001445", "0.79001445", "0.7892845", "0.7892424", "0.7889236", "0.78850675", "0.7883231", "0.7882905", "0.78781056", "0.7877196", "0.7876751", "0.7875894", "0.7867915", "0.7867159", "0.7865216", "0.7864372", "0.78637373", "0.7862842" ]
0.0
-1
returns true if the game is ovr (win/draw)
def over?(board) if won?(board) || draw?(board) true else false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw?\n \t@game_over == true and @winner == false\n end", "def game_is_over?\n (won? || draw? || full?) ? true : false\n end", "def over?\n draw? || won?\n end", "def over?\n draw? || won?\n end", "def over?\n if draw? == true or won? != false\n return true\n end\n end", "def over?\r\n won? || draw?\r\n end", "def over?\n if draw? || won?\n return true\n else\n return false\n end\n end", "def over?\n draw? || won?\n end", "def over?\n draw? || won?\n end", "def over?\n return draw? || won?\n end", "def over?\n draw? || won? ? true : false\n end", "def over?\n if draw? || won?\n true\n else \n false\n end\nend", "def over?\n won? || draw?\n end", "def game_won?\n if diagonal_win?\n true\n elsif horizontal_win?\n true\n elsif vertical_win?\n true\n else\n false\n end\n end", "def over?\r\n won? || draw? ? true : false\r\n end", "def over?\n won? || full? || draw?\n end", "def over?\n if won? or draw? or full?\n return true\n else\n return false\n end\n end", "def over?\n won? || draw?\n end", "def over?\n won? || draw?\n end", "def over?\n if won? || draw? || full?\n true\n end\n end", "def over?\n won? || full? || draw?\n end", "def over? \n if draw?\n return true\n elsif won?\n return true\n end\n end", "def game_over?\n self.lost? || self.won?\n end", "def win?\n false\n end", "def over? #\n draw? || won?\nend", "def over?\n if won? != false && won? != nil || draw? == true\n return true\n else\n return false\n end\n end", "def over?\n won? || draw? || full?\n end", "def over?\n won? || draw? || full?\n end", "def over?\n won? || draw? || full?\n end", "def over?\n if draw? == true || won? != false\n return true\n end\nend", "def over?\n if won? || draw? || full?\n true\n else\n false\n end\nend", "def over?\n if won?\n return true\n elsif draw?\n return true\n else\n return false\n end\n end", "def over?\n won? || draw? || full?\n end", "def over?\n if ( won? || draw? || full?)\n return true\n else\n return false\n end\nend", "def over?()\n if won?() || draw?()\n return true\n end\n return false\n end", "def over?\n draw? || won? || full?\nend", "def game_play?()\n if self.admin\n return false\n elsif self.team.nil?\n return false\n elsif !self.team_adopt\n return false\n end\n game=Game[self.team.active_game]\n if game.nil?\n return false\n end\n\n if game.run?\n return true\n elsif game.owner?(self)\n return true\n end\n\n return false\n end", "def active?\n game.winner.nil?\n end", "def game_over?\n return true if victory? || (@turns == 12)\n false\n end", "def draw?\n if full?\n !won?\n\n else\n false\n end\n\n end", "def win?\n\n end", "def over?\n\t\tdraw? || won?\n\tend", "def over?\n won = won?()\n draw = draw?()\n # Due to the won? method never explicitly returning a true value,\n # the program must instead check if it isn't false.\n if draw == true || won != false\n return true\n else\n return false\n end\n end", "def over?\n if draw? \n return true\nelsif won?\n return true \nelse\n false \nend\nend", "def over?\r\n if self.draw? == true || self.won? != false\r\n return true\r\n end\r\n false\r\n end", "def over?\n if draw? == true || won? != false\n return true\n elsif full? == false\n return false\n end\n end", "def over?\n\t\tdraw? || won? ? true : false\n\tend", "def over?\n self.draw? || self.won? != false\n end", "def won?\n @game.started? && !detectives_won? && detectives_cannot_move?\n end", "def over?\n won? || draw?\n # if full? && won?\n # true\n # elsif won?\n # true\n # elsif !full? && !won?\n # false\n # elsif draw?\n # true\n # end\n end", "def won?()\r\n\t\twin_game = false\r\n\t\t\r\n\t\tif()\r\n\t\t win_game = true\r\n\t end\r\n\t\t\r\n\t\treturn win_game\r\n\tend", "def win?\n @strategy.win?\n end", "def win?\n @strategy.win?\n end", "def draw?\n if full? && !won?\n return true\n else\n return false\n end\n end", "def draw?\n if full?\n if !won?\n return true\n else\n return false\n end\n end\n end", "def draw?\r\n if self.full? == true && self.won? == false\r\n return true\r\n end\r\n false\r\n end", "def over?\n won? || draw?;\n end", "def game_over?\n true\n end", "def over?\n #require 'pry'\n #binding.pry\n if won? || draw?\n true\n end\n end", "def draw?\n if full? && !won?\n true\n else\n false\n end\nend", "def over?\n self.won? || self.draw?\n end", "def won_game?\n @points > @opponent.points + 1 && @points >= 3\n end", "def draw?\r\n !won? && full?\r\n end", "def draw?\n (full? && !won?) ? true : false\n end", "def draw?()\n if full?() && !won?()\n return true\n end\n return false\n end", "def check_for_game_over\n if @proposed_code == @secret_code && @player_role_selection == 'breaker'\n puts 'YOU WIN!'\n true\n elsif @proposed_code == @secret_code && @player_role_selection == 'maker'\n puts 'COMPUTER WINS!'\n true\n else\n false\n end\n end", "def draw?\n full? && !won?\n end", "def draw?\n if !won? && full?\n return true\n else\n return false\n end\n end", "def draw?\n if not won?\n return full?\n else\n return false\n end\n end", "def draw?\n !(won?) && (full?)\n end", "def game_owner?\n self == game.owner if game.winner.nil?\n end", "def draw?\n !won? && full?\n end", "def over?\n if(!!won?)\n return true\n end\n if(draw?)\n return true\n end\n return false\n end", "def game_over?\n alive_robots.count == 1\n end", "def draw?\n !won? && full? \n end", "def draw?\n won? == false && full? == true\n end", "def draw?\n if !won? && full?\n true\n end\n end", "def o_won?\r\n o = @game_board.each_index.select { |position| @game_board[position] == \"O\" }\r\n get_win(o)\r\n end", "def draw?\n !(won?) && full?\n end", "def draw?\n won? == false && full? ? true : false\n end", "def draw?\n !won? && full?\n end", "def draw?\n !won? && full?\n end", "def draw?\n !won? && full?\n end", "def draw? \n if full? == true\n !won?\n end\n end", "def winGame\n @victory = true\n if @level == 2\n @win = true\n end\n end", "def won_game?\n if @points > @opponent.points + 1 && @points > 3\n @points = 0\n opponent.points = 0\n return true\n end\n end", "def someone_won?(brd)\n !!detect_winner(brd)\n end", "def draw?\n !won? && full?\n end", "def over?(board)\r\n if draw?(board) || won?(board)\r\n true\r\n else\r\n false\r\n end\r\nend", "def winner?\n\t\t@winner\n\tend", "def is_win\n\t\tgame_win = false # on cree une variable Game_win qui vaux false par default\n\t\t# si une des 8 condition de victoire est bonne alor on la variable game_win devien egale a true\n\t\tif (@board_case[\"A1\"] == @board_case[\"A2\"] && @board_case[\"A2\"] == @board_case[\"A3\"] && @board_case[\"A1\"] != \" \") ||\n\t\t\t(@board_case[\"B1\"] == @board_case[\"B2\"] && @board_case[\"B2\"] == @board_case[\"B3\"] && @board_case[\"B1\"] != \" \") ||\n\t\t\t(@board_case[\"C1\"] == @board_case[\"C2\"] && @board_case[\"C2\"] == @board_case[\"C3\"] && @board_case[\"C1\"] != \" \") ||\n\t\t\t(@board_case[\"A1\"] == @board_case[\"B1\"] && @board_case[\"B1\"] == @board_case[\"C1\"] && @board_case[\"A1\"] != \" \") ||\n\t\t\t(@board_case[\"A2\"] == @board_case[\"B2\"] && @board_case[\"B2\"] == @board_case[\"C2\"] && @board_case[\"A2\"] != \" \") ||\n\t\t\t(@board_case[\"A3\"] == @board_case[\"B3\"] && @board_case[\"B3\"] == @board_case[\"C3\"] && @board_case[\"A3\"] != \" \") ||\n\t\t\t(@board_case[\"A1\"] == @board_case[\"B2\"] && @board_case[\"B2\"] == @board_case[\"C3\"] && @board_case[\"A1\"] != \" \") ||\n\t\t\t(@board_case[\"A3\"] == @board_case[\"B2\"] && @board_case[\"B2\"] == @board_case[\"C1\"] && @board_case[\"A3\"] != \" \")\n\t\t\tgame_win = true\n\t\tend\n\t\tgame_win # on renvoi la valeur de la variable qui indique si il y a un cas de victoire sur le plateau ou pas\n\tend", "def over?\n won? || board.full? || draw?\n end", "def draw?\n if won? == nil && full? == true\n true\n else\n false\n end\n end", "def win_or_lose\n if game_data.guesses_remaining.zero?\n puts File.read('./views/you_dead')\n puts File.read('./views/dead')\n elsif game_data.letters_left_to_guess == []\n puts File.read('./views/winscreen')\n else\n # allows us to break recursion if we are testing\n @test_cond == false ? Turn.new(game_data) : true\n end\n end", "def is_game_over?; won_by?(:hunter) || won_by?(:prey) end", "def gameover?\n winning_row? || winning_column? || winning_diagonal? || full_board?\n end", "def over?\n WIN_COMBINATIONS.each do |combination|\n if combination1 = @board[combination[0]] == \"X\" && @board[combination[1]] == \"X\" && @board[combination[2]] == \"X\" ||\n combination2 = @board[combination[0]] == \"O\" && @board[combination[1]] == \"O\" && @board[combination[2]] == \"O\"\n return true\n end\n end\n draw = full?\n if draw == true\n return true\n else\n return false\n end\n end", "def someone_won_round?\r\n !!winner\r\n end", "def win?\n horizontal || vertical || diagonal_left || diagonal_right\n end", "def over?(board)\n draw?(board) == true || won?(board) != false ? true : false\nend", "def draw?\n if (!won?) && (full?)\n return true\n end\n return false\n end" ]
[ "0.7454595", "0.7369726", "0.7369414", "0.7345956", "0.73402804", "0.7331565", "0.7331228", "0.7296298", "0.7296298", "0.7288599", "0.7273116", "0.7269048", "0.726067", "0.7258506", "0.72488505", "0.7243298", "0.72399473", "0.72378737", "0.72378737", "0.72345495", "0.72082", "0.72000355", "0.7183294", "0.7178275", "0.71606964", "0.71539754", "0.714603", "0.714603", "0.714603", "0.7144948", "0.7140145", "0.71257055", "0.7124675", "0.7113904", "0.71000415", "0.7087133", "0.70856297", "0.7084468", "0.70836097", "0.7064004", "0.7061496", "0.70549244", "0.70409214", "0.7033319", "0.7032618", "0.70321393", "0.703147", "0.702986", "0.7024913", "0.702197", "0.7013035", "0.7010812", "0.7010812", "0.701055", "0.69999", "0.69883734", "0.6985779", "0.69845015", "0.69841313", "0.6982673", "0.69520694", "0.6950126", "0.6946413", "0.6945952", "0.6942168", "0.69415087", "0.693707", "0.6922047", "0.69219613", "0.69146895", "0.6910555", "0.6904625", "0.6901946", "0.6877826", "0.68752944", "0.68701744", "0.6868961", "0.6862585", "0.68590313", "0.68554896", "0.68550134", "0.68550134", "0.68550134", "0.6850082", "0.68392074", "0.6829834", "0.68291986", "0.68267655", "0.68232036", "0.68195885", "0.6819073", "0.6817443", "0.6817016", "0.68167925", "0.6814917", "0.68118644", "0.6809032", "0.68045354", "0.6794873", "0.67866117", "0.6785692" ]
0.0
-1
returns the current player (X or O) depending on who won
def winner(board) if won?(board) && board[won?(board)[0]] == "X" return "X" elsif won?(board) && board[won?(board)[0]] == "O" return "O" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def winner\r\n if self.won? != false\r\n if self.current_player == \"X\"\r\n return \"O\"\r\n else\r\n return \"X\"\r\n end\r\n end\r\n end", "def current_player\n player = nil\n if turn_count() % 2 == 0\n player = 'X'\n else\n player = 'O'\n end\n return player\n end", "def current_player()\n # Assume player X goes first\n return turn_count() % 2 == 0 ? \"X\" : \"O\"\n end", "def current_player()\n current_turn = turn_count()\n if current_turn == 0 || current_turn % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\n end", "def current_player\r\n if turn_count % 2 != 0\r\n return \"O\"\r\n else\r\n return \"X\"\r\n end\r\n end", "def current_player\n turn = turn_count\n if turn%2 == 0\n return \"X\"\n else\n return 'O'\n end\n end", "def current_player\n if turn_count % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\n end", "def current_player\n return turn_count%2==0 ? \"X\" : \"O\"\n end", "def winner\n if current_player.marker == \"X\"\n return \"O\"\n else\n return \"X\"\n end\n end", "def current_player\r\n if self.turn_count == 0\r\n return \"X\"\r\n elsif self.turn_count.odd?\r\n return \"O\"\r\n else\r\n return \"X\"\r\n end\r\n end", "def current_player\n turn_count%2==0 ? \"X\" : \"O\"\n end", "def current_player\n turn_count % 2 == 0 ? \"X\" : \"O\"\n end", "def current_player\n turns_played = turn_count()\n if turns_played % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\n end", "def current_player\n x_moves = @board.select {|position| position == \"X\"}\n o_moves = @board.select {|position| position == \"O\"}\n\n if x_moves.size == o_moves.size\n character = \"X\"\n else\n character = \"O\"\n end\n end", "def current_player\r\n turn_count\r\n if turn_count % 2 == 0\r\n return \"X\"\r\n else\r\n return \"O\"\r\n end\r\n end", "def current_player\n turn_count == 0 || turn_count % 2 == 0 ? \"X\" : \"O\"\n end", "def current_player\n turn_count % 2 == 0 ? \"X\" : \"O\"\n end", "def current_player\n turn_count % 2 == 0 ? \"X\" : \"O\"\n end", "def current_player\n\t\tturn_count % 2 == 0 ? \"X\" : \"O\"\n\tend", "def current_player\n turn_count.even? ? \"X\" : \"O\"\n end", "def current_player\n turn_count.even? ? \"X\" : \"O\"\n end", "def current_player\n return turn_count.even? ? \"X\" : \"O\"\n end", "def current_player \n turn_count % 2 == 0 ? \"X\" : \"O\"\n end", "def winner\n if finished?\n if @player_1[@length] = \"x\"\n return @players[0]\n elsif @player_2[@length] = \"x\"\n return @players[1]\n end\n end\n\n end", "def current_player\n x_count = self.board.cells.count {|token| token == \"X\"}\n o_count = self.board.cells.count {|token| token == \"O\"}\n if (x_count + o_count).even?\n player_1\n elsif (x_count + o_count).odd?\n player_2\n end\n end", "def current_player\n turn_count % 2 == 0 ? \"X\" : \"O\" # << tweaked\n end", "def current_player(board)\n turn = turn_count(board)\n if turn == 0\n return \"X\"\n elsif turn == 1\n return \"O\"\n elsif turn == 2\n return \"X\"\n end\nend", "def current_player\n turn_count.even? ? \"X\" : \"O\"\n end", "def current_player\n turn_count.even? ? \"X\" : \"O\"\n end", "def current_player\n turn_count.even? ? \"X\" : \"O\"\n end", "def current_player(board)\n #is turn count divisible by 2 then return X, if not, return O. \n turn_count(@board) % 2 == 0? \"X\" : \"O\"\n end", "def opposing_player(cur_player)\n cur_player == \"X\"? \"O\" : \"X\"\n end", "def current_player\n\n @number = turn_count\n\n if (@number % 2 == 0)\n return \"X\"\n else\n return \"O\"\n end\n\n end", "def winner\n winning_conditions_met? == \"x\" ? \"#{@player_one} won!\" : \"#{@player_two} won!\"\n end", "def current_player(board)\n if turn_count(board) == 0\n return \"X\"\n elsif\n turn_count(board) % 2 == 0 \n return \"X\"\n else\n return \"O\"\n end \n end", "def current_player(board)\n if turn_count(board) == 0\n return \"X\"\n elsif\n turn_count(board) % 2 == 0 \n return \"X\"\n else\n return \"O\"\n end \n end", "def get_next_turn\n\n # Using an X?\n if @current_player == 'X'\n\n # Yes, change to O\n @current_player = 'O'\n\n else\n\n # No, change to X\n @current_player = 'X'\n\n end\n\n return @current_player\n\n end", "def current_player(board)\n counter_turn = turn_count(board)\n if counter_turn % 2 == 0\n \"X\"\n else\n \"O\"\n end\n end", "def winner\n won = won?()\n if won != false\n if @board[won[0]] == \"X\"\n return \"X\"\n elsif @board[won[0]] == \"O\"\n return \"O\"\n end\n else\n return nil\n end\n end", "def current_player(board)\n turn_count(board) % 2 == 0 ? \"X\" : \"O\"\n end", "def current_player\n turn_count.even? ? \"X\" : \"O\"\n\n end", "def current_player\n if turn_count % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\nend", "def current_player\n (turn_count % 2 == 0)? \"X\" : \"O\"\nend", "def current_player\n if (turn_count % 2) == 0\n player = \"X\"\n elsif (turn_count % 2) != 0\n player = \"O\"\n end\nend", "def winner\n win_combo = won?\n if win_combo\n @board[win_combo[0]] # == 'X' || 'O'\n else\n nil\n end\n end", "def current_player(board)\n if turn_count(board)%2 == 0\n current_player = \"X\"\n else\n current_player = \"O\"\n end\n return current_player\nend", "def current_player\n turn_count.even? ? \"X\" : \"O\"\n end", "def current_player\n if turn_count % 2 == 0\n \"X\"\n else\n \"O\"\n end\nend", "def current_player\n if turn_count % 2 == 0\n \"X\"\n else\n \"O\"\n end\nend", "def current_player(board)\n turn_count(board).even? ? \"X\" : turn_count(board).odd? ? \"O\" : \"X\"\n end", "def current_player(board)\n current_turn = turn_count(board)\n if current_turn == 0 || current_turn % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\nend", "def winner\n store_person = winner_function\n store_combo = won?\n if store_combo == false\n return nil\n elsif store_person == \"X\"\n return \"X\"\n elsif store_person == \"O\"\n return \"O\"\n else\n return false\n end\n end", "def current_player\n\tif $turn == 0\n\t\tplayerone\n\telse\n\t\tplayertwo\n\tend\nend", "def winner\n player_alive?(Player1) ? Player1 : Player2\n end", "def current_player(board)\n\tcount = turn_count(board)\n\tcount % 2 == 0 ? \"X\" : \"O\"\nend", "def current_player(board)\n if turn_count(board)&1==0 || turn_count(board) == 0;\n return \"X\"\n else\n return \"O\"\n end\nend", "def current_player(board)\n player = \"\"\n if turn_count(board) % 2 == 0\n player= \"X\"\n else\n player = \"O\"\n end\n player\nend", "def winner\n index = won?\n if index && @board.cells[index[0]] == \"X\"\n return \"X\"\n elsif index && @board.cells[index[0]] == \"O\"\n return \"O\"\n else\n return nil\n end\n end", "def current_player(board)\n if (turn_count(board) % 2) == 0\n player = \"X\"\n elsif (turn_count(board) % 2) != 0\n player = \"O\"\n end\nend", "def current_player(board)\n if turn_count(board) % 2 == 0\n character = \"X\"\n else\n character = \"O\"\n end\n return character\nend", "def current_player(board)\n count = turn_count(board)\n return count.odd? ? \"O\" : \"X\"\nend", "def current_player(board)\n count = turn_count(board)\n \n player = count.even? ? \"X\" : \"O\"\n \n return player\nend", "def current_player(board)\r\n (turn_count(board) % 2 == 0)? \"X\" : \"O\"\r\nend", "def winner\n if check_rows_for_winner || check_columns_for_winner || check_diagonals_for_winner\n return @player\n else\n return nil\n end\n end", "def get_player\n\t\tputs \"Will player 1 be X or O?\"\n\t\tplayer = gets.chomp\n\t\tputs \"\"\n\n\t\tif player == \"x\" || player == \"X\"\n\t\t\tputs \"Player 1: X\"\n\t\t\tputs \"Player 2: O\"\n\n\t\t\treturn \"X\", \"O\"\n\t\telsif player == \"o\" or player == \"O\"\n\t\t\tputs \"Player 1: O\"\n\t\t\tputs \"Player 2: X\"\n\n\t\t\treturn \"O\", \"X\"\n\t\telse\n\t\t\tputs \"Input not valid.\"\n\t\t\tputs\n\t\t\tputs \"Player 1: X\"\n\t\t\tputs \"Player 2: O\"\n\n\t\t\treturn \"X\", \"O\"\n\t\tend\n\tend", "def who_won?\n which = rand(2) + 1\n if which == 1\n return @player1\n else\n return @player2\n end\n end", "def current_player(board)\n return turn_count(board)%2==0 ? \"X\" : \"O\"\nend", "def current_player(board)\n if (turn_count(board) % 2 == 0)\n return \"X\"\n elsif !(turn_count(board) % 2 == 0)\n return \"O\"\n end\nend", "def current_player(board)\n if turn_count(board) % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\nend", "def current_player(board)\n if turn_count(board) % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\nend", "def current_player(board)\n if turn_count(board) % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\nend", "def current_player(board)\n if turn_count(board) % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\nend", "def current_player(board)\n if turn_count(board) % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\nend", "def current_player(board)\n if turn_count(board) % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\nend", "def current_player(board)\n if turn_count(board) % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\nend", "def current_player\n turn_count \n if turn_count%2 != 0 \n \"O\"\n else\n \"X\"\n end\nend", "def current_player(board)\n return turn_count(board) % 2 == 0 ? \"X\" : \"O\";\nend", "def current_player(board)\n if turn_count(board).even?\n current_player = \"X\"\n else\n current_player = \"O\"\n end\nend", "def current_player(board)\n next_turn = turn_count(board)\n if next_turn % 2 == 0 \n return 'X'\n else \n return 'O'\n end\nend", "def current_player(board)\n if turn_count(board) % 2 == 0\n return \"X\"\n else \n return \"O\"\n end\nend", "def current_player(board)\n player = turn_count(board).even? ? \"X\" : \"O\"\nend", "def current_player(board)\n\t\tif board.turn_count.odd?\n\t\t\t\"O\" # If the number of turns is an odd number it is Player two with the \"O\" token\n\t\telse\n\t\t\t\"X\" # If the number of turns is an even number it is Player one with the \"X\" token\n\t\tend\n\tend", "def winner\n win_combination = won?\n if win_combination == false\n nil\n elsif @board.cells[win_combination[0]] == \"X\"\n return \"X\"\n elsif @board.cells[win_combination[0]] == \"O\"\n return \"O\"\n end\n end", "def current_player\n if board.turn_count.odd?\n player_2\n elsif board.turn_count.even?\n player_1\n end\n end", "def current_player(board)\n (turn_count(board) % 2 == 0) ? \"X\" : \"O\"\nend", "def winner(board)\n \n if (won?(board) == FALSE)\n return NIL\n end\n \n winning_combination = won?(board)\n win_player = board[winning_combination[0]]\n \n if (win_player == \"X\")\n return \"X\"\n else \n return \"O\"\n end\nend", "def winner()\n if won?()\n win = won?()\n if @board[win[0]] == \"X\"\n return \"X\"\n elsif @board[win[0]] == \"O\"\n return \"O\"\n else @board[win[0]] != \"X\" && @board[win[0]] != \"O\" #srsly..this is like ducttape over a huge hole\n return nil\n end\n end\nend", "def current_player(board)\n if turn_count(board) % 2 == 0\n \"X\"\n else\n \"O\"\n end\nend", "def current_player(board)\n current_player = turn_count(board) % 2 == 0 ? \"X\" : \"O\"\n\nend", "def current_player(board)\n if turn_count(board) % 2 == 0\n \"X\"\n elsif turn_count(board) % 2 == 1\n \"O\"\n end\nend", "def winner(board)\n if won?(board)\n position = won?(board)\n if board[position[0]] == \"X\"\n return \"X\"\n else\n return \"O\"\n end\n end\nend", "def current_player(board)\n return (turn_count(board).even? ? \"X\" : \"O\")\nend", "def winner\n #return token x or o that won the game\n won = \" \"\n if winner = won?\n won = @board[winner.first]\n end\nend", "def current_player(board)\n if turn_count(board).odd?\n \"O\"\n else\n \"X\"\n end\nend", "def winner(board)\n if (over?(board))\n if (board[won?(board)[0]] == \"X\")\n return \"X\"\n else\n return \"O\"\n end\n else\n end\n end", "def opponent_of(the_player)\n the_player == player_1 ? player_2 : player_1\n end", "def declare_winner(board_model, pos)\n board_model[pos] == \"X\" ? \"Player 1 won\" : \"Player 2 won\"\nend", "def current_player(board)\n turns=turn_count(board)\n if(turns%2==0)\n \"X\"\n else\n \"O\"\n end\nend", "def current_player(board)\n if turn_count(board) % 2 == 0 \n \"X\"\n else\n \"O\"\n end\nend", "def winner\n return self.player_a_pyre_end_health <= 0 ? :player_b : :player_a\n end", "def get_current_winner\r\n if self.rank_one == nil\r\n return nil\r\n else\r\n return rank_one.owner\r\n end\r\n end" ]
[ "0.8405077", "0.8381531", "0.83064467", "0.8267883", "0.82061416", "0.8180897", "0.815627", "0.81288904", "0.81178117", "0.8079409", "0.8050384", "0.8048401", "0.8020336", "0.8016536", "0.8007132", "0.7982897", "0.7946468", "0.7946468", "0.79414046", "0.7918997", "0.7918997", "0.78979504", "0.78830093", "0.7875765", "0.7861248", "0.78500605", "0.7795325", "0.77897286", "0.77897286", "0.77897286", "0.7775371", "0.7770698", "0.7759211", "0.77568585", "0.7755743", "0.7755743", "0.7741916", "0.77146846", "0.77086294", "0.76866806", "0.7677268", "0.76746666", "0.7654628", "0.7646536", "0.76273966", "0.76216924", "0.7600634", "0.75825465", "0.75825465", "0.75608844", "0.7544911", "0.7540611", "0.7532079", "0.7493773", "0.7490814", "0.74680924", "0.74618", "0.7460404", "0.74486715", "0.74469346", "0.7444252", "0.7442843", "0.7438184", "0.74308944", "0.74194634", "0.7418814", "0.7415123", "0.73959297", "0.73814714", "0.73814714", "0.73814714", "0.73814714", "0.73814714", "0.73814714", "0.73814714", "0.73802054", "0.7379094", "0.7361669", "0.7359432", "0.73566276", "0.7352283", "0.7343428", "0.7338173", "0.7336682", "0.7335749", "0.7323736", "0.7316954", "0.7316053", "0.73074967", "0.73006994", "0.7289645", "0.72879636", "0.7286055", "0.72763544", "0.72743094", "0.7273837", "0.7269441", "0.7268945", "0.7266652", "0.7263364", "0.7250111" ]
0.0
-1
the play method is the method that rus the game using the helpr methods
def play(board) while !over?(board) turn(board) end if won?(board) puts "Congratulations #{winner(board)}!" elsif draw?(board) puts "Cat's Game!" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def play\n #calls to all the methods that produce game!\n end", "def play; end", "def play \n end", "def play\n \n end", "def play\n\t\tgame_loop\n\tend", "def play\n end", "def play\n end", "def play\n end", "def play\n end", "def play\n end", "def play\n\tend", "def play\n board_setup\n gameplay_setup\n end", "def play\n take_turn until @master.game_over?\n @master.show_board\n @robot.speak\n end", "def play\n puts 'Playing'\n end", "def play\n\t\n\t\tuntil over?\n\t\tturn\n\t\tend\n\t\t\n\t\tif won? \n\t\t\twinner\n\t\telsif draw? \n\t\t\tputs \"The game was a Draw!\"\n\t\telse \n\t\t\tputs \"Unexpected Error Occured\" \n\t\tend\n\tend", "def perform\n\tgame_menu\n\tgameplay\nend", "def play\r\n display_welcome_message\r\n human_choose_move\r\n computer_choose_move\r\n display_winner\r\n display_goodbye_message\r\nend", "def play\n greeting\n get_tiles\n move_sequence\n end", "def play()\n @ole.Play()\n end", "def play()\n @ole.Play()\n end", "def play\n init_player()\n init_board()\n puts \"Test game play\"\n end", "def play(cmd)\n play_game(cmd)\n end", "def play\n\t\twelcome\n\t\task_name\n\t\task_name2 \n\t\task_input\n\t\tturns\n\tend", "def play\n @hungry = true\n #p \"play method called\" #print notification to console\n end", "def play\n display_welcome_message\n loop do\n human.choose\n computer.choose\n display_moves\n display_winner\n keep_score\n break unless play_again?\n end\n display_goodbye_message\n end", "def play\n # Game play asks for players input on a turn of the game\n # Game play checks if the game is over after every turn\n # Game play plays the first turn of the game\n # Game play plays the first few turns of the game\n # Game play checks if the game is won after every turn\n # Game play checks if the game is a draw after every turn\n while !over?\n turn\n end\n # Game play stops playing if someone has won\n # Game play congratulates the winner X\n # Game play congratulates the winner O\n if won?\n puts \"Congratulations #{winner}!\"\n # Game play stops playing in a draw\n # Game play prints \"Cat's Game!\" on a draw\n elsif draw?\n puts \"Cat's Game!\"\n end\n end", "def play\n game_introductions\n\n loop do\n set_markers_and_first_mover\n\n loop do\n clear_screen_and_display_board\n loop_of_player_moves\n display_result\n break if someone_won_match?\n display_play_again_message\n reset\n end\n\n clear\n display_champion\n break unless rematch?\n reset_game_data\n end\n\n display_goodbye_message\n end", "def play\n# \tThere are 3 players in Knuckleheads: \n\t\tputs \"There are #{to_s} players in #{@title}\"\n# \tI'm Moe with a health of 100 and a score of 103.\n# \tI'm Larry with a health of 60 and a score of 65.\n# \tI'm Curly with a health of 125 and a score of 130.\n\t\[email protected] do |spieler|\n\t\t\tputs \"I'm #{spieler} with a health of #{@health} and a score of #{score}\"\n\t\t\tend\n# \tMoe got blammed!\n# \tMoe got w00ted!\n# \tMoe got w00ted!\n# \tI'm Moe with a health of 120 and a score of 123.\n# \tLarry got blammed!\n# \tLarry got w00ted!\n# \tLarry got w00ted!\n# \tI'm Larry with a health of 80 and a score of 85.\n# \tCurly got blammed!\n# \tCurly got w00ted!\n# \tCurly got w00ted!\n# \tI'm Curly with a health of 145 and a score of 150.\n\t\tend", "def play\n \"We're rockiinnggg\"\n end", "def play\r\n display_welcome_message\r\n init_players\r\n\r\n loop do\r\n play_match\r\n break unless play_again?\r\n end\r\n\r\n display_goodbye_message\r\n end", "def play_game\r\n \r\n Console_Screen.cls #Clear the display area\r\n \r\n #Call on the method responsible for collecting the player's move\r\n playerMove = get_player_move\r\n \r\n #Call on the method responsible for generating the computer's move\r\n computerMove = get_computer_move\r\n \r\n #Call on the method responsible for determining the results of the game\r\n result = analyze_results(playerMove, computerMove)\r\n \r\n #Call on the \r\n gameCount = game_count\r\n\r\n #Call on the method responsible for displaying the results of the game\r\n display_results(playerMove, computerMove, result)\r\n \r\n end", "def play\n display_welcome_message\n loop do \n human.choose #.choose is an instance method on the Player class, since human is an object of the Player class\n computer.choose\n display_winner\n break unless play_again? #could put play again loop here, but easier to not have double loop here\n end \n display_goodbye_message\n end", "def play\n # unless the game is over players take turns\n take_turn until game_over?\n\n #start a new game if the game is over\n new_game_or_quit\n end", "def play\r\n while !over?\r\n turn\r\n end\r\n if won?\r\n puts \"Congratulations #{winner}!\"\r\n elsif draw?\r\n puts \"Cats Game!\"\r\n end\r\n end", "def play\n puts \"buzz\"\n end", "def play\n while !over?\n \t turn\n end\n if won?\n \t puts \"Congratulations \"+ winner() +\"!\"\n else\n \t puts \"Cat's Game!\"\n end\n end", "def play()\n \n begin\n \n @computer_choice = get_computer_choice()\n @player_choice = get_player_choice()\n \n result = logic(@computer_choice, @player_choice)\n\n get_choices()\n \n case result\n\n when \"tie\"\n @rounds -= 1\n @ties += 1\n puts \"[~] it's a tie !\"\n \n when \"player win\"\n @rounds -= 1\n @player_wins += 1\n puts \"[$] Player win this round (#{@player_wins}/3)!\"\n\n when \"computer win\"\n @rounds -= 1\n @computer_wins += 1\n puts \"[$] Computer win this round (#{@computer_wins}/3)!\"\n\n end\n\n rescue Interrupt\n\n puts \"\\n\\n[!] Keyboard interrupt, Exting.\"; exit()\n \n \n end\n \n\n end", "def game; end", "def game; end", "def play\n\t\t\"playing #{title}\"\n\tend", "def game; end", "def game; end", "def game; end", "def game; end", "def game; end", "def play\n\t\t@current_turn = 0\n\t\t@current_player = @hunter\n\t\tplayers.each{|p| p.write(game_parameters)}\n\t\tuntil is_game_over?\n\t\t\tpre_turn_wall_count = @walls.size\n\t\t\treport_state_to_spectators\n\t\t\t@current_player.take_turn\n\t\t\t# Only print the board every 10 turns or if a wall was added or removed\n\t\t\tprint_minified_board() if @current_turn%10 == 0 || @walls.size != pre_turn_wall_count\n\t\t\tadvance_turn!\n\t\t\tprint \"#{@current_turn} \"\n\t\tend\n\t\tresult = report_winner\n\t\tcleanup_players!\n\t\tcleanup_spectators!\n\t\tresult\t# Returns this so the EvasionServer can save results\n\tend", "def play_game\n # WarAPI.play_turn()\n end", "def play_sports\n end", "def play\r\n\t\t[FOLD]\r\n\tend", "def play\n\n until over?\n turn\n end\n\n if self.won?\n puts \"Congratulations #{self.winner}!\"\n elsif self.draw?\n puts \"Cat's Game!\"\n end\n\n end", "def start_a_game\n jeopardy_board\n play_game\nend", "def play\r\n self.display_board\r\n while !self.over? do\r\n self.turn\r\n end\r\n if self.draw? \r\n puts \"Cat's Game!\"\r\n else\r\n puts \"Congratulations #{self.winner}!\"\r\n end\r\n end", "def play_round\n take_turn\n puts \"Current word: #{@fragment}\"\n if losses(current_player) == true\n record(current_player)\n score_board\n end\n next_player!\n end", "def play() \n\n turn()\n\n return \"Game Finished\"\n\nend", "def get_play() \n # \n end", "def play_cycle\n play\n earn_achievements\n end_game\n end", "def play\n\n until self.over?\n self.turn\n end\n\n if self.won?\n self.board.display\n puts \"Congratulations #{self.winner}!\"\n elsif self.draw?\n self.board.display\n puts \"Cat's Game!\"\n end\n end", "def play\n until over?\n turn\n end\n\n if won?\n puts \"Congratulations #{winner}!\"\n elsif draw?\n puts \"Cat's Game!\"\n end\n end", "def play\n while !over?\n turn\n end\n if won?\n puts \"Congratulations #{winner}!\"\n else draw?\n puts \"Cat's Game!\"\n end\n end", "def play\n self\n end", "def play\n while !over?\n #binding.pry\n turn\n end\n\n if won?\n puts \"Congratulations #{winner}!\"\n else\n puts \"Cats Game!\"\n end\n end", "def play_game\r\n\r\n Console_Screen.cls #Clear the display area\r\n\r\n #Call on the method responsible for collecting the player's move\r\n playerMove = get_player_move\r\n\r\n #Call on the method responsible for generating the computer's move\r\n computerMove = get_computer_move\r\n\r\n #Call on the method responsible for determining the results of the game\r\n result = analyze_results(playerMove, computerMove)\r\n\r\n #CAll on the method responsible for ingrementing the game count\r\n game_Count\r\n\r\n #Call on the method responsible for displaying the results of the game\r\n display_results(playerMove, computerMove, result)\r\n\r\n end", "def play\n while over? == false\n turn\n end\n if won?\n puts \"Congratulations #{winner}!\"\n elsif draw?\n puts \"Cat's Game!\"\n end\n end", "def player; end", "def player; end", "def player; end", "def player; end", "def player; end", "def player; end", "def player; end", "def play\n while !over?\n turn\n end\n\n if won?\n puts \"Congratulations #{winner}!\"\n elsif draw?\n puts \"Cat's Game!\"\n end\n end", "def play\n while !over?\n turn\n end\n if won?\n puts \"Congratulations #{ winner }!\"\n elsif draw?\n puts \"Cat's Game!\"\n else\n puts \"Game over\"\n end\n end", "def play\n until over? do\n turn;\n end\n\n if won?\n puts \"Congratulations #{winner}!\";\n replay\n elsif draw?\n puts \"Cat's Game!\";\n replay\n end\n end", "def play\n while !over?\n turn\n board.display\n end\n if won?\n puts \"Congratulations #{winner}!\" \n elsif draw?\n puts \"Cats Game!\" \n end\n end", "def play\n display_welcome_message\n loop do\n number_of_games = 0\n loop do\n computer.choose(@human)\n human.choose\n display_moves\n increment_game_count\n puts\n display_winner\n display_score\n update_win_history\n number_of_games += 1\n puts\n break if first_to_score?(10)\n end\n display_final_outcome\n reset_game\n break unless play_again?\n end\n display_goodbye_message\n end", "def play_hand\n\n p1 = self.player1\n p2 = self.player2\n p1.play\n p2.play\n winner = winner?(p1,p2)\n if winner\n handle_winner(p1,p2)\n else \n self.war\n end\n\n end", "def run \n Engine::play(Beginning)\nend", "def play_game\r\n\r\n Console_Screen.cls #Clear the display area\r\n\r\n #Assign the player and dealer an initial starting card\r\n playerHand = get_new_card\r\n dealerHand = get_new_card\r\n\r\n #Call the method responsible for dealing new cards to the player\r\n playerHand = complete_player_hand(playerHand, dealerHand)\r\n\r\n #If the player has not gone bust, call the method responsible for managing\r\n #dealer's hand\r\n if playerHand <= 21 then\r\n dealerHand = play_dealer_hand(dealerHand)\r\n end\r\n\r\n #call the method responsible for determining the results of the game\r\n determine_winner(playerHand, dealerHand)\r\n\r\n end", "def play\n start = Time.now\n until @board.won?\n @player ? round_player : round_ai\n @attempts += 1\n sleep(2)\n system(\"cls\")\n @board.render\n end\n finish = Time.now\n time_to_finish = finish - start\n declare_win(time_to_finish)\n end", "def play\n while !over?()\n turn()\n end\n\n if won?()\n puts \"Congratulations #{winner()}!\"\n elsif draw?()\n puts \"Cat's Game!\"\n end\n end", "def play\n until self.over? do\n turn\n end\n\n if self.won?\n puts \"Congratulations #{self.winner}!\"\n elsif self.draw?\n puts \"Cat's Game!\"\n end\n end", "def play\n while !over?\n turn\n end\n if won?\n puts \"Congratulations #{winner}!\"\n else\n puts \"Cat's Game!\"\n end\n end", "def play\n until over?\n @board.display\n turn\n end\n @board.display\n puts draw? ? \"Cat's Game!\" : \"Congratulations #{winner}!\"\n end", "def play\n\t\tboard = Board.new # cree une instance de la class board\n\t\tfor i in 1..9 # fait une boucle qui vas de 1 a 9, quand on arrive a 9 ca veut dire que toutes les cases du tableau on ete remplis. \n\t\t\tboard.display_stat(@player_one.return_name, @player_two.return_name, @player_one.return_number_of_win, @player_two.return_number_of_win, @player_two.return_number_of_egality) # on appel la methode display stats qui vas servire a affichier les statistiques, nombre de parties, nom des joueurs, leur nombre de victoires...\n\t\t\tif @who_play == 1 # on cree une condition qui vas servire a afficher le nom du joueur qui doit jouer ce tours.\n\t\t\t\tputs \"A toi de jouer #{@player_one.return_name.colorize(:green)} !\\n\\n\\n\"\n\t\t\telse\n\t\t\t\tputs \"A toi de jouer #{@player_two.return_name.colorize(:green)} !\\n\\n\\n\"\n\t\t\tend\n\t\t\tboard.display_board(@board_case) # on affiche le plateau du jeux\n\t\t\tselect_board_case # on appel la methode qui demande a l'utilisateur de choisire la case sur laquel il vas jouer\n\t\t\tif is_win == true # on fait une condition qui appel la methode is_win, cette methode verifi si il y a un cas de victoire\n\t\t\t\tboard.display_board(@board_case) # on affiche le plateau une derniere fois pour montrer la derniere modification\n\t\t\t\tif @who_play == 1 # on fait une condition qui verifie qui a gagner\n\t\t\t\t\tputs \"le joueur #{@player_one.return_name} a gagner cette partie!\" # si c'est le joueur 1 qui a gagner on dit qu'il a gagner, on affiche son nom\n\t\t\t\t\t@player_one.increments_number_of_win\t# on incremente du nombre de victoire \n\t\t\t\telse\n\t\t\t\t\tputs \"le joueur #{@player_two.return_name} a gagner cette partie!\"\n\t\t\t\t\t@player_two.increments_number_of_win\n\t\t\t\tend\n\t\t\t\tbreak # On quitte la boucle car il y a eu une victoire\n\t\t\tend\n\t\t\t@who_play == 1 ? @who_play = 2 : @who_play = 1 # cette ligne sert a faire que c'est a l'autre joueur de jouer (c'est une condition de type ternaire)\n\t\tend\n\t\tif is_win == false # si on sort de la boucle et qu'il n'y a aucune victoire alor c'est un match nul\n\t\t\t@player_one.increments_number_of_egality # on incremente la variable qui compte le nombres de matchs nuls\n\t\t\t@player_two.increments_number_of_egality\n\t\t\tputs \"MATCH NULLLLLLL\".colorize(:red) # on affiche que c'est un match nul\n\t\tend\n\tend", "def play\n until over?\n turn\n end\n\n if won?\n puts \"Congratulations #{winner}!\"\n\n else draw?\n puts \"Cat's Game!\"\n\n end\n end", "def main\n rounds = Game.start\n game = Game.new(rounds)\n roshambo = Roshambo.new(game)\n Roshambo.play(roshambo)\nend", "def play()\n \n while !over?()\n turn()\n end\n \n if won?()\n puts \"Congratulations #{winner()}!\"\n elsif draw?()\n puts \"Cat's Game!\"\n end\n end", "def play_round\n system(\"clear\")\n @board.render\n puts\n full_move = self.get_full_move\n pos = self.get_position(full_move)\n action = self.get_action(full_move)\n while action.downcase == \"e\" && !(self.valid_flip?(pos))\n self.display_unflag_message\n full_move = self.get_full_move\n pos = self.get_position(full_move)\n action = self.get_action(full_move)\n end\n action.downcase == \"e\" ? @board[pos].reveal : @board[pos].toggle_flag\n @board.reveal_bombs if @board.is_a_bomb?(pos) && @board[pos].revealed\n end", "def play\n loop do\n prep_game\n loop do\n current_player_moves\n break if board.someone_won? || board.full?\n board.clear_screen_and_display_board(players) if human_turn?\n end\n display_result\n break unless play_again?\n reset\n end\n display_goodbye_message\n end", "def play_game\n\n Console_Screen.cls #Clear the display area\n \n #Assist the player and dealer an initial starting card\n playerHand = get_new_card\n dealerHand = get_new_card\n \n #Call the method responsible for dealing new cards to the player\n playerHand = complete_player_hand(playerHand, dealerHand)\n \n #If the player has not gone bust, call the method responsible for managing\n #dealer's hand\n if playerHand <= 21 then\n dealerHand = play_dealer_hand(dealerHand)\n end\n\n #call the method responsible for determining the results of the game\n determine_winner(playerHand, dealerHand)\n\n end", "def go_play\n puts \"Let's start a new game\"\n @grid.print_board # prints the initial blank layout of the board\n puts @player1.name + \" \" + \"your turn first!\" # player 1 always goes first\n end", "def play\n $game.surface.+$game.white.get('Ant')\n $game.surface.+$game.black.get('Beetle')\n $game.surface.+($game.white.get('Ant'), $game.surface.bug(Hive::Color[:white], Bug::Type[:ant1]), Side::Face[:bottom_left])\n #$game.surface.+($game.black.get('Grasshopper'), $game.surface.bug(Hive::Color[:black], Bug::Type[:beetle1]), Side::Face[:bottom_left])\n $game.surface.+($game.black.get('Grasshopper'), $game.surface.bug(Hive::Color[:black], Bug::Type[:beetle1]), Side::Face[:top_right])\n $game.surface.+($game.white.get('Ant'), $game.surface.bug(Hive::Color[:white], Bug::Type[:ant2]), Side::Face[:bottom_right])\n $game.surface.+($game.black.get('Queen'), $game.surface.bug(Hive::Color[:black], Bug::Type[:grasshopper1]), Side::Face[:top_right])\n $game.surface.+($game.white.get('Queen'), $game.surface.bug(Hive::Color[:white], Bug::Type[:ant3]), Side::Face[:bottom_right])\n $game.surface.+($game.black.get('Grasshopper'), $game.surface.bug(Hive::Color[:black], Bug::Type[:queen1]), Side::Face[:top_right])\n $game.surface.+($game.white.get('Spider'), $game.surface.bug(Hive::Color[:white], Bug::Type[:queen1]), Side::Face[:bottom_center])\n $game.surface.bug(Hive::Color[:black], Bug::Type[:grasshopper2]).move(Hive::Color[:black], Bug::Type[:beetle1], Side::Face[:bottom_left])\n $game.surface.bug(Hive::Color[:white], Bug::Type[:ant2]).move(Hive::Color[:black], Bug::Type[:queen1], Side::Face[:bottom_center])\n $game.surface.+($game.black.get('Grasshopper'), $game.surface.bug(Hive::Color[:black], Bug::Type[:beetle1]), Side::Face[:top_center])\n \n # Try putting a $game.list_moves after any move directive\n\n puts \"\\n\\n=====PROOF SECTION=======================\"\n $game.surface.bug(Hive::Color[:black], Bug::Type[:beetle1]).describe\n $game.surface.bug(Hive::Color[:black], Bug::Type[:grasshopper1]).describe\n $game.surface.bug(Hive::Color[:black], Bug::Type[:grasshopper2]).describe\n $game.surface.bug(Hive::Color[:black], Bug::Type[:grasshopper3]).describe\n $game.surface.bug(Hive::Color[:black], Bug::Type[:queen1]).describe\n \n $game.surface.bug(Hive::Color[:white], Bug::Type[:ant1]).describe\n $game.surface.bug(Hive::Color[:white], Bug::Type[:ant2]).describe\n $game.surface.bug(Hive::Color[:white], Bug::Type[:ant3]).describe\n $game.surface.bug(Hive::Color[:white], Bug::Type[:queen1]).describe\n $game.surface.bug(Hive::Color[:white], Bug::Type[:spider1]).describe\n end", "def play\n @play_array = [\"rock\", \"paper\", \"scissors\"]\n @play_array.sample\n end", "def run\n Interface::header\n Interface::newline\n\n count = get_number_of_players\n get_player_names( count )\n\n @b.play_game\n end", "def start\n \t\tself.board.display_instruction\n \t\tcurrent_player = select_first_player\n \t\t(self.board.size).times do \n \t\t\tplay(current_player)\n \t\t\tcurrent_player = next_of current_player \n end\n display_winner(nil, true)\n \tend", "def play\n\t\tprocessed = process_guesses(@user_guesses, @word)\n\t\tboard = draw(processed)\n\t\tinput = get_input\n\t\t@user_guesses << input\n\t\t@num_guesses -= 1\n\t\tresult = game_over?\n\t\tif result[:over]\n\t\t\tputs \"Game Over!\\n#{result[:message]}\"\n\t\t\tputs \"Word was #{@word}\"\n\t\t\treturn @controller.play_again\n\t\telse\n\t\t\treturn play\n\t\tend\n\n\tend", "def playGame\n #start the opening of the game\n #introduce the rules, ask for human or computer etc\n self.opening()\n\n end", "def play\n\n @board.render(clear=true)\n until @board.won? \n\n # should call reveal two time\n guess_1 = @board.reveal # gonna get position guess from the user and return the value\n @board.render(clear=true)\n guess_2 = @board.reveal # gonna get position guess from the user and return the value\n @board.render(clear=true)\n \n if guess_1 == guess_2\n puts \"It's a match!\" \n else\n # reset the board - set all card to face_up == false\n puts \"Try Again!\"\n @board.reset \n end\n sleep 3\n \n @board.render(clear=true)\n end\n end", "def play\n puts \"#{name} got zoomies playing fetch!\"\n @hungry = true\n end", "def game_play\n until game_over\n graphic\n guess\n end\n end", "def play\n display_welcome_message\n\n # Each game...\n loop do\n # Each round...\n loop do\n display_game_history unless rounds.empty?\n round_results = Round.new(human, computer).play\n @rounds << round_results\n break if winner?\n end\n\n set_winner\n display_end_game\n\n break unless play_again?\n reset_game\n end\n\n display_goodbye_message\n end" ]
[ "0.87633026", "0.81679434", "0.81589025", "0.8145581", "0.81110036", "0.80821043", "0.80586505", "0.80586505", "0.80586505", "0.80586505", "0.79644406", "0.78774005", "0.77044684", "0.75336766", "0.75064915", "0.7497062", "0.74899805", "0.74563855", "0.7453192", "0.7453192", "0.74521625", "0.7440134", "0.7429797", "0.7421817", "0.7400391", "0.7369471", "0.7340837", "0.73354644", "0.7333258", "0.7332948", "0.7322368", "0.73077226", "0.7291817", "0.7291407", "0.7287359", "0.7277175", "0.72527885", "0.7235693", "0.7235693", "0.7235367", "0.72352797", "0.72352797", "0.72352797", "0.72352797", "0.72352797", "0.72182983", "0.7218144", "0.7208816", "0.72070664", "0.72059005", "0.71900463", "0.7179657", "0.7154684", "0.7154331", "0.714744", "0.71435386", "0.7131128", "0.71304274", "0.71199507", "0.71187973", "0.7116165", "0.71150804", "0.7095627", "0.70900375", "0.70900375", "0.70900375", "0.70900375", "0.70900375", "0.70900375", "0.70900375", "0.7089922", "0.70882916", "0.7082457", "0.70776117", "0.70651877", "0.70571", "0.7047178", "0.70461726", "0.70382", "0.7038025", "0.7033672", "0.70271087", "0.7026026", "0.70227975", "0.70203394", "0.7011382", "0.70063764", "0.70038813", "0.69960356", "0.6992807", "0.69850385", "0.697598", "0.6972473", "0.69698656", "0.6964875", "0.69645196", "0.6964275", "0.69503653", "0.6947987", "0.6944348", "0.6944109" ]
0.0
-1
define permitted attributes for strong parameters feature cancancan will look for "create_params" and "update_params" methods while loading resources so these are here to prevent an exception
def create_params sample_storage_container_params end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def permit_attributes\n params.require(resource_as_param_key).permit(*permitted_attributes)\n end", "def resource_params\n params.require(resource_name).permit(*permitted_params)\n end", "def strong_parameters\n\t\t\tattrs = self.attribute_names - [\"created_at\", \"updated_at\", \"id\"]\n\t\t\tattrs.push(:_color) if colored? # add the color attribute to the permitted attributes if the object is colorable\n\t\t\tif is_encrypted? # add the color attribute to the permitted attributes if the object is colorable\n\t\t\t\tattrs.push(:_inki_password) \n\t\t\t\tattrs.push(:_inki_password_confirmation) \n\t\t\tend\n\t\t\tattrs.collect do |a|\n\t\t\t\ta.to_sym\n\t\t\tend\n\t\tend", "def permitted_params\n policy(resource || resource_class.new).send(\"permitted_#{action_name}_attributes\")\n end", "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "def attrs\n if options[:permit]\n controller.params.require(model_name).permit(*call(:permit))\n else\n params_method = \"#{name}_params\"\n if controller.respond_to?(params_method, true)\n controller.send(params_method)\n else\n {}\n end\n end\n end", "def permitted_params\n @permitted_params ||= PermittedParams.new(params, current_user)\n end", "def permitted_params\n \t@permitted_params ||= PermittedParams.new(params, current_user)\n end", "def permitted_create_params\n fail NotImplementedError\n end", "def permitted_params\n if is_singleton?\n singleton_permitted_params\n else\n params.require(:data).permit(allowed_resource_params.to_a)\n end\n end", "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "def resource_params\n strong_params = params.require(resource_name.to_sym).permit(*permit_attributes)\n strong_params.merge(user_id: current_user.id) if user_signed_in?\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 attr_params\n params[:attr].permit(:name, :type, :value, :foreign_key, :ordinal, :group, :visible, :editable, :required, :input)\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 form_params\n # Remove role and privilege ids as these are managed by the app not by\n # the active record associations\n params[:user].delete :role_ids\n params[:user].delete :privilege_ids\n params.require(:user).permit(user_allowable_params)\n end", "def resource_params\n @resource_params ||= current_model_service.permit params\n end", "def resource_params\n params.require(model_name.underscore.intern).permit(*@model.column_names.map(&:intern))\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 permitted_params\n @permitted_params ||= declared(params,\n include_missing: false,\n include_parent_namespaces: false)\n end", "def permitted_params\n @implementation_class ||= implementation_class\n\n res = @implementation_class.permitted_params\n @implementation_class.refine_permitted_params res\n end", "def resource_params\n deserialized_params.permit!\n end", "def attr_params\n params.require(:attr).permit(:name)\n end", "def record_params\n fields = resource.editable_fields.map(&:name)\n params.require(model.model_name.param_key.underscore.to_sym).permit(fields)\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def form_params\n params.permit(Document.allowable_params)\n end", "def strengthen_params!(method_name)\n permitting_model_name = self.class.instance_variable_defined?(:@permitting_model_name) && self.class.instance_variable_get(:@permitting_model_name)\n target_model_name = (permitting_model_name || self.class.name.sub(/.+::/, '').sub(/Controller$/, '')).singularize.underscore.tr('/', '_').to_sym\n permitted_attributes = self.class.instance_variable_defined?(:@permitted_attributes) && self.class.instance_variable_get(:@permitted_attributes)\n\n method_parameters = method(method_name).parameters\n method_parameters.each do |type, key|\n trimmed_key = key.to_s.sub(/_params\\z/, '').to_sym\n if (trimmed_key == target_model_name) && permitted_attributes\n params.require(trimmed_key) if %i[req keyreq].include?(type)\n params[trimmed_key] = params[trimmed_key].try :permit, *permitted_attributes if params.key? trimmed_key\n end\n end\n end", "def object_params\n params.require(resource.name.underscore.to_sym)\n .permit(resource_params)\n end", "def permitted\n {attrib_name => spec.permitted}\n end", "def permitted_attributes\n klass.properties.keys.map(&:to_sym) + %i[id edit_users edit_groups read_groups visibility work_members_attributes]\n end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def case_support_params\n params.require(:case_support).permit(CaseSupport.safe_attributes)\n end", "def case_support_params\n params.require(:case_support).permit(CaseSupport.safe_attributes)\n end", "def <%= singular_name %>_params\n params.require(:<%= singular_name %>).permit(<%= attributes_allowed %>)\n end", "def permitted_params(action, kind=nil)\n params.require(model_name).permit!\n end", "def resource_params\n permition = @klazz.attribute_names - [:created_at, :updated_at]\n @metadata.items.each do |entity|\n permition << {\"many_#{entity.name}_attributes\".to_sym =>\n [:id] + entity.many_field.map{|field| field.name.to_sym} - [:created_at, :updated_at]}\n end\n params.require(@resource_sym).permit(*permition)\n end", "def safe_params\n safe_attributes = %i[name key]\n params.require(:role).permit(safe_attributes)\n end", "def sanitized_allowed_attributes=(attributes); end", "def sanitized_allowed_attributes=(attributes); end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def expected_permitted_parameter_names; end", "def task_params\n params.require(:task).permit(Task.safe_attributes)\n end", "def task_params\n params.require(:task).permit(Task.safe_attributes)\n end", "def permit_params_on_create *keys\n filter_strong_params :permit, [:create], keys\n end", "def plan_params\n params.require(:plan).permit(Plan.safe_attributes)\n end", "def user_params\n params.require(:user).permit(current_ability.permitted_attributes(:manage, @user))\n end", "def user_params\n params.permit(User::UPDATABLE_ATTRIBUTES)\n end", "def permit(*permitted)\n hardened_params = params.dup\n\n hardened_params.keep_if { |k, _v| permitted.flatten.include?(k.to_sym) }\n\n hardened_params.symbolize_keys\n end", "def resource_params\n # TODO DANGER!\n params.require(@resource_class.name.underscore.to_sym).permit!\n end", "def users_params\n\t\tparams.require(:user).permit(User::PERMIT_ATTRIBUTES)\n\tend", "def form_params\n params.require(:capital_project).permit(CapitalProject.allowable_params)\n end", "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end", "def system_control\r\n\r\n params.require(:system_control).permit(*system_control_attributes)\r\n\r\n end", "def model_params\n if Rails.version < '4.0'\n params[model_identifier]\n else\n params.require(model_identifier).permit(permitted_attrs)\n end\n end", "def permitted_attributes\n [:user_id, :code, :name, :status_id, :group_id, :contact_id, :body,\n :address, :hours, :notes, :live_date, :website, :rss, :twitter, :wiki,\n :logo,\n contact_attributes: %i[id name hidden email phone notes user_id _destroy]]\n end", "def permitted_params\n []\n end", "def permitted_update_params\n fail NotImplementedError\n end", "def form_params\n params.require(:culvert).permit(Culvert.new.allowable_params)\n end", "def permitted_params\n res = attribute_names.map(&:to_sym) - %i[disabled user_id created_at updated_at tracker_id tracker_history_id\n admin_id]\n refine_permitted_params res\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def form_params\n params.require(:funding_request).permit(FundingRequest.allowable_params)\n end", "def other_skill_params\n params.require(:other_skill).permit(OtherSkill.safe_attributes)\n end", "def link_params\n params.require(:link).permit(allowed_attributes)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def extract_permitted_attributes(attributes, *keys)\n permitted_attributes = attributes.slice(*keys)\n permitted_attributes.permit! if permitted_attributes.respond_to?(:permit!)\n permitted_attributes\n end", "def additional_permitted_params\n []\n end", "def post_params\n # params.require(:post).permit(policy(@post).permitted_attributes) instead of permitted_attributes\n params.require(:post).permit(:title, :body)\n end", "def manage_assign_attributes_with_params _params\n\t\t\tassign_attributes _params.permit([:status, :note])\n\t\tend", "def form_params\n params.require(:scenario).permit(Scenario.allowable_params)\n end", "def permit_params(*args, &block)\n param_key = config.param_key.to_sym\n\n controller do\n define_method :permitted_params do\n belongs_to_param = active_admin_config.belongs_to_param\n create_another_param = :create_another if active_admin_config.create_another\n\n permitted_params =\n active_admin_namespace.permitted_params +\n Array.wrap(belongs_to_param) +\n Array.wrap(create_another_param)\n\n params.permit(*permitted_params, param_key => block ? instance_exec(&block) : args)\n end\n\n private :permitted_params\n end\n end", "def profile_params\n params.require(:profile).permit(Profile.allowed_attributes)\n end", "def build_permitted_params\n super + [\n { date_of_work_attributes: permitted_time_span_params },\n { inscription_attributes: permitted_inscription_params },\n { additional_credit_attributes: permitted_additional_credit_params },\n after: [],\n artist: [],\n attributed_to: [],\n author: [],\n addressee: [],\n creator_of_work: [],\n contributor: [],\n editor: [],\n engraver: [],\n interviewee: [],\n interviewer: [],\n manner_of: [],\n school_of: [],\n manufacturer: [],\n photographer: [],\n printer: [],\n printer_of_plates: [],\n publisher: [],\n place_of_interview: [],\n place_of_manufacture: [],\n place_of_publication: [],\n place_of_creation: [],\n ]\n end", "def defect_params\n params.require(:defect).permit(Defect.allowable_params)\n end", "def block_params\n params.require(required_params).permit(default_permitted_attributes)\n end", "def attributes\n @allowed_attributes\n end", "def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end", "def contact_params\n params.require(:contact).permit(Contact.safe_attributes)\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 case_params\n params.require(:case).permit(Case.safe_attributes)\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 allowed_attributes=(_arg0); end", "def allowed_attributes=(_arg0); end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def student_params(*args) #is the helper method \n\n\t\tparams.require(:student).permit(*args)\n\t\t#uses .require and .permit methods as stronger params to prevent hacks through inspect element right click edit html \n\t\t#require restricts, permit allows, and *args is for the custom arguments\n\tend", "def permit_all_params options = {}\n prepend_before_filter do\n self.params.deep_permit!\n end\n end", "def analise_privacidade_params\n #params.require(:analise_privacidade).permit(:rede_social, :url_rede_social, :descricao_analise, tipo_coumunicacoes_attributes: [:id, :tipo_comunicacao, :observacao])\n \n \n params.require(:analise_privacidade).permit!\n \n \n \n \n \n end", "def car_params\n params\n .require(:car)\n .permit(*policy(@car || Car.new).permitted_attributes)\n end", "def required_candidate_params\n params.require(:candidate).permit(Candidate.permitted_params)\n end", "def service_params\n\t\tparams.require(:service).permit(*Service::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def user_params\n params.require(:user).permit(User::REGISTRABLE_ATTRIBUTES)\n end", "def create_params\n permitted = params.permit(*common_params, :is_group,\n annotated_students_attributes: [:student_id])\n permitted[:annotated_students_attributes] = [] if params[:is_group]\n permitted\n end", "def user_attributes\n params.permit(:first_name,\n :last_name, :description)\n end", "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "def permitted_params\n\t\tputs \"image permitted params are:\"\n\t\tputs Image.permitted_params\n\t\tparams.permit(Image.permitted_params)\n\tend", "def product_assign_params\n params.require(:product_assign).permit(ProductAssign.safe_attributes)\n end", "def maintenance_activity_params\n params.require(:maintenance_activity).permit(MaintenanceActivity.allowable_params)\n end", "def attribute_params\n params.require(:attribute).permit(:attribute_id, :attribute_type, :name, :sex, :is_neuter)\n end", "def canister_params\n params.require(:canister).permit(:_id, :properties)\n end", "def document_params\n params.require(:document).permit(Document.safe_attributes)\n end" ]
[ "0.7850429", "0.7298118", "0.725215", "0.72401816", "0.7216541", "0.71798575", "0.71505195", "0.7147149", "0.7110159", "0.7067974", "0.69763404", "0.69573665", "0.6918069", "0.6895281", "0.6874742", "0.6874742", "0.68576556", "0.68500894", "0.6847119", "0.68360615", "0.68227375", "0.67997885", "0.678383", "0.6715413", "0.6711937", "0.67077655", "0.6704057", "0.6693878", "0.66698235", "0.6667373", "0.6664039", "0.6662432", "0.66605824", "0.66605824", "0.66599834", "0.6657398", "0.6647869", "0.6646832", "0.6645594", "0.6645594", "0.6643592", "0.6638843", "0.6636891", "0.6636891", "0.66353196", "0.6634524", "0.6625881", "0.66112405", "0.6591372", "0.6572414", "0.65696114", "0.65689516", "0.6543413", "0.65350324", "0.65248877", "0.6524152", "0.65189385", "0.6515054", "0.6513435", "0.64909816", "0.6490314", "0.6475959", "0.64644426", "0.6461064", "0.6454072", "0.64537805", "0.6439169", "0.64389884", "0.64305526", "0.64290106", "0.64208627", "0.64183336", "0.64166933", "0.64081305", "0.63988197", "0.6396894", "0.6396247", "0.63905007", "0.63860947", "0.6385353", "0.63842744", "0.6383907", "0.6383907", "0.63757974", "0.6367084", "0.6366641", "0.63635445", "0.6355398", "0.6349597", "0.6343353", "0.6339649", "0.6336683", "0.6333323", "0.6332405", "0.6324154", "0.63166964", "0.63130116", "0.63118494", "0.63093257", "0.629971", "0.62850267" ]
0.0
-1
Generate the video tag +options+ you can specify height/width/allowfullscreen for an individual video here
def video_tag(options = {}) options = ActiveRecord::Acts::Cinema::DEFAULT_OPTIONS.merge(options) video_url = read_attribute(ActiveRecord::Acts::Cinema::SOURCE_PARAM) width = options[:width] height = options[:height] allow_full_screen = options[:allow_full_screen] ? "true" : "false" # Check the tag option, if a method is assigned, # call it to get the template string if options[:tag_template].is_a?(Symbol) tag_template = self.send options[:tag_template] else tag_template = options[:tag_template] end ERB.new(tag_template).result(binding) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_video_directly options={}\n # render video player\n content_tag(:div) do\n options[:value].collect do |video_md5|\n l1 = video_md5[0..1]\n l2 = video_md5[2..3]\n content_tag(:video,\n content_tag(:source, \"I'm sorry; your browser doesn't support HTML5 video in MP4 with H.264.\",\n src: \"https://cspace-prod-02.ist.berkeley.edu/#TENANT#_nuxeo/data/#{l1}/#{l2}/#{video_md5}\",\n id: 'video_md5',\n type: 'video/mp4'),\n controls: 'controls',\n style: 'width: 640px;')\n end.join.html_safe\n end\n end", "def video(*sources)\n options = sources.extract_options!.symbolize_keys\n sources = sources.shift if sources.size == 1\n\n if options[:poster]\n options[:poster] = asset_path(options[:poster])\n end\n\n if size = options.delete(:size)\n options[:width], options[:height] = size =~ /^\\d+x\\d+$/ ? size.split('x') : size\n end\n\n if sources.is_a?(Array)\n content_tag(:video, options) do\n sources.collect { |source| tag(:source, src: asset_path(source)) }.join(\"\\n\")\n end\n else\n tag(:video, options.reverse_merge(src: asset_path(sources)))\n end\n end", "def render_video_csid options={}\n # render video player\n content_tag(:div) do\n options[:value].collect do |video_csid|\n content_tag(:video,\n content_tag(:source, \"I'm sorry; your browser doesn't support HTML5 video in MP4 with H.264.\",\n src: \"https://webapps.cspace.berkeley.edu/#TENANT#/imageserver/blobs/#{video_csid}/content\",\n id: 'video_csid',\n type: 'video/mp4'),\n controls: 'controls',\n style: 'width: 640px;')\n end.join.html_safe\n end\n end", "def video_args(video=nil)\n video = Process.input_video_options.merge(video.to_h)\n [].tap do |args|\n fps = nil # NOTE ah, ruby\n args.concat %W[-noautorotate] unless video.delete(:auto_rotate)\n args.concat %W[-r #{fps}] if (fps = video.delete(:fps))\n Util.assert_options_empty! video\n end\n end", "def video_background_with_features(slides, options={})\n default_options = { hide_for_small: true, hide_arrow: false, pattern_overlay: true }\n options = default_options.merge options\n\n hide_for_small = (options[:hide_for_small]) ? \"hide-for-small\" : \"\"\n ret = \"\"\n\n if slides.size > 0\n if slides.pluck(:slide_file_name).find{|f| /^(.*)\\.webm|mp4$/ =~ f}\n fname = $1\n\n video_sources = \"\"\n if webm = slides.find{|f| /webm/i =~ f.slide_content_type && /^#{fname}\\./ =~ f.slide_file_name }\n video_sources += \"<source src='#{ webm.slide.url }' type='#{ webm.slide_content_type }'/>\"\n end\n\n if ogv = slides.find{|f| /ogv/i =~ f.slide_content_type && /^#{fname}\\./ =~ f.slide_file_name }\n video_sources += \"<source src='#{ ogv.slide.url }' type='video/ogg ogv' codecs='theora, vorbis'/>\"\n end\n\n if mp4 = slides.find{|f| /mp4/i =~ f.slide_content_type && /^#{fname}\\./ =~ f.slide_file_name }\n video_sources += \"<source src='#{ mp4.slide.url }' type='#{ mp4.slide_content_type }'/>\"\n end\n poster = slides.find{|f| /jpg|jpeg|png/i =~ f.slide_content_type && /^#{fname}\\./ =~ f.slide_file_name }\n\n ret += content_tag(:video, video_sources.html_safe,\n poster: (poster) ? poster.slide.url : '',\n id: \"video_background\",\n preload: \"auto\",\n autoplay: \"true\",\n loop: \"loop\",\n muted: \"true\",\n volume: 0)\n\n if options[:pattern_overlay]\n ret += content_tag(:div, \"\", id: \"video_pattern\")\n end\n\n if anim = slides.find{|f| /gif/i =~ f.slide_content_type && /^#{fname}\\./ =~ f.slide_file_name }\n ret += content_tag(:div, class: \"bg-gif\") do\n image_tag( anim.slide.url, lazy: false )\n end\n elsif poster\n ret += content_tag(:div, class: \"bg-gif\") do\n image_tag( poster.slide.url, lazy: false )\n end\n end\n\n if website.homepage_headline\n if website.homepage_headline_product_id\n headline_slide = content_tag(:h1, website.homepage_headline)\n product = Product.find(website.homepage_headline_product_id)\n if product.name.match(/^\\d*$/)\n headline_slide += content_tag(:p, \"#{product.name} #{product.short_description_1}\")\n else\n headline_slide += content_tag(:p, product.name)\n end\n headline_slide += link_to(\"Learn More\", product, class: \"secondary button\")\n if product.in_production?\n headline_slide += buy_it_now_link(product, html_button: true)\n end\n elsif website.homepage_headline_product_family_id\n product_family = ProductFamily.find(website.homepage_headline_product_family_id)\n headline_slide = content_tag(:h1, product_family.name.titleize)\n headline_slide += content_tag(:p, website.homepage_headline)\n headline_slide += link_to(\"Learn More\", product_family, class: \"button\")\n else\n headline_slide = content_tag(:h1, website.homepage_headline)\n end\n headline_class = website.homepage_headline_overlay_class || \"large-6 small-12 columns\"\n ret += content_tag(:div, class: 'row headline_slide') do\n content_tag(:div, headline_slide, class: headline_class )\n end\n else\n ret += content_tag(:div, class: \"container\", id: \"feature_spacer\") do\n if options[:tagline]\n content_tag(:h1, website.tagline, id: \"tagline\")\n end\n end\n end\n\n ret = content_tag(:div, ret.html_safe, id: \"video-container\", class: hide_for_small)\n ret += content_tag(:div, \"\", class: \"bouncing-arrow\") unless options[:hide_arrow]\n @leftover_slides = slides.reject{|f| /^#{fname}\\./ =~ f.slide_file_name }\n\n else\n\n ret += content_tag(:div, class: \"row\") do\n content_tag(:div, class: \"large-12 #{ hide_for_small } columns\") do\n orbit_slideshow(slides: slides, duration: 6000, navigation_arrows: false, transition: \"fade\")\n end\n end\n\n end\n end\n\n raw(ret)\n end", "def process_video(options = {})\n vzaar_video_id = nil\n request_xml = %{\n <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <vzaar-api>\n <video>\n <guid>#{options[:guid]}</guid>\n <title>#{options[:title]}</title>\n <description>#{options[:description]}</description>\n <profile>#{options[:profile]}</profile>\n }\n if !options[:transcoding].nil?\n request_xml += %{\n <transcoding>#{options[:transcoding]}</transcoding>\n }\n end\n request_xml += %{ \n </video>\n </vzaar-api>\n }\n auth_connection HTTP_POST, '/api/videos', request_xml do |response_body|\n vzaar_video_id = get_video_id_from_response_body(response_body)\n end\n vzaar_video_id\n end", "def oembed_options\n { :maxwidth => \"560\", :maxheight => \"315\" }.merge(options[:oembed]||{})\n end", "def path_to_video(source, options = T.unsafe(nil)); end", "def video_url(source, options = T.unsafe(nil)); end", "def create_video_object(obj)\n return content_tag(:div, content_tag(:iframe, \"\", :src => obj.link, :width => \"100%\"), :style => \"position:absolute; top: #{obj.y}px; left: #{obj.x}px;\")\n end", "def embed_code_html(width = 500, height = 315)\n '[video saved - will display when done]'\n end", "def url_to_video(source, options = T.unsafe(nil)); end", "def video_gen(slide)\n term = slide['term']\n kind = slide['kind']\n index = slide['index']\n audio = slide['audio']\n image = slide['image']\n raise \"audio is required fof #{term}\" unless audio\n raise \"image is required fof #{term}\" unless image\n file_name = file_name_gen(slide, \".mpg\")\n audio = command_arg(slide['audio'])\n image = command_arg(slide['image'])\n video = command_arg(file_name)\n `ffmpeg -loop 1 -y -i #{image} -i #{audio} -acodec libmp3lame -vcodec mpeg4 -shortest -qscale:v 1 #{video}`\n slide['video'] = file_name\nend", "def video_path(source, options = T.unsafe(nil)); end", "def embed_code(width = 500, height = 315)\n if self.vimeod?\n '<iframe src=\"http://player.vimeo.com/video/' + self.vimeo_id.to_s + '?api=1&player_id=video_' + self.id.to_s + '&title=0&byline=0&portrait=0\" id=\"video_' + self.id.to_s + '\" width=\"' + width.to_s + '\" height=\"' + height.to_s + '\" frameborder=\"0\" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>'\n else\n self.embed_code_html(width, height)\n end\n end", "def video(filename, opts = {})\n n = input(filename, opts)\n @videos << n\n n\n end", "def video_xml(video_options)\n SitemapGenerator::Builder::SitemapUrl.new(url_options[:path], {\n :host => url_options[:host],\n :video => video_options\n }).to_xml\n end", "def create_black_video(movie, visual)\n #Render an image and create a video file from it\n @generated_videos += 1\n filename = movie.project.trimmed + \"/generated-#{@generated_videos}.avi\"\n cmd = @settings['still_video'].dup\n length = visual.end_point - visual.start_point\n cmd.sub!('<frames>', length.to_frames(25).to_s)\n cmd.sub!('<source>', VREConfig.instance.vre_root + \"resources/black_box.png\")\n cmd.sub!('<resolution>', movie.resolution)\n cmd.sub!('<target>', filename)\n system(cmd)\n visual.file = filename\n visual.type = \"video\"\n visual.mute = true\n filename\n end", "def video\n \"#{self.video_file_name}\"\n end", "def video_embed_tag(youtube_url, width = '500', height = '315')\n embed_url = Youtube.embed_url(youtube_url)\n return '' if embed_url.blank?\n tag(:iframe, {:width => width, :height => height, :src => embed_url, :frameborder => 0, :allowfullscreen => true})\n end", "def new\n @video = Video.new\n @video.duration = 60\n @video.width = 1280\n @video.height = 720\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end", "def to_xml\n xml = \"<video>\\n\"\n instance_variables.each do |attr|\n value = instance_variable_get(attr).to_s\n value.gsub!(/<br \\/>/, \"\\n\")\n value.gsub!(/<.*?>/m, '')\n value.gsub!(/&/m, '&amp;')\n value.gsub!(/'/m, '&apos;')\n value.gsub!(/\"/m, '&quot;')\n value.gsub!(/</m, '&lt;')\n value.gsub!(/>/m, '&gt;')\n attr.sub!(/@/, '')\n xml += \"<#{attr}>#{value}</#{attr}>\\n\"\n end\n xml += \"</video>\\n\"\n end", "def define_youtube_player_tag(c,data)\n c.define_tag 'player' do |tag|\n width=(tag.attr['width']||(data[:video].width.to_i > 0 ? data[:video].width.to_i : nil)||400).to_i\n height=(tag.attr['height']||(data[:video].height.to_i > 0 ? data[:video].height.to_i : nil)||300).to_i\n color=tag.attr['bg'] || \"#FFFFFF\"\n if !editor?\n if data[:video].thumbnail_file_id && !tag.attr['no_thumb']\n thumbnail_file = DomainFile.find_by_id(data[:video].thumbnail_file_id)\n img_src = \"<a href='javascript:void(0);' onclick='writeVideoPlayer#{paragraph.id}();'><img src='#{thumbnail_file.url}' width='#{width}' height='#{height}'/></a>\"\n autoplay='1'\n else\n autoplay='0'\n end\n autoplay='1' if data[:video].autoplay\n \n <<-PLAYER_CODE\n <div id='video_player_#{paragraph.id}' style='width:#{width}px;height:#{height}px;'>#{img_src}</div>\n <script type=\"text/javascript\">\n function writeVideoPlayer#{paragraph.id}() {\n swfobject.embedSWF(\"http#{\"s\" if request.ssl?}://www.youtube.com/v/#{data[:video].video_id}&rel=0&autoplay=#{autoplay}\",\"video_player_#{paragraph.id}\",\"#{width}\",\"#{height}\",\"8\",\"\",\n { playerMode: \"embedded\" },\n { wmode: \"transparent\", bgcolor: \"#{color}\" });\n }\n #{\"writeVideoPlayer#{paragraph.id}();\" if tag.attr['no_thumb'] || !thumbnail_file}\n </script>\n PLAYER_CODE\n else\n \"<div id='video_player_#{paragraph.id}' style='width:#{width}px;height:#{height}px;'></div>\"\n end\n end \n end", "def video_xml\n xml = Builder::XmlMarkup.new(:indent => 2)\n xml.instruct! :xml, :version => '1.0', :encoding => nil\n xml.entry :xmlns => 'http://www.w3.org/2005/Atom',\n 'xmlns:media' => 'http://search.yahoo.com/mrss/',\n 'xmlns:yt' => 'http://gdata.youtube.com/schemas/2007' do\n xml.media :group do\n xml.media :title, @opts[:title], :type => 'plain'\n xml.media :description, @opts[:description], :type => 'plain'\n xml.media :category, @opts[:category], :scheme => 'http://gdata.youtube.com/schemas/2007/categories.cat'\n @opts[:developer_tags].each do |developer_tag|\n xml.media :category, developer_tag, :scheme => 'http://gdata.youtube.com/schemas/2007/developertags.cat'\n end\n xml.tag! 'media:keywords', @opts[:keywords].join(\",\")\n end\n end\n xml.target!\n end", "def video_xml\n xml = Builder::XmlMarkup.new(:indent => 2)\n xml.instruct! :xml, :version => '1.0', :encoding => nil\n xml.entry :xmlns => 'http://www.w3.org/2005/Atom',\n 'xmlns:media' => 'http://search.yahoo.com/mrss/',\n 'xmlns:yt' => 'http://gdata.youtube.com/schemas/2007' do\n xml.media :group do\n xml.media :title, @opts[:title], :type => 'plain'\n xml.media :description, @opts[:description], :type => 'plain'\n xml.media :category, @opts[:category], :scheme => 'http://gdata.youtube.com/schemas/2007/categories.cat'\n @opts[:developer_tags].each do |developer_tag|\n xml.media :category, developer_tag, :scheme => 'http://gdata.youtube.com/schemas/2007/developertags.cat'\n end\n xml.tag! 'media:keywords', @opts[:keywords].join(\",\")\n end\n end\n xml.target!\n end", "def options\n {\n # audio_sample_rate: 44100,\n # audio_channels: 2,\n audio_bitrate: AUDIO_BITRATE,\n video_max_bitrate: new_bitrate,\n buffer_size: new_bitrate,\n # video_bitrate: new_bitrate,\n # FIXME: `-fs` doesn't work as inteded. it just stops encoding when file got bigger.\n # http://ffmpeg.gusari.org/viewtopic.php?f=11&t=2141\n # custom: \"-fs #{FILESIZE_BOUND}\"\n }\n end", "def generate_black_video(movie, visual)\n #Render an image and create a video file from it\n @generated_videos += 1\n filename = movie.project.trimmed + \"/generated-#{@generated_videos}.avi\"\n cmd = @settings['still_video'].dup\n length = visual.end_point - visual.start_point\n cmd.sub!('<frames>', length.to_frames(25).to_s)\n cmd.sub!('<source>', VREConfig.instance.vre_root + \"resources/black_box.png\")\n cmd.sub!('<resolution>', movie.resolution)\n cmd.sub!('<target>', filename)\n system(cmd)\n filename\n end", "def cdn_video_tag(url, opts = {})\n if opts[:size]\n width, height = opts[:size].split('x')\n else\n width, height = opts[:width], opts[:height]\n end\n\n return video_tag(url, opts) # if Rails.env.development?\n\n # url = \"http:#{url}\" if url.present? && url[0..1] == \"//\"\n # cloudfront backed vide\n # video_tag(\"http://d2xfsikitl0nz3.cloudfront.net/#{CGI.escape(url)}\", opts)\n end", "def video_link\n if video_type? && !body.nil?\n vimeo_video(body) || youtube_video(body)\n end\n end", "def show; @video.show; end", "def show\n @iframe = @video.iFrame_Source.html_safe\n end", "def set_VideoDuration(value)\n set_input(\"VideoDuration\", value)\n end", "def embed\n \"#{video.__embed__}#{tracker(true)}\"\n end", "def mux(options={})\n if File.file?(options[:output])\n File.delete(options[:output])\n end\n\n create do |mp4creator|\n mp4creator.create = options[:audio]\n mp4creator.file = options[:output]\n end\n\n create do |mp4creator|\n mp4creator.create = options[:video]\n mp4creator.rate = options[:frame_rate].to_f\n mp4creator.file = options[:output]\n end\n\n if options[:hint]\n create do |mp4creator|\n mp4creator.hint = 1\n mp4creator.file = options[:output]\n end\n\n create do |mp4creator|\n mp4creator.hint = 2\n mp4creator.file = options[:output]\n end\n\n create do |mp4creator|\n mp4creator.optimize = true\n mp4creator.file = options[:output]\n end\n end\n end", "def set_Video(value)\n set_alias(\"Video\", value)\n end", "def slide_video_tag(slide, field)\n if current_page?(controller: 'signs', action: 'play')\n if field == :background\n video_tag(slide.background, id: \"js-background-video\", class: \"ui-slide-background\", preload: \"auto\", loop: true)\n else\n video_tag(slide.foreground, id: \"js-foreground-video\", class: \"ui-slide-foreground\", preload: \"auto\", loop: true)\n end\n else\n if field == :background\n video_tag(slide.background, controls: true, muted: true, id: \"js-background-video\", class: \"ui-slide-background\", preload: \"auto\", loop: true)\n else\n video_tag(slide.foreground, controls: true, muted: true, id: \"js-foreground-video\", class: \"ui-slide-foreground\", preload: \"auto\", loop: true)\n end\n end\n end", "def create\n @video = Video.new(video_params)\n @video.board_id = @board.id\n\n urlVideo = VideoInfo.new(@video.source)\n\n\n @video.iFrame_Source = urlVideo.embed_code\n @video.title = urlVideo.title\n @video.date = urlVideo.date\n @video.provider = urlVideo.provider\n @video.description = urlVideo.description\n @video.smaller_thumbnail = urlVideo.thumbnail_small\n @video.larger_thumbnail = urlVideo.thumbnail_large\n\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to board_video_path(@board, @video), notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def video_convert_to_mp4_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VideoApi.video_convert_to_mp4 ...'\n end\n # resource path\n local_var_path = '/video/convert/to/mp4'\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/octet-stream'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n header_params[:'fileUrl'] = opts[:'file_url'] if !opts[:'file_url'].nil?\n header_params[:'maxWidth'] = opts[:'max_width'] if !opts[:'max_width'].nil?\n header_params[:'maxHeight'] = opts[:'max_height'] if !opts[:'max_height'].nil?\n header_params[:'preserveAspectRatio'] = opts[:'preserve_aspect_ratio'] if !opts[:'preserve_aspect_ratio'].nil?\n header_params[:'frameRate'] = opts[:'frame_rate'] if !opts[:'frame_rate'].nil?\n header_params[:'quality'] = opts[:'quality'] if !opts[:'quality'].nil?\n\n # form parameters\n form_params = {}\n form_params['inputFile'] = opts[:'input_file'] if !opts[:'input_file'].nil?\n\n # http body (model)\n post_body = nil\n auth_names = ['Apikey']\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 => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VideoApi#video_convert_to_mp4\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def video_params\n params.require(:video).permit(:user_id, :id_code, :provider, :title, :duration, :description, :thumbnail, :embed_url, :embed_code, :tags, :category1, :category2, :plays)\n end", "def combine_video(presentation)\n term = presentation['term']\n args = []\n for slide in presentation['slides']\n args.push command_arg(slide['video'])\n end\n args = args.join(' ')\n combined_arg = command_arg(\"#{BUILD_DIR}/#{term}/#{term}-combined.mpg\")\n final = \"#{DIST_DIR}/#{term}/#{term}.avi\"\n final_arg = command_arg(final)\n `cat #{args} > #{combined_arg}`\n `ffmpeg -y -i #{combined_arg} -r 25 -qscale:v 1 #{final_arg}`\n presentation['video'] = final\nend", "def video_resize_video_simple(opts = {})\n data, _status_code, _headers = video_resize_video_simple_with_http_info(opts)\n data\n end", "def iframe(options = {})\n concat(content_tag(:iframe, class: options[:class], src: options[:src], width: options[:width], height: options[:height]) do\n end).html_safe\n end", "def youtube_tag(url, opts = {})\n # extract youtube thing\n m = url.match(/(?<=v=)[A-z0-9\\-]+/)\n youtube_id = m.present? ? m[0] : url\n embed_url = \"//www.youtube.com/embed/#{youtube_id}\"\n\n content_tag(:iframe, \"\", :src => embed_url,\n :frameborder => opts[:frameborder],\n :allowfullscreen => true,\n :width => opts[:width] || \"600\",\n :height => opts[:height] || \"480\"\n )\nend", "def video_path(source, options = {})\n asset_path source, sprockets_helpers_settings.default_path_options[:video_path].merge(options)\n end", "def flv_file(options = {})\n base = \"/library/video/#{created_on.year.to_s}/#{created_on.month.to_s}/#{user_id}/#{id}u#{Digest::SHA1.hexdigest(created_on.to_s)}/#{id}.flv\"\n if options[:full_path].nil?\n base\n else\n File.join(\"#{Rails.root}/public/\", base)\n end\n end", "def video_resize_video_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VideoApi.video_resize_video ...'\n end\n # resource path\n local_var_path = '/video/resize/preserveAspectRatio'\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/octet-stream'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n header_params[:'fileUrl'] = opts[:'file_url'] if !opts[:'file_url'].nil?\n header_params[:'maxWidth'] = opts[:'max_width'] if !opts[:'max_width'].nil?\n header_params[:'maxHeight'] = opts[:'max_height'] if !opts[:'max_height'].nil?\n header_params[:'frameRate'] = opts[:'frame_rate'] if !opts[:'frame_rate'].nil?\n header_params[:'quality'] = opts[:'quality'] if !opts[:'quality'].nil?\n header_params[:'extension'] = opts[:'extension'] if !opts[:'extension'].nil?\n\n # form parameters\n form_params = {}\n form_params['inputFile'] = opts[:'input_file'] if !opts[:'input_file'].nil?\n\n # http body (model)\n post_body = nil\n auth_names = ['Apikey']\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 => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VideoApi#video_resize_video\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def youtube_embed_code(size)\n width, height = video_embed_size(size)\n \"<iframe id='embedded_video' width='#{width}' height='#{height}' src='http://www.youtube.com/embed/#{self.params['v'][0]}?autohide=1&hd=1&border=1&showinfo=0' frameborder='0' allowfullscreen></iframe>\".html_safe\n end", "def generate_previews(filename, options = {})\n\tframegrab_grid = options['framegrab_grid'] || Config['PreviewSettings']['default_grid']\n\tframegrab_interval = options['framegrab_interval'] || Config['PreviewSettings']['default_interval']\n\tframegrab_height = options['framegrab_height'] || Config['PreviewSettings']['default_height']\n\n\tbase_filename = File.basename(filename)\n\tfilesize = File.size(filename)\n\tfile_info = Mediainfo.new filename\n\n\tif framegrab_interval.to_i == 0\n\t\ttotal_images = 1\n\t\tframegrab_grid.split('x').each do |x|\n\t\t\ttotal_images *= x.to_i\n\t\tend\n\t\tframegrab_interval = file_info.duration / total_images\n\tend\n\n\tcount = 0\n\tunits = ['bytes', 'KB', 'MB', 'GB', 'TB']\n\tloop do\n\t\tbreak if filesize < 1024.0\n\t\tcount += 1\n\t\tfilesize /= 1024.0\n\tend\n\n\tpretty_filesize = filesize.round(2).to_s + ' ' + units[count]\n\n\tduration = file_info.duration\n\tremainder = 0\n\tcount = 0\n\tunits = ['sec','min','h']\n\tloop do\n\t\tbreak if duration < 60\n\t\tcount += 1\n\t\tremainder = duration % 60\n\t\tduration /= 60\n\tend\n\n\tpretty_duration = duration.round(0).to_s + ' ' + units[count]\n\n\tif remainder > 0\n\t\tpretty_duration += ' ' + remainder.round(0).to_s + ' ' + units[count-1]\n\tend\n\n\tcommand = \"ffmpeg -loglevel panic -y -i \\\"#{filename}\\\" -frames 1 -q:v 1 -vf \\\"select='isnan(prev_selected_t)+gte(t-prev_selected_t\\,\" + framegrab_interval.to_s + \")',scale=-1:\" + framegrab_height.to_s + \",tile=\" + framegrab_grid + \"\\\" '/tmp/video_preview.jpg'\"\n\t# puts command\n\tif system(command)\n\t# \t# Now that the preview is generated, post it to Mattermost\n\t\tif !(uploaded_file_url = upload_file('/tmp/video_preview.jpg', base_filename))\n\t\t\tcall_mattermost({:text => \"We ran into a problem uploading the file. Have someone look at this!\"})\n\t\telse\n\t\t\tmessage = \"![#{base_filename}](#{uploaded_file_url})\\n\\n\"\n\t\t\tmessage+= \"|#{base_filename}|[(preview)](#{uploaded_file_url})|\\n\"\n\t\t\tmessage+= \"|-|-:|\\n\"\n\t\t\tmessage+= \"|File Size| **#{pretty_filesize}**|\\n\"\n\t\t\tmessage+= \"|Duration| **#{pretty_duration}**|\\n\"\n\t\t\tmessage+= \"|Format| **#{file_info.format}**|\"\n\n\t\t\tactions = Config['FileOperations']\n\t\t\tattachments_actions = []\n\t\t\tactions.keys.each do |key|\n\t\t\t\taction_hash = {\n\t\t\t\t\t'name': key,\n\t\t\t\t\t'integration': {\n\t\t\t\t\t\t'url': [Config['Webhook']['url'], 'run-command'].join('/'),\n\t\t\t\t\t\t'context': {\n\t\t\t\t\t\t\t'command': key,\n\t\t\t\t\t\t\t'filename': File.realpath(filename)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tattachments_actions.push(action_hash)\n\t\t\tend\n\n\n\t\t\tattachments = [\n \t\t{\n \t\t\t\"text\": message,\n \t\t\t\"actions\": attachments_actions\n\t\t }]\n\n\t\t\tpayload = {:attachments => attachments}\n\n\t\t\tcall_mattermost(payload)\n\t\tend\n\telse\n\t\tLog.error \"There was an error running the command: #{command}\"\n\t\tcall_mattermost({:text => \"### DANGER WILL ROBINSON\\nERROR\"})\n\tend\n\nend", "def videoResolutionStringFromMovie(movie, withAttributes:stringAttributes)\n videoSize = movie.attributeForKey(QTMovieNaturalSizeAttribute).sizeValue\n videoSizeFormat = \"\\n\\tResolution: %.0fx%.0f\" % [videoSize.width, videoSize.height]\n return NSAttributedString.alloc.initWithString(videoSizeFormat, attributes: stringAttributes)\n end", "def smart_video_preview\n vp = Tempfile.new([\"video-preview\", \".png\"], binmode: true)\n\n # https://ffmpeg.org/ffmpeg.html#Main-options\n # https://ffmpeg.org/ffmpeg-filters.html#thumbnail\n output = shell!(\"ffmpeg -i #{file.path.shellescape} -vf thumbnail=300 -frames:v 1 -y #{vp.path.shellescape}\")\n Rails.logger.debug(output)\n\n MediaFile.open(vp)\n end", "def smart_video_preview\n vp = Tempfile.new([\"video-preview\", \".png\"], binmode: true)\n\n # https://ffmpeg.org/ffmpeg.html#Main-options\n # https://ffmpeg.org/ffmpeg-filters.html#thumbnail\n output = shell!(\"ffmpeg -i #{file.path.shellescape} -vf thumbnail=300 -frames:v 1 -y #{vp.path.shellescape}\")\n Rails.logger.debug(output)\n\n MediaFile.open(vp)\n end", "def initialize\n super(VIDEO_CONFIG)\n end", "def video_params\n params.require(:video).permit(:title, :source, :board_id, :iFrame_Source, :type)\n end", "def generateVideos()\n #GENERATE AN INTERMEDIARY DIRECTORY WHERE WE'D STORE THE VIDEO FRAGMENTS\n pathToIntermediates=\"#{$PATHTOGENERATEINTERMEDIATES}/#{@meetingData.meetingId}\"\n puts \"generating intermediate videos in #{pathToIntermediates}\"\n createDirectoryIfNotExists(pathToIntermediates)\n \n dsPath=\"#{$PATHTOPUBLISHED}/#{@meetingData.meetingId}/deskshare\"\n presentationPath=\"#{$PATHTOPUBLISHED}/#{@meetingData.meetingId}/presentation\"\n \n #Scale to optimal resolution\n maxW=0\n maxH=0\n if Dir.exist?dsPath then\n maxW, maxH = getMaxResolution(dsPath)\n else \n maxW, maxH = getMaxResolution()\n end\n\n\n @objects.each_with_index{\n |val, index|\n puts \"Generating a #{val.class} video in interval [#{val.start_timestamp}, #{val.stop_timestamp}]\"\n val.generateVideo(pathToIntermediates, index, maxW, maxH)\n } \n end", "def codec\n if RAILS_ENV == 'development'\n \"-ar 22050 -ab 32 -f flv -y\"\n else\n \"-vcodec libx264 -vpre hq -ar 22050 -ab 32 -crf 15\"\n end\n end", "def convert_img(el, indent)\n\t\tif el.attr['alt'] == 'videoplayer'\n\t\t\treturn \"<video src='#{cdn_url(el.attr['src'])}' controls preload='none' class='video-js vjs-default-skin' data-setup='{}'>\"\n\t\telsif el.attr['src'] && el.attr['src'] !~ /(^[\\w]*:|^\\/)/\n\t\t\tel.attr['src'] = File.join(@options[:asset_prefix], el.attr['src'])\n\t\tend\n\t\tsuper\n\tend", "def video_resize_video_simple_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VideoApi.video_resize_video_simple ...'\n end\n # resource path\n local_var_path = '/video/resize/target'\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/octet-stream'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n header_params[:'fileUrl'] = opts[:'file_url'] if !opts[:'file_url'].nil?\n header_params[:'maxWidth'] = opts[:'max_width'] if !opts[:'max_width'].nil?\n header_params[:'maxHeight'] = opts[:'max_height'] if !opts[:'max_height'].nil?\n header_params[:'frameRate'] = opts[:'frame_rate'] if !opts[:'frame_rate'].nil?\n header_params[:'quality'] = opts[:'quality'] if !opts[:'quality'].nil?\n header_params[:'extension'] = opts[:'extension'] if !opts[:'extension'].nil?\n\n # form parameters\n form_params = {}\n form_params['inputFile'] = opts[:'input_file'] if !opts[:'input_file'].nil?\n\n # http body (model)\n post_body = nil\n auth_names = ['Apikey']\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 => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VideoApi#video_resize_video_simple\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def video_params\n params.require(:video).permit(:title, :description, :length, :video_filename, :video_type)\n end", "def show\n view_options(\n full_width: true,\n small_footer: @game.uses_small_footer? || enable_scrolling?,\n has_i18n: @game.has_i18n?\n )\n end", "def showtube_img_tag(vid, imwidth, imheight, html_options = {})\n image_tag(\"http://img.youtube.com/vi/#{vid}/0.jpg\", :size => \"#{imwidth}x#{imheight}\")\n end", "def set_VideoEmbeddable(value)\n set_input(\"VideoEmbeddable\", value)\n end", "def embed_media( options = {} )\n width = options[:width] || 633\n height = options[:height] || 475\n\n if options[:link] && options[:uploaded_image_url]\n raise ArgumentError, \"embed_media cannot have both \\\"link\\\" and\n \\\"uploaded_image_url\\\" arguments\"\n end\n\n if options[:link]\n return embed_video(link: options[:link], \n width: width, \n height: height,\n class: options[:class])\n\n elsif options[:uploaded_image_url]\n return \"<img src=\\\"#{options[:uploaded_image_url]}\\\" class=\\\"#{options[:class]}\\\">\".html_safe\n\n elsif !options[:uploaded_image_url] && !options[:link]\n return broken_image_tag(height, width, options[:class])\n end\n\n end", "def video_params\n params.require(:video).permit(:anime_id, :video_url, :frame, :release)\n end", "def parse_video\n # standard\n unless /\\A\\s*(?<width>\\d+)x(?<height>\\d+)\\s+(?<url>.+)\\z/ =~ content\n env.warn 'can not parse \\video content, should be \"#{WIDTH}x#{HEIGHT} #{URL}\"'\n return\n end\n\n case url\n when /youtu\\.?be/\n # NOTE merging them into one regexp fails (because longest match?)\n unless id = url[/(?<=watch\\?v=)\\w+/] || url[/(?<=embed\\/)\\w+/] || url[/(?<=youtu\\.be\\/)\\w+/]\n env.warn 'can not parse youtube id'\n return\n end\n %Q|<iframe width=\"#{width}\" height=\"#{height}\" src=\"https://www.youtube-nocookie.com/embed/#{id}?rel=0\" frameborder=\"0\" allowfullscreen></iframe>|\n when /vimeo/\n unless id = url[/(?<=vimeo\\.com\\/)\\w+/]\n env.warn 'can not parse vimeo id, should use link like this \"http://vimeo.com/#{DIGITS}\"'\n return\n end\n %Q|<iframe width=\"#{width}\" height=\"#{height}\" src=\"https://player.vimeo.com/video/#{id}\" frameborder=\"0\" allowFullScreen></iframe>|\n when /sm/\n unless id = url[/\\bsm\\d+/]\n env.warn 'can not find \"sm#{DIGITS}\" from link'\n return\n end\n %Q|<script src=\"https://ext.nicovideo.jp/thumb_watch/#{id}?w=#{width}&h=#{height}\"></script>\"|\n else\n env.warn 'failed to parse video link, currently only youtube, vimeo and niconico are supported'\n return\n end\n end", "def videostab(path_to_video, width, height, crop, tracking_mode)\n\t# from true/false to 1/0\n\ttracking_mode = tracking_mode && 1 || 0\n\tpython_output = `python #{PYNAME} #{path_to_video} #{width} #{height} #{crop} #{tracking_mode}`\n\tputs \"The output from #{PYNAME} is: #{python_output}\"\nend", "def ffmpeg_libvpx_cmd(input_path, output_path, bitrate, output_size, force=false)\n replace = force ? \"-y\" : \"\"\n return [\n \"ffmpeg -i '#{input_path}' -threads 8\",\n \"-c:v libvpx -pix_fmt yuv420p -crf 10 -b:v #{bitrate} -s #{output_size} -movflags +faststart -r 29.97 -c:a libvorbis -aq 5 #{replace} '#{output_path}'\"\n ]\nend", "def processVideoAttachmentMessage(attachmentName, outputFileName)\r\n html = \"<video controls=\\\"\\\">\\n\"\r\n html << \"<source src=\\\"#{outputFileName}\\\">\\n\"\r\n html << \"<a href=\\\"#{outputFileName}\\\">#{outputFileName}</a>\\n\"\r\n html << \"</video>\\n\"\r\n return html\r\n end", "def attach_video(filename, element_id: , put_video_path: , model_attribute: 'video_url')\n injected_file = inject_file filename, element_id, put_video_path\n\n page.execute_script 'video = window.Dashboard.router.pageView.model.video;'\n page.execute_script \"video.attributes['#{model_attribute}']='#{injected_file}'\"\n page.execute_script '$(\".video textarea[required]\").attr(\"required\", false)'+\n '.attr(\"disabled\", true);'\n end", "def vimeo_tag vimeo_data, **args\n if vimeo_data.is_a?(Hash) && vimeo_data[:sources].present?\n tag.iframe class: args[:class], data: { src: vimeo_data[:embed_url] }, width: '100%', height: '100%', frameborder: '0', allow: 'autoplay; fullscreen', webkitallowfullscreen: true, mozallowfullscreen: true, allowfullscreen: true\n elsif supports_afterglow_player?(vimeo_data)\n klass = args[:class].is_a?(Array) ? args[:class] : [args[:class]]\n klass << 'afterglow'\n klass << 'afterglow--ios' if browser.platform.ios?\n\n skin = args[:skin] == :light ? 'light' : 'dark'\n source = tag.source type: 'video/mp4', src: vimeo_data[:download_url]\n content_tag :video, {\n class: klass,\n width: vimeo_data[:width],\n height: vimeo_data[:height],\n poster: vimeo_data[:thumbnail],\n data: { skin: skin },\n } do\n vimeo_data[:sources].each do |source|\n next if source[:quality] == 'hls'\n\n concat tag.source({\n type: source[:type],\n src: source[:link],\n data: { quality: ('hd' if source[:quality] != 'sd') },\n })\n end\n end\n else\n # Fallback to a simple vimeo iframe, if the afterglow player is not supported.\n url = \"https://player.vimeo.com/video/#{vimeo_data}\"\n tag.iframe class: klass, data: { src: url }, width: '100%', height: '100%', frameborder: '0', allow: 'autoplay; fullscreen', webkitallowfullscreen: true, mozallowfullscreen: true, allowfullscreen: true\n end\n end", "def thumbnail(options={})\n image = File.expand_path(options[:image])\n\n encode do |ffmpeg|\n ffmpeg.input = options[:video]\n ffmpeg.record_start_time = options[:start]\n ffmpeg.record_for = options[:length]\n ffmpeg.video_frames = options[:frames]\n ffmpeg.fps = (options[:fps] || 1)\n ffmpeg.video_frame_size = \"#{options[:width]}x#{options[:height]}\"\n ffmpeg.disable_audio = true\n ffmpeg.overwrite_output_files = true\n ffmpeg.output = image\n end\n\n image_search = image.split('%d').map { |part|\n Regexp.escape(part)\n }.join('*')\n\n return Dir[image_search]\n end", "def vimeo_tag(url, opts = {})\n # extract vimeo_id thing\n# m = url.match(/(?<=\\/)\\d{2,}(?=$|\\/)/)\n# vimeo_id = m.present? ? m[0] : url\n vimeo_id = 36820781\n # \"https://player.vimeo.com/video/999999\"\n embed_url = \"//player.vimeo.com/video/#{vimeo_id}\"\n\n content_tag(:iframe, \"\", :src => embed_url,\n :frameborder => opts[:frameborder],\n :allowfullscreen => true,\n :width => opts[:width] || \"600\",\n :height => opts[:height] || \"480\"\n )\nend", "def wp_get_video_extensions()\n # Filters the list of supported video formats.\n apply_filters('wp_video_extensions', ['mp4', 'm4v', 'webm', 'ogv', 'flv'])\n end", "def video_params\n params.require(:video).permit(:name, :rating, :category, :subcategory, :language, :tags, :description, :uid, :status, :duration, :url_name, :tumbnail, :video)\n end", "def set_VideoContent(value)\n set_input(\"VideoContent\", value)\n end", "def video_cut_video(opts = {})\n data, _status_code, _headers = video_cut_video_with_http_info(opts)\n data\n end", "def embedyoutube(videonumber)\n %{\n <body style=\"margin:0;\">\n <object height=\"100%\" width=\"100%\"><param name=\"movie\" value=\"http://www.youtube.com/v/#{videonumber}&autoplay=1\" /><embed height=\"100%\" src=\"http://www.youtube.com/v/#{videonumber}&autoplay=1\" type=\"application/x-shockwave-flash\" width=\"100%\"></embed></object>\n </body>\n }\n end", "def youtube_video(resource_id, caption=\"\")\n if caption == \"\"\n return <<-EOL\n <p>\n <div class=\"youtube-container column is-mobile center\">\n <iframe width=\"100%\" height=\"100%\" src=\"https://www.youtube.com/embed/#{resource_id}\" \\ \n frameborder=\"0\" allow=\"autoplay; encrypted-media\" allowfullscreen>\n </iframe>\n </div>\n </p>\n EOL\n else\n return <<-EOL\n <p>\n <div class=\"youtube-container column is-mobile center\">\n <iframe width=\"100%\" height=\"100%\" src=\"https://www.youtube.com/embed/#{resource_id}\" \\ \n frameborder=\"0\" allow=\"autoplay; encrypted-media\" allowfullscreen>\n </iframe>\n </div>\n <em>#{caption}</em>\n </p>\n EOL\n end\n \n end", "def video_params\n params.require(:video).permit(:title,\n :description,\n :published,\n :external_url,\n :transcript,\n :director,\n :production,\n :fx,\n :client,\n :industry,\n :year,\n :location,\n :thumbnail_default,\n :thumbnail_medium,\n :thumbnail_high, \n # video_upload_attributes: [ :source_video ],\n :published\n )\n end", "def video_params\n params.require(:video).permit(:video, :title, :subtitle, :description, :is_published, :is_showed_on_tv, :showed_date)\n end", "def set_video_metatags! tags, record\n metadata = record.vimeo_metadata\n metadata = metadata[:horizontal] if metadata.key?(:horizontal)\n return unless metadata.present?\n\n tags.merge!({\n 'og:type' => 'video.other',\n 'og:image' => metadata[:thumbnail],\n 'og:video' => metadata[:download_url],\n 'og:video:duration' => metadata[:duration],\n 'og:video:release_date' => record.created_at.to_s(:db),\n 'twitter:card' => 'player',\n 'twitter:player:url' => metadata[:embed_url],\n 'twitter:player:width' => metadata[:width],\n 'twitter:player:height' => metadata[:height],\n })\n end", "def swf_tag(source, options={}, &block)\n ActionView::Helpers::SwfFuHelper::Generator.new(source, options, self).generate(&block)\n end", "def set_video_based_on_user\n video_id = params[:video_id] || params[:id]\n\n begin\n if current_user?(@user)\n @video ||= @user.videos.where(:id => video_id).joins(:video_graph).where(:video_graphs => { :status => Video.statuses_to_show_to_current_user }).first\n else\n @video ||= @user.videos.where(:id => video_id).joins(:video_graph).where(:video_graphs => { :status => VideoGraph.get_status_number(:ready) }).first\n end\n rescue ActiveRecord::StatementInvalid\n @video = nil\n end\n \n ruby_code_from_view.ruby_code_from_view do |rb_from_view|\n if we_should_show_og_tags && [email protected]? \n # Facebook OpenGraph protocol for embedding our video link back to Brevidy \n public_video_url(:public_token => @video.public_token) \n @video.title \n @video.description \n @video.get_thumbnail_url(@video.selected_thumbnail) \n public_video_url(:public_token => @video.public_token) \n else \n # Standard meta tags \n image_path('meta_tag_logo.png') \n end \n browser_title \n # Logged In CSS \n cache_buster_path('/stylesheets/i_love_lamp-1.0.3.min.css') \n # Site-wide JS \n javascript_include_tag \"https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js\" \n cache_buster_path('/javascripts/functions.min.js') \n cache_buster_path('/javascripts/i_love_lamp-1.0.3.min.js') \n javascript_include_tag \"player/player.js\" \n javascript_include_tag \"http://html5shiv.googlecode.com/svn/trunk/html5.js\" \n # Fav Icon and CSRF meta tag \n favicon_link_tag \n csrf_meta_tag \n get_background_for_user \n # Top navigation header \n link_to(image_tag(\"brevidy_rgb_white.png\", :size => \"135x35\", :alt => \"Brevidy - The Soul of Video\"), signed_in? ? user_stream_path(current_user) : :root, :class => \"brand\") \n video_search_path \n if signed_in? \n link_to(\"Explore\", explore_path) \n link_to(\"Upload\", new_user_video_path(current_user)) \n link_to(\"Share a Link\", user_share_dialog_path(current_user), :remote => true, \"data-method\" => \"GET\") \n link_to(\"Invite\", user_invitations_path(current_user)) \n end \n if signed_in? \n link_to(user_path(current_user), :class => \"dropdown-toggle\") do \n image_tag(\"#{current_user.image.blank? ? 'default_user_35px.jpg' : current_user.image_url(:small_profile) }\", :alt => \"#{current_user.name}\", :size => \"35x35\") \n current_user.username \n end \n link_to(\"My Channels\", user_channels_path(current_user)) \n link_to(\"Account Settings\", user_account_path(current_user)) \n link_to(\"Find People\", find_people_path) \n link_to(\"Help\", \"http://getsatisfaction.com/brevidy\", :target => \"_blank\") \n link_to(\"Logout\", logout_path, :remote => true, \"data-method\" => \"DELETE\") \n else \n link_to(\"Explore\", explore_path) \n link_to(\"Sign up\", signup_path) \n link_to(\"Login\", login_path) \n end \n \n # Main container \n # Dark Content Wrapper \n # Main (White) Content Wrapper \n link_to \"Go back\", :back \n image_tag(\"okayguy.png\", :alt => \"Okay\", :size => \"256x275\") \n # Lower navigation \n unless @page_has_infinite_scrolling \n succeed \" \" do \n link_to(\"FAQ\", faq_path, :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Blog\", \"http://blog.brevidy.com\", :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Status\", \"http://status.brevidy.com\", :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Contact\", contact_path, :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Terms\", tos_path, :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Privacy\", privacy_path, :class => \"inlinelink\") \n end \n \n end \n # GetSatisfaction Feedback Widget & Google Analytics \n # Google Analytics \n # GetSatisfaction Code \n # AddThis script \n \n # Scroll back to top \n\nend\n\n end", "def video_params\n params.require(:video).permit(:name, :description, :added_by, :duration, :video_file, :audio_file, :image_file)\n end", "def method_missing(method, *args, &block)\n if video.respond_to? method\n video.send(method, *args, &block)\n else\n super\n end\n end", "def set_player_options(options)\n self.media_player.allowsAirPlay = options[:allows_air_play] if options.has_key? :allows_air_play\n self.media_player.controlStyle = options[:control_style] if options.has_key? :control_style\n self.media_player.endPlaybackTime = options[:end_playback_time] if options.has_key? :end_playback_time\n self.media_player.initialPlaybackTime = options[:initial_playback_time] if options.has_key? :initial_playback_time\n self.media_player.movieSourceType = options[:movie_source_type] if options.has_key? :movie_source_type\n self.media_player.repeatMode = options[:repeat_mode] if options.has_key? :repeat_mode\n self.media_player.scalingMode = options[:scaling_mode] if options.has_key? :scaling_mode\n self.media_player.shouldAutoplay = options[:should_autoplay] if options.has_key? :should_autoplay\n self.media_player.useApplicationAudioSession = options[:use_application_audio_session] if options.has_key? :use_application_audio_session\n end", "def videos options={}\n response = client.get(\"/#{id}/videos\", options)\n end", "def render_x3d_directly options={}\n # render x3d player\n content_tag(:div) do\n options[:value].collect do |x3d_md5|\n l1 = x3d_md5[0..1]\n l2 = x3d_md5[2..3]\n content_tag(:video,\n content_tag(:source, \"I'm sorry; your browser doesn't support HTML5 video in MP4 with H.264.\",\n src: \"https://cspace-prod-02.ist.berkeley.edu/#TENANT#_nuxeo/data/#{l1}/#{l2}/#{x3d_md5}\",\n id: 'x3d_md5',\n type: 'model/x3d+xml'),\n controls: 'controls',\n style: 'width: 640px;')\n end.join.html_safe\n end\n end", "def video_format=(video_format)\n if !video_format.nil? && video_format.to_s.length > 5\n fail ArgumentError, 'invalid value for \"video_format\", the character length must be smaller than or equal to 5.'\n end\n\n @video_format = video_format\n end", "def init_video_embed(position)\n clear_insert_toolbar_before(@current_edited_node_position)\n @current_edited_node_position = position\n\n video_embed = VideoEmbed.new\n\n modal_open(\n nil,\n t(Components::VideoEmbeds::New, \n {\n video_embed: video_embed,\n on_collect: ->(video_embed, component){generic_create_node(video_embed, component)}\n }\n )\n )\n end", "def put_video(*video_args, &block)\n args = parse_media_args(video_args, \"videos\")\n args.last[:video] = true\n put_connections(*args, &block)\n end", "def youtube_embed video, *style\n result = content_tag :iframe, 'youtube', src: video.yt_embed_link\n if style\n result = content_tag :iframe, 'youtube', src: video.yt_embed_link, style: style\n end\n return result\n end", "def youtube( video_id, size = [425,350] )\n\tif @conf.mobile_agent? or feed? then\n\t\t%Q|<div class=\"youtube\"><a href=\"http://www.youtube.com/watch?v=#{video_id}\">YouTube (#{video_id})</a></div>|\n\telsif defined?( :smartphone? ) and @conf.smartphone?\n\t\tsize = [240, 194]\n\t\t<<-TAG\n\t\t<iframe class=\"youtube-player\" type=\"text/html\" width=\"#{size[0]}\" height=\"#{size[1]}\" src=\"http://www.youtube.com/embed/#{video_id}\" frameborder=\"0\">\n\t\t</iframe>\n\t\t<div class=\"youtube\"><a href=\"http://www.youtube.com/watch?v=#{video_id}\">YouTube (#{video_id})</a></div>\n\t\tTAG\n\telse\n\t\t<<-TAG\n\t\t<iframe class=\"youtube-player\" type=\"text/html\" width=\"#{size[0]}\" height=\"#{size[1]}\" src=\"http://www.youtube.com/embed/#{video_id}\" frameborder=\"0\">\n\t\t</iframe>\n\t\tTAG\n\tend\nend", "def audio(path, attr=nil)\n attr ||= {}\n attr.merge!( {width: 0, height: 0, hidden: true} )\n video(path, attr)\nend", "def video_params\n params.fetch(:video, {})\n end", "def video_params\n params.require(:video).permit(\n :title,\n :description,\n :video,\n :slide,\n :image,\n :category_id,\n :tag_list,\n :published,\n :date_of_video,\n :short_description,\n :featured\n )\n end", "def video_params\n params[:video]\n end", "def video_params\n params[:video]\n end", "def video_params\n params[:video]\n end", "def video_url\n \"http://video.ted.com/#{videoID}\"\n end", "def video_params\n params.require(:video).permit(:title, :description, :video_url, :duration, :author, :chapter_id)\n end" ]
[ "0.71909595", "0.6952281", "0.69388676", "0.63539743", "0.6339057", "0.63382554", "0.63025355", "0.6230984", "0.6212228", "0.61467355", "0.61361605", "0.6087843", "0.6050872", "0.6015247", "0.59435266", "0.59200305", "0.58018124", "0.5798503", "0.57810897", "0.576828", "0.5747561", "0.5736658", "0.5733585", "0.5708203", "0.5708203", "0.569346", "0.5685451", "0.5653958", "0.5645615", "0.5622446", "0.5574629", "0.5542764", "0.55378705", "0.5530856", "0.55071175", "0.5498876", "0.5489824", "0.54757696", "0.5465938", "0.5450748", "0.54466033", "0.5440023", "0.5428282", "0.5427744", "0.5411225", "0.5390559", "0.5379463", "0.5374199", "0.5367117", "0.53638613", "0.53638613", "0.5363108", "0.53581834", "0.5345153", "0.532865", "0.5324164", "0.5317432", "0.5316745", "0.53084844", "0.53063184", "0.5305843", "0.53012353", "0.53002626", "0.5299697", "0.5294953", "0.52911294", "0.52749014", "0.5274354", "0.5270435", "0.5253987", "0.52516294", "0.52501184", "0.5237967", "0.5237359", "0.52327824", "0.52143764", "0.521161", "0.51960117", "0.5187106", "0.5186586", "0.5170082", "0.5168745", "0.5164511", "0.5162534", "0.5155363", "0.5148718", "0.51475775", "0.51466995", "0.51160926", "0.5113113", "0.51078993", "0.5100034", "0.5097989", "0.50921816", "0.50815976", "0.5075237", "0.5075237", "0.5075237", "0.5070225", "0.506985" ]
0.77156365
0
attr_accessible : :email,:topic, :phone_number, :body, :created_at, :updated_at, :escalated, :needed_by
def escalate_to_admin self.update_attributes(:escalated => true) InvestigateMailer.escalate_email(self).deliver end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def email_params\n params.require(:email).permit(:from_name,:from_email,:to_email,:subject,:text_body,:user_id,:html_body,:is_published)\n end", "def topic_params\n params.require(:topic).permit(:name, :description, :created_by)\n end", "def permitted_attributes\n [:user_id, :code, :name, :status_id, :group_id, :contact_id, :body,\n :address, :hours, :notes, :live_date, :website, :rss, :twitter, :wiki,\n :logo,\n contact_attributes: %i[id name hidden email phone notes user_id _destroy]]\n end", "def post_params\n params.require(:post).permit(:topic_id, :content, :user_id, :created_at)\n end", "def permited_params\n @params.permit(:to, :to_name, :from, :from_name, :subject, :body)\n end", "def user_params\n params.permit(:uuid, :email, :name, :deleted_at,:is_teacher,:user_image)\n end", "def teacher_params\n params.permit(:name, :email, :phone, :subject, :school_id)\n end", "def email_params\n params.require(:email).permit(:mail_text, :subject, :user_id)\n end", "def usermail_params\n #params.require(:usermail).permit(:subject, :content, :date, :from, :to)\n end", "def mailing_params\n params.require(:mailing).permit(:title,\n :description,\n :content,\n :published_at,\n :attachment,\n :image,\n :slug)\n end", "def educator_params\n params.require(:educator).permit(:title, :first_name, :last_name, :job_title, :summary, :dob, :ssn, :gender, :ethnicity)\n end", "def post_params\n params.permit(:content, :user_id, :topic_id)\n end", "def board_member_params\n params.require(:board_member).permit(:description, :user_id, :email, :display_order)\n end", "def protected_attributes=(attributes = nil)\n attributes = attributes.is_a?(Hash) ? attributes.symbolize_keys : {}\n send :attributes=, attributes.only(:author, :email, :summary, :content, :attachment), false\n end", "def subject_params\n # params.require(:subject).permit(:name, :position, :visible) #without created_at\n params.require(:subject).permit(:name, :position, :visible, :created_at) #with created_at\n end", "def topic_params\n params.require(:topic).permit(:title, :date, :body)\n end", "def topic_params\n params.require(:topic).permit(:title, :description, :proposed_date)\n end", "def topic_params\n params.require(:topic).permit(:name,:description,:permalink,:topic_type)\n end", "def mailing_params\n params.require(:mailing).permit(:name, :email, :allow)\n end", "def post_thread_params\n params.require(:post_thread).permit(:subject, :create_date)\n end", "def email_params\n params.require(:email).permit(:title, :body, :supplier_id, :consumer_id, :new)\n end", "def article_params\n params.require(:article).permit(:email, :title, :content, :date, :published)\n end", "def topic_params\n params.permit(:user_id, :name, :topic_type)\n end", "def post_params\n params.permit(:title, :email, :body)\n end", "def feedback_params\n params.require(:feedback).permit( :name, :email, :phone_number, :company, :location, :description )\n end", "def viewthread_params\n params.require(:viewthread).permit(:Subject, :Text, :CreatedBy)\n end", "def topic_params\n params.require(:topic).permit(:title, :description)\n end", "def post_params\n params.require(:post).permit(:title, :body, :author, :topic_id)\n end", "def user_params\n params.require(:user).permit(:email, :stakeholder_id, :is_admin)\n end", "def post_params\n params.permit(:title, :body, :picture, :subject, :author_id, user: {})\n end", "def feed_params\n params.require(:feed).permit(:name, :email, :phone, :description)\n end", "def user_params\n params.require(:user).permit(:osu_id, :is_administrator, :fte , :first_name, :last_name, :role, :is_wait_list, :major, :consider, :gemails_attributes => [:id, :user_id, :email , :done, :_destroy])\n end", "def topic_params\n params.require(:topic).permit(:title, :body, :user_id)\n end", "def mail_params\n params.require(:mail).permit(:from, :to, :subject, :description, :timestamp)\n end", "def post_params\n params.require(:post).permit(:id, :posts_reason, :posts_title, :posts_description, :posts_hierarchy, :is_active, :posted_by, :updated_by, :post_type, :posted_at, :created_at, :updated_at, :assign_to, :anonymous_post, :issue_tracker, :posts_aots)\n end", "def question_params\n params.require(:question).permit(:user_id, :title, :description, :topics)\n end", "def message_params\n params.require(:message).permit(:title, :body, :email, :sender_id, :recipient_id, :read_status, :read_at)\n end", "def submission_params\n params.require(:submission).permit(:intro, :body, :due_by, :title)\n end", "def message_params\n params.require(:message).permit(:title, :description, :date, :important)\n end", "def email_params\n params.require(:email).permit(:name, :image, :image_cache, :remove_image, :description, :ngo, :ngo_link, :published)\n end", "def post_params\n params.require(:post).permit(:title, :content, :topic_id, :user_id)\n end", "def subject_params\n params.require(:subject).permit(:subject) #requires model subject and column subject\n end", "def valid_attributes\n attributes_for(:announcement)\n end", "def email_params\n params.require(:email).permit(:from, :received_at, :subject, :user_id)\n end", "def teacher_params\n params.require(:teacher).permit(:name, :email, :address, :discipline, :phone)\n end", "def feedback_params\n params.require(:feedback).permit(:text, :email)\n end", "def post_params\n params.require(:post).permit(:content, :topic_id)\n end", "def post_params\n params.require(:post).permit(:title, :body, :topic_id)\n end", "def topic_params\n params.require(:topic).permit(:title, :body)\n end", "def news_letter_params\n params.require(:news_letter).permit(:name, :email)\n end", "def user_params\n\t\tparams.require(:user).permit(:name, :email, :password, :admin, :super, :messages, :unread)\n\tend", "def topic_params\n params.require(:topic).permit(:name, :description, :user_id)\n end", "def blog_params\n params.require(:blog).permit(:user_id,:title, :type,:content, :good, :bad,:knowledge_digest,:label,:autoGenerate)\n end", "def post_params\n params.require(:post).permit(:subject, :description)\n end", "def topic_params\n params.require(:topic).permit(:name, :description, :group_id, :user_id)\n end", "def subject_params\n params.require(:subject).permit(:experiment_id, :email, :phone_number,:name,:custom_field_1_value,:custom_field_2_value,:custom_field_3_value)\n end", "def topic_new_params\n params.require(:forum_topic).permit(:title, :locked, :pinned, posts_attributes: [:content])\n end", "def email_params\n params.require(:email).permit(:object, :body)\n end", "def post_params\n params.require(:post).permit(:author, :location, :message, :topic)\n end", "def email_params\n params.require(:email).permit(:body)\n end", "def user_params\n params.require(:user).permit(:id, :created_at, :updated_at, :school_id, :role,\n :email, :phone, :first_name, :last_name, :box, \n :major, :minor, :classification, :remember_token)\n end", "def question_params\n params.require(:question).permit(:question, :name, :email)\n end", "def topic_params\n params.require(:topic).permit(:title, :description, :user_id)\n end", "def member_params\n params.require(:member).permit :email, :first_name, :last_name, :other_name, :teacher_status, :portrait, :website_url, :facebook_url, :twitter_handle, :google_plus_url, :allow_newsletter, :allow_daily_digests\n end", "def post_params\n params.require(:post).permit(:title, \n :body, \n :slug, \n :category, \n :user_id, \n :meta_description, \n :meta_title, \n :published,\n :user_id\n )\n end", "def twee_params\n params.require(:twee).permit(:content, :created_on)\n end", "def exposed_attributes\n [:id, :first_name, :last_name, :email, :phone, :role_id, :school_id]\n end", "def field_params\n params.require(:user).permit(:name, :password, :password_digest, :password_confirmation, :username, :email, :skills, :resume, :phone, :role, :contactName)\n end", "def subscriber_params\n params.permit(:name, :subject, :email ,:phone ,:mesagge ,:is_subscriber)\n end", "def topic_params\n params.require(:topic).permit(:name, :heading, :user_id)\n end", "def user_params\n \tparams.require(:user).permit(:name,:dob,:avatar,:role,:password,:password_confirmation,:email,:university_id,hobbies_attributes:[:hobby,:_destroy,:id],qualifications_attributes:[:stream,:subject,:completed,:_destroy,:id])\n end", "def required_params\n params.require(:newsletter).permit(:title, :layout_id, :sender_name, :reply_to, :email_object,\n :newsletter_mailing_list_id)\n end", "def message_params\n params.require(:message).permit(:name, :user_email, :body)\n end", "def topic_params\n params.require(:topic).permit(:user_id, :title, :body, :is_draft, :is_open)\n end", "def create\n super\n end", "def email_params\n params.require(:email).permit(:subject, :body)\n end", "def user_attributes\n params.permit(:first_name,\n :last_name, :description)\n end", "def create\n\t\tsuper\n\tend", "def email_params\n params.require(:email).permit(:template_id, :title, :content)\n end", "def resource_params\n params.require(:messagestoadministrator).permit(:name, :user_id, :telephone, :email, :message)\n end", "def mentee_params\n params.require(:mentee).permit(:user_id,:major, :area_of_interest, :preferred_method_of_contact, :location, :length_of_mentorship, :graduation_year, :avatar)\n end", "def post_params\n params.require(:post).permit(:active,:title,:delivery_needed,:service_needed,:pick_up_needed,:other_needed ,:other_needed_string,:phone_contact,:email_contact, :description, :email,:user_id,:due_date,\n post_subscriptions_attributes: [:_destroy, :id, :subcategory_id])\n end", "def member_params\n params.require(:member).permit(:first_name, :last_name, :belt_id, :school_id, :comment, :is_active, :is_teacher, :is_quark, :is_kid, :is_teen)\n end", "def newsletter_params\n params.require(:newsletter).permit(:subject, :description, :from, :to)\n end", "def super_params\n params.require(:super).permit(:name, :email)\n end", "def teacher_params\n params.require(:teacher).permit(:name, :email, :password, :current_topic_id)\n end", "def mailer_params\n params.require(:mailer).permit(:name, :email, :message, :nickname) \n end", "def contact_post_params\n params.require(:contact_post).permit(:name, :phone, :email, :message, :subject)\n end", "def subject_params\n params.require(:subject).permit(:user_id, :title, :description, :value, :board_id)\n end", "def messenger_params\r\n params.require(:user).permit(:name, :lastname, :phone, :address, :rol,:email,:confirmed_at,:password_confirmation,:password)\r\n end", "def g_anewby_params\n params.require(:g_anewby).permit(:name, :email)\n end", "def subject_params\n #params.require(:subject).permit(:name, :category_id, :user_id, messages_attributes: [:id, :created_at, :update_at, :subject_id, :content, :user_id, :category_id])\n\tparams.require(:subject).permit(:name, :category_id, :user_id)\n end", "def create\n super\n end", "def create\n super\n end", "def create\n super\n end", "def create\n super\n end", "def create\n super\n end", "def create\n super\n end", "def create\n super\n end", "def create\n super\n end", "def create\n super\n end" ]
[ "0.6529876", "0.6481785", "0.63628954", "0.6337481", "0.62908316", "0.6254169", "0.625216", "0.6225253", "0.62250584", "0.6161487", "0.61449695", "0.6067164", "0.60516226", "0.6050973", "0.6026839", "0.60252947", "0.602467", "0.6008757", "0.5997703", "0.5997", "0.59946746", "0.5984274", "0.5968497", "0.59597504", "0.595628", "0.59374595", "0.5927335", "0.591729", "0.5909375", "0.59054875", "0.5901371", "0.59011936", "0.58987963", "0.5893343", "0.5882962", "0.58729184", "0.5871791", "0.5871727", "0.5868423", "0.5867926", "0.58622026", "0.58557796", "0.58478916", "0.5847098", "0.58447874", "0.5844342", "0.5844277", "0.58430487", "0.5839724", "0.58360106", "0.5835517", "0.58310235", "0.5830598", "0.583047", "0.5822094", "0.5816138", "0.58118075", "0.5807563", "0.5806877", "0.58029795", "0.58011985", "0.5797267", "0.5795573", "0.5795061", "0.5793494", "0.57894546", "0.5786029", "0.57838666", "0.57833326", "0.5777832", "0.5768868", "0.5768698", "0.5765951", "0.57649106", "0.5763745", "0.576023", "0.57596034", "0.57575923", "0.5753965", "0.57476515", "0.5746733", "0.5745485", "0.5741703", "0.5739191", "0.5729406", "0.57271796", "0.57217234", "0.5721693", "0.5714891", "0.57115096", "0.5709836", "0.57096624", "0.57076573", "0.57076573", "0.57076573", "0.57076573", "0.57076573", "0.57076573", "0.57076573", "0.57076573", "0.57076573" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_picture_collection @picture_collection = PictureCollection.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 picture_collection_params params.require(:picture_collection).permit(:collection_id, :picture_id) 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 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 allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\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 authorize_own_or_shared_lists\n authorize_lists current_user.all_lists\n end", "def check_params\n true\n end", "def may_contain!(*keys)\n self.allow_only_permitted = true\n self.permitted_keys = [*permitted_keys, *keys].uniq\n end", "def user_pref_list_params\n\t\tparams.require(:user).permit(:preference_list)\n\tend", "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 admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end", "def params(list)\n @declared_params = list\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 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 default_param_whitelist\n [\"mode\"]\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.6946679", "0.6811753", "0.67995036", "0.679359", "0.67437977", "0.6738685", "0.6525698", "0.65186113", "0.6492684", "0.64316213", "0.64316213", "0.64316213", "0.6397299", "0.63539475", "0.63526994", "0.6344162", "0.63427454", "0.6336022", "0.63279474", "0.63279474", "0.63279474", "0.63112956", "0.62973624", "0.62632746", "0.62585145", "0.62577724", "0.6236648", "0.6226037", "0.6218912", "0.6218692", "0.62073606", "0.6196937", "0.61941737", "0.6170688", "0.6154999", "0.615445", "0.61529905", "0.61342645", "0.6120347", "0.610985", "0.60723", "0.6070494", "0.6059134", "0.6056713", "0.60461736", "0.60344803", "0.6018893", "0.6016638", "0.60140854", "0.60105246", "0.6008837", "0.6007521", "0.60065186", "0.6002943", "0.6002943", "0.5998129", "0.5991463", "0.5991002", "0.59827024", "0.5970269", "0.5968056", "0.59644747", "0.59636426", "0.59605366", "0.59590155", "0.59314376", "0.5927605", "0.59203064", "0.5906842", "0.5903382", "0.5901305", "0.58916384", "0.58901024", "0.58798325", "0.58798325", "0.58798325", "0.58705807", "0.58597535", "0.5851733", "0.5842875", "0.5841526", "0.583349", "0.58309424", "0.5829408", "0.5828163", "0.5815936", "0.5812692", "0.58125335", "0.58095205", "0.58004385", "0.58004385", "0.57981116", "0.579359", "0.57834667", "0.5779521", "0.5776312", "0.57739943", "0.5767878", "0.57658947", "0.5762125", "0.57555723" ]
0.0
-1
Gets access to client
def oauth_access client = Fitgem::Client.new({:consumer_key => @consumer_key, :consumer_secret => @consumer_secret}) request_token = client.request_token token = request_token.token secret = request_token.secret puts "Go to http://www.fitbit.com/oauth/authorize?oauth_token=#{token} and then enter the verifier code below and hit Enter" verifier = gets.chomp access_token = client.authorize(token, secret, { :oauth_verifier => verifier }) puts "Verifier is: "+verifier puts "Token is: "+access_token.token puts "Secret is: "+access_token.secret token = access_token.token secret = access_token.secret user_id = '3B8C8S' client = Fitgem::Client.new({:consumer_key => @consumer_key, :consumer_secret => @consumer_secret, :token => token, :secret => secret, :user_id => user_id}) access_token = client.reconnect(token, secret) # Pass client to runner here client end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getclient\n return @client\n end", "def client\n @client\n end", "def client\n @client\n end", "def get_client\n @client\n end", "def client_access\n super\n end", "def client\n\t\treturn @client\n\tend", "def client\n @client\n end", "def client\n @client\n end", "def client\n @client\n end", "def client\n @client ||= Client.current\n end", "def client_mechanisms\n mechanisms :client\n end", "def public_client\n return @public_client\n end", "def client\n @@client\n end", "def client\n user_thread.client\n end", "def client_info\n self.class.client_info\n end", "def client\n @client ||= self.class.client\n end", "def client\n self.class.client\n end", "def client\n self.class.client\n end", "def client\n self.class.client\n end", "def orchestrate_client\n client\n end", "def client\n @admin ||= User.find_by(is_admin: true)\n @auth_record ||= @admin.auth_record\n @client ||= CiscoAmpApi::V1::Client.new(@auth_record.api_client, @auth_record.api_key )\n end", "def client\n @client ||= Client.new\n end", "def client\n Thread.current[:client]\n end", "def get_client(id)\n conn = @client.get do |req|\n req.url \"/api/v2/client/#{id}\"\n req.headers[\"Authorization\"] = @token\n end\n conn.body\n end", "def client_channel\n \"#{access_key}-client\"\n end", "def get_clients\n @clients\n end", "def get_clients\n @clients\n end", "def client_context\n return @client_context\n end", "def fetch_client\n # check if client not present?\n r = ClientApiDetail.get_client_data(@api_key)\n @client = r[:client]\n @client_api_detail = r[:client_api_detail]\n end", "def get_access(client)\n current_time = Time.current\n range = current_time.strftime(@format)\n reset = current_time.to_i + @interval - (current_time.to_i % @interval)\n key_client = key(client)\n counter = @redis.hincrby(key_client, range, 1)\n\n if counter < @limit\n pass = true\n remaining = @limit - counter\n else\n pass = false\n remaining = 0\n end\n\n {\n 'pass' => pass,\n 'RateLimit' =>\n {\n 'X-RateLimit-Limit' => @limit,\n 'X-RateLimit-Remaining' => remaining,\n 'X-RateLimit-Counter' => counter,\n 'X-RateLimit-Reset' => reset\n }\n }\n end", "def fetch_client\n response = Util::EntityHelper.fetch_and_validate_client(@manager[:current_client_id], 'am_vc_')\n return error_with_go_to(\n response.internal_id,\n response.general_error_identifier,\n GlobalConstant::GoTo.logout\n ) unless response.success?\n\n @client = response.data\n success\n end", "def current_client\n @current_client ||= Replica.user_model.find(session[:user])\n @current_client\n end", "def client\n end", "def client_context\n return @client_context\n end", "def client\n @client || Client.connection\n end", "def engine_client\n if current_user\n identity_session.access_token.http_client\n else\n Identity.http_client\n end\n end", "def client\n query[\"client_id\"]\n end", "def client\n set_connection unless @client\n @client\n end", "def client; end", "def client; end", "def show\n @client = Client.find(params[:id])\n authorize! :read, @client\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @client }\n end\n end", "def doorkeeper_client\n doorkeeper_token.resource_owner_id ? Client.find(doorkeeper_token.resource_owner_id) : Client.new\n end", "def get_client\n config.client.new(self)\n end", "def client\n return @fetcher.client\n end", "def clients\n if self.is_admin?\n User.where(client_id: self.id)\n else\n raise Unauthorized.new(self)\n end\n end", "def client\n @parent.instance_variable_get(:@client)\n end", "def get_client_by_id client_id\n @clients[client_id]\n end", "def client\n @@client ||= Orchestrate::Application::Connect.client\n end", "def security_server_client\n end", "def client\n Contentful::Management::Client.shared_instance\n end", "def get_client_id\n @client_id\n end", "def client\n # @client ||= MyService::Client.new(SinaToken.consumer.key, SinaToken.consumer.secret, token, secret)\n end", "def client_name\n client.name\n end", "def client\r\n @client ||= APIController.new config\r\n end", "def octokit_client\n # Check if we already have the octokit client stored in an instance variable else fetch it using\n # the user's access token to authenticate.\n @client ||= Octokit::Client.new :access_token => token\n @client\n end", "def client\n @config.send(\"#{config_prefix}_client\")\n end", "def get_current_client\n get_current_hub&.current_client\n end", "def client_creds\n return @smbclient, @host, @port, @share, @user, @pass, @domain\n end", "def client\n Hsquare.application(@application).admin_client\n end", "def getAccessInfo()\n @accessInfo\n end", "def current_client\n @current_client ||= @finder.call\n end", "def details\n response = CreateSend.get \"/clients/#{client_id}.json\", {}\n Hashie::Mash.new(response)\n end", "def index\n @clients = current_user.is_admin ? Client.all : current_user.clients\n end", "def clients\n @clients ||= Harvest::API::Clients.new(credentials)\n end", "def check(client)\n client.user.current\n end", "def client\n @client ||= Client.new(config[:credentials], config[:end_point])\n end", "def client(name)\n @clients[name]\n end", "def get_client(uri, http_type, method)\n return @client\n end", "def client\n shell.client\n end", "def set_client_access(opts)\n opts = check_params(opts,[:client_access_info])\n super(opts)\n end", "def current_client\n #@current_client ||= session[:client_id] unless @current_client == false\n @current_client ||= Client.find_by_id session[:client_id]\n end", "def get_access_or_wait(client)\n result = get_access(client)\n return result if result['pass']\n time_to_sleep = result['RateLimit']['X-RateLimit-Reset'] - Time.current.to_i\n sleep(time_to_sleep)\n get_access(client)\n end", "def current_access_control\n @access_control\n end", "def connection\n client.send(:connection)\n end", "def show\n id = shift_argument || raise(Heroku::Command::CommandFailed, \"Usage: clients:show [ID]\")\n\n client = request do\n api.request(\n :expects => 200,\n :headers => headers,\n :method => :get,\n :path => \"/oauth/clients/#{CGI.escape(id)}\"\n ).body\n end\n\n if options[:shell]\n puts \"HEROKU_OAUTH_ID=#{client[\"id\"]}\"\n puts \"HEROKU_OAUTH_SECRET=#{client[\"secret\"]}\"\n else\n styled_header(%{Client \"#{client[\"name\"]}\".})\n styled_hash(client)\n end\n end", "def client\n @client ||= Utils::Box::Client.new\n end", "def get_client_token\n request = Typhoeus::Request.new(\n TOKEN_ENDPOINT,\n method: :post,\n body: {\n 'grant_type' => \"client_credentials\",\n 'client_id' => ID,\n 'client_secret' => SECRET,\n })\n request.run\n response = request.response\n access_token = response.body.access_token\n end", "def client\n @client ||= Client.new(configuration)\n end", "def client\n user = User.last\n auth_token = user.fresh_authorization_token\n Strava::Client.new(access_token: auth_token)\nend", "def client\n return @client if @client\n\n unless session = cached_session\n Logger.info \"Creating a new Baidu session!\"\n session = create_session!\n end\n\n @client = Baidu::PCS::Client.new(session, dir_name)\n rescue => err\n raise Error.wrap(err, 'Authorization Failed.')\n end", "def client_detail\n service_response = UserManagement::GetClientDetail.new(params).perform\n render_api_response(service_response)\n end", "def connection\n CryptKeeper::Connection.http_instance\n end", "def client(name)\n Thread.current['clients_manager'].client(name)\n end", "def client\n @client ||= es_node.client(true).data(false).node.client\n end", "def client\n if !@client || @client.hash != options.hash\n @client = Croudia::Client.new\n end\n @client\n end", "def token\n client.token if client\n end", "def client(client, options = {})\n get(\"clients/#{client}\", options).pop\n end", "def init_client\n client.credentials?\n end", "def index\n @authorized_clients = AuthorizedClient.all\n end", "def client_id\n @client_id\n end", "def client_id\n @client_id\n end", "def client_id\n return @client_id\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 api_client\n self.class.api_client\n end", "def connection\n client.connection\n end", "def current_client\n self.clients.where(status: true).first\n end", "def client_id\n me.client.id\n end", "def client_id\n me.client.id\n end", "def access\r\n global = @global_access\r\n server = nil\r\n channel = nil\r\n if @context_server != nil\r\n server = self[@context_server].access\r\n\r\n if @context_channel != nil\r\n channel = self[@context_server][@context_channel].access\r\n end\r\n end\r\n\r\n return global if server.nil? && channel.nil?\r\n return Access::merge(global, server, channel)\r\n end", "def client\n @client ||= OpenIDConnect::Client.new(\n identifier: @client_id,\n secret: @secret,\n redirect_uri: @redirect_url,\n realm: 'esdl-mapeditor',\n audience: @audience,\n authorization_endpoint: discovery.authorization_endpoint,\n token_endpoint: discovery.token_endpoint,\n userinfo_endpoint: discovery.userinfo_endpoint\n )\n end", "def client\n @client ||= NPS::Client.new\n end" ]
[ "0.75716084", "0.7344322", "0.7344322", "0.730398", "0.7221974", "0.71736616", "0.7100587", "0.7100587", "0.7100587", "0.7026085", "0.6906161", "0.69056594", "0.68686044", "0.6845626", "0.6841886", "0.68337435", "0.6753792", "0.6753792", "0.6708698", "0.6691486", "0.6606681", "0.6593842", "0.6589128", "0.6566306", "0.6549168", "0.65380937", "0.65380937", "0.65334576", "0.65279716", "0.650158", "0.6462961", "0.6453679", "0.64323384", "0.642959", "0.6419348", "0.638431", "0.6373535", "0.63568914", "0.6346606", "0.6346606", "0.63406247", "0.63364553", "0.63316613", "0.63222146", "0.630703", "0.6287649", "0.62866795", "0.62831455", "0.6257181", "0.62259686", "0.62222993", "0.6203074", "0.61954105", "0.6190681", "0.61871946", "0.6163795", "0.61632335", "0.6161463", "0.61599797", "0.6159079", "0.61355186", "0.6121102", "0.6112698", "0.6108567", "0.6108102", "0.61002016", "0.60995346", "0.6096005", "0.6092092", "0.608626", "0.6081334", "0.6077465", "0.60733366", "0.60689026", "0.60683966", "0.60637236", "0.60614324", "0.6053585", "0.60526115", "0.60501975", "0.6049585", "0.6049288", "0.6049012", "0.6042966", "0.60400337", "0.6037066", "0.6035254", "0.6034436", "0.6033333", "0.6027442", "0.6027442", "0.6020608", "0.6011264", "0.6008838", "0.6007285", "0.60015786", "0.60005164", "0.60005164", "0.5991737", "0.5987168", "0.59792507" ]
0.0
-1
Cache "now" so that digests match... TODO: figure out how we might want to expire this cache...
def now @now ||= Time.now.utc end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def now\n cache\n end", "def now\n cache\n end", "def now\n cache\n end", "def expires_now; end", "def cache_valid_from\n if caching_enabled?\n @cache_valid_from ||= Time.now\n else\n invalidate_cache!\n end\n @cache_valid_from\n end", "def new_version\n # the expiry needs to be longer than any page that might use this as a\n # cache key.\n time = Time.now.to_i\n versionable_options[:cache].write(version_cache_key, time, :expires_in => versionable_options[:ttl])\n time\n end", "def invalidate_cache! now\n end", "def verify\n @cache[:last_accessed] = nil if\n @cache.has_key?(:last_accessed) &&\n @cache[:last_accessed].to_date != Date.today\n end", "def update_cache\n return '' if disabled?\n\n key = \"#{identity_cache_key}:#{short_sha1}:#{Time.now.to_f}\"\n ArCache.write(identity_cache_key, key, raw: true, expires_in: 20.years)\n key\n end", "def now!\r\n @last_build_file.modification_time = @time = Time.now\r\n end", "def expires_now\n response.cache_control.replace(no_cache: true)\n end", "def expires_now\n response.cache_control.replace(no_cache: true)\n end", "def cached?; end", "def cache_for(time)\n expires_in time, :public => true\n end", "def cache_set(key, data, from_now = nil)\n true\n end", "def now; end", "def now; end", "def refresh_expiry\n self.expires_at = Time.now + ttl\n end", "def test_ttl_eviction_on_access\n @cache.store(:a, 1)\n @cache.store(:b, 2)\n\n Timecop.freeze(Time.now + 330)\n\n @cache.store(:c, 3)\n\n assert_equal({ c: 3 }, @cache.raw[:cache])\n end", "def refresh_time\n self.update_column( :expires, Time.zone.now + TOKEN_LIFE )\n end", "def cache_timestamp\n Tml::Utils.interval_timestamp(version_check_interval)\n end", "def now\n @now ||= Time.now\n end", "def cache_on?; end", "def cache_on?; end", "def just_saw\n\t\t\t@last_seen = Time.now\n\t\tend", "def cache(time = 1.hour)\n expires_in(time)\n end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def http_cache_forever(public: false)\n expires_in 100.years, public: public\n\n yield if stale?(etag: request.fullpath,\n last_modified: Time.new(2011, 1, 1).utc,\n public: public)\n end", "def http_cache_forever(public: false)\n expires_in 100.years, public: public\n\n yield if stale?(etag: request.fullpath,\n last_modified: Time.new(2011, 1, 1).utc,\n public: public)\n end", "def cache time: 3600, &block\n return yield if 'development' == ENV['RACK_ENV']\n\n key = \"url:#{I18n.locale}:#{request.path}\"\n cached = $redis.get(key)\n page = cached || yield\n etag Digest::SHA1.hexdigest(page)\n\n if cached\n ttl = $redis.ttl(key)\n response.header['redis-ttl'] = ttl.to_s\n response.header['redis'] = 'HIT'\n else\n response.header['redis'] = 'MISS'\n $redis.setex(key, time, page)\n end\n page\n end", "def now=(_arg0); end", "def cache_fresh?(tmp_file)\n now = Time.now\n tmp_mtime = File.stat(tmp_file).mtime\n now - tmp_mtime < 300.0 && File.stat(__FILE__).mtime - tmp_mtime < 0.0\nend", "def simulate_expire; end", "def no_cache\n expires_now\n end", "def seen!\n @last_seen = Time.now\n end", "def new_expiration_score\n now + 3600\n end", "def fetch_followed\n cache(:expire_in => 2.hours).followed\n end", "def cache_for(expires, *args, &blk)\n @cache_data ||= CacheData.new\n @cache_data.value caller_locations(1,1)[0].label.to_sym, expires, args, &blk\n end", "def fresh?\n DateTime.now.new_offset(0) < @expire_at\n end", "def cache_value?; end", "def update_cache\n # Does nothing...up to subclasses to implement.\n end", "def now?(t=@time)\n #\n # Use the cache if we've already worked out what happens at time t.\n #\n return @now_cache[t] if @now_cache.has_key?(t)\n \n #\n # Store the test time in an instance variable so the test knows what time\n # we're testing against.\n #\n @test_time = t\n\n #\n # Store the answer in our cache and return.\n #\n @now_cache[t] = (instance_eval(&@during) ? true : false)\n end", "def now\n generate_otp(timecode(Time.now))\n end", "def cache_expired?\n return true unless cache_exist?\n File.new(@cache_file).mtime < Time::now - (@cache_life.to_i * 60)\n # TODO check html rendered date\n end", "def now(padding=false)\n generate_otp(timecode(Time.now), padding)\n end", "def now\n @__space__.now\n end", "def fresh_by_time?\n return false unless env.key?(IF_MODIFIED_SINCE) && !last_modified.nil?\n Time.parse(last_modified) <= Time.parse(env.fetch(IF_MODIFIED_SINCE))\n end", "def fresh?( ses_obj )\n return true if ses_obj['expire'] == 0\n now = Time.now\n ses_obj['expire'] >= now \n end", "def now\n Time.now\n end", "def now\n Time.now\n end", "def timestamp\n memoized_info[:local_timestamp]\n end", "def now\n @clock\n end", "def cache!\n @@cache\n end", "def getExpiration; @expires; end", "def cache_version\n if cache_versioning && timestamp = try(:updated_at)\n timestamp.utc.to_s(:usec)\n end\n end", "def assert_cache_friendly_last_modified\n assert_last_modified 'Mon, 10 Jan 2005 10:00:00 GMT'\n end", "def pipeline_digest(element)\n value = digest(\"#{Time.now.to_s}::#{element}\")\n @literal_cache[element.to_s] ||= value\n end", "def cache_expiry\n if options[:extend_cache_life]\n (1 + options[:extend_cache_life]) * super\n else\n super\n end\n end", "def update! #update\n if @expires_in > LONG_EXPIRED\n add = 1\n elsif @expires_in > MEDIUM_EXPIRED\n add = 2\n elsif @expires_in > 0\n add = 3\n end\n @quality = @expires_in > 0 ? [@quality + add, 50].min : 0\n @expires_in -= 1\n end", "def cache(key = nil)\n key ||= BasicCache.caller_name\n key = key.to_sym\n if include? key\n @store[key].value\n else\n value = yield\n @store[key] = TimeCacheItem.new Time.now, value\n value\n end\n end", "def age() Time.now - mtime end", "def stale?\n if config.cache.is_a?(Proc)\n proc_timestamp != mem_timestamp\n else\n file_timestamp != mem_timestamp\n end\n end", "def was_seen!\n update_attribute(:last_seen_at, Time.now) if valid? && (last_seen_at.nil? || last_seen_at < 1.hour.ago)\n end", "def was_seen!\n update_attribute(:last_seen_at, Time.now) if valid? && (last_seen_at.nil? || last_seen_at < 1.hour.ago)\n end", "def cache_key\n \"me/#{object.id}-#{object.updated_at.utc.to_s(:number)}\"\n end", "def cache_buster_hash(*files)\n i = files.map { |f| File.mtime(f).to_i }.max\n (i * 4567).to_s.reverse[0...6]\n end", "def counter_cache; end", "def set_cache(value); end", "def set_cache(value); end", "def cache\n the_current_time = current_time\n cache_loaded_at = @cache.loaded_at if @cache\n\n if @cache && cache_expiration_policy_object.stale?(cache_loaded_at, the_current_time)\n flush!(:stale, :loaded => cache_loaded_at, :now => the_current_time)\n end\n\n unless @cache\n instrument('cache_load') do\n @cache = LowCardTables::LowCardTable::Cache.new(@low_card_model, @low_card_model.low_card_options)\n end\n end\n\n @cache\n end", "def getContentCache(theContent)\n\n\ttheChecksum = Digest::SHA256.hexdigest(theContent).insert(2, '/');\n\ttheCache = \"#{PATH_FORMAT_CACHE}/#{theChecksum}\";\n\t\n\treturn theCache;\n\nend", "def singleton_cache; end", "def request_fresh?\n # make sure we have something to compare too.\n return false unless last_modified or etag\n\n fresh = true\n\n # only check if we have set the right headers\n fresh &&= etag_matches?(self.etag) if etag\n fresh &&= not_modified?(self.last_modified) if last_modified\n fresh\n end", "def now\n Time.now\n end", "def ensure_cache_up_to_date\n self.last_update_timestamp = self.redis.get(\"bluster:last_update_timestamp\").to_i\n if self.last_update_timestamp.nil?\n update_object_cache\n elsif self.last_update_timestamp != File.new(self.objects_path).mtime.to_i\n update_object_cache\n end\n end", "def update_now_date_time\n @now_date_time = Time.new\n end", "def cache_valid?(uri)\n last = last_cached(uri)\n (last > 0 && Time.now.to_i <= (last + @options[:expires_after].to_i))\n end", "def caching\n @caching = \"data_update[#{data_path}]\"\n end", "def caching\n @caching = \"data_update[#{data_path}]\"\n end", "def caching\n @caching = \"data_update[#{data_path}]\"\n end", "def caching\n @caching = \"data_update[#{data_path}]\"\n end", "def fresh?\n last_compilation_digest&.== watched_files_digest\n end", "def refresh_if_near_expiration; end", "def singleton0_cache; end", "def stale?\n digest != current_digest\n end", "def version_for_cache\n \"download_url:#{source[:url]}|#{digest_type}:#{checksum}\"\n end", "def fresh?\n ttl && ttl > 0\n end", "def invalidate_cache!\n @cache_valid_from = Time.now\n end", "def cache_set(key, data, from_now = nil)\n _expire = from_now ? from_now.minutes.from_now : nil\n cache_write(key, [data, _expire])\n Merb.logger.info(\"cache: set (#{key})\")\n true\n end", "def show\n @user = User.find(params[:id])\n fresh_when :last_modified => @user.updated_at.utc, :etag => @user\n end", "def gmtime() end", "def cache_content(uri, content)\n clear_cache(uri)\n\n time = Time.now.to_i\n\n cache_store.write(cache_key(uri), time)\n cache_store.write(cache_key([uri, time]), content)\n \n content\n end", "def expire=(_); end", "def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end" ]
[ "0.7747326", "0.7747326", "0.7740735", "0.67308563", "0.65119", "0.6469379", "0.62900114", "0.6280648", "0.62240136", "0.6202402", "0.61736476", "0.61736476", "0.6155824", "0.61491525", "0.60677433", "0.6062298", "0.6062298", "0.60501415", "0.60400414", "0.600054", "0.5999402", "0.59958386", "0.595306", "0.595306", "0.59407383", "0.59405905", "0.5938176", "0.5938176", "0.5938176", "0.5938176", "0.5938176", "0.5938176", "0.5938176", "0.5937209", "0.5937209", "0.5874811", "0.5871932", "0.58562124", "0.5825549", "0.58229357", "0.5808921", "0.578181", "0.5765864", "0.57616776", "0.5757702", "0.57331073", "0.57310134", "0.5730281", "0.572396", "0.5716504", "0.5713299", "0.56858224", "0.56778914", "0.5673196", "0.566497", "0.566497", "0.5661489", "0.564835", "0.56481117", "0.5631029", "0.56309646", "0.5630828", "0.5627534", "0.5625806", "0.5621657", "0.56113863", "0.56095636", "0.56075287", "0.5606411", "0.5606411", "0.56019306", "0.55985683", "0.55789644", "0.557791", "0.557791", "0.5577672", "0.5576856", "0.5572118", "0.556499", "0.5562297", "0.55609316", "0.55586755", "0.5555985", "0.55528253", "0.55528253", "0.55528253", "0.55528253", "0.5550406", "0.5548005", "0.5533248", "0.55316526", "0.5530716", "0.5525098", "0.5515631", "0.5510981", "0.5509177", "0.5494508", "0.549057", "0.54855675", "0.54818517" ]
0.5795723
41
We're going to generate the timestamp ourselves, since WSSE is hard coded to generate the timestamp section directly within wsse:Security. TODO: Allow for configurability of these timestamps.
def timestamp { "u:Timestamp" => { "u:Created" => now.xs_datetime, "u:Expires" => (now + 60 * 5).xs_datetime, :order! => ["u:Created", "u:Expires"], }, :attributes! => { "u:Timestamp" => { "u:Id" => timestamp_id, "xmlns:u" => WSUNamespace } }, } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wsu_timestamp\n security_hash :wsu, \"Timestamp\",\n \"wsu:Created\" => (created_at || Time.now).xs_datetime,\n \"wsu:Expires\" => (expires_at || (created_at || Time.now) + 60).xs_datetime\n end", "def generate_timestamp\n Time.now.strftime(\"%Y-%m-%dT%T.%N%:z\")\n end", "def timestamp() @timestamp ||= Time.now.strftime(\"%Y%m%d%H%M%SZ\") end", "def timestamp\n @timestamp ||= Time.now.strftime Savon::SOAP::DateTimeFormat\n end", "def set_signature_timestamp\n time = Time.now\n @signed_at = time\n @signed_at_timestamp = TimeFormatting.printable_time time\n @signed_at_timestamp_ms = TimeFormatting.ms_timestamp(time)\n set_document_tag :esigntimestamp, @signed_at_timestamp\n end", "def timestamp\n @timestamp ||= Time.now.xs_datetime\n end", "def timestamp\n DateTime.now.strftime(\"%Y%m%d%H%M%S\")\n end", "def request_timestamp\n request_time.strftime(\"%Y%m%dT%H%M%SZ\")\n end", "def timestamp=(timestamp)\n @wsu_timestamp = timestamp\n end", "def timestamp\n timestamp_to_datetime(static_data(\"timestamp\"))\n end", "def timestamp\n Time.at((self[:tsh].to_i << 32 | self[:tsl].to_i) * ts_resol)\n end", "def get_time_stamp\n Time.now.strftime('%Y-%m-%d_%H-%M-%S')\n end", "def timestamp\n Time.at((self.tsh << 32 | self.tsl) * ts_resol)\n end", "def time_stamp()\n return get INIT_TIME_STAMP_NAME\n end", "def get_timestamp\n timestamp = Time.now.gmtime\n timestamp = timestamp.strftime(\"%Y-%m-%dT%H:%M:%S.000Z\")\n timestamp.to_s\n end", "def timestamp_value\n @timestamp_value ||=\n ((@time_hi_and_version & 0b1111_1111_1111) << 48) |\n (@time_mid << 32) | @time_low\n end", "def ship_timestamp\n Time.new.strftime('%Y-%m-%dT%H:%M:%S%z').tap{|str| str[-2,0] = ':' }\n end", "def timestamp; end", "def timestamp; end", "def timestamp; end", "def timestamp; end", "def timestamp; end", "def timestamp; end", "def new_timestamp # :nodoc:\n @properties['timestamp'].dup\n end", "def timestamp\n _timestamp.as_time\n end", "def nonce_timestamp(tolerance = 5)\n Time.now.to_i + tolerance\n end", "def create_timestamp(offset: rand(0..(TIMESTAMP_MAX-TIMESTAMP_MIN)))\n Time.at(TIMESTAMP_MIN+offset).strftime('%Y-%m-%d %H:%M:%S')\n end", "def gen_nonce\n Time.now.utc.to_i.to_s\n end", "def timestamp\n date.strftime(\"%Y%m%d%H%M%S\") \n end", "def timestamp\n mask = class_trait[:timestamp]\n Time.now.strftime(mask || \"%Y-%m-%d %H:%M:%S\")\n end", "def timestamp \n\ttime = Time.new\n\t\"#{time.day}/#{time.month}/#{time.year}\"\nend", "def timestamp\n _timestamp.as_time\n end", "def request_timestamp\n auth_info[\"date\"] || \"\"\n end", "def get_timestamp\n timestamp = Time.now.gmtime \n timestamp = timestamp.strftime(\"%a, %d %b %Y %H:%M:%S GMT\")\n timestamp.to_s\n end", "def current_timestamp\n Time.now.strftime \"%Y%m%dT%H:%M:%S\"\n end", "def cache_timestamp\n Tml::Utils.interval_timestamp(version_check_interval)\n end", "def t_stamp\n Time.now.strftime(\"%m-%d_%H-%M-%S\")\nend", "def generate_security_token\n self.security_token = Digest::SHA1.hexdigest(\"--#{Time.now.to_s}--#{email}--#{salt}--\")\n end", "def timestamp\n attribute_prop(4)\n end", "def timestamp\n time_formated = Time.now.to_i.to_s.reverse.chop.chop.chop.reverse.to_i\n return time_formated.to_s\nend", "def now_stamp(now = nil)\n now ||= Time.now\n now.utc.strftime(\"%Y-%m-%dT%H:%M:%S.%6NZ\")\n end", "def srs_tt(t=Time.now.utc)\n Base64.encode64((t.to_i / (60*60*24) % 210).to_s)[0,2]\n end", "def generation_time\n Time.at(data.unpack(\"N\")[0]).utc\n end", "def generation_time\n Time.at(data.unpack(\"N\")[0]).utc\n end", "def get_timestamp(time)\r\n srandom_r time\r\n t0 = random_r\r\n t1 = 0x17dc65df;\r\n hi = (t0 * t1) >> 32;\r\n t2 = t0 >> 31;\r\n t3 = hi >> 23;\r\n t3 = t3 - t2;\r\n t4 = t3 * 0x55d4a80;\r\n t0 = t0 - t4;\r\n t0 = t0 + 0x989680;\r\n\r\n ieee754_round(t0)\r\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 timestamp=(_arg0); end", "def timestamp=(_arg0); end", "def timestamp=(_arg0); end", "def timestamp=(_arg0); end", "def write_timestamp\n filepath = \"#{Dir.tmpdir}/govpay_request_refund_service_last_run_time\"\n # FileUtils.touch seems unreliable in VM so need to write/read the actual time\n File.write(filepath, Time.zone.now)\n end", "def datetime_stamp\n Time.now.utc.iso8601\n end", "def timestamp\n Time.now.to_i.to_s\n end", "def get_formatted_timestamp()\n return Time.now.iso8601.to_s\n end", "def timestamp\n TimeStamp.new\n end", "def timestamp\n @timestamp ||= Time.parse(@origdate)\n end", "def new_timestamp_and_uuid()\n u = UUID.timestamp_create()\n [u.hexdigest, u.timestamp]\n end", "def timestamp\n Time.now.utc.to_i\n end", "def timestamp\n Time.now.to_s\n end", "def signature\n time = Time.now\n {\n mktowsUserId: user_id,\n requestTimestamp: time.to_s,\n requestSignature: hmac(time),\n }\n end", "def getTimestamps(cfg)\n hw_ts = nil\n sw_ts = nil\n cfg.each do |c|\n # Here, the first two 64-bit fields are sw stamps, two are not used,\n # and the last two contains the hw stamp we are looking for.\n if c.cmsg_is?(:SOCKET, Socket::SO_TIMESTAMPING)\n hw_ts = c.data.unpack(\"q*\")[4..5]\n elsif c.cmsg_is?(:SOCKET, Socket::SO_TIMESTAMPNS)\n sw_ts = c.data.unpack(\"qq\")\n end\n\n end\n return sw_ts,hw_ts\n end", "def timestamp\n @now = Vedeu.clock_time\n @time ||= 0.0\n @last ||= @now\n\n unless @last == @time\n @time += (@now - @last).round(4)\n @last = @now\n end\n\n \"[#{format('%7.4f', @time.to_s)}] \".rjust(7)\n end", "def precision_timestamp\n Time.now.strftime(\"%Y%m%d%H%M%S%L\")\n end", "def timestamp\n params['TIMESTAMP']\n end", "def timestamp\n Time.at((attributes[:timestamp] || Time.now).to_i)\n end", "def get_timestamp\n Time.now.strftime('%d %B %Y %H:%M')\n end", "def timestamp\n nil\n end", "def get_timestamp\n # Appending integer timestamp including second decimals\n now = Time.now.to_f * 10\n return now.round.to_s\n end", "def default_timestamp_format\n \"TIMESTAMP '%Y-%m-%d %H:%M:%S%N %z'\".freeze\n end", "def generate_token\n\t\tUUIDTools::UUID.timestamp_create.to_s\n\tend", "def timestamp t\n\n\t\t::Pantheios::Core.timestamp t, nil\n\tend", "def generate_salt\n Digest::SHA1.hexdigest(Time.now.to_f.to_s)\n end", "def time_xml\n Time.now.utc.xmlschema\n end", "def default_timestamp_format\n \"{ts '%Y-%m-%d %H:%M:%S%N'}\"\n end", "def secret_key\n encode_tz(:edsk, 32)\n end", "def timestamp\n time.strftime formatter\n end", "def timestamp\n self[:timestamp]\n end", "def timestamp\n oauth_merged_params[:oauth_timestamp]\n end", "def get_request_timestamp\n\t\treturn @transport.get_path(\"meta\",\"datetime\")\n\tend", "def get_timestamp\n \"[#{(Time.now.in_time_zone(TIME_ZONE_PACIFIC)).strftime('%m/%d/%y %l:%M%p')}]\"\nend", "def timestamp\n\t\tTime.now.to_i\n\tend", "def timestamp\n @i ||= 0\n \"#{Time.now.utc.iso8601}.#{@i += 1}\"\n end", "def create_time(); @create_time; end", "def timestamp?\n created_at || expires_at || @wsu_timestamp\n end", "def created_at_timestamp\n Time.now.gmtime.strftime(\"%Y-%m-%dT%H:%M:%S.000Z\")\n end", "def operation_timestamp # :nodoc:\n # Format is \"document.appendMarkup1260632282946\" (number is timestamp)\n @properties['operationId'] =~ /(\\d+)$/\n time_from_json($1)\n end", "def signature\n encode_tz(:edsig, 64)\n end", "def generate_signature\n Digest::MD5.hexdigest(Configuration.hotel_api_key + \n Configuration.hotel_shared_secret + \n Time.now.to_i.to_s)\n end", "def test_custom_nonce\n now = Time.now.to_i\n \n oauth_params = OAUTH_REQ_PARAMS.merge(:timestamp => now)\n assert_equal %{oauth_timestamp=\"#{now}\"}, %{oauth_timestamp=\"#{SOAuth.header('http://lonelyvegan.com/', oauth_params).match(now.to_s)[0]}\"}\n end", "def request_datestamp\n request_time.strftime(\"%Y%m%d\")\n end", "def build_timestamp\n @build_timestamp\n end", "def fix_timestamp(time, unique)\n Time.at time.to_i + (Zlib::crc32(unique.to_s) % 1000).to_f / 1000\nend", "def timestamp\n @java.getTimestamp\n end", "def get_iso_timestamp( data_import_session )\n data_import_session.created_at.strftime(\"%Y%m%d%H%M\")\n end", "def create_timestamp_file\n timestamp = Time.now.utc\n timestamp_file = File.new(report_timing_file, 'w')\n timestamp_file.puts(timestamp)\n timestamp_file.close\n end", "def content_security_policy_nonce_generator; end", "def content_security_policy_nonce_generator; end", "def get_Timestamp()\n \t return @outputs[\"Timestamp\"]\n \tend", "def get_Timestamp()\n \t return @outputs[\"Timestamp\"]\n \tend" ]
[ "0.7668719", "0.70871943", "0.6882533", "0.6720933", "0.6365917", "0.6329936", "0.6305434", "0.6297988", "0.6294691", "0.62787247", "0.62358046", "0.62048787", "0.6183145", "0.61368436", "0.61064065", "0.6050609", "0.6024699", "0.6024393", "0.6024393", "0.6024393", "0.6024393", "0.6024393", "0.6024393", "0.60085547", "0.59948796", "0.5986443", "0.5966487", "0.5958532", "0.5940998", "0.5918438", "0.5905324", "0.5891062", "0.58887434", "0.58832836", "0.5880632", "0.5868695", "0.58337134", "0.58307517", "0.5820211", "0.5804008", "0.579546", "0.57856023", "0.5771128", "0.5771128", "0.5768287", "0.57619077", "0.57619077", "0.5752898", "0.5752898", "0.5752898", "0.5752898", "0.5736559", "0.57241386", "0.57205135", "0.57148206", "0.56903076", "0.5689925", "0.5687547", "0.5680816", "0.5679046", "0.5677751", "0.5674528", "0.56680477", "0.56675196", "0.56629753", "0.5661553", "0.56444883", "0.5637215", "0.56205314", "0.55869067", "0.55840546", "0.55723625", "0.5570515", "0.55702156", "0.5563611", "0.554657", "0.55438334", "0.55342203", "0.5529546", "0.5524643", "0.5522177", "0.55220175", "0.5517074", "0.55118734", "0.5509436", "0.55033565", "0.5502747", "0.55014896", "0.54969805", "0.5483836", "0.5480696", "0.5476886", "0.547459", "0.54682434", "0.5454189", "0.5450636", "0.54495233", "0.54495233", "0.5441811", "0.54414773" ]
0.68034965
3
right One angle of the triangle is a right angle (90 degrees) acute All 3 angles of the triangle are less than 90 degrees obtuse One angle is greater than 90 degrees. To be a valid triangle, the sum of the angles must be exactly 180 degrees, and all angles must be greater than 0: if either of these conditions is not satisfied, the triangle is invalid. Write a method that takes the 3 angles of a triangle as arguments, and returns a symbol :right, :acute, :obtuse, or :invalid depending on whether the triangle is a right, acute, obtuse, or invalid triangle. You may assume integer valued angles so you don't have to worry about floating point errors. You may also assume that the arguments are specified in degrees.
def valid_triangle(deg1, deg2, deg3) return :invalid if deg1 + deg2 + deg3 != 180 return :invalid if deg1 <= 0 || deg2 <= 0 || deg3 <= 0 :valid end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def triangle(angle1, angle2, angle3)\n angles = [angle1, angle2, angle3]\n return :invalid unless angles.sum == 180 && angles.all?(&:positive?)\n\n if angles.include?(90)\n :right\n elsif angles.all? { |angle| angle < 90 }\n :acute\n else\n :obtuse\n end\nend", "def triangle(angle1, angle2, angle3)\n angles = [angle1, angle2, angle3]\n return :invalid if angles.sum != 180\n return :invalid if angles.any? {|angle| angle <= 0}\n return :right if angles.any? {|angle| angle == 90}\n return :acute if angles.all? {|angle| angle < 90}\n return :obtuse if angles.any? {|angle| angle > 90}\nend", "def triangle(a1, a2, a3)\n angles = [a1, a2, a3]\n\n return :invalid if angles.sum != 180 || angles.include?(0)\n return :right if angles.include?(90)\n return :acute if angles.max < 90\n return :obtuse if angles.max > 90\nend", "def triangle(angle_1, angle_2, angle_3)\n angles = [angle_1, angle_2, angle_3]\n\n case \n when angles.sum != 180 || angles.include?(0)\n :invalid\n when angles.any?(90)\n :right\n when angles.all? { |angle| angle < 90 }\n :acute\n else\n :obtuse\n end\nend", "def triangle(angle_1, angle_2, angle_3)\n angles = [angle_1, angle_2, angle_3]\n case\n when angles.inject(:+) != 180 || angles.include?(0)\n :invalid\n when angles.include?(90)\n :right\n when angles.any? { |angle| angle > 90}\n :obtuse\n when angles.all? { |angle| angle < 90 }\n :acute\n end\nend", "def triangle(*angles)\n return :invalid if angles.any?(0) || angles.sum != 180\n\n return :right if angles.include?(90)\n return :obtuse if angles.sort.last > 90\n :acute\nend", "def triangle(angle1, angle2, angle3)\n angles = [angle1, angle2, angle3]\n\n case\n when angles.reduce(:+) != 180, angles.include?(0)\n :invalid\n when angles.include?(90)\n :right\n when angles.all? { |angle| angle < 90 }\n :acute\n else\n :obtuse\n end\nend", "def triangle(angle1, angle2, angle3)\n angles = [angle1, angle2, angle3]\n return :invalid if angles.sum != 180 || angles.min.zero?\n case angles.max\n when 90 then :right\n when 0...90 then :acute\n else :obtuse\n end\nend", "def triangle(a, b, c)\n angles = [a, b, c]\n return :invalid unless angles.sum == 180 && angles.none?(&:zero?) # no 0s and sum to 180\n return :right if angles.any? { |x| x == 90 }\n return :obtuse if angles.any? { |x| x > 90 }\n :acute\nend", "def triangle(angle_1, angle_2, angle_3)\n angles = [angle_1, angle_2, angle_3]\n return :invalid if angles.include?(0) || angles.sum != 180\n \n if angles.include?(90) then :right\n elsif angles.select {|angle| angle > 90}.size > 0 then :obtuse\n else :acute\n end\n\nend", "def triangle(*angles)\n return :invalid if angles.reduce(:+) != 180 || angles.include?(0)\n return :right if angles.include?(90)\n return :obtuse if angles.max > 90\n :acute\nend", "def triangle(angle1, angle2, angle3)\n angles = [angle1, angle2, angle3]\n \n case \n when angles.reduce(:+) != 180 || angles.include?(0)\n :invalid\n when angles.count(90) == 1\n :right\n when angles.count {|an| an < 90} == 3\n :acute\n when angle1 > 90 || angle2 > 90 || angle3 > 90 \n :obtuse\n end\nend", "def triangle(angle1, angle2, angle3)\n angles = [angle1, angle2, angle3]\n return :invalid unless is_triangle?(angles)\n\n case\n when angles.any? { |a| a == 90 }\n :right\n when angles.all? { |a| a < 90 }\n :acute\n else\n :obtuse\n end\nend", "def triangle(first, second, third)\n angles = [first, second, third]\n return :invalid unless angles.sum == 180 && angles.none?(0)\n\n case\n when angles.any?(90) then :right\n when angles.all? { |angle| angle < 90 } then :acute\n when angles.one? { |angle| angle > 90 } then :obtuse\n else :invalid\n end\nend", "def triangle(angle1, angle2, angle3)\n angles = [angle1, angle2, angle3]\n case\n when angles.inject(:+) != 180 then :invalid\n when angles.any? { |angle| angle <= 0 } then :invalid\n when angles.any? { |angle| angle > 90 } then :obtuse\n when angles.any? { |angle| angle == 90 } then :right\n else :acute\n end\nend", "def triangle(angle1, angle2, angle3)\n angles = [angle1, angle2, angle3]\n largest_angle = angles.max\n\n case\n when angles.sum != 180, angles.include?(0)\n :invalid\n when largest_angle > 90\n :obtuse\n when largest_angle == 90\n :right\n else\n :acute\n end\nend", "def triangle(a, b, c)\n angles = [a, b, c]\n\n # angles.sum = angles.reduce(:+) \n return :invalid if angles.sum != 180 || angles.any?(0)\n return :right if angles.any?(90)\n return :acute if angles.all? { |angle| angle < 90 }\n :obtuse\nend", "def triangle(angle1, angle2, angle3)\n sides = [angle1, angle2, angle3]\n return :invalid if invalid_triangle? [angle1, angle2, angle3]\n return :acute if acute? sides\n return :obtuse if obtuse? sides\n return :right if right? sides\nend", "def triangle(a, b, c)\n angles = [a, b, c]\n case\n when angles.any? { |x| x <= 0 } || angles.sum != 180 then :invalid\n when angles.any? { |x| x == 90 } then :right\n when angles.all? { |x| x < 90 } then :acute\n when angles.any? { |x| x > 90 } then :obtuse\n end\nend", "def triangle(a, b, c)\n angles = [a, b, c]\n sum = angles.reduce(:+)\n case\n when sum != 180 || angles.any? { |ang| ang <= 0 }\n :invalid\n when angles.any? { |ang| ang == 90 }\n :right\n when angles.any? { |ang| ang > 90 }\n :obtuse\n when angles.all? { |ang| ang < 90 }\n :acute\n end\nend", "def triangle(a, b, c)\n angles = [a, b, c]\n\n case\n when angles.sum != 180 || angles.min <= 0\n :invalid\n when angles.max == 90\n :right\n when angles.max > 90\n :obtuse\n else\n :acute\n end\nend", "def tri_angle(ang1, ang2, ang3)\n angles = [ang1, ang2, ang3]\n return :invalid unless valid_angles?(angles)\n return :right if angles.include?(90)\n return :acute if angles.all? { |ang| ang < 90 }\n return :obtuse\nend", "def triangle(ang1, ang2, ang3)\n ary = [ang1, ang2, ang3].sort\n return :invalid if ary.sum != 180 || ary.include?(0)\n if ary[-1] < 90\n :acute\n elsif ary[-1] == 90\n :right\n else\n :obtuse\n end\nend", "def triangle(num1, num2, num3)\n if (num1 + num2 + num3) != 180\n return :invalid \n elsif num1 == 0 || num2 == 0 || num3 == 0 \n return :invalid\n elsif num1 > 90 || num2 > 90 || num3 > 90\n return :obtuse \n elsif num1 == 90 || num2 == 90 || num3 == 90\n return :right \n else \n :acute\n end\nend", "def triangle(side1, side2, side3)\n arr = [side1, side2, side3]\n if arr.sum != 180 || arr.any?(0)\n :invalid\n elsif arr.any?(90)\n :right\n elsif arr.any? { |n| n > 90 }\n :obtuse\n else\n :acute\n end\nend", "def is_valid_triangle(angle1, angle2, angle3)\n angles = [angle1, angle2, angle3]\n if angles.reduce(:+) == 180 && angle1 != 0 && angle2 != 0 && angle3 != 0\n true\n else\n false\n end\nend", "def valid_triangle?(angle1, angle2, angle3)\n sides = [angle1, angle2, angle3]\n\n return true if sides.reduce(:+) == 180 && sides.all? { | num| num > 0}\n false\nend", "def triangle(x, y, z)\n sides = [x, y, z]\n largest_side = sides.max\n\n # binding.pry\n case\n when sides.inject(:+) != 180, sides.include?(0)\n puts :invalid\n when sides.inject(:+) == 180 && sides.include?(90)\n puts :right\n when sides.inject(:+) == 180 && largest_side > 90\n puts :obtuse\n else \n puts :acute\n end\nend", "def triangle(a, b, c)\n sides = [a, b, c]\n \n return :invalid if sides.include?(0) || sides.max >= sides.min(2).sum\n return :equilateral if sides.max == sides.min\n return :isosceles if sides.tally.value?(2)\n :scalene\nend", "def valid_triangle?(angles)\n return false if angles.any?(&:zero?)\n\n angles.sum == 180\nend", "def triangle(side_1, side_2, side_3)\n ordered_array = [side_1, side_2, side_3].sort\n if !ordered_array.all? { |side| side > 0 }\n return :invalid\n end\n if (ordered_array[0] + ordered_array[1]) <= ordered_array[2]\n return :invalid\n end\n if (side_1 == side_2) && (side_2 == side_3)\n :equilateral\n elsif (side_1 == side_2) || (side_1 == side_3) || (side_2 == side_3)\n :isosceles\n else\n :scalene\n end\nend", "def triangle(len1, len2, len3)\n lengths = [len1, len2, len3].sort\n return :invalid unless valid_triangle?(lengths)\n return :equilateral if lengths.all?(lengths[0])\n return :scalene if lengths.uniq == lengths\n return :isosceles\nend", "def triangle(a, b, c)\n if numbers_below_possible(a, b, c)\n raise TriangleError, \"One of the sides are 0 or negative (below allowed)\"\n end\n\n if triangle_not_possible(a, b, c)\n raise TriangleError, \"Triangle not possible with values passed\"\n end\n\n if a == b && a == c\n return :equilateral\n end\n\n if a == b || a == c || b == c\n return :isosceles\n end\n\n :scalene\nend", "def triangle(side1, side2, side3)\n if side1 + side2 > side3 && side2 + side3 > side1 && side1 + side3 > side2\n if side1 == side2 && side2 == side3\n return :equilateral\n elsif side1 == side2 || side2 == side3 || side1 == side3\n return :isosceles\n else\n return :scalene\n end\n else\n return :invalid\n end\nend", "def triangle(s1, s2, s3)\n sides = [s1, s2, s3]\n return :invalid if sides.any?(0) || sides.max > sides.reduce(:+) - sides.max\n type_of_triangle(sides)\nend", "def triangle(a, b, c)\n return :invalid if [a, b, c].any?(&:zero?) # if any length is 0\n return :invalid unless [a, b, c].sort[0..1].sum > [a, b, c].max # sum of smaller > largest\n return :equilateral if a == b && b == c # if all sides are the same length\n return :isosceles if [a, b, c].uniq.size == 2 # if one length is repeated 2x\n :scalene # all other valid triangles\nend", "def triangle(a, b, c)\n sides = a, b, c\n case\n when sides.any? { |side| side.zero? }\n :invalid\n when sides.any? { |side| sides.reduce(:+) - side < side }\n :invalid\n when sides.all? { |side| side == sides.first }\n :equilateral\n when sides == sides.uniq\n :scalene\n else\n :isosceles\n end\nend", "def triangle(a, b, c)\n if a==0||b==0||c==0\n\traise TriangleError, \"one of the sides equals zero\"\n end\n if (a+b<=c)||(a+c<=b)||(b+c<=a)\n\traise TriangleError, \"2 any sides must be greater then 1\"\n end\n if a<0||b<0||c<0\n\traise TriangleError, \"negative sides\"\n end\n if (a==b) && (a==c) && (b==c)\n :equilateral\n\telsif (a==b)||(a==c)||(b==c)\n :isosceles\n\telse \n :scalene\nend\n\nend", "def triangle(side1, side2, side3)\n arr = [side1, side2, side3].sort\n return :invalid if arr[0] + arr[1] <= arr[2]\n return :equilateral if arr[0] == arr[1] && arr[1] == arr[2]\n return :isosceles if arr.uniq.size == 2\n return :scalene if arr.uniq.size == 3\nend", "def triangle(side1, side2, side3)\n sides = [side1, side2, side3].sort\n\n if sides.count(0) > 0 || sides[0] + sides[1] <= sides[2]\n :invalid\n elsif sides.uniq.size == 1\n :equilateral\n elsif sides.uniq.size == 2\n :isosceles\n elsif sides.uniq.size == 3\n :scalene\n end\nend", "def triangle(side1, side2, side3)\n sides = [side1, side2, side3]\n return :invalid if sides.max > sides.sum / 2 || sides.min.zero?\n case sides.uniq.size\n when 1 then :equilateral\n when 2 then :isosceles\n else :scalene\n end\nend", "def triangle(s1, s2, s3)\n sides = [s1, s2, s3]\n longest_side = sides.max\n\n case\n when largest_side > sides.reduce(:+) - largest_side, sides.include?(0)\n :invalid\n when s1 == s2 && s2 == s3\n :equilateral\n when s1 == s2 || s1 == s3 || s2 == s3\n :issoceles\n else\n :scalene\n end\nend", "def triangle(side1, side2, side3)\n sides = [side1, side2, side3]\n sides.sort!\n return :invalid if sides.include?(0) || sides[0] + sides[1] < sides[2]\n sides_uniq = sides.uniq\n case sides_uniq.length\n when 1 then return :equilateral\n when 2 then return :isosceles\n when 3 then return :scalene\n end\nend", "def triangle(a, b, c)\n\t\n\tcheckValidity(a,b,c)\n\t\n\tif (equilateral?(a,b,c))\n\t\treturn :equilateral\n\tend\n\tif (isosceles?(a,b,c))\n\t\treturn :isosceles\n\tend\n\t:scalene\nend", "def triangle(n1, n2, n3)\n sides = [n1, n2, n3].sort\n case\n when sides.any?{|side| side <= 0 }, sides[0..1].sum <= sides.last\n :invalid\n when sides.uniq.size == 1\n :equilateral\n when sides.uniq.size == 2\n :isosceles\n else\n :scalene\n end\nend", "def triangle(a, b, c)\r\n lengths = [a,b,c].sort\r\n return :invalid if lengths.any? { |side| side == 0 } || lengths[0..1].sum <= lengths.max\r\n if lengths.each_cons(2).any? { |pair| pair[0] == pair [1] }\r\n lengths.uniq.size == 1 ? :equilateral : :isosceles\r\n else\r\n :scalene\r\n end\r\nend", "def triangle(*sides)\n # could have used sides.includes?(0)\n return :invalid unless sides.none?(&:zero?)\n return :invalid if sides.max > sides.reduce(:+) - sides.max\n return :equilateral if sides.min == sides.max\n return :isosceles if sides.count { |x| x == sides.max } == 2\n :scalene\nend", "def triangle(a, b, c)\n sides = [a, b, c]\n\n # https://stackoverflow.com/a/11361502\n raise TriangleError if sides.min <= 0\n\n # my original answer\n #sides.each do |item|\n # if item <= 0\n # raise TriangleError\n # end\n #end\n\n # https://stackoverflow.com/a/11361502\n x, y, z = sides.sort\n raise TriangleError if x + y <= z\n\n # my original answer\n #if a + b <= c or b + c <= a or c + a <= b\n # raise TriangleError\n #end\n\n # https://stackoverflow.com/questions/4742692/a-more-elegant-solution-to-ruby-koans-triangle-rb\n case sides.uniq.size\n when 1 then :equilateral\n when 2 then :isosceles\n else :scalene\n end\n\n # my original answer\n #if a == b and b == c\n # :equilateral\n #elsif a == b or b == c or c == a\n # :isosceles\n #else\n # :scalene\n #end\nend", "def triangle(a,b,c)\n raise TriangleError unless is_valid_triangle?(a,b,c)\n h = [a]\n h << b unless h.include?(b)\n h << c unless h.include?(c)\n return :equilateral if h.length == 1\n return :isosceles if h.length == 2\n :scalene\nend", "def triangle(side1, side2, side3)\n arr = [side1, side2, side3].sort!\n if arr[0] + arr[1] <= arr[2]\n :invalid\n elsif arr[0] == arr[1] && arr[0] == arr[2]\n :equilateral\n elsif arr[0] == arr[1] || arr[0] == arr[2] || arr[1] == arr[2]\n :isosceles\n else\n :scalene\n end\nend", "def triangle(x,y,z)\n sides = [x, y, z].sort \n return :invalid unless sides.all?{ |e| e.is_a?(Numeric) && e > 0 }\n return :invalid if sides[0] + sides[1] <= sides[2]\n # Now, since the sides are sorted, we can do the following:\n if sides[0] == sides[2]\n :equilateral\n elsif sides[0] == sides[1] || sides[1] == sides[2]\n :isosceles\n else\n :scalene\n end\nend", "def triangle(side1, side2, side3)\n sides = [side1, side2, side3]\n largest_side = sides.max\n\n case\n when 2 * largest_side > sides.reduce(:+), sides.include?(0)\n :invalid\n when side1 == side2 && side2 == side3\n :equilateral\n when side1 == side2 || side1 == side3 || side2 == side3\n :isosceles\n else\n :scalene\n end\nend", "def triangle(side1, side2, side3)\n sides = [side1, side2, side3]\n largest_side = sides.max\n\n case\n when 2 * largest_side > sides.reduce(:+), sides.include?(0)\n :invalid\n when side1 == side2 && side2 == side3\n :equilateral\n when side1 == side2 || side1 == side3 || side2 == side3\n :isosceles\n else\n :scalene\n end\nend", "def triangle(side1, side2, side3)\n side_array = [side1, side2, side3].sort\n if side_array.include?(0)\n :invalid\n elsif !((side1 + side2) > side3) || !((side2 + side3) > side1)\n :invalid\n elsif side1 == side2 && side1 == side3\n :equilateral\n elsif (side1 == side2 && side1 != side3) || side2 == side3 && side2 != side1 || side1 == side3 && side1 != side2\n :isosceles\n elsif side1 != side2 && side1 != side3 && side3 != side2\n :scalene\n end\nend", "def triangle(side1, side2, side3)\n arr = [side1, side2, side3].sort\n if side1 == side2 && side2 == side3\n :equilateral\n elsif (arr[0] + arr[1]) < arr[2] || arr.include?(0)\n :invalid\n elsif arr[0] == arr[1] || arr[1] == arr[2]\n :isosceles\n else\n :scalene\n end\nend", "def triangle(a_side, b_side, c_side)\n # WRITE THIS CODE\n sum = a_side + b_side + c_side\n minimum = [a_side, b_side, c_side].min\n maximum = [a_side, b_side, c_side].max\n raise TriangleError unless minimum.positive? && (maximum < sum - maximum)\n\n return :equilateral if equilateral?(a_side, b_side, c_side)\n\n return :isosceles if isosceles?(a_side, b_side, c_side)\n\n :scalene\nend", "def valid_triangle?(a, b, c)\n if (a + b > c) && (a + c > b) && (b + c) > a\n\ttrue\n else\n\tfalse\n end\n\n\n # arr = [a, b, c]\n # largest_side = a\n # index = 0\n # for i in arr\n # \tif i >= largest_side\n # \t\tlargest_side = i\n # \t\tindex_of = arr.index(i)\n # \tend\n # end\n # arr.delete_at(index_of)\n # puts arr\n # angle = (arr[0]**2 + arr[1]**2 - largest_side**2).to_f / (2*arr[0]*arr[1])\n # if largest_side**2 == (arr[0])**2 + (arr[1])**2 - 2*arr[0]*arr[1]*angle\n # \ttrue\n # else\n # \tfalse\n # end\n\n\n\n # if (a**2 == b**2 + c**2) || (b**2 == c**2 + a**2 ) || (c**2 == b**2 + a**2)\n # \ttrue\n # else\n # \tfalse\n # end\n\nend", "def right_triangle?(side_a, side_b, side_c)\n side_a**2 + side_b**2 == side_c**2\nend", "def triangle(a, b, c)\n tri = [a, b, c].sort\n\n if tri[0..1].sum <= tri[2] then :invalid\n elsif tri.any? { |side| side <= 0 } then :invalid\n elsif tri[0] == tri[1] && tri[1] == tri[2] then :equilateral\n elsif tri[0] != tri[1] && tri[0] != tri[2] && tri[1] != tri[2] then :scalene\n else :isosceles\n end\nend", "def triangle(a, b, c)\n sides = [a,b,c]\n validate_sides(sides)\n\n unique_side_lengths = sides.uniq.length\n\n case unique_side_lengths\n when 1\n :equilateral\n when 2\n :isosceles\n when 3\n :scalene\n end\nend", "def triangle(a, b, c)\n sorted_triangle_sizes = [a, b, c].sort\n return :invalid if sorted_triangle_sizes.include?(0) || sorted_triangle_sizes[0] + sorted_triangle_sizes[1] < sorted_triangle_sizes[2]\n\n return :equilateral if a == b && a == c\n return :isosceles if a == b && a != c\n return :scalene\nend", "def right_triangle?(a, b, c)\n a**2 + b**2 == c**2\nend", "def triangle(a, b, c)\n #sort arguments by length\n triangle_array = [a, b, c].sort\n\n #initialize variables to sorted sides\n x = triangle_array[0]\n y = triangle_array[1]\n z = triangle_array[2]\n \n # rule out invalid triangles\n if x + y <= z || (x*y*z) == 0\n return :invalid\n end\n\n if x == y && x == z\n :equilateral\n elsif x == y || x == z || y == z\n :isosceles\n else\n :scalene\n end\nend", "def third_quadrant?(angle)\n\t\t180 < angle && angle < 270\n\tend", "def triangle(a, b, c)\n #\n # My first solution\n #\n # # Test that the triangle is valid\n # # No side can be <= 0\n # raise TriangleError if a <= 0 || b <= 0 || c <= 0\n # # Sum of any two sides must be > third side\n # raise TriangleError if a >= b+c || b >= a+c || c >= a+b\n\n # return :equilateral if a == b && b == c\n # return :isosceles if a == b || b == c || a == c\n # return :scalene\n #\n\n #\n # The Stack Overflow assisted version\n #\n\n # Sort the triangle sides in ascending order such that a is the smallest\n a, b, c = sides = [a, b, c].sort\n\n # If a <= 0\n raise TriangleError if a <= 0 || a + b <= c\n # Slightly easier to read version:\n # raise TriangleError unless a > 0 || a + b > c\n\n # Find out how many unique lengths there are. If 1, return :equilateral; if\n # 2, return :isoceles; if 3, return :scalene. Note the clever usage of the\n # negative indexing into the array to directly map the number of unique sides\n # to the type of triangle without needing to pad the array\n [:scalene, :isosceles, :equilateral][-sides.uniq.size]\nend", "def triangle(num1, num2, num3)\n sides = [num1, num2, num3]\n\n sides.sort!\n\n return :invalid if sides[0..1].sum <= sides.last\n\n\n if sides.uniq.size == 1\n :equilateral\n elsif sides.uniq.size == 2\n :isosceles\n elsif sides.uniq.size == 3\n :scalene\n end\nend", "def triangle(first, second, third)\n sides_array = [first, second, third]\n max_value = sides_array.max\n sum_of_smaller_sides = sides_array.sum - max_value\n check_array = sides_array.uniq\n\n if sides_array.include?(0) || sum_of_smaller_sides < max_value\n return :invalid\n elsif check_array.size == 1\n return :equilateral\n elsif check_array.size == 2\n return :isosceles\n else\n return :scalene\n end\nend", "def triangle_bk(s1, s2, s3)\n sorted_sides = [s1, s2, s3].sort\n if sorted_sides.any? { |side| side <= 0} || (sorted_sides[0] + sorted_sides[1] <= sorted_sides[2])\n :invalid\n elsif sorted_sides.all? { |side| side == sorted_sides[0]}\n :equilateral\n elsif sorted_sides[0] != sorted_sides[1] && sorted_sides[1] != sorted_sides[2]\n :scalene\n else\n :isosceles\n end\nend", "def validity \n if @a + @b <= @c || @c + @a <= @b || @b + @c <=@a\n puts \"These is not a valid triangle, please make sure 2 sides are greater than the addition of one.\"\n return false \n else \n return true \n end \n end", "def isTriangle(a,b,c)\n (a+b>c && a+c>b && c+b>a)? true : false\nend", "def isTriangle(a,b,c)\n a + b > c && b + c > a && a + c > b\nend", "def isTriangle(a,b,c)\n a + b > c && b + c > a && a + c > b\nend", "def valid_triangle?(a, b, c)\n if a == 0 or b == 0 or c == 0\n return false\n elsif a == b and b == c and a == c\n return true\n elsif a + b < c or a + c < b or b + c < a\n return false\n else\n return true\n end\nend", "def isTriangle(a,b,c)\n if (a > 0) || (b > 0) || (c > 0)\n if ((a + b) > c) && ((a + c) > b) && ((b + c) > a)\n return true\n else\n return false\n end\n else\n return false\n end\nend", "def valid_triangle?(a, b, c)\n ((a+b>c) && (b+c>a) && (a+c>b))? true:false\nend", "def valid_triangle?(a, b, c)\n a + b > c && b + c > a && c + a > b\nend", "def valid_triangle?(a, b, c)\n if (a==0 || b==0 || c==0)\n return false\n elsif (a+b<=c) || (a+c<=b) || (c+b<=a)\n return false\n elsif (a==b && a==c && b==c)\n return true\n elsif (a==b || a==c || b==c)\n return true\n elsif (((a**2)+(b**2))==(c**2) || ((a**2)+(c**2))==(b**2) || ((c**2)+(b**2))==(a**2))\n return true\n else\n return false\n end\nend", "def valid?(ang1, ang2, ang3)\n ang1 + ang2 + ang3 == 180 && ang1 > 0 && ang2 > 0 && ang3 > 0\nend", "def valid_triangle?(a, b, c)\n a + b > c && a + c > b && b + c > a\nend", "def valid_triangle?(a, b, c)\n a + b > c && a + c > b && b + c > a\nend", "def valid_triangle?(a, b, c)\n a + b > c && a + c > b && b + c > a\nend", "def valid_triangle?(a, b, c)\n if (a + b > c) && (a + c > b) && (b + c > a)\n true\n else\n false\n end\nend", "def is_valid_triangle?(sides)\n !(sides.include?(0) || sides.sum != 180)\nend", "def valid_triangle?(a,b,c)\n\n integer_cant_be_zero = (a == 0) || (b == 0) || (c == 0)\n invalid_triangle = ((a + b) < c) || ((b + c) < a) || ((a + c) < b)\n equilateral_triangle = (a == b) && (b == c)\n isoceles_triangle = (a == b) || (b == c) || (a == c)\n c_b_squared_equ_a_squared = (a > b) && (a > c) && (c**2 + b**2 == a**2)\n a_c_squared_equ_b_squared = (b > a) && (b > c) && (c**2 + a**2 == b**2)\n b_a_squared_equ_c_squared = (c > a) && (c > b) && (b**2 + a**2 == c**2)\n\n if integer_cant_be_zero || invalid_triangle\n return false\n elsif equilateral_triangle || isoceles_triangle\n return true\n elsif c_b_squared_equ_a_squared || a_c_squared_equ_b_squared || b_a_squared_equ_c_squared\n return true\n end\n\nend", "def isTriangle(a,b,c)\n a+b>c && a + c > b && b + c > a ? true : false\nend", "def angles\n [angle_a, angle_b, angle_c]\n end", "def other_angle(a, b)\n 180 - (a + b)\nend", "def right?\n angles.map(&:degrees).include? 90.0\n end", "def check_angle(hours, minutes)\n (minutes * 6 - (hours * 30 + minutes * 0.5)).abs\nend", "def other_angle(a, b)\n 180 - (a + b)\nend", "def angle(x1, y1, x2, y2)\n end", "def is_triangle(a,b,c)\n if a + b <= c || a + c <= b || b + c <= a\n false\n else \n true\n end \nend", "def valid_triangle?(a, b, c)\n if a + b > c && a + c > b && b + c > a\n return true\n else\n return false\n end\nend", "def isTriangle(a, b, c)\n a, b, c = [a, b, c].sort\n a + b > c\nend", "def valid_triangle? (num1,num2,num3)\n if num1 + num2 < num3\n true\n elsif num1 + num3 < num2\n true\n elsif num2 + num3 < num1\n true\n else\n false\n end\nend", "def valid_triangle?(a, b, c)\n # Your code goes here!\na+b > c && a+c > b && b+c >a\nend", "def calc_angle(x1, y1, x2, y2)\r\n# - - - - - - - - - - - - - - - - - - - -\r\n if (x1 == x2)\r\n if (y2 >= y1)\r\n return 0\r\n else\r\n return 180\r\n end #else\r\n elsif (y1 == y2)\r\n if (x2 >= x1)\r\n return 90\r\n else\r\n return 270\r\n end #else\r\n else\r\n x1 = x1 + 0.0 # force to be floating point\r\n x2 = x2 + 0.0 # force to floating point\r\n slope = (y2-y1) / (x2-x1)\r\n radians = Math.atan(slope)\r\n degrees = conv_radian_to_degree(radians)\r\n # Handle Adjusting Quadrent\r\n if ((x2 > x1) && (y2 > y1))\r\n # Quadrent 1;\r\n degrees = degrees\r\n elsif ((x2 > x1) && (y2 < y1))\r\n # Quadrent 2\r\n degrees = 90 - degrees;\r\n elsif ((x2 < x1) && (y2 < y1))\r\n # Quadrent 3\r\n degrees = 270 - degrees\r\n else\r\n # must be Quadrent 4\r\n degrees = 270 - degrees\r\n end # else\r\n end # else\r\n return degrees\r\nend", "def valid_triangle?(side1, side2, side3)\n\tif ((side1 + side2 > side3) && (side2 + side3 > side1) && (side3 + side1 > side2))\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend", "def check_error(val_a, val_b, val_c)\n raise TriangleError if (val_b + val_c <= val_a) || (val_c + val_a <= val_b)\n raise TriangleError if val_a + val_b <= val_c\nend", "def valid_triangle?(a, b, c)\n # Your code goes here!\n if (c + b > a) && (a + c > b) && (a + b >c)\n true\n else\n false\n end\n \nend" ]
[ "0.8748617", "0.87328637", "0.8643118", "0.864102", "0.86348295", "0.86137396", "0.86102813", "0.86074847", "0.86046904", "0.8596239", "0.85850525", "0.8567385", "0.85637075", "0.85527486", "0.8531753", "0.8508684", "0.8503153", "0.8471452", "0.84654504", "0.8456906", "0.83225095", "0.82615083", "0.7988189", "0.7770195", "0.765933", "0.7307046", "0.7039416", "0.68998045", "0.68915516", "0.66860497", "0.66699874", "0.6609974", "0.6605502", "0.65798724", "0.6536663", "0.6525541", "0.6515642", "0.6496166", "0.64382493", "0.64331836", "0.6415619", "0.63962775", "0.6392596", "0.63903886", "0.6383846", "0.63825464", "0.6378903", "0.63752073", "0.63724047", "0.63375026", "0.63227564", "0.6321742", "0.6321742", "0.6290142", "0.62871885", "0.62760395", "0.62608904", "0.6252513", "0.62444973", "0.6236893", "0.6213539", "0.62054765", "0.61943644", "0.6182389", "0.61765313", "0.61523503", "0.6015415", "0.59981257", "0.599039", "0.59669864", "0.5966441", "0.5960339", "0.59568965", "0.59565127", "0.59451747", "0.5941074", "0.59407777", "0.59285676", "0.592729", "0.592729", "0.592729", "0.5923995", "0.5920962", "0.59157115", "0.59001887", "0.58506507", "0.58385915", "0.5831163", "0.58155465", "0.5808269", "0.578853", "0.5767927", "0.5751034", "0.5734378", "0.5732331", "0.5726135", "0.57252115", "0.5723039", "0.5703078", "0.569054" ]
0.7468811
25
TODO: it's not clear to me whether this can be generated at all.
def process_else(exp) add_to_score :branch @scorer.penalize_by 0.1 do analyze_list exp end s() end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def probers; end", "def custom; end", "def custom; end", "def formation; end", "def implementation; end", "def implementation; end", "def generate; end", "def generate; end", "def schubert; end", "def code_of_conduct; end", "def from; end", "def from; end", "def from; end", "def from; end", "def extra; end", "def generate_comprehensive\n\n end", "def spec; end", "def spec; end", "def real_name; end", "def specialty; end", "def intensifier; end", "def offences_by; end", "def verdi; end", "def reflector; end", "def reflector; end", "def weber; end", "def signature; end", "def signature; end", "def signature; end", "def signature; end", "def signature; end", "def signature; end", "def signature; end", "def signature; end", "def signature; end", "def signature; end", "def __id__() end", "def internal; end", "def terpene; end", "def reflection; end", "def reflection; end", "def original_result; end", "def wrapper; end", "def expanded; end", "def macro; raise NotImplementedError; end", "def macro; raise NotImplementedError; end", "def macro; raise NotImplementedError; end", "def return_type; end", "def return_type; end", "def return_type; end", "def expanded_name; end", "def as_you_like_it_quote; end", "def class; end", "def class; end", "def kid_generator=(_arg0); end", "def kid_generator=(_arg0); end", "def generate\n raise \"must implement\"\n end", "def final; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def dynamic; end", "def overrides; end", "def required_positionals; end", "def parslet; end", "def parslet; end", "def parslet; end", "def parslet; end", "def type; end", "def type; end" ]
[ "0.741562", "0.63965315", "0.63965315", "0.63965315", "0.63965315", "0.63382274", "0.6159166", "0.6159166", "0.6107916", "0.5987315", "0.5987315", "0.59718317", "0.59718317", "0.592249", "0.58518183", "0.5846135", "0.5846135", "0.5846135", "0.5846135", "0.5841233", "0.58391", "0.58227175", "0.58227175", "0.582242", "0.580271", "0.5799866", "0.5788765", "0.5775551", "0.57365674", "0.57365674", "0.5727854", "0.57184625", "0.57184625", "0.57184625", "0.57184625", "0.57184625", "0.57184625", "0.57184625", "0.57184625", "0.57184625", "0.57184625", "0.5680455", "0.5663254", "0.5655826", "0.5641403", "0.5641403", "0.56409824", "0.56313676", "0.5626162", "0.56209147", "0.56209147", "0.56209147", "0.56180614", "0.56180614", "0.56180614", "0.561563", "0.55955476", "0.55849725", "0.55849725", "0.55833554", "0.55833554", "0.5578519", "0.5569387", "0.5556651", "0.5556651", "0.5556651", "0.5556651", "0.5556651", "0.5556651", "0.5556651", "0.5556651", "0.5556651", "0.5556651", "0.5556651", "0.5556651", "0.5556651", "0.5556651", "0.5556651", "0.5556651", "0.5556651", "0.5556651", "0.5556651", "0.5556651", "0.5556651", "0.5556651", "0.5556651", "0.5556651", "0.5556651", "0.5556651", "0.5556651", "0.5556651", "0.5556651", "0.55559915", "0.55523866", "0.5545821", "0.55336416", "0.55336416", "0.55336416", "0.55336416", "0.55289626", "0.55289626" ]
0.0
-1
Public: Prints the elements inside tree nodes in a PARENT LEFT RIGHT manner x Node, Preferably a root node Examples NOTE: Based on the mock tree structure at LINE:61 preoder_tree_walk(F) => F B A D C E G I H
def preoder_tree_walk(x) unless x.nil? p x.key preoder_tree_walk(x.left) preoder_tree_walk(x.right) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_tree(tree)\n return \"-\" if tree.nil?\n puts \"#{tree.value}: \"\n print \"Left: \"\n puts \"#{print_tree(tree.children[0])}\"\n print \"Right: \"\n puts \"#{print_tree(tree.children[1])}\"\nend", "def preorder(node)\n return if !node\n print node.value, \" \"\n preorder(node.left_child)\n preorder(node.right_child)\n end", "def printTree()\n def pTree(node, i)\n puts node.toString i\n node.children.each do|child|\n pTree(child, i+1)\n end\n end\n pTree(@root, 0)\n end", "def left_side_of_tree(root, current_level)\n return if root.nil?\n if (current_level > @max_level)\n puts root.val\n @max_level = current_level\n end\n left_side_of_tree(root.left, current_level + 1)\n left_side_of_tree(root.right, current_level + 1)\nend", "def see_tree(tree)\n tree.each do |i|\n puts \"---------------\"\n puts \"Node: #{i.value}\"\n puts \"Parent: \" + i.find_parent[0].value.to_s if i.find_parent.count > 0\n puts \"Left Child: \" + i.find_left_child[0].value.to_s if i.find_left_child.count > 0\n puts \"Right Child: \" + i.find_right_child[0].value.to_s if i.find_right_child.count > 0\n end\nend", "def preorder(node)\n # 1->2->4->5->3->6\n if node\n print node.value.to_s + '->'\n preorder(node.left_child)\n preorder(node.right_child)\n end\n end", "def print_tree\n current = nil\n stack = Stack.new\n stack.push(@root)\n until stack.empty?\n current = stack.pop\n if current.parent.nil?\n puts current.tag\n else\n puts \"#{current.tag}\\t<=\\t#{current.parent.tag}\"\n end\n unless current.childs.size.zero?\n current.childs.reverse_each { |child| stack.push(child) }\n end\n end\n end", "def display_tree() \n list = []\n yield @tree.value\n left_child = @tree.left_child\n right_child = @tree.right_child\n\n list << left_child if left_child != nil\n list << right_child if right_child != nil\n\n loop do\n break if list.empty?\n node = list.shift\n yield node.value\n list << node.left_child if node.left_child != nil\n list << node.right_child if node.right_child != nil\n end\n end", "def preorder_traversal(node=@root)\n return if (node == nil)\n preorder_traversal(node.left)\n preorder_traversal(node.right)\n puts node.value.to_s\n end", "def preorder_traverse(root=@root)\n unless !root\n result = \"#{root.data}\"\n result << preorder_traverse(root.left) unless !root.left\n result << preorder_traverse(root.right) unless !root.right\n result\n end\n end", "def print_preorder\n return \"Empty BST\" if is_empty\n\n stack = [@root]\n\n until stack.empty?\n current = stack.pop\n\n puts current.value\n\n stack << current.right unless current.right.nil?\n stack << current.left unless current.left.nil?\n end\n end", "def print_tree\n if root.children\n puts \" - root : #{root.children.length} - \"\n root.children.each(&:print_node)\n puts ''\n end\n end", "def preorder(node)\n p node.value if node.value \n preorder(node.left) if node.left\n preorder(node.right) if node.right\nend", "def print_tree\n ''\n end", "def level_order_print(tree)\n unless tree\n return\n end\n\n nodes = [tree]\n current_line_count = 1\n next_line_count = 0\n\n while nodes.length != 0\n current_node = nodes.shift\n current_line_count -= 1\n print current_node.key.to_s + ' '\n if current_node.left_child\n nodes.push(current_node.left_child)\n next_line_count += 1\n end\n if current_node.right_child\n nodes.push(current_node.right_child)\n next_line_count += 1\n end\n if current_line_count == 0\n # finished printing current level\n puts ''\n current_line_count = next_line_count\n next_line_count = current_line_count\n end\n end\nend", "def DFT_pre_order_recursive(root)\n if root == nil\n return\n end\n print \"#{root.value}\\n\"\n DFT_pre_order_recursive(root.left)\n DFT_pre_order_recursive(root.right)\n end", "def node_tree(nodes, &block)\n \n nodes = nodes.dup\n printed_nodes = []\n \n result = \"<ul>\"\n \n # top level nodes first, then others\n for node in nodes\n next if node.instance_of?(Center) || node.instance_of?(Team)\n next unless node.parent == nil\n printed_nodes << node\n result += \"<li>\"\n\n if block_given?\n result += yield node\n else\n result += node.title\n end\n\n children = node.children.dup\n children.delete_if { |r| not nodes.include?(r) }\n if not children.empty?\n result += node_tree_help(children, nodes, printed_nodes, &block)\n end\n \n result += \"</li>\"\n end\n \n # TODO: Add depth counting here to get a minimum of trees\n for node in nodes\n next if printed_nodes.include? node\n printed_nodes << node\n \n result += \"<li>\"\n\n if block_given?\n result += yield node\n else\n result += node.title\n end\n\n children = node.children #.dup\n children.delete_if { |r| not nodes.include?(r) }\n\n if not children.empty?\n result += node_tree_help(children, nodes, printed_nodes, &block)\n end\n \n result += \"</li>\"\n end\n\n result += '</ul>'\n\n return result\n end", "def test_print_tree\n setup_test_tree\n #puts\n #@root.print_tree\n end", "def print_prefix(node)\n return if node == nil\n print node.value + \" \" #print contents of this node\n print_prefix(node.left) #starts recursion -- go left\n print_prefix(node.right) #go right\nend", "def printf\n output = []\n children = []\n output.push(\"#{@root.title}: #{@root.rating}\")\n if @root.left != nil\n children.push(@root.left)\n end\n if @root.right != nil\n children.push(@root.right)\n end\n children.each do |i|\n output.push(\"#{i.title}: #{i.rating}\")\n if i.left != nil\n children.push(i.left)\n end\n if i.right != nil\n children.push(i.right)\n end\n end\n puts output\n end", "def preorder(node)\n visit node \n left = preorder node.left_node if node.left_node \n right = preorder node.right_node if node.right_node\n p left ? left.value : nil \n p right ? right.value : nil\n p node.value\n puts '----'\n node\n end", "def postorder_tree_walk(x)\n unless x.nil?\n postorder_tree_walk(x.left)\n postorder_tree_walk(x.right)\n p x.key\n end\n end", "def printlewis(node)\r\n\tputs node.to_s + \" =\"\r\n\tif node.nodes?\r\n\t\ttemp = Array.new\r\n\t\tnode.nodes.each { |n|\r\n\t\t\tif n == nil\r\n\t\t\t\tputs \":\"\r\n\t\t\telsif n == node.parent\r\n\t\t\t\tputs n\r\n\t\t\telsif !temp.include?(n)\r\n\t\t\t\ttemp << n\r\n\t\t\t\tputs n\r\n\t\t\telse\r\n\t\t\t\tputs n\r\n\t\t\tend\r\n\t\t}\r\n\t\tif !temp.empty?\r\n\t\t\ttemp.each { |n|\r\n\t\t\t\tputs \"========\"\r\n\t\t\t\tprintlewis(n)\r\n\t\t\t}\r\n\t\tend\r\n\tend\r\nend", "def printout\n\t\t\n\t\tindex = 0\n\t\t\n\t\tdef small_loop (node, index)\n\t\t\t\n\t\t\tfor i in 0...index\n\t\t\t\tprint \" \"\n\t\t\tend\n\t\t\t\n\t\t\tputs node.name\n\t\t\tindex += 1\n\t\t\t\n\t\t\tif node.children.length > 0\n\t\t\t\tindex += 1\n\t\t\t\tnode.children.cycle(1) { |child| small_loop(child, index) }\n\t\t\tend\n\t\tend\n\t\t\n\t\tsmall_loop(@root, index)\n\tend", "def pretty_print(node = @root, prefix = '', is_left = true)\n pretty_print(node.right_child, \"#{prefix}#{is_left ? '│ ' : ' '}\", false) if node.right_child\n puts \"#{prefix}#{is_left ? '└── ' : '┌── '}#{node.data}\"\n pretty_print(node.left_child, \"#{prefix}#{is_left ? ' ' : '│ '}\", true) if node.left_child\n end", "def pretty_print(node = @root, prefix = '', is_left = true)\n pretty_print(node.right_child, \"#{prefix}#{is_left ? '│ ' : ' '}\", false) if node.right_child\n puts \"#{prefix}#{is_left ? '└── ' : '┌── '}#{node.data}\"\n pretty_print(node.left_child, \"#{prefix}#{is_left ? ' ' : '│ '}\", true) if node.left_child\n end", "def print_tree(tree)\n\t\t\tif tree.is_leaf? and tree.depth > 0\n\t\t\t\tprint_line((\"|\\t\"*(tree.depth-1))+\"+------\"+tree.name)\n\t\t\telse\n\t\t\t\tprint_line((\"|\\t\"*tree.depth)+tree.name)\n\t\t\tend\n\t\t\ttree.children.each_pair do |name,child|\n\t\t\t\t\tprint_tree(child)\n\t\t\tend\n\t\tend", "def print_tree(level = 0)\n if is_root?\n print \"\\n*\"\n else\n print \"|\" unless parent.is_root?\n print(' ' * (level - 1) * 4)\n print(is_root? ? \"+\" : \"|\")\n print \"---\"\n print(has_children? ? \"+\" : \">\")\n end\n\n if content\n content_hash = content.split(\"[\").first\n else\n content_hash = nil\n end\n\n puts \" #{content}\" + \" <Type: \" + (@node_type || \"no_type\") + \">\"\n\n children { |child| child.print_tree(level + 1)}\n end", "def print_prefix(node)\n return if node.nil?\n print node.value + \" \"\n print_prefix(node.left)\n print_prefix(node.right)\nend", "def printnodes(node, level)\r\n\theader(level)\r\n\tputs node\r\n\tif node.nodes?\r\n\t\ttemp = Array.new\r\n\t\tnode.nodes.each { |n|\r\n\t\t\tif n == nil\r\n\t\t\t\theader(level + 1)\r\n\t\t\t\tputs \":\"\r\n\t\t\telsif n == node.parent\r\n\t\t\t\theader(level + 1)\r\n\t\t\t\tputs node\r\n\t\t\telsif !temp.include?(n)\r\n\t\t\t\ttemp << n\r\n\t\t\telse\r\n\t\t\t\theader(level + 1)\r\n\t\t\t\tputs node\r\n\t\t\tend\r\n\t\t}\r\n\t\tif !temp.empty?\r\n\t\t\ttemp.each { |n|\r\n\t\t\t\tprintnodes(n, level + 1)\r\n\t\t\t}\r\n\t\tend\r\n\tend\r\nend", "def printf(children=nil)\n queue = [@root]\n\n queue.each do |current|\n puts \"#{current.value}\"\n if current.left && current.right\n queue << current.left << current.right\n elsif current.left\n queue << current.left\n elsif current.right\n queue << current.right\n end\n end\n end", "def inOrderTraversal( rootNode )\n return if rootNode == nil\n inOrderTraversal( rootNode.leftChild )\n puts rootNode.data\n inOrderTraversal( rootNode.rightChild )\n end", "def postorder_traverse(root=@root)\n unless !root\n result = root.left ? \"#{postorder_traverse(root.left)}\" : \"\"\n result << postorder_traverse(root.right) unless !root.right\n result << root.data\n result\n end\n end", "def printf(list=[@root], output='')\n # remove front list item & add it to the output\n first = list.shift()\n print_string = first.title + ': ' + first.rating.to_s + \"\\n\"\n output << print_string\n # add its children to the back of the list\n if first.left\n list << first.left\n end\n if first.right\n list << first.right\n end\n # repeat until all nodes have been visited, then print output\n if list.empty?\n puts output\n return\n else\n printf(list, output)\n end\n end", "def pretty_print(node = @root, prefix = '', is_left = true)\n unless node.right.nil?\n pretty_print(node.right, \"#{prefix}#{is_left ? '│ ' : ' '}\", false)\n end\n puts \"#{prefix}#{is_left ? '└── ' : '┌── '}#{node.data}\"\n unless node.left.nil?\n pretty_print(node.left, \"#{prefix}#{is_left ? ' ' : '│ '}\", true)\n end\n end", "def show_node(tree, node)\n print \"ID:#{node.id} Parent:#{node.parent} Keys:\"\n node.keys.each { |key| print \"[#{key}]\"}\n print \" Sub trees:\"\n node.sub_trees.each { |sub_tree| print \"-#{sub_tree}-\"}\n print \"\\n\"\n node.sub_trees.compact.each { |sub_tree| show_node(tree, tree.nodes[sub_tree])}\nend", "def pretty_print(node = @root, prefix = '', is_left = true)\n pretty_print(node.right, \"#{prefix}#{is_left ? '│ ' : ' '}\", false) if node.right\n puts \"#{prefix}#{is_left ? '└── ' : '┌── '}#{node.data}\"\n pretty_print(node.left, \"#{prefix}#{is_left ? ' ' : '│ '}\", true) if node.left\n end", "def print_level_order\n return \"Empty BST\" if is_empty\n\n queue = [@root]\n\n until queue.empty?\n current = queue.pop\n puts current.value\n\n queue << current.left unless current.left.nil?\n queue << current.right unless current.right.nil?\n end\n end", "def render(node = nil)\n elt = node | tree\n puts \"\\nNodes: #{elt.body.count}\"\n puts \"\\nAttributes:\"\n elt.attrs.each{ |k, v| puts(\"#{k}: #{v}\") }\n children = elt.body.select{ |i| i.is_a?(Node) }\n puts \"\\nChildren: #{children.each{ |c| render(c) }}\"\n\n\n end", "def printf(children=nil)\n if @root != nil\n queue = Queue.new\n queue.enq(@root)\n result = nil\n while !queue.empty?\n node = queue.deq\n puts(node.to_s)\n queue.enq(node.left) if node.left\n queue.enq(node.right) if node.right\n end\n end\n end", "def print_level_order(root)\n return if !root\n queue = Queue.new()\n queue.enqueue(root)\n total_nodes_in_current_level = 1\n total_nodes_in_next_level = 0\n\n while (!queue.is_empty?) # as long as the queue is not empty\n current_node = queue.dequeue\n\n # we print current_node's value and decrement total_nodes_in_current_level by 1. We then add its children (if any) to the queue and increment total_nodes_in_next_level by 2.\n print current_node.value, \" \"\n total_nodes_in_current_level -= 1\n\n queue.enqueue(current_node.left_child) if current_node.left_child\n queue.enqueue(current_node.right_child) if current_node.right_child\n total_nodes_in_next_level += 2\n\n if total_nodes_in_current_level == 0 # this means we finished printing the node values in the current node\n print \"\\n\"\n # swap total_nodes_in_current_level and total_nodes_in_next_level\n total_nodes_in_current_level = total_nodes_in_next_level\n total_nodes_in_next_level = total_nodes_in_current_level\n end\n end\n print \"\\n\"\nend", "def printTree(options = {})\n # Set defaults\n options[:name] ||= true\n options[:content] ||= false\n \n result = \"\"\n \n options[:output] = result \n # Traverse tree and modify result by tacking on child names.\n printTraversal(options)\n \n puts result\n end", "def printTree(root = @root, indentation = \"\\n\")\r\n #print root the first time running mehtod, the rest will be printed as children\r\n puts \"#{indentation}#{root.value}\" if root == @root\r\n root.children.each do | child |\r\n puts \"#{indentation}\\t#{child.value}\\n\"\r\n #if there are children, again\r\n printTree(child, indentation + \"\\t\") if child.children.any?\r\n end\r\n end", "def pre_order_print(start, traversal = \"\")\n return traversal unless start\n\n traversal += \"#{start.value}-\"\n traversal = pre_order_print(start.left, traversal)\n pre_order_print(start.right, traversal)\n end", "def pretty_print(node = root, prefix = '', is_left = true)\n pretty_print(node.right, \"#{prefix}#{is_left ? '│ ' : ' '}\", false) if node.right\n puts \"#{prefix}#{is_left ? '└── ' : '┌── '}#{node.data}\"\n pretty_print(node.left, \"#{prefix}#{is_left ? ' ' : '│ '}\", true) if node.left\n end", "def printf(children=nil)\n list = [@root]\n while !list.empty?\n if list[0].left\n list.push(list[0].left)\n end\n if list[0].right\n list.push(list[0].right)\n end\n puts \"#{list[0].title}: #{list[0].rating}\\n\"\n list.shift\n end\n end", "def depth_traversal(node, &block)\n yield node.value # print the current block\n\n # recurse down to the left child\n depth_traversal(node.left, &block) if node.left\n\n # recurse down to the right child\n depth_traversal(node.right, &block) if node.right\nend", "def preorder(current_node = root)\n return if current_node.nil?\n print \"#{current_node.value} \"\n inorder(current_node.left)\n inorder(current_node.right)\n end", "def pretty_print(node = @root, prefix = '', is_left = true)\n pretty_print(node.right_node, \"#{prefix}#{is_left ? '│ ' : ' '}\", false) if node.right_node\n puts \"#{prefix}#{is_left ? '└── ' : '┌── '}#{node.data}\"\n pretty_print(node.left_node, \"#{prefix}#{is_left ? ' ' : '│ '}\", true) if node.left_node\n end", "def print(node = @root, prefix = '', is_left = true)\n if node.nil?\n return\n end\n\n print(node.right_node, \"#{prefix}#{is_left ? '│ ' : ' '}\", false) if node.right_node\n puts \"#{prefix}#{is_left ? '└── ' : '┌── '}#{node.value}\"\n print(node.left_node, \"#{prefix}#{is_left ? ' ' : '│ '}\", true) if node.left_node\n end", "def pretty_print(node = @root, prefix = '', is_left = true)\n pretty_print(node.right_child, \"#{prefix}#{is_left ? '│ ' : ' '}\", false) if node.right_child\n puts \"#{prefix}#{is_left ? '└── ' : '┌── '}#{node.value}\"\n pretty_print(node.left_child, \"#{prefix}#{is_left ? ' ' : '│ '}\", true) if node.left_child\n end", "def nodes_preorder(node = self.root, &block)\n yield( node ) if block_given?\n nodes_preorder(node.left_child, &block) if node.has_left_child?\n nodes_preorder(node.right_child, &block) if node.has_right_child?\n end", "def print(node = root)\n puts %( ) * node.level + \"#{node}\"\n node.children.each do |child|\n print(child)\n end\n true\n end", "def print\n node = root\n \n print_node(node, \"> \")\n end", "def printf(children=nil)\n queue = [@root]\n result = \"\"\n\n until queue.empty?\n temp_root = queue.shift\n\n unless temp_root.left == nil\n queue << temp_root.left\n end\n unless temp_root.right == nil\n queue << temp_root.right\n end\n\n result << \"#{temp_root.title}: #{temp_root.rating}\\n\"\n end\n\n puts result\n end", "def printf(children=nil)\n children = [@root] if children.nil?\n grand_children = []\n children.each do |node|\n puts \"#{node.title}: #{node.rating}\\n\"\n grand_children.push(node.left) if node.left\n grand_children.push(node.right) if node.right\n end\n printf(grand_children) unless grand_children.empty?\n end", "def rotate_left(node)\n puts \"left rotation on node #{node}\"\n v = node.right\n v.parent = node.parent\n node.right = v.left\n\n node.right.parent=node unless node.right.nil?\n\n v.left = node\n node.parent = v\n\n unless v.parent.nil?\n v.parent.right = v if v.parent.right==node\n v.parent.left = v if v.parent.left==node\n end\n\n update_balance(node)\n update_balance(v)\n v\n end", "def left_child\n # Returns left_child unless it's nil\n return @left_child unless @left_child.nil?\n\n # If passed the guard, left_child was not calculated yet, so generates it,\n # stores a ref and return the node\n @left_child = calculate_left_child\n @left_child\n end", "def inorder_display_helper node\n return nil if node.nil?\n inorder_display_helper(node.left_child)\n puts node.to_s\n inorder_display_helper(node.right_child)\n end", "def print_BST_in_order(root)\n if root.nil?\n return\n end\n print_BST_in_order(root.left)\n print \"#{root.value} \"\n print_BST_in_order(root.right)\nend", "def print_tree(d)\n \n print_tree(d['l']) if d.key?('l')\n print \"#{d['v']},\" if d.key?('v')\n print_tree(d['r']) if d.key?('r')\n \nend", "def doubleWithLeftChild(k3)\n k3.left = rotateWithRightChild(k3.left)\n rotateWithLeftChild(k3)\n end", "def postorder(node)\n return if !node\n postorder(node.left_child)\n postorder(node.right_child)\n print node.value, \" \"\n end", "def pretty_print(node = @root_node, prefix = '', is_left = true)\n pretty_print(node.right_node, \"#{prefix}#{is_left ? '│ ' : ' '}\", false) if node.right_node\n puts \"#{prefix}#{is_left ? '└── ' : '┌── '}#{node.data}\"\n pretty_print(node.left_node, \"#{prefix}#{is_left ? ' ' : '│ '}\", true) if node.left_node\n end", "def print_r prefix=\"\", daughters=false\n\t\tputs \"#{prefix}#{@e}\"\n\t\tif @children\n\t\t\t(daughters ? @daughters : @children).each do |child|\n\t\t\t\tchild.print_r \"#{prefix}\\t\", daughters\n\t\t\tend\n\t\tend\n\tend", "def render_tree(elements, symbols, parents = [])\n i = 0\n x = elements.map do |li|\n last = elements.length == i+1\n\n current = indentation(parents, last, symbols) + li[:value]\n\n children = \"\"\n if li[:children].length > 0\n children = \"\\n\" + render_tree(li[:children], symbols, parents + [last])\n end\n\n i += 1\n current + children\n end\n\n x.join(\"\\n\")\n end", "def DFT_pre_order_iterative(root)\n print '[\"I\", \"O\", \"L\", \"A\", \"G\", \"R\", \"H\", \"T\", \"M\"]' + \"\\n\"\n st = Stack.new\n if root == nil\n return\n end\n st.push(root)\n while !st.empty?\n root = st.pop\n print \"#{root.value}\\n\"\n if root.right\n st.push(root.right)\n end\n if root.left\n st.push(root.left)\n end\n end\n end", "def postorder_traversal(node=@root)\n return if (node == nil)\n puts node.value.to_s\n postorder_traversal(node.left)\n postorder_traversal(node.right)\n end", "def printf(children=nil)\n if children == nil\n children = [@root]\n end\n arr = []\n children.each do |ele|\n puts \"#{ele.title}: #{ele.rating}\"\n arr << ele.left if ele.left != nil\n arr << ele.right if ele.right != nil\n end\n if arr.size == 0\n return nil\n else\n printf(arr)\n end\n end", "def postOrder(root)\n return nil if root == nil\n\n postOrder(root.left)\n postOrder(root.right)\n print \" #{root.value}\"\nend", "def printf(children=nil)\n tree_output = [@root]\n tree_output.each do |node|\n tree_output.push(node.left) if !node.left.nil?\n tree_output.push(node.right) if !node.right.nil?\n end\n\n tree_output.each do |node|\n puts \"#{node.title}: #{node.rating}\"\n end\n\n end", "def printf\n queue = Queue.new\n queue.enq(@root)\n until queue.empty?\n value = queue.deq\n puts value unless value.title.nil?\n queue.enq(value.left) if value.left\n queue.enq(value.right) if value.right\n end\n end", "def printf(root=nil)# def printf(children=nil)\n if root == nil\n root = @root\n end\n node_array = []\n node_array.push(root)\n printf_breadth(node_array)\n end", "def printf(children=nil)\n queue = [@root]\n result = []\n while queue.length > 0\n new_root = queue.shift\n if new_root.left != nil\n queue.push(new_root.left)\n end\n if new_root.right != nil\n queue.push(new_root.right)\n end\n result.push(\"#{new_root.title}: #{new_root.rating}\")\n end\n result.each {|x| puts x}\n end", "def calculate_left_child\n # Guard condition for movement not possible\n return nil if blank_x + 1 == size\n\n # Make the movement\n new_state = swap_left\n\n # Avoids loop\n parents_array = parent_states(3)\n return nil if parents_array.include?(new_state)\n\n # Returns new node\n Node.new(new_state, self, blank_x + 1, blank_y)\n end", "def pretty_print(node = @root, prefix = '', is_left = true)\n pretty_print(node.right, \"#{prefix}#{is_left ? '│ ' : ' '}\", false) if node.right\n puts \"#{prefix}#{is_left ? '└── ' : '┌── '}#{node.value}\"\n pretty_print(node.left, \"#{prefix}#{is_left ? ' ' : '│ '}\", true) if node.left\n end", "def preOrderTraversal(root)\n return nil if root == nil\n\n stack = [root]\n while !stack.empty?\n node = stack.pop\n print \" #{node.value}\"\n if node.right != nil\n stack.push(node.right)\n end\n if node.left != nil\n stack.push(node.left)\n end\n end\nend", "def print_in_order\n return \"Empty BST\" if is_empty\n\n current = @root\n stack = []\n\n while current || !stack.empty?\n if current != nil\n stack.push(current)\n current = current.left\n elsif !stack.empty?\n current = stack.pop()\n puts current.value\n\n current = current.right\n end\n end\n end", "def left_rotate( node=@tree )\n node.left = node.right\n node.right = node.right.right\n node.left.right = nil\n node.value, node.left.value = node.left.value, node.value\n end", "def show_tree\n htmltree = \"\"\n self.each { |node| \n htmltree += \"<li><a href='#{normalize(node.name)}'>\"\n htmltree += '&nbsp; ' * node.node_depth * 3\n htmltree += \"#{node.name}</a></li>\\n\"\n }\n htmltree\n end", "def preorder(&block)\n yield item\n @left_subtree.preorder(&block) if @left_subtree != nil\n @right_subtree.preorder(&block) if @right_subtree != nil\n end", "def print_tree(indent = 0, lines = [])\n lines << (\" \" * indent) + self.to_s\n @nodes.keys.sort.each do |reference|\n node = @nodes[reference]\n if node.is_a? APISpec::Namespace\n node.print_tree(indent + 1, lines)\n else\n lines << (\" \" * (indent + 1)) + \"#{reference} => #{node.to_s}\"\n end\n end\n lines.join(\"\\n\")\n end", "def move_to_left_of(node)\n self.move_to(node, :left)\n end", "def preorder_traverse node, &block\n block.call(node)\n if node.children.count > 0 then\n node.children.each do |child|\n preorder_traverse(child, &block)\n end\n end\n end", "def rotate_left(node)\n y = node.right\n node.right = y.left\n\n y.left.parent = node if y.left.parent != @sentinel\n y.parent = node.parent\n if node.parent == @sentinel\n node.parent.left = y\n else\n node.parent.right = y\n end\n\n y.left = node\n node.parent = y\n end", "def preOrder(root) # O(n)\n\n return nil if root == nil\n\n print \" #{root.value}\"\n preOrder(root.left)\n preOrder(root.right)\n\nend", "def inorder(node)\n if node.left_child\n inorder(node.left_child)\n end\n puts node.value\n if node.right_child\n inorder(node.right_child)\n end\nend", "def print_tree(array , item, level)\n items = array[item]\n unless items == nil\n indent = level > 0 ? sprintf(\"%#{level * 2}s\", \" \") : \"\"\n items.each do |e|\n puts \"#{indent}-#{e[:title]}\"\n print_tree(e, level + 1)\n end\n end\nend", "def printf(children=nil)\n line = [@root]\n\n line.each do |i|\n puts \"#{i.title}: #{i.rating}\"\n if i.left\n line << i.left\n end\n if i.right\n line << i.right\n end\n end\n end", "def left_child_node(index)\n index * 2 + 1\n end", "def preorder_print(start, traversal)\n traversal\n end", "def printf(children=nil)\n\n new_children = []\n \n if children == nil\n children = [@root.left, @root.right]\n puts @root.title.to_s + \": \" + @root.rating.to_s\n end\n\n children.each do |ch|\n if ch != nil\n puts ch.title.to_s + \": \" + ch.rating.to_s\n new_children.push(ch.left) if ch.left\n new_children.push(ch.right) if ch.right\n end\n end\n\n if new_children != []\n printf(new_children)\n end\n end", "def print_tree_perimeter(root)\n print \"print\"\nend", "def printPrefixNotation( rootNode=@root )\n return if rootNode.nil?\n \n # print open paran, operator, left operand, right operand, close parans\n if( isOp?(rootNode.data) )\n print '(' + rootNode.data + ' '\n printPrefixNotation( rootNode.leftChild )\n printPrefixNotation( rootNode.rightChild )\n print ') '\n else\n print rootNode.data + ' '\n end\n end", "def print()\n current_node = @root_node\n while current_node != nil\n current_node.print()\n current_node = current_node.get_next()\n end\n end", "def move_to_left_of(node)\n self.move_to node, :left\n end", "def printf(children=nil)\n if children.nil?\n children = [@root]\n end\n next_row = []\n children.each do |child|\n puts \"#{child.title}: #{child.rating}\"\n next_row.push(child.left) if !child.left.nil?\n next_row.push(child.right) if !child.right.nil?\n end\n if next_row.size == 0\n nil\n else\n printf(next_row)\n end\n end", "def move_to_left_of(node)\n move_to node, :left\n end", "def move_to_left_of(node)\n move_to node, :left\n end", "def move_to_left_of(node)\n move_to node, :left\n end" ]
[ "0.6997386", "0.6885649", "0.68095547", "0.6699235", "0.6674675", "0.665289", "0.6595587", "0.6548316", "0.653387", "0.64814216", "0.63783693", "0.63685155", "0.63498884", "0.628961", "0.62798953", "0.62707573", "0.6260636", "0.62538236", "0.6225005", "0.6216512", "0.62128687", "0.6192037", "0.615693", "0.6148671", "0.6129551", "0.6129551", "0.61281586", "0.6112999", "0.6090047", "0.6025332", "0.6020881", "0.6020128", "0.6011797", "0.6007642", "0.59997016", "0.5992262", "0.59834325", "0.59772396", "0.5976342", "0.5967496", "0.59452957", "0.5944216", "0.59358275", "0.5931911", "0.5931646", "0.59311026", "0.59120274", "0.5908366", "0.590131", "0.58990407", "0.5894877", "0.58883816", "0.58838934", "0.5882713", "0.5874033", "0.5873645", "0.58656514", "0.5864959", "0.58595574", "0.58585036", "0.58474445", "0.5844681", "0.584413", "0.5842466", "0.5833341", "0.5830435", "0.582665", "0.58243173", "0.58212703", "0.58151287", "0.5813474", "0.5809716", "0.5794911", "0.5794256", "0.5791903", "0.5790721", "0.57903415", "0.5787346", "0.57860637", "0.5783175", "0.5780326", "0.57749707", "0.57743496", "0.5769922", "0.57692665", "0.5759854", "0.57547414", "0.575413", "0.574889", "0.574027", "0.5737391", "0.573362", "0.57326585", "0.57255584", "0.5721547", "0.57029593", "0.57029027", "0.5702029", "0.5702029", "0.5702029" ]
0.709064
0
Public: Prints the elements inside tree nodes in a LEFT RIGHT PARENT manner x Node, Preferably a root node Examples NOTE: Based on the mock tree structure at LINE:61 postorder_tree_walk(F) => A C E D B H I G F
def postorder_tree_walk(x) unless x.nil? postorder_tree_walk(x.left) postorder_tree_walk(x.right) p x.key end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preorder(node)\n return if !node\n print node.value, \" \"\n preorder(node.left_child)\n preorder(node.right_child)\n end", "def print_tree(tree)\n return \"-\" if tree.nil?\n puts \"#{tree.value}: \"\n print \"Left: \"\n puts \"#{print_tree(tree.children[0])}\"\n print \"Right: \"\n puts \"#{print_tree(tree.children[1])}\"\nend", "def postorder_traverse(root=@root)\n unless !root\n result = root.left ? \"#{postorder_traverse(root.left)}\" : \"\"\n result << postorder_traverse(root.right) unless !root.right\n result << root.data\n result\n end\n end", "def printTree()\n def pTree(node, i)\n puts node.toString i\n node.children.each do|child|\n pTree(child, i+1)\n end\n end\n pTree(@root, 0)\n end", "def preoder_tree_walk(x)\n unless x.nil?\n p x.key\n preoder_tree_walk(x.left)\n preoder_tree_walk(x.right)\n end\n end", "def postorder(node)\n return if !node\n postorder(node.left_child)\n postorder(node.right_child)\n print node.value, \" \"\n end", "def print_tree\n current = nil\n stack = Stack.new\n stack.push(@root)\n until stack.empty?\n current = stack.pop\n if current.parent.nil?\n puts current.tag\n else\n puts \"#{current.tag}\\t<=\\t#{current.parent.tag}\"\n end\n unless current.childs.size.zero?\n current.childs.reverse_each { |child| stack.push(child) }\n end\n end\n end", "def preorder(node)\n # 1->2->4->5->3->6\n if node\n print node.value.to_s + '->'\n preorder(node.left_child)\n preorder(node.right_child)\n end\n end", "def postorder_traversal(node=@root)\n return if (node == nil)\n puts node.value.to_s\n postorder_traversal(node.left)\n postorder_traversal(node.right)\n end", "def print_preorder\n return \"Empty BST\" if is_empty\n\n stack = [@root]\n\n until stack.empty?\n current = stack.pop\n\n puts current.value\n\n stack << current.right unless current.right.nil?\n stack << current.left unless current.left.nil?\n end\n end", "def postOrder(root)\n return nil if root == nil\n\n postOrder(root.left)\n postOrder(root.right)\n print \" #{root.value}\"\nend", "def print_post_order\n return \"Empty BST\" if is_empty\n\n stack_1 = [@root]\n stack_2 = []\n\n until stack_1.empty?\n current = stack_1.pop\n stack_2 << current\n\n stack_1 << current.left unless current.left.nil?\n stack_1 << current.right unless current.right.nil?\n end\n\n until stack_2.empty?\n current = stack_2.pop\n puts current.value\n end\n end", "def preorder_traverse(root=@root)\n unless !root\n result = \"#{root.data}\"\n result << preorder_traverse(root.left) unless !root.left\n result << preorder_traverse(root.right) unless !root.right\n result\n end\n end", "def preorder_traversal(node=@root)\n return if (node == nil)\n preorder_traversal(node.left)\n preorder_traversal(node.right)\n puts node.value.to_s\n end", "def print_tree\n if root.children\n puts \" - root : #{root.children.length} - \"\n root.children.each(&:print_node)\n puts ''\n end\n end", "def see_tree(tree)\n tree.each do |i|\n puts \"---------------\"\n puts \"Node: #{i.value}\"\n puts \"Parent: \" + i.find_parent[0].value.to_s if i.find_parent.count > 0\n puts \"Left Child: \" + i.find_left_child[0].value.to_s if i.find_left_child.count > 0\n puts \"Right Child: \" + i.find_right_child[0].value.to_s if i.find_right_child.count > 0\n end\nend", "def level_order_print(tree)\n unless tree\n return\n end\n\n nodes = [tree]\n current_line_count = 1\n next_line_count = 0\n\n while nodes.length != 0\n current_node = nodes.shift\n current_line_count -= 1\n print current_node.key.to_s + ' '\n if current_node.left_child\n nodes.push(current_node.left_child)\n next_line_count += 1\n end\n if current_node.right_child\n nodes.push(current_node.right_child)\n next_line_count += 1\n end\n if current_line_count == 0\n # finished printing current level\n puts ''\n current_line_count = next_line_count\n next_line_count = current_line_count\n end\n end\nend", "def print_level_order\n return \"Empty BST\" if is_empty\n\n queue = [@root]\n\n until queue.empty?\n current = queue.pop\n puts current.value\n\n queue << current.left unless current.left.nil?\n queue << current.right unless current.right.nil?\n end\n end", "def left_side_of_tree(root, current_level)\n return if root.nil?\n if (current_level > @max_level)\n puts root.val\n @max_level = current_level\n end\n left_side_of_tree(root.left, current_level + 1)\n left_side_of_tree(root.right, current_level + 1)\nend", "def DFT_post_order_recursive(root)\n if root == nil\n return\n end\n \n DFT_post_order_recursive(root.left)\n DFT_post_order_recursive(root.right)\n print \"#{root.value}\\n\"\n \n end", "def display_tree() \n list = []\n yield @tree.value\n left_child = @tree.left_child\n right_child = @tree.right_child\n\n list << left_child if left_child != nil\n list << right_child if right_child != nil\n\n loop do\n break if list.empty?\n node = list.shift\n yield node.value\n list << node.left_child if node.left_child != nil\n list << node.right_child if node.right_child != nil\n end\n end", "def preorder(node)\n p node.value if node.value \n preorder(node.left) if node.left\n preorder(node.right) if node.right\nend", "def printout\n\t\t\n\t\tindex = 0\n\t\t\n\t\tdef small_loop (node, index)\n\t\t\t\n\t\t\tfor i in 0...index\n\t\t\t\tprint \" \"\n\t\t\tend\n\t\t\t\n\t\t\tputs node.name\n\t\t\tindex += 1\n\t\t\t\n\t\t\tif node.children.length > 0\n\t\t\t\tindex += 1\n\t\t\t\tnode.children.cycle(1) { |child| small_loop(child, index) }\n\t\t\tend\n\t\tend\n\t\t\n\t\tsmall_loop(@root, index)\n\tend", "def DFT_pre_order_recursive(root)\n if root == nil\n return\n end\n print \"#{root.value}\\n\"\n DFT_pre_order_recursive(root.left)\n DFT_pre_order_recursive(root.right)\n end", "def print_level_order(root)\n return if !root\n queue = Queue.new()\n queue.enqueue(root)\n total_nodes_in_current_level = 1\n total_nodes_in_next_level = 0\n\n while (!queue.is_empty?) # as long as the queue is not empty\n current_node = queue.dequeue\n\n # we print current_node's value and decrement total_nodes_in_current_level by 1. We then add its children (if any) to the queue and increment total_nodes_in_next_level by 2.\n print current_node.value, \" \"\n total_nodes_in_current_level -= 1\n\n queue.enqueue(current_node.left_child) if current_node.left_child\n queue.enqueue(current_node.right_child) if current_node.right_child\n total_nodes_in_next_level += 2\n\n if total_nodes_in_current_level == 0 # this means we finished printing the node values in the current node\n print \"\\n\"\n # swap total_nodes_in_current_level and total_nodes_in_next_level\n total_nodes_in_current_level = total_nodes_in_next_level\n total_nodes_in_next_level = total_nodes_in_current_level\n end\n end\n print \"\\n\"\nend", "def printf(children=nil)\n queue = [@root]\n\n queue.each do |current|\n puts \"#{current.value}\"\n if current.left && current.right\n queue << current.left << current.right\n elsif current.left\n queue << current.left\n elsif current.right\n queue << current.right\n end\n end\n end", "def print_tree(level = 0)\n if is_root?\n print \"\\n*\"\n else\n print \"|\" unless parent.is_root?\n print(' ' * (level - 1) * 4)\n print(is_root? ? \"+\" : \"|\")\n print \"---\"\n print(has_children? ? \"+\" : \">\")\n end\n\n if content\n content_hash = content.split(\"[\").first\n else\n content_hash = nil\n end\n\n puts \" #{content}\" + \" <Type: \" + (@node_type || \"no_type\") + \">\"\n\n children { |child| child.print_tree(level + 1)}\n end", "def test_print_tree\n setup_test_tree\n #puts\n #@root.print_tree\n end", "def print_tree\n ''\n end", "def printf(children=nil)\n if @root != nil\n queue = Queue.new\n queue.enq(@root)\n result = nil\n while !queue.empty?\n node = queue.deq\n puts(node.to_s)\n queue.enq(node.left) if node.left\n queue.enq(node.right) if node.right\n end\n end\n end", "def preorder(node)\n visit node \n left = preorder node.left_node if node.left_node \n right = preorder node.right_node if node.right_node\n p left ? left.value : nil \n p right ? right.value : nil\n p node.value\n puts '----'\n node\n end", "def postorder\n # left -> right -> root\n return postorder_helper(@root)\n end", "def print_in_order\n return \"Empty BST\" if is_empty\n\n current = @root\n stack = []\n\n while current || !stack.empty?\n if current != nil\n stack.push(current)\n current = current.left\n elsif !stack.empty?\n current = stack.pop()\n puts current.value\n\n current = current.right\n end\n end\n end", "def print_BST_in_order(root)\n if root.nil?\n return\n end\n print_BST_in_order(root.left)\n print \"#{root.value} \"\n print_BST_in_order(root.right)\nend", "def printf\n output = []\n children = []\n output.push(\"#{@root.title}: #{@root.rating}\")\n if @root.left != nil\n children.push(@root.left)\n end\n if @root.right != nil\n children.push(@root.right)\n end\n children.each do |i|\n output.push(\"#{i.title}: #{i.rating}\")\n if i.left != nil\n children.push(i.left)\n end\n if i.right != nil\n children.push(i.right)\n end\n end\n puts output\n end", "def printTree(root = @root, indentation = \"\\n\")\r\n #print root the first time running mehtod, the rest will be printed as children\r\n puts \"#{indentation}#{root.value}\" if root == @root\r\n root.children.each do | child |\r\n puts \"#{indentation}\\t#{child.value}\\n\"\r\n #if there are children, again\r\n printTree(child, indentation + \"\\t\") if child.children.any?\r\n end\r\n end", "def postorder(current_node = root)\n return if current_node.nil?\n inorder(current_node.left)\n inorder(current_node.right)\n print \"#{current_node.value} \"\n end", "def printnodes(node, level)\r\n\theader(level)\r\n\tputs node\r\n\tif node.nodes?\r\n\t\ttemp = Array.new\r\n\t\tnode.nodes.each { |n|\r\n\t\t\tif n == nil\r\n\t\t\t\theader(level + 1)\r\n\t\t\t\tputs \":\"\r\n\t\t\telsif n == node.parent\r\n\t\t\t\theader(level + 1)\r\n\t\t\t\tputs node\r\n\t\t\telsif !temp.include?(n)\r\n\t\t\t\ttemp << n\r\n\t\t\telse\r\n\t\t\t\theader(level + 1)\r\n\t\t\t\tputs node\r\n\t\t\tend\r\n\t\t}\r\n\t\tif !temp.empty?\r\n\t\t\ttemp.each { |n|\r\n\t\t\t\tprintnodes(n, level + 1)\r\n\t\t\t}\r\n\t\tend\r\n\tend\r\nend", "def pretty_print(node = @root, prefix = '', is_left = true)\n pretty_print(node.right_child, \"#{prefix}#{is_left ? '│ ' : ' '}\", false) if node.right_child\n puts \"#{prefix}#{is_left ? '└── ' : '┌── '}#{node.data}\"\n pretty_print(node.left_child, \"#{prefix}#{is_left ? ' ' : '│ '}\", true) if node.left_child\n end", "def pretty_print(node = @root, prefix = '', is_left = true)\n pretty_print(node.right_child, \"#{prefix}#{is_left ? '│ ' : ' '}\", false) if node.right_child\n puts \"#{prefix}#{is_left ? '└── ' : '┌── '}#{node.data}\"\n pretty_print(node.left_child, \"#{prefix}#{is_left ? ' ' : '│ '}\", true) if node.left_child\n end", "def printlewis(node)\r\n\tputs node.to_s + \" =\"\r\n\tif node.nodes?\r\n\t\ttemp = Array.new\r\n\t\tnode.nodes.each { |n|\r\n\t\t\tif n == nil\r\n\t\t\t\tputs \":\"\r\n\t\t\telsif n == node.parent\r\n\t\t\t\tputs n\r\n\t\t\telsif !temp.include?(n)\r\n\t\t\t\ttemp << n\r\n\t\t\t\tputs n\r\n\t\t\telse\r\n\t\t\t\tputs n\r\n\t\t\tend\r\n\t\t}\r\n\t\tif !temp.empty?\r\n\t\t\ttemp.each { |n|\r\n\t\t\t\tputs \"========\"\r\n\t\t\t\tprintlewis(n)\r\n\t\t\t}\r\n\t\tend\r\n\tend\r\nend", "def print_prefix(node)\n return if node == nil\n print node.value + \" \" #print contents of this node\n print_prefix(node.left) #starts recursion -- go left\n print_prefix(node.right) #go right\nend", "def inOrderTraversal( rootNode )\n return if rootNode == nil\n inOrderTraversal( rootNode.leftChild )\n puts rootNode.data\n inOrderTraversal( rootNode.rightChild )\n end", "def node_tree(nodes, &block)\n \n nodes = nodes.dup\n printed_nodes = []\n \n result = \"<ul>\"\n \n # top level nodes first, then others\n for node in nodes\n next if node.instance_of?(Center) || node.instance_of?(Team)\n next unless node.parent == nil\n printed_nodes << node\n result += \"<li>\"\n\n if block_given?\n result += yield node\n else\n result += node.title\n end\n\n children = node.children.dup\n children.delete_if { |r| not nodes.include?(r) }\n if not children.empty?\n result += node_tree_help(children, nodes, printed_nodes, &block)\n end\n \n result += \"</li>\"\n end\n \n # TODO: Add depth counting here to get a minimum of trees\n for node in nodes\n next if printed_nodes.include? node\n printed_nodes << node\n \n result += \"<li>\"\n\n if block_given?\n result += yield node\n else\n result += node.title\n end\n\n children = node.children #.dup\n children.delete_if { |r| not nodes.include?(r) }\n\n if not children.empty?\n result += node_tree_help(children, nodes, printed_nodes, &block)\n end\n \n result += \"</li>\"\n end\n\n result += '</ul>'\n\n return result\n end", "def preOrderTraversal(root)\n return nil if root == nil\n\n stack = [root]\n while !stack.empty?\n node = stack.pop\n print \" #{node.value}\"\n if node.right != nil\n stack.push(node.right)\n end\n if node.left != nil\n stack.push(node.left)\n end\n end\nend", "def print_tree(tree)\n\t\t\tif tree.is_leaf? and tree.depth > 0\n\t\t\t\tprint_line((\"|\\t\"*(tree.depth-1))+\"+------\"+tree.name)\n\t\t\telse\n\t\t\t\tprint_line((\"|\\t\"*tree.depth)+tree.name)\n\t\t\tend\n\t\t\ttree.children.each_pair do |name,child|\n\t\t\t\t\tprint_tree(child)\n\t\t\tend\n\t\tend", "def postorder(node)\n postorder node.left_node if node.left_node \n postorder node.right_node if node.right_node \n visit node\n end", "def preorder(current_node = root)\n return if current_node.nil?\n print \"#{current_node.value} \"\n inorder(current_node.left)\n inorder(current_node.right)\n end", "def print(node = root)\n puts %( ) * node.level + \"#{node}\"\n node.children.each do |child|\n print(child)\n end\n true\n end", "def printf(list=[@root], output='')\n # remove front list item & add it to the output\n first = list.shift()\n print_string = first.title + ': ' + first.rating.to_s + \"\\n\"\n output << print_string\n # add its children to the back of the list\n if first.left\n list << first.left\n end\n if first.right\n list << first.right\n end\n # repeat until all nodes have been visited, then print output\n if list.empty?\n puts output\n return\n else\n printf(list, output)\n end\n end", "def printTree(options = {})\n # Set defaults\n options[:name] ||= true\n options[:content] ||= false\n \n result = \"\"\n \n options[:output] = result \n # Traverse tree and modify result by tacking on child names.\n printTraversal(options)\n \n puts result\n end", "def postorder_traverse node, &block\n if node.children.count > 0 then\n node.children.each do |child|\n postorder_traverse(child, &block)\n end\n end\n block.call(node)\n end", "def printf(children=nil)\n queue = [@root]\n result = \"\"\n\n until queue.empty?\n temp_root = queue.shift\n\n unless temp_root.left == nil\n queue << temp_root.left\n end\n unless temp_root.right == nil\n queue << temp_root.right\n end\n\n result << \"#{temp_root.title}: #{temp_root.rating}\\n\"\n end\n\n puts result\n end", "def pretty_print(node = @root, prefix = '', is_left = true)\n unless node.right.nil?\n pretty_print(node.right, \"#{prefix}#{is_left ? '│ ' : ' '}\", false)\n end\n puts \"#{prefix}#{is_left ? '└── ' : '┌── '}#{node.data}\"\n unless node.left.nil?\n pretty_print(node.left, \"#{prefix}#{is_left ? ' ' : '│ '}\", true)\n end\n end", "def postorder\n tree_array = []\n if root.nil?\n return tree_array\n else\n root.postorder(tree_array)\n return tree_array\n end\n end", "def printPostOrder\n if !left.nil?\n left.printInOrder\n end\n\n if !right.nil?\n right.printInOrder\n end\n\n puts \"data: #{data}, left: #{left ? left.data : \"nil\"}, right: #{right ? right.data : \"nil\"}\"\n end", "def printf(children=nil)\n children = [@root] if children.nil?\n grand_children = []\n children.each do |node|\n puts \"#{node.title}: #{node.rating}\\n\"\n grand_children.push(node.left) if node.left\n grand_children.push(node.right) if node.right\n end\n printf(grand_children) unless grand_children.empty?\n end", "def print_prefix(node)\n return if node.nil?\n print node.value + \" \"\n print_prefix(node.left)\n print_prefix(node.right)\nend", "def postorder\n array = []\n return [] if @root.nil?\n current = @root\n\n return postorder_recursive(current, array)\n end", "def print\n node = root\n \n print_node(node, \"> \")\n end", "def pretty_print(node = @root, prefix = '', is_left = true)\n pretty_print(node.right, \"#{prefix}#{is_left ? '│ ' : ' '}\", false) if node.right\n puts \"#{prefix}#{is_left ? '└── ' : '┌── '}#{node.data}\"\n pretty_print(node.left, \"#{prefix}#{is_left ? ' ' : '│ '}\", true) if node.left\n end", "def DFT_pre_order_iterative(root)\n print '[\"I\", \"O\", \"L\", \"A\", \"G\", \"R\", \"H\", \"T\", \"M\"]' + \"\\n\"\n st = Stack.new\n if root == nil\n return\n end\n st.push(root)\n while !st.empty?\n root = st.pop\n print \"#{root.value}\\n\"\n if root.right\n st.push(root.right)\n end\n if root.left\n st.push(root.left)\n end\n end\n end", "def postorder_traverse(current_node = @root)\n postorder_array = []\n\n # Base case: reached child of a leaf node (nil)\n return [] if current_node.nil?\n\n postorder_array += postorder_traverse(current_node.left)\n postorder_array += postorder_traverse(current_node.right)\n postorder_array << current_node\n\n postorder_array\n end", "def render(node = nil)\n elt = node | tree\n puts \"\\nNodes: #{elt.body.count}\"\n puts \"\\nAttributes:\"\n elt.attrs.each{ |k, v| puts(\"#{k}: #{v}\") }\n children = elt.body.select{ |i| i.is_a?(Node) }\n puts \"\\nChildren: #{children.each{ |c| render(c) }}\"\n\n\n end", "def printf(children=nil)\n queue = [@root]\n result = []\n while queue.length > 0\n new_root = queue.shift\n if new_root.left != nil\n queue.push(new_root.left)\n end\n if new_root.right != nil\n queue.push(new_root.right)\n end\n result.push(\"#{new_root.title}: #{new_root.rating}\")\n end\n result.each {|x| puts x}\n end", "def print_postfix(node)\n return if node == nil\n print_postfix(node.left) #starts recursion -- go left\n print_postfix(node.right) #go right\n print node.value + \" \" #print contents of this node\nend", "def printf\n queue = Queue.new\n queue.enq(@root)\n until queue.empty?\n value = queue.deq\n puts value unless value.title.nil?\n queue.enq(value.left) if value.left\n queue.enq(value.right) if value.right\n end\n end", "def print_tree(indent = 0, lines = [])\n lines << (\" \" * indent) + self.to_s\n @nodes.keys.sort.each do |reference|\n node = @nodes[reference]\n if node.is_a? APISpec::Namespace\n node.print_tree(indent + 1, lines)\n else\n lines << (\" \" * (indent + 1)) + \"#{reference} => #{node.to_s}\"\n end\n end\n lines.join(\"\\n\")\n end", "def print()\n current_node = @root_node\n while current_node != nil\n current_node.print()\n current_node = current_node.get_next()\n end\n end", "def depth_traversal(node, &block)\n yield node.value # print the current block\n\n # recurse down to the left child\n depth_traversal(node.left, &block) if node.left\n\n # recurse down to the right child\n depth_traversal(node.right, &block) if node.right\nend", "def printf(root=nil)# def printf(children=nil)\n if root == nil\n root = @root\n end\n node_array = []\n node_array.push(root)\n printf_breadth(node_array)\n end", "def printf(children=nil)\n list = [@root]\n while !list.empty?\n if list[0].left\n list.push(list[0].left)\n end\n if list[0].right\n list.push(list[0].right)\n end\n puts \"#{list[0].title}: #{list[0].rating}\\n\"\n list.shift\n end\n end", "def inorder_display_helper node\n return nil if node.nil?\n inorder_display_helper(node.left_child)\n puts node.to_s\n inorder_display_helper(node.right_child)\n end", "def pretty_print(node = @root, prefix = '', is_left = true)\n pretty_print(node.right_child, \"#{prefix}#{is_left ? '│ ' : ' '}\", false) if node.right_child\n puts \"#{prefix}#{is_left ? '└── ' : '┌── '}#{node.value}\"\n pretty_print(node.left_child, \"#{prefix}#{is_left ? ' ' : '│ '}\", true) if node.left_child\n end", "def level_order_traversal(root_node)\n queue = Queue.new\n queue.enq root_node\n while(!queue.empty?)\n magic_node = queue.deq\n\n puts magic_node.value\n\n queue.enq(magic_node.left) unless magic_node.left.nil?\n\n queue.enq(magic_node.right) unless magic_node.right.nil?\n end \n end", "def inorder_traverse(root=@root)\n unless !root\n result = root.left ? \"#{inorder_traverse(root.left)}\" : \"\"\n result << root.data\n result << inorder_traverse(root.right) unless !root.right\n result\n end\n end", "def printf(children=nil)\n if children == nil\n children = [@root]\n end\n arr = []\n children.each do |ele|\n puts \"#{ele.title}: #{ele.rating}\"\n arr << ele.left if ele.left != nil\n arr << ele.right if ele.right != nil\n end\n if arr.size == 0\n return nil\n else\n printf(arr)\n end\n end", "def pretty_print(node = root, prefix = '', is_left = true)\n pretty_print(node.right, \"#{prefix}#{is_left ? '│ ' : ' '}\", false) if node.right\n puts \"#{prefix}#{is_left ? '└── ' : '┌── '}#{node.data}\"\n pretty_print(node.left, \"#{prefix}#{is_left ? ' ' : '│ '}\", true) if node.left\n end", "def preOrder(root) # O(n)\n\n return nil if root == nil\n\n print \" #{root.value}\"\n preOrder(root.left)\n preOrder(root.right)\n\nend", "def pretty_print(node = @root, prefix = '', is_left = true)\n pretty_print(node.right_node, \"#{prefix}#{is_left ? '│ ' : ' '}\", false) if node.right_node\n puts \"#{prefix}#{is_left ? '└── ' : '┌── '}#{node.data}\"\n pretty_print(node.left_node, \"#{prefix}#{is_left ? ' ' : '│ '}\", true) if node.left_node\n end", "def render_tree(elements, symbols, parents = [])\n i = 0\n x = elements.map do |li|\n last = elements.length == i+1\n\n current = indentation(parents, last, symbols) + li[:value]\n\n children = \"\"\n if li[:children].length > 0\n children = \"\\n\" + render_tree(li[:children], symbols, parents + [last])\n end\n\n i += 1\n current + children\n end\n\n x.join(\"\\n\")\n end", "def pre_order_print(start, traversal = \"\")\n return traversal unless start\n\n traversal += \"#{start.value}-\"\n traversal = pre_order_print(start.left, traversal)\n pre_order_print(start.right, traversal)\n end", "def show_node(tree, node)\n print \"ID:#{node.id} Parent:#{node.parent} Keys:\"\n node.keys.each { |key| print \"[#{key}]\"}\n print \" Sub trees:\"\n node.sub_trees.each { |sub_tree| print \"-#{sub_tree}-\"}\n print \"\\n\"\n node.sub_trees.compact.each { |sub_tree| show_node(tree, tree.nodes[sub_tree])}\nend", "def print(node = @root, prefix = '', is_left = true)\n if node.nil?\n return\n end\n\n print(node.right_node, \"#{prefix}#{is_left ? '│ ' : ' '}\", false) if node.right_node\n puts \"#{prefix}#{is_left ? '└── ' : '┌── '}#{node.value}\"\n print(node.left_node, \"#{prefix}#{is_left ? ' ' : '│ '}\", true) if node.left_node\n end", "def inorder(node)\n if node.left_child\n inorder(node.left_child)\n end\n puts node.value\n if node.right_child\n inorder(node.right_child)\n end\nend", "def postorder\n return postorder_recursion(current = @root, tree = [])\n end", "def nodes_preorder(node = self.root, &block)\n yield( node ) if block_given?\n nodes_preorder(node.left_child, &block) if node.has_left_child?\n nodes_preorder(node.right_child, &block) if node.has_right_child?\n end", "def nodes_postorder(node = self.root, &block)\n nodes_postorder(node.left_child, &block) if node.has_left_child?\n nodes_postorder(node.right_child, &block) if node.has_right_child?\n yield( node ) if block_given?\n end", "def postorder\n return [] if @root == nil\n\n current = @root \n array = []\n \n return postorder_helper(current, array)\n end", "def postorder\n postorder_traversal(@root, [])\n end", "def printf(children=nil)\n if @root.nil?\n return nil\n else\n for i in @root\n puts i\n end\n end\n end", "def printf(children=nil)\n tree_output = [@root]\n tree_output.each do |node|\n tree_output.push(node.left) if !node.left.nil?\n tree_output.push(node.right) if !node.right.nil?\n end\n\n tree_output.each do |node|\n puts \"#{node.title}: #{node.rating}\"\n end\n\n end", "def DFT_post_order_iterative(root)\n print '[\"A\", \"G\", \"L\", \"R\", \"O\", \"T\", \"M\", \"H\", \"I\"]' + \"\\n\"\n st1 = Stack.new\n st2 = Stack.new\n\n st1.push(root)\n while !st1.empty?\n root = st1.pop\n st2.push(root)\n if !root.left.nil?\n st1.push(root.left)\n end\n if !root.right.nil?\n st1.push(root.right)\n end\n end\n while !st2.empty?\n print \"#{st2.pop.value}\\n\"\n end\n end", "def pretty_print(node = @root_node, prefix = '', is_left = true)\n pretty_print(node.right_node, \"#{prefix}#{is_left ? '│ ' : ' '}\", false) if node.right_node\n puts \"#{prefix}#{is_left ? '└── ' : '┌── '}#{node.data}\"\n pretty_print(node.left_node, \"#{prefix}#{is_left ? ' ' : '│ '}\", true) if node.left_node\n end", "def preorder_traverse node, &block\n block.call(node)\n if node.children.count > 0 then\n node.children.each do |child|\n preorder_traverse(child, &block)\n end\n end\n end", "def postorder\n arr = []\n if @root.nil?\n return arr\n end \n current_node = @root\n return postorder_helper(current_node, arr)\n end", "def printf(children=nil)\n text = \"\"\n if (self.root)\n queue = Queue.new\n queue.push(self.root)\n while (!queue.empty?)\n temp = queue.pop\n text << temp.title << \":\" << temp.rating.to_s\n if (temp.left)\n queue.push(temp.left)\n end\n if (temp.right)\n queue.push(temp.right)\n end\n text << \"\\n\"\n end\n puts text\n return\n end\n end", "def pretty_print(node = @root, prefix = '', is_left = true)\n pretty_print(node.right, \"#{prefix}#{is_left ? '│ ' : ' '}\", false) if node.right\n puts \"#{prefix}#{is_left ? '└── ' : '┌── '}#{node.value}\"\n pretty_print(node.left, \"#{prefix}#{is_left ? ' ' : '│ '}\", true) if node.left\n end", "def printf(children=nil)\n results = Queue.new\n results.enq(@root)\n\n while !results.empty?\n node = results.deq\n \n puts \"#{node.title}: #{node.rating}\" if node.title \n\n results.enq(node.left) if node.left\n results.enq(node.right) if node.right\n end\n end", "def level_order_print(start, traversal = \"\")\n return traversal unless start\n\n queue = Queue.new\n queue << start\n\n while queue.size > 0 do\n node = queue.pop\n traversal += \"#{node.value}-\"\n queue << node.left if node.left\n queue << node.right if node.right\n end\n\n traversal\n end" ]
[ "0.6935577", "0.69213015", "0.6864955", "0.68047947", "0.67963105", "0.6789903", "0.6738954", "0.6690396", "0.66553366", "0.66539526", "0.6625834", "0.66160625", "0.6540885", "0.6508527", "0.6493962", "0.6455651", "0.6444168", "0.6426628", "0.6425922", "0.6385903", "0.63763684", "0.63650024", "0.6319375", "0.62871003", "0.62840503", "0.6275601", "0.6258283", "0.6230915", "0.6209128", "0.61867464", "0.61709", "0.616279", "0.6159138", "0.61513674", "0.6148994", "0.61466634", "0.614587", "0.6105704", "0.6102281", "0.6102281", "0.60942554", "0.60876817", "0.6068173", "0.60491115", "0.60438824", "0.6040386", "0.6020803", "0.60194564", "0.5996561", "0.5982965", "0.59818774", "0.59786266", "0.5976618", "0.5975099", "0.5969844", "0.5969178", "0.59564596", "0.59490657", "0.59478325", "0.59429973", "0.5937174", "0.5934439", "0.59253323", "0.5920541", "0.59147877", "0.5906803", "0.59043896", "0.5896102", "0.5892835", "0.58866525", "0.5886537", "0.588652", "0.5884607", "0.58842725", "0.5878081", "0.587431", "0.5866645", "0.5859797", "0.5856742", "0.58490634", "0.5846518", "0.5842857", "0.5842262", "0.58381826", "0.58367157", "0.5816239", "0.5810296", "0.5809581", "0.5807939", "0.5803754", "0.5803592", "0.5801227", "0.5798024", "0.5792344", "0.5788635", "0.5784525", "0.5782578", "0.5771409", "0.576927", "0.5768509" ]
0.6909823
2
unused currently unable to call from view
def incprintcount @post = Post.find(params[:id]) if @post.printcount.blank? @post.update_attribute(:printcount, "1") @post.save else @post.update_attribute(:printcount, @post.printcount + 1) @post.save end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _view; end", "def view; end", "def private; end", "def view_flow; end", "def rendered_views=(_arg0); end", "def render; end", "def render; end", "def render; end", "def render; end", "def render; end", "def view\n end", "def rendered; end", "def loc_view\n \n end", "def rendered=(_arg0); end", "def after_view_setup\n end", "def render\n end", "def view_flow=(_arg0); end", "def render_calls; end", "def view_assigns; end", "def view_assigns; end", "def private_method\n end", "def rendered_views; end", "def render\n end", "def render\n end", "def render\n end", "def doctorView \n end", "def view_renderer; end", "def view_renderer; end", "def render\n\n end", "def view\n @_view\n end", "def refutal()\n end", "def helpers; end", "def helpers; end", "def helpers; end", "def render\n end", "def run()\n\t\tif Core::DEBUG\n\t\t\traise \"View #{self.class.name} can't be build because run method is not redefined.\"\t\t\n\t\tend\n\tend", "def custom; end", "def custom; end", "def suivre; end", "def vieworder\n end", "def render!; raise NotImplementedError end", "def results_view\n end", "def view_info\n super\n end", "def view_with_check_option_support\n nil\n end", "def view()\n @view\n end", "def view_paths; end", "def view_paths; end", "def view_paths; end", "def after_partial_setup(view)\n end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def partial; end", "def partial; end", "def partial; end", "def partial; end", "def who_we_are\r\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def get()\n \n end", "def show\n #not needed for our implementation\n end", "def handler; end", "def handler; end", "def public; end", "def public; end", "def text ; view.text ; end", "def x()\n @view__.x\n end", "def extra; end", "def protected_method\n end", "def form_view\n end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end" ]
[ "0.7381524", "0.7137623", "0.6825302", "0.6801576", "0.6727366", "0.6583986", "0.6583986", "0.6583986", "0.6583986", "0.6583986", "0.6484622", "0.64833564", "0.6417709", "0.63687205", "0.6364569", "0.62448275", "0.62367165", "0.623068", "0.62185603", "0.62185603", "0.6215949", "0.62102014", "0.6207501", "0.6207501", "0.6207501", "0.6189926", "0.6158177", "0.6158177", "0.6156764", "0.61547166", "0.6124513", "0.60986704", "0.60986704", "0.60986704", "0.6069771", "0.60409725", "0.60135496", "0.60135496", "0.6011982", "0.5997402", "0.5982421", "0.5971387", "0.59655094", "0.59187263", "0.5850272", "0.5843073", "0.5843073", "0.5843073", "0.5822353", "0.5813528", "0.5813528", "0.5813528", "0.5813528", "0.5813528", "0.5813528", "0.5813528", "0.5813528", "0.5813528", "0.5813528", "0.5813528", "0.58085895", "0.58085895", "0.58085895", "0.58085895", "0.57921", "0.5782903", "0.5782903", "0.5782903", "0.5782903", "0.5782903", "0.57828575", "0.57756174", "0.57700324", "0.57700324", "0.5763322", "0.5763322", "0.57629025", "0.5760149", "0.5748721", "0.57486594", "0.57434094", "0.57340306", "0.57340306", "0.57340306", "0.57340306", "0.57340306", "0.57340306", "0.57340306", "0.57340306", "0.57340306", "0.57340306", "0.57340306", "0.57340306", "0.57340306", "0.57340306", "0.57340306", "0.57340306", "0.57340306", "0.57340306", "0.57340306", "0.57340306" ]
0.0
-1
go to app controller to change ip while on local host
def getlocation @myip = remote_ip() # based off freegeoip.net is really terrible result = Geocoder.search(@myip) @mylat = result.latitude @mylong = result.longitude @mycity = result.address #51.243048, -0.588458 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_ip\n @ip = get_ip(request.remote_ip.to_s)\n end", "def update_ip\n ip = ip_from_request_env\n logger.debug \"Built notice from #{ip}, current host ip is #{@host.ip}, updating\" if @host.ip != ip\n\n # @host has been changed even if the save fails, so we have to change it back\n old_ip = @host.ip\n @host.ip = old_ip unless @host.update_attributes({'ip' => ip})\n end", "def change_ip\n self.connect\n self.authenticate self.password\n send_command(:signal, 'NEWNYM')\n self.close\n end", "def set_ip_address\n @ip_address = IpAddress.find(params[:id])\n end", "def setup_ip\n @request = ActionController::TestRequest.create(self.class.controller_class)\n @request.remote_addr = \"127.0.0.1\"\n session[:user_id] = 1\n end", "def set_current_ip(ip)\n @ip = ip\n end", "def set_device_ip_address(ip)\n ENV['RAILS_TEST_IP_ADDRESS'] = ip\nend", "def set_ip_adress\n @ip_adress = IpAddress.find(params[:id])\n end", "def rescue_action_in_public!\n @request.remote_addr = '208.77.188.166' # example.com\n end", "def set_ip_name\n @ip_name = IpName.find(params[:id])\n end", "def my_ip\n get(\"/tools/myip\")\n end", "def connect\n @ip = Ip.find(params[:id])\n respond_to do |format|\n format.html { redirect_to \"http://#{@ip.ip}\" }\n format.rdp { }\n format.ssh { }\n end\n end", "def local_ip\n\nend", "def run_host(ip)\n\n\t\tself.target_port = datastore['RPORT']\t\n\n\t\tbegin\n\t\t\tres = send_request_raw({\n\t\t\t\t'uri' => '/',\n\t\t\t\t'method' => 'GET'\n\t\t\t}, 10)\n\n\t\t\tif (res and res.headers['Server'])\n\t\t\t\textra = http_fingerprint(res)\n\t\t\t\tprint_status(\"#{ip} is running #{res.headers['Server']}#{extra}\")\n\n\t\t\t\trep_id = wmap_base_report_id(\n\t\t\t\t\t\twmap_target_host,\n\t\t\t\t\t\twmap_target_port,\n\t\t\t\t\t\twmap_target_ssl\n\t\t\t\t)\n\t\t\t\twmap_report(rep_id,'WEB_SERVER','TYPE',\"#{res.headers['Server']}#{extra}\",nil)\n\t\t\tend\n\t\t\t\n\t\trescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout\n\t\trescue ::Timeout::Error, ::Errno::EPIPE\n\t\tend\n\n\tend", "def set_IP(value)\n set_input(\"IP\", value)\n end", "def remote_ip\r\n@remote_ip ||= (@env[\"action_dispatch.remote_ip\"] || ip).to_s\r\nend", "def update\n @ip = AllowedIpAddress.find(params[:id])\n\n respond_to do |format|\n if @ip.update_attributes(params[:ip])\n flash[:notice] = 'Host was successfully updated.'\n format.html { redirect_to allowed_ip_address_path(@ip) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ip.errors.to_xml }\n end\n end\n end", "def ip_restrict\n allow_ips = Settings.ip_addresses.monstarlab.to_h.values.flatten\n allow_ips << \"::1\" if Rails.env.development?\n remote_ip = request.remote_ip\n\n return render_404 unless allow_ips.include? remote_ip\n end", "def send_change_ip(new_ip)\n @conn.send_msg({ :type => 'change_ip', :client => @current_name, :ip_old => @current_ip, :ip_new => new_ip }.to_json)\n @current_ip == new_ip\n end", "def set_nameserver(domain, ip)\n adminrun(\"netsh\", \"interface ip set dns \\\"VMware Network Adapter VMnet8\\\" static #{ip}\")\n end", "def vip_user\n redirect_to(root_url) unless current_user.vip?\n end", "def device_ipaddress=(_arg0); end", "def device_ipaddress=(_arg0); end", "def set_IPAddress(value)\n set_input(\"IPAddress\", value)\n end", "def authorize_me\n authorize_ip_address(Fog::CurrentMachine.ip_address)\n end", "def ip\n render text: local_ip\n end", "def jump(loc)\n @ip = loc\n end", "def jump(loc)\n @ip = loc\n end", "def jump(loc)\n @ip = loc\n end", "def request_ip(env)\n obtain_ip_from_rails(env) || obtain_ip_from_rack(env)\n end", "def ip=(value)\n if value == @defaults['ai.device.ip']\n @values.delete 'ai.device.ip' if @values.key? 'ai.device.ip'\n else\n @values['ai.device.ip'] = value\n end\n end", "def after_ip_authentication\n end", "def after_ip_authentication(_remote_ip); end", "def update_state_with_new_local_ip\n # First, find out this machine's private IP address. If multiple eth devices\n # are present, use the same one we used last time.\n all_local_ips = HelperFunctions.get_all_local_ips()\n new_private_ip = all_local_ips[@eth_interface]\n\n # Next, find out this machine's public IP address. In a cloud deployment, we\n # have to rely on the metadata server, while in a cluster deployment, it's\n # the same as the private IP.\n if [\"ec2\", \"euca\"].include?(@creds[\"infrastructure\"])\n new_public_ip = HelperFunctions.get_public_ip_from_aws_metadata_service()\n elsif @creds[\"infrastructure\"] == \"gce\"\n new_public_ip = HelperFunctions.get_public_ip_from_gce_metadata_service()\n else\n new_public_ip = new_private_ip\n end\n\n # Finally, replace anywhere that the old public or private IP addresses were\n # used with the new one.\n old_public_ip = @my_public_ip\n old_private_ip = @my_private_ip\n\n if @userappserver_public_ip == old_public_ip\n @userappserver_public_ip = new_public_ip\n end\n\n if @userappserver_private_ip == old_private_ip\n @userappserver_private_ip = new_private_ip\n end\n\n @nodes.each { |node|\n if node.public_ip == old_public_ip\n node.public_ip = new_public_ip\n end\n\n if node.private_ip == old_private_ip\n node.private_ip = new_private_ip\n end\n }\n\n if @creds[\"hostname\"] == old_public_ip\n @creds[\"hostname\"] = new_public_ip\n end\n\n if !is_cloud?\n nodes = JSON.load(@creds[\"ips\"])\n nodes.each { |node|\n if node['ip'] == old_private_ip\n node['ip'] == new_private_ip\n end\n }\n @creds[\"ips\"] = JSON.dump(nodes)\n end\n\n @app_info_map.each { |appid, app_info|\n if app_info['appengine'].nil?\n next\n end\n\n changed = false\n new_app_info = []\n app_info['appengine'].each { |location|\n host, port = location.split(\":\")\n if host == old_private_ip\n host = new_private_ip\n changed = true\n end\n new_app_info << \"#{host}:#{port}\"\n\n if changed\n app_info['appengine'] = new_app_info\n end\n }\n }\n\n @all_stats = []\n\n @my_public_ip = new_public_ip\n @my_private_ip = new_private_ip\n end", "def associate_public_ip(c)\n associate_address_with(Application.public_ip, @instance_id) if master? && Application.public_ip && !Application.public_ip.empty?\n end", "def resolve(adr)\n adr.ip = program.size\n end", "def ip; end", "def ip; end", "def clientip\n localhost ? local_ip : request.remote_ip\n end", "def check_ip; end", "def set_IPAddress(value)\n set_input(\"IPAddress\", value)\n end", "def remote_ip; end", "def mock_ip_address\n if Rails.env == 'development' || Rails.env == 'cucumber' || Rails.env == 'test'\n test_ip = ENV['RAILS_TEST_IP_ADDRESS']\n unless test_ip.nil? or test_ip.empty?\n request.instance_eval <<-EOS\n def ip\n \"#{test_ip}\"\n end\n EOS\n end\n end\n end", "def set_client_face_ip\n @client_face_ip = FaceIp.find(params[:id])\n end", "def index\n \n @ip_joins = @ipobject.saveIP(@virtualmachine.RemoteID,@virtualmachine.id)\n @ipaddresses = @virtualmachine.ipaddresses\n end", "def ip_check\n logger.warn request.remote_addr.inspect\n if Rails.env == \"production\" && !request.remote_ip.include?(\"99.166.163.112\")\n render :text => \"GETTHEFUCKOUT\"\n end\n end", "def set_ip_list\n @ip_list = IpList.find(params[:id])\n end", "def set_host\n @host = Host.find(params[:id])\n end", "def set_host\n @host = Host.find(params[:id])\n end", "def set_host\n @host = Host.find(params[:id])\n end", "def set_host\n @host = Host.find(params[:id])\n end", "def ip\n request.env['HTTP_X_FORWARDED_FOR'] || request.remote_ip \n end", "def set_ip(device_mac, ip_address, subnet_mask = '255.255.255.0', standard_gateway = '0.0.0.0', change_duration = :permanent)\n result_of device_mac, Frames::SetRequest.new.ip(ip_address, subnet_mask, standard_gateway, change_duration)\n end", "def show\n @link.clicks.create(ip_address: request.remote_ip)\n redirect_to @link.full_url\n end", "def set_host_address\n @host_address = HostAddress.find(params[:id])\n end", "def ip_lkup(ip)\n send_req({a: :ip_lkup, ip: ip})\n end", "def SetIp(node)\n \tnode.GetInterfaces().each do |ifn|\n\t self.GetGroupInterface(node, ifn).ip=\"1.1.1.1\"\n \t #self.GetGroupInterface(node, ifn).up\n\tend\n end", "def set_host\n @host = Host.find(params[:id])\n end", "def poke(app, ip)\n\t\tupdate_attribute(:client_application_id, app.id) if app\n\t\tupdate_attribute(:last_ip, ip) if ip\n\t\tupdate_attribute(:status, :online)\n\tend", "def start(target_ip, spoofed_ip, options={})\n add target_ip, spoofed_ip, options\n activate target_ip\n end", "def location\n \t#@ip = request.remote_id\n \t@ip = '118.113.226.34'\n \t@location = Rails.cache.read(@ip)\n end", "def get_ip_address \t\t\t\n\t\trequest.remote_ip \n\tend", "def replace_administrative_ip(opts)\n opts = check_params(opts,[:old_ips,:new_ips,:netmasks])\n super(opts)\n end", "def set_card_ip\n @card_ip = CardIp.find(params[:id])\n end", "def local_ip_address\n conf['base_address'] ||\n %x{ip addr show #{conf['base_interface'] || 'br0'} | grep inet}.split(' ')[1].to_s.strip.split('/').first.to_s\nend", "def ip\n @actions << :ip\n self.class.mocked_ip\n end", "def ip_check\n \tuser_ip = request.remote_ip\n\n \t# For testing purposes only!\n \t# If IP is explicitly passed then it is a test case\n \tunless (params[:ip].nil?)\n database_ip = User.exists?(:ip => params[:ip])\n else\n database_ip = User.exists?(:ip => user_ip)\n end\n\n \trespond_to do |format|\n\t \tif(database_ip)\n\t\t \tformat.html { redirect_to '/review' } # If appointment was created redirect to review\n\t\t format.json { render :show, status: :created, location: '/review' }\n\t \telse\n\t\t \tformat.html { redirect_to '/form' } # Else send to form to apply for appointment\n\t\t format.json { render :show, status: :created, location: '/form' }\n\t\tend\n\tend\n end", "def show\n @hostname.user ||= current_user\n @hostname.save\n session['user_return_to'] = hostname_path(@hostname)\n end", "def ip\n ssh.exec!(\"/sbin/ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'\").chomp\n end", "def remember_host!; end", "def host=(new_host); end", "def call(env)\n @env = env\n\n @pool = @env[:auto_network_pool]\n @machine = @env[:machine]\n\n request_address unless machine_has_address?(@machine)\n\n @app.call(@env)\n end", "def set_face_ip\n @face_ip = FaceIp.find(params[:id])\n end", "def get_tester_ip_addr\n if File.exists?(\"/var/spool/ec2/meta-data.rb\")\n require \"/var/spool/ec2/meta-data-cache\" \n else\n ENV['EC2_PUBLIC_HOSTNAME'] = \"127.0.0.1\"\n end\n my_ip_input = \"text:\" \n my_ip_input += ENV['EC2_PUBLIC_HOSTNAME']\n my_ip_input\n end", "def user_ip\n \trequest.location\n end", "def ip\n if ifconfig =~ /inet addr:([0-9.]+)/\n $1\n else\n \"0.0.0.0\"\n end\n end", "def check_correct_ip\n puts \"\"\n puts \"*************************************\"\n answer = \"n\"\n\n servers = roles[:app].servers.uniq!.join(\", \")\n\n message = \"You are about to deploy to: #{servers} do you want to continue? (y/N)\\n\"\n answer = Capistrano::CLI.ui.ask(message)\n answer = \"n\" if answer == \"\"\n unless answer.downcase == 'y' # answer.first.downcase == \"y\"\n raise \"Deploy aborted by user\"\n end\n end", "def remote_addr=(_arg0); end", "def change_address\n site = Site.find(params[:id])\n site.address = params[:url]\n site.save\n render :nothing => true\n end", "def set_vip\n @vip = Vip.find(params[:id])\n end", "def read_host_ip\n ip = read_machine_ip\n base_ip = ip.split(\".\")\n base_ip[3] = \"1\"\n base_ip.join(\".\")\n end", "def set_local_settings(app_settings)\n @log.debug \"Update net_control setting\"\n @host_server = app_settings[\"session\"][:host_server]\n @port_server = app_settings[\"session\"][:port_server]\n @login_name = app_settings[\"session\"][:login_name]\n @password_login_md5 = app_settings[\"session\"][:password_login]\n @password_saved = app_settings[\"session\"][:password_saved]\n @serv_conn_type = app_settings[\"session\"][:connect_type]\n @server_type_http = app_settings[\"web_http\"]\n @remote_web_url = app_settings[\"session\"][:remote_web_srv_url]\n @server_msg_aredebugged = app_settings[\"session\"][:debug_server_messages]\n end", "def local_ip\n Synchronizer.config['local_url']\n end", "def hostip(ip)\n if GeoLocation::dev.nil? || GeoLocation::dev.empty?\n url = \"http://api.hostip.info/?ip=#{ip}\"\n uri = URI.parse(url) \n data_from_hostip_http_response(ip, Net::HTTP.get_response(uri).body)\n else\n data_from_maxmind_http_response(ip, GeoLocation::dev)\n end\n end", "def redirect_to_user_home\n redirect_to :controller=>'virtual_machines', :action=>'index'\n end", "def authorize_ip_address(ip)\n authorize_cidrip(\"#{ip}/32\")\n end", "def get_tester_ip_addr\n if File.exists?(\"/var/spool/ec2/meta-data.rb\")\n require \"/var/spool/ec2/meta-data-cache\" \n else\n ENV['EC2_PUBLIC_HOSTNAME'] = \"127.0.0.1\"\n end\n my_ip_input = \"text:\" \n my_ip_input += ENV['EC2_PUBLIC_HOSTNAME']\n my_ip_input\n end", "def get_tester_ip_addr\n if File.exists?(\"/var/spool/ec2/meta-data.rb\")\n require \"/var/spool/ec2/meta-data-cache\" \n else\n ENV['EC2_PUBLIC_HOSTNAME'] = \"127.0.0.1\"\n end\n my_ip_input = \"text:\" \n my_ip_input += ENV['EC2_PUBLIC_HOSTNAME']\n my_ip_input\n end", "def save_ip_addr\n self.ip_address = IPAddr.new(self.ip_address).to_i.to_s(16).rjust(8, \"0\")\n end", "def ass_ip(instance_id, ip)\n @connection.get 'AssociateEip', {\n eip: ip,\n instance: instance_id,\n zone: 'sh1a'\n }\n end", "def check\n uri = URI.parse(\"https://ifconfig.co/ip\")\n begin\n response = Net::HTTP.get_response(uri)\n if response.code == \"200\" || response.code == 200\n current_ip = \"#{response.body}\".strip\n saved_ip = \"#{read_current_ip}\".strip\n if current_ip != saved_ip\n logger.log(\"New IP: #{current_ip}\")\n slack_notifier.log(\"New IP: #{current_ip}\")\n write_current_ip(current_ip)\n end\n else\n logger.log(\"Cannot Reach ifconfig.co\")\n end\n rescue => e\n logger.log(\"Error checking IFCONFIG\")\n logger.log(\"#{e.inspect}\")\n end\n nil\n end", "def ip\n @values.fetch('ai.device.ip') { \n @values['ai.device.ip'] = nil\n }\n end", "def get_remote_ip(env)\n# X-Forwarded-For provides a list of IP addresses, from the calling client to the last proxy:\n# X-Forwarded-For: client1, proxy1, proxy2\n if addr = env['HTTP_X_FORWARDED_FOR']\n addr.split(',').first.strip\n else\n env['REMOTE_ADDR'] # Only gives the IP address of the last proxy.\n end\nend", "def write_apploadbalancer_location()\n login_file = \"#{CONFIG_FILE_LOCATION}/appdashboard_public_ip\"\n login_ip = get_login.public_ip()\n HelperFunctions.write_file(login_file, login_ip)\n end", "def ip_address(env)\n ip_address_record(env)[:address]\n end", "def run_host(ip)\n\n\t\tverbs = [\n\t\t\t\t'get',\n\t\t\t\t'active',\n\t\t\t\t'create',\n\t\t\t\t'change',\n\t\t\t\t'set',\n\t\t\t\t'put',\n\t\t\t\t'do',\n\t\t\t\t'go',\n\t\t\t\t'resolve',\n\t\t\t\t'start',\n\t\t\t\t'recover',\n\t\t\t\t'initiate',\n\t\t\t\t'negotiate',\n\t\t\t\t'define',\n\t\t\t\t'stop',\n\t\t\t\t'begin',\n\t\t\t\t'end',\n\t\t\t\t'manage',\n\t\t\t\t'administer',\n\t\t\t\t'modify',\n\t\t\t\t'register',\n\t\t\t\t'log',\n\t\t\t\t'add',\n\t\t\t\t#'delete', # Best to be safe!\n\t\t\t]\n\n\t\tnouns = [\n\t\t\t\t'password',\n\t\t\t\t'task',\n\t\t\t\t'pass',\n\t\t\t\t'administration',\n\t\t\t\t'account',\n\t\t\t\t'admin',\n\t\t\t\t'login',\n\t\t\t\t'token',\n\t\t\t\t'credentials',\n\t\t\t\t'credential',\n\t\t\t\t'key',\n\t\t\t\t'guid',\n\t\t\t\t'message',\n\t\t\t\t'user',\n\t\t\t\t'username',\n\t\t\t\t'load',\n\t\t\t\t'list',\n\t\t\t\t'name',\n\t\t\t\t'file',\n\t\t\t\t'path',\n\t\t\t\t'directory',\n\t\t\t\t'configuration',\n\t\t\t\t'config',\n\t\t\t\t'setting',\n\t\t\t\t'settings',\n\t\t\t\t'registry',\n\t\t\t\t'on',\n\t\t\t\t'off',\n\t\t\t]\n\n\t\ttarget_port = datastore['RPORT']\n\t\tvhost = datastore['VHOST'] || wmap_target_host || ip\n\n\t\tbegin\n\t\t\t# Check service exists\n\t\t\tres = send_request_raw({\n\t\t\t\t'uri' => datastore['PATH'],\n\t\t\t\t'method' => 'GET',\n\t\t\t\t'vhost' => vhost,\n\t\t\t}, 10)\n\n\t\t\tif (res.code == 200)\n\t\t\t\tprint_status(\"PATH appears to be OK.\")\n\n\t\t\t\tverbs.each do |v|\n\t\t\t\t\tnouns.each do |n|\n\n\t\t\t\t\t\t# This could be cleaned up - patrickw\n\t\t\t\t\t\tdata = '<?xml version=\"1.0\" encoding=\"utf-8\"?>' + \"\\r\\n\"\n\t\t\t\t\t\tdata << '<soap:Envelope xmlns:xsi=\"' + datastore['XMLINSTANCE'] + '\" xmlns:xsd=\"' + datastore['XMLSCHEMA'] + '\" xmlns:soap=\"' + datastore['XMLSOAP'] + '\">' + \"\\r\\n\"\n\t\t\t\t\t\tdata << '<soap:Body>' + \"\\r\\n\"\n\t\t\t\t\t\tdata << \"<#{v}#{n}\" + \" xmlns=\\\"#{datastore['XMLNAMESPACE']}\\\">\" + \"\\r\\n\"\n\t\t\t\t\t\tdata << \"</#{v}#{n}>\" + \"\\r\\n\"\n\t\t\t\t\t\tdata << '</soap:Body>' + \"\\r\\n\"\n\t\t\t\t\t\tdata << '</soap:Envelope>' + \"\\r\\n\\r\\n\"\n\n\t\t\t\t\t\tres = send_request_raw({\n\t\t\t\t\t\t\t'uri' => datastore['PATH'] + '/' + v + n,\n\t\t\t\t\t\t\t'method' => 'POST',\n\t\t\t\t\t\t\t'vhost' => vhost,\n\t\t\t\t\t\t\t'data'\t\t=> data,\n\t\t\t\t\t\t\t'headers' =>\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'Content-Length' => data.length,\n\t\t\t\t\t\t\t\t\t'SOAPAction'\t=> '\"' + datastore['XMLNAMESPACE'] + v + n + '\"',\n\t\t\t\t\t\t\t\t\t'Expect'\t=> '100-continue',\n\t\t\t\t\t\t\t\t\t'Content-Type'\t=> datastore['CONTENTTYPE'],\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}, 15)\n\n\t\t\t\t\t\tif (res && !(res.body.empty?))\n\t\t\t\t\t\t\tif (res.body =~ /method name is not valid/)\n\t\t\t\t\t\t\t\tprint_status(\"Server rejected SOAPAction: #{v}#{n} with HTTP: #{res.code} #{res.message}.\")\n\t\t\t\t\t\t\telsif (res.message =~ /Cannot process the message because the content type/)\n\t\t\t\t\t\t\t\tprint_status(\"Server rejected CONTENTTYPE: HTTP: #{res.code} #{res.message}.\")\n\t\t\t\t\t\t\t\tres.message =~ /was not the expected type\\s\\'([^']+)'/\n\t\t\t\t\t\t\t\tprint_status(\"Set CONTENTTYPE to \\\"#{$1}\\\"\")\n\t\t\t\t\t\t\t\treturn false\n\t\t\t\t\t\t\telsif (res.code == 404)\n\t\t\t\t\t\t\t\treturn false\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tprint_status(\"Server responded to SOAPAction: #{v}#{n} with HTTP: #{res.code} #{res.message}.\")\n\t\t\t\t\t\t\t\t## Add Report\n\t\t\t\t\t\t\t\treport_note(\n\t\t\t\t\t\t\t\t\t:host\t=> ip,\n\t\t\t\t\t\t\t\t\t:proto\t=> 'HTTP',\n\t\t\t\t\t\t\t\t\t:port\t=> rport,\n\t\t\t\t\t\t\t\t\t:type\t=> \"SOAPAction: #{v}#{n}\",\n\t\t\t\t\t\t\t\t\t:data\t=> \"SOAPAction: #{v}#{n} with HTTP: #{res.code} #{res.message}.\"\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\tif datastore['DISPLAYHTML']\n\t\t\t\t\t\t\t\t\tprint_status(\"The HTML content follows:\")\n\t\t\t\t\t\t\t\t\tprint_status(res.body + \"\\r\\n\")\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\telse\n\t\t\tprint_status(\"Server did not respond with 200 OK.\")\n\t\t\tprint_status(res.to_s)\n\t\tend\n\t\trescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout\n\t\trescue ::Timeout::Error, ::Errno::EPIPE\n\t\tend\n\tend", "def regist_ip\n puts 'Registering IP address of this node'\n\n sock = TCPSocket.open($leader_ip)\n sock.write(\"regist\")\n ret_ip = sock.gets\n sock.close\n return ret_ip\n end", "def set_origin\n return unless route_request? && (params[:action] == 'index')\n origin = (params[:controller].presence unless request.path == root_path)\n session['app.origin'] = origin || 'root'\n end", "def ip\n @vps.ip \n end", "def scan_host(ip)\n if spoofed?\n datastore['ScannerRecvWindow'] = 0\n scanner_spoof_send(@probe, ip, datastore['RPORT'], datastore['SRCIP'], datastore['NUM_REQUESTS'])\n else\n scanner_send(@probe, ip, datastore['RPORT'])\n end\n end", "def routing\n if Vagrant::Util::Platform.darwin?\n @gateway = `route -n get default | grep 'gateway' | awk '{print $2}'`.delete(\"\\n\")\n elsif Vagrant::Util::Platform.linux?\n # Not tested\n @gateway = `ip route show`[/default.*/][/\\d+\\.\\d+\\.\\d+\\.\\d+/]\n end\n\n $vagrant.vm.provision :shell,\n run: \"always\",\n path: File.join(__dir__, \"../\", \"/utils/routing.py\"),\n args: \"#{@gateway}\"\n end" ]
[ "0.64206463", "0.61753833", "0.6172101", "0.6138652", "0.60515815", "0.6035928", "0.60241747", "0.60093385", "0.60051876", "0.6001638", "0.5934353", "0.5901277", "0.5892654", "0.5849963", "0.58456933", "0.5815324", "0.58004975", "0.5773114", "0.57495487", "0.5724904", "0.5721107", "0.57115173", "0.57115173", "0.5670934", "0.564054", "0.56388706", "0.5632449", "0.5632449", "0.5632449", "0.5630731", "0.56214076", "0.55933815", "0.5566871", "0.55653965", "0.5554784", "0.5518158", "0.55066955", "0.55066955", "0.54899895", "0.54881763", "0.5487209", "0.5483576", "0.5479015", "0.54558545", "0.54368526", "0.5427497", "0.54243296", "0.5423274", "0.5423274", "0.5423274", "0.5423274", "0.54115224", "0.5399325", "0.5391107", "0.5387875", "0.5386449", "0.5384247", "0.53825295", "0.5375312", "0.53713614", "0.5369297", "0.5367939", "0.53585863", "0.5357594", "0.53407264", "0.53277296", "0.5323508", "0.5313303", "0.53054476", "0.5304453", "0.53026056", "0.52982205", "0.52944344", "0.5292361", "0.528307", "0.5274495", "0.52698874", "0.5259478", "0.52524436", "0.5249923", "0.5242184", "0.524173", "0.5239647", "0.52392554", "0.52373", "0.5226561", "0.52160466", "0.52160466", "0.52156776", "0.52140087", "0.5209935", "0.5205946", "0.5201944", "0.51987493", "0.5197217", "0.5192778", "0.51817584", "0.5181673", "0.51672935", "0.51626956", "0.5162137" ]
0.0
-1
GET /posts GET /posts.xml
def index # @posts = Post.all(:order => "created_at DESC") @posts = Post.paginate :page => params[:page], :per_page => 24, :order => "created_at DESC" respond_to do |format| format.html # index.html.erb format.xml { render :xml => @posts } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @post }\n format.xml { render xml: @posts }\n end\n end", "def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end", "def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end", "def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.xml { render xml: @posts }\n end\n end", "def index\n @posts = Post.find(:all, :order=>'created_on DESC')\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @posts.to_xml }\n end\n end", "def index\n @posts = Post.find(:all, :order => :created_at)\n\n respond_to do |format|\n format.html # index.rhtml\n# format.xml { render :xml => @posts.to_xml }\n end\n end", "def index\n @posts = Post.find_list(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end", "def feed\r\n @posts = Post.all(:order => \"created_at DESC\")\r\n respond_to do |format|\r\n format.rss\r\n end\r\n end", "def index\n @posts = Post.order(created_at: :desc)\n respond_to do |format|\n format.html { render }\n format.text { render }\n format.xml { render xml: @posts }\n format.json { render json: @posts.to_json }\n end\n end", "def list\r\n @posts = Post.paginate :page => params[:page], :per_page => 24, :order => \"created_at DESC\"\r\n\r\n respond_to do |format|\r\n\r\n format.html # list.html.erb\r\n format.xml { render :xml => @posts }\r\n end\r\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n format.json { render :json => @post }\n format.rss { render :layout => false }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def index\n @posts = Post.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts,:layout => false }\n end\n end", "def index\n @posts = Post.published.page(params[:page]).per(5).ordered\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @post.to_xml }\n end\n end", "def index\n @posts = Post.paginate(:page=>params[:page], :order=>'created_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def list_posts(api_object)\r\n puts \"Current Post:\"\r\n doc = Nokogiri::XML.parse api_object.read\r\n contents= doc.xpath('posts/post/content').collect {|e| e.text }\r\n puts contents.join(\", \")\r\n puts \"\"\r\nend", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def index\n @posts = Post.find(:all,:order => 'created_at DESC').paginate(:per_page => 5, :page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end", "def show\n\t\t@post = Post.find(params[:id])\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.xml { render:xml => @post}\n\t\tend\n\tend", "def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.atom\n end\n end", "def show\n @post = Post.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n# format.xml { render :xml => @post.to_xml }\n end\n end", "def index\n @posts = Post.all\n\n @title = \"Blog Management\"\n\n respond_to do |format| \n format.html { render :index }\n format.xml { render :xml => @posts.to_xml}\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end", "def show\n r = PostRepository.new\n @post = r.GetPost(\"PostID\", params[:id].to_i)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end \n end", "def show\n @post = Post.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def index\n respond_with(@posts) do |format|\n format.html do\n return redirect_to blog_path, :status => 301 if request.path =~ /^\\/posts(\\/?)$/ && flash.empty?\n\n @posts = user_signed_in? ? Post.latest : Post.published.latest\n @posts = @posts.paginate :page => params[:page], :per_page => Post.per_page\n end\n\n format.rss { @posts = Post.published.latest }\n end\n end", "def index\n authorize! :read, Post\n @posts = Post.accessible_by(current_ability).order('created_at DESC').paginate(:per_page => 15, :page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n format.rss { render :layout => false } \n end\n end", "def index\n @title = \"Home\"\n @posts = Post.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n format.json { render :json => @posts }\n format.atom # index.atom.builder\n end\n end", "def index\n # @posts = Post.paginate :page => params[:page]\n @posts = Post.paginate :page => params[:page], :per_page => 2\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end", "def index\n @posts = Post.limit 50\n @title = \"Weblog - last posts\"\n @updated = @posts.first.created_at unless @posts.empty?\n respond_to do |format|\n format.rss do\n redirect_to feeds_path(format: :atom),\n status: :moved_permanently\n end\n format.atom\n end\n end", "def posts(opts)\n response = get(\"posts\", opts)\n response\n end", "def index\n @posts = Mist::Post.recently_published(20, Mist.authorized?(:view_drafts, self))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @posts }\n end\n end", "def show\n @post251 = Post251.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post251 }\n end\n end", "def index\n @posts = Post.order(\"created_at DESC\").where(:published => true).limit(5)\n @title = \"Home\"\n @description = \"the blog and website of bassist and programmer Johnny Grubb. no baseball information here.\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.xml\n end\n end", "def index\n @posts = if params[:tag]\n Post.tagged_with(params[:tag])\n else\n Post.scoped\n end\n @posts = @posts.where(:published => true).order(\"created_at DESC\")\n @posts = @posts.paginate(:page => params[:page], :per_page => 4) unless params[:count] == \"all\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.rss { render :layout => false }\n format.xml { render :xml => @posts }\n end\n end", "def show\n #render :template => 'posts/show.xml.builder', :layout => false\n render :json => @post, :layout => false\n end", "def show\n @feed = Feed.find(params[:id])\n @posts = @feed.posts.order(\"published desc\").paginate(:page => params[:page], :per_page => 20)\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feed }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feed }\n end\n end", "def show\n provides :xml, :json\n \n @post = Post[params[:id]]\n \n if content_type == :html\n render\n else\n display @post\n end\n end", "def index\n respond_to do |format|\n format.html { \n @posts = Post.search(params[:search_title], params[:search_tags], params[:page])\n }\n \n format.rss { \n @posts = Post.all(:limit => RSS_ITEM_LIMIT, :order => \"created_at DESC\")\n render :layout => false \n }\n\n format.xml { \n @posts = Post.all\n render :xml => @posts\n }\n \n format.json { \n @posts = Post.all\n render :json => @posts\n }\n end\n end", "def index\n\t@posts = list_posts\n end", "def index \n authorize! :read, Post\n @posts = Post.find(:all, :order => \"created_at DESC\")\n respond_to do |format|\n format.html\n format.atom\n end\n\n end", "def rss\n @events = Post.find(:all, {:conditions=> \"status=public\"},:order => \"id DESC\")\n render :layout => false\n headers[\"Content-Type\"] = \"application/xml; charset=utf-8\"\n end", "def show\n @post134 = Post134.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post134 }\n end\n end", "def index\n @posts = PostService.getAllPosts\n end", "def show\n @post125 = Post125.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post125 }\n end\n end", "def show\n @post101 = Post101.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post101 }\n end\n end", "def index\n\n\t\t# GET ALL THE BLOG POSTS\n @posts = Post.find(:all, :limit => 5)\n @downloads = Download.find(:all, :limit => 5, :conditions => {:parent_id => nil})\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end", "def show\n @post246 = Post246.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post246 }\n end\n end", "def show\n @post78 = Post78.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post78 }\n end\n end", "def show\n @post99 = Post99.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post99 }\n end\n end", "def show\n @post120 = Post120.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post120 }\n end\n end", "def show\n @post57 = Post57.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post57 }\n end\n end", "def index\n if params[:all]\n @posts = Post.all\n elsif\n @posts = Post.tagged_with(\"blog\")\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end", "def index\n @post_categories = PostCategory.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @post_categories }\n end\n end", "def show\n @post181 = Post181.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post181 }\n end\n end", "def index\n @feeds = Feed.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @feeds.to_xml }\n end\n end", "def index\n options = {:page => params[:page] || 1, :per_page => 2}\n @posts = (params[:tag].blank? ? Post.published.search(params[:search], options) : Post.published.paginate_tagged_with(params[:tag], options))\n respond_to do |format|\n format.html{}\n format.xml{ render :xml => @posts }\n end\n end", "def show\n @post253 = Post253.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post253 }\n end\n end", "def show\n @post342 = Post342.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post342 }\n end\n end", "def show\n @post75 = Post75.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post75 }\n end\n end", "def rss\n @headers[\"Content-Type\"] = \"application/xml\"\n @articles = Article.find(:all, \n :order => 'created_at DESC',\n :conditions => [\"articles.approved = ?\", true],\n :limit => 10\n )\n render :layout => false\n end", "def show\n @post81 = Post81.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post81 }\n end\n end", "def show\n @post182 = Post182.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post182 }\n end\n end", "def index\n @posts = Post.search(params[:search], params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n format.js\n format.atom\n end\n end", "def show\n @post55 = Post55.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post55 }\n end\n end", "def show\n @post77 = Post77.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post77 }\n end\n end", "def show\n @post257 = Post257.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post257 }\n end\n end", "def show\n @post445 = Post445.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post445 }\n end\n end", "def show\n @feed = Feed.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @feed.to_xml }\n end\n end", "def show\n @post66 = Post66.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post66 }\n end\n end", "def show\n @blog_post = BlogPost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @blog_post }\n end\n end", "def show\n @post107 = Post107.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post107 }\n end\n end", "def show\n @post321 = Post321.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post321 }\n end\n end", "def show\n @post231 = Post231.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post231 }\n end\n end", "def show\n @post105 = Post105.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post105 }\n end\n end", "def index\n @articles = Article.published\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @articles }\n end\n end", "def index\n # TODO: implement listing all posts\n end", "def index\n @page[:per_page] = params[:limit] || 5\n @blog_posts = BlogPost.order(@order).paginate(@page)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @blog_posts, callback: params[:callback] }\n format.xml { render xml: @blog_posts }\n format.rss { render 'feed' }\n end\n end", "def show\n @post109 = Post109.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post109 }\n end\n end", "def show\n @post184 = Post184.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post184 }\n end\n end", "def show\n @post74 = Post74.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post74 }\n end\n end", "def show\n @post117 = Post117.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post117 }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n make_rss\n end", "def show\n @post10 = Post10.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post10 }\n end\n end", "def show\n @post = Post.find(params[:id], :include => [:blog, :comments, :user, :tags])\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @post }\n end\n end", "def index\n @posts = Post.all\n @title=\"All LitwakRecommends Posts\"\n\t@metadescription = \"Listing of all Posts for LitwakRecommends travel blog\"\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end" ]
[ "0.73163414", "0.72102565", "0.72102565", "0.70133805", "0.69922805", "0.69905823", "0.6946224", "0.68449396", "0.6825624", "0.68239427", "0.67839086", "0.67474705", "0.6744808", "0.67014694", "0.66831535", "0.66570085", "0.66536814", "0.6641173", "0.6569632", "0.6569632", "0.6569632", "0.6569632", "0.6569632", "0.6569632", "0.6569632", "0.6569632", "0.6569632", "0.6569632", "0.6569632", "0.65689623", "0.6562864", "0.6548791", "0.65417695", "0.65400404", "0.6532962", "0.6532095", "0.6509035", "0.6509035", "0.6451045", "0.6432708", "0.64157194", "0.64118004", "0.6391085", "0.63896364", "0.63731444", "0.63691884", "0.6361821", "0.6360292", "0.63583076", "0.63511515", "0.6342905", "0.6339071", "0.63336664", "0.63287073", "0.6324601", "0.63148195", "0.6311334", "0.6296899", "0.6286889", "0.62864393", "0.62858725", "0.62757164", "0.62744164", "0.6268504", "0.6262129", "0.6247976", "0.6244519", "0.6240205", "0.6239487", "0.6233154", "0.6226862", "0.62248725", "0.6223015", "0.62088597", "0.62063754", "0.6198131", "0.6196574", "0.6194646", "0.61905736", "0.6187951", "0.6187811", "0.6174592", "0.617229", "0.6170761", "0.61688745", "0.61672014", "0.6162086", "0.616047", "0.6160359", "0.6157711", "0.6154687", "0.6154447", "0.61543655", "0.61533695", "0.615046", "0.61485565", "0.6146997", "0.6145814", "0.61350554", "0.61348975" ]
0.6423995
40
GET /posts GET /posts.xml
def search @search = Post.search(params[:search]) @posts = @search.all @posts = @search.paginate :page => params[:page], :per_page => 24, :order => "created_at DESC" @posts_count = @search.count # @search = Post.offer_like_any(params[:search]) # @posts = @search.all.paginate :page => params[:page], :per_page => 24, :order => "created_at DESC" # @posts = Post.offer_like_any(params[:search].to_s.split).paginate :page => params[:page], :per_page => 24, :order => "created_at DESC" # @posts = Post.company_like_any(params[:search].to_s.split).paginate :page => params[:page], :per_page => 24, :order => "created_at DESC" respond_to do |format| format.html # search.html.erb format.xml { render :xml => @posts } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @post }\n format.xml { render xml: @posts }\n end\n end", "def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end", "def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end", "def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.xml { render xml: @posts }\n end\n end", "def index\n @posts = Post.find(:all, :order=>'created_on DESC')\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @posts.to_xml }\n end\n end", "def index\n @posts = Post.find(:all, :order => :created_at)\n\n respond_to do |format|\n format.html # index.rhtml\n# format.xml { render :xml => @posts.to_xml }\n end\n end", "def index\n @posts = Post.find_list(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end", "def feed\r\n @posts = Post.all(:order => \"created_at DESC\")\r\n respond_to do |format|\r\n format.rss\r\n end\r\n end", "def index\n @posts = Post.order(created_at: :desc)\n respond_to do |format|\n format.html { render }\n format.text { render }\n format.xml { render xml: @posts }\n format.json { render json: @posts.to_json }\n end\n end", "def list\r\n @posts = Post.paginate :page => params[:page], :per_page => 24, :order => \"created_at DESC\"\r\n\r\n respond_to do |format|\r\n\r\n format.html # list.html.erb\r\n format.xml { render :xml => @posts }\r\n end\r\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n format.json { render :json => @post }\n format.rss { render :layout => false }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def index\n @posts = Post.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts,:layout => false }\n end\n end", "def index\n @posts = Post.published.page(params[:page]).per(5).ordered\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @post.to_xml }\n end\n end", "def index\n @posts = Post.paginate(:page=>params[:page], :order=>'created_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def list_posts(api_object)\r\n puts \"Current Post:\"\r\n doc = Nokogiri::XML.parse api_object.read\r\n contents= doc.xpath('posts/post/content').collect {|e| e.text }\r\n puts contents.join(\", \")\r\n puts \"\"\r\nend", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def index\n @posts = Post.find(:all,:order => 'created_at DESC').paginate(:per_page => 5, :page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end", "def show\n\t\t@post = Post.find(params[:id])\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.xml { render:xml => @post}\n\t\tend\n\tend", "def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.atom\n end\n end", "def show\n @post = Post.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n# format.xml { render :xml => @post.to_xml }\n end\n end", "def index\n @posts = Post.all\n\n @title = \"Blog Management\"\n\n respond_to do |format| \n format.html { render :index }\n format.xml { render :xml => @posts.to_xml}\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end", "def show\n r = PostRepository.new\n @post = r.GetPost(\"PostID\", params[:id].to_i)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end \n end", "def show\n @post = Post.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def index\n respond_with(@posts) do |format|\n format.html do\n return redirect_to blog_path, :status => 301 if request.path =~ /^\\/posts(\\/?)$/ && flash.empty?\n\n @posts = user_signed_in? ? Post.latest : Post.published.latest\n @posts = @posts.paginate :page => params[:page], :per_page => Post.per_page\n end\n\n format.rss { @posts = Post.published.latest }\n end\n end", "def index\n authorize! :read, Post\n @posts = Post.accessible_by(current_ability).order('created_at DESC').paginate(:per_page => 15, :page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n format.rss { render :layout => false } \n end\n end", "def index\r\n # @posts = Post.all(:order => \"created_at DESC\")\r\n @posts = Post.paginate :page => params[:page], :per_page => 24, :order => \"created_at DESC\"\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @posts }\r\n end\r\n end", "def index\n @title = \"Home\"\n @posts = Post.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n format.json { render :json => @posts }\n format.atom # index.atom.builder\n end\n end", "def index\n # @posts = Post.paginate :page => params[:page]\n @posts = Post.paginate :page => params[:page], :per_page => 2\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end", "def index\n @posts = Post.limit 50\n @title = \"Weblog - last posts\"\n @updated = @posts.first.created_at unless @posts.empty?\n respond_to do |format|\n format.rss do\n redirect_to feeds_path(format: :atom),\n status: :moved_permanently\n end\n format.atom\n end\n end", "def posts(opts)\n response = get(\"posts\", opts)\n response\n end", "def index\n @posts = Mist::Post.recently_published(20, Mist.authorized?(:view_drafts, self))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @posts }\n end\n end", "def show\n @post251 = Post251.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post251 }\n end\n end", "def index\n @posts = Post.order(\"created_at DESC\").where(:published => true).limit(5)\n @title = \"Home\"\n @description = \"the blog and website of bassist and programmer Johnny Grubb. no baseball information here.\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.xml\n end\n end", "def index\n @posts = if params[:tag]\n Post.tagged_with(params[:tag])\n else\n Post.scoped\n end\n @posts = @posts.where(:published => true).order(\"created_at DESC\")\n @posts = @posts.paginate(:page => params[:page], :per_page => 4) unless params[:count] == \"all\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.rss { render :layout => false }\n format.xml { render :xml => @posts }\n end\n end", "def show\n #render :template => 'posts/show.xml.builder', :layout => false\n render :json => @post, :layout => false\n end", "def show\n @feed = Feed.find(params[:id])\n @posts = @feed.posts.order(\"published desc\").paginate(:page => params[:page], :per_page => 20)\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feed }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feed }\n end\n end", "def show\n provides :xml, :json\n \n @post = Post[params[:id]]\n \n if content_type == :html\n render\n else\n display @post\n end\n end", "def index\n respond_to do |format|\n format.html { \n @posts = Post.search(params[:search_title], params[:search_tags], params[:page])\n }\n \n format.rss { \n @posts = Post.all(:limit => RSS_ITEM_LIMIT, :order => \"created_at DESC\")\n render :layout => false \n }\n\n format.xml { \n @posts = Post.all\n render :xml => @posts\n }\n \n format.json { \n @posts = Post.all\n render :json => @posts\n }\n end\n end", "def index\n\t@posts = list_posts\n end", "def index \n authorize! :read, Post\n @posts = Post.find(:all, :order => \"created_at DESC\")\n respond_to do |format|\n format.html\n format.atom\n end\n\n end", "def rss\n @events = Post.find(:all, {:conditions=> \"status=public\"},:order => \"id DESC\")\n render :layout => false\n headers[\"Content-Type\"] = \"application/xml; charset=utf-8\"\n end", "def show\n @post134 = Post134.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post134 }\n end\n end", "def index\n @posts = PostService.getAllPosts\n end", "def show\n @post125 = Post125.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post125 }\n end\n end", "def show\n @post101 = Post101.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post101 }\n end\n end", "def index\n\n\t\t# GET ALL THE BLOG POSTS\n @posts = Post.find(:all, :limit => 5)\n @downloads = Download.find(:all, :limit => 5, :conditions => {:parent_id => nil})\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end", "def show\n @post246 = Post246.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post246 }\n end\n end", "def show\n @post78 = Post78.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post78 }\n end\n end", "def show\n @post99 = Post99.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post99 }\n end\n end", "def show\n @post120 = Post120.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post120 }\n end\n end", "def show\n @post57 = Post57.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post57 }\n end\n end", "def index\n if params[:all]\n @posts = Post.all\n elsif\n @posts = Post.tagged_with(\"blog\")\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end", "def index\n @post_categories = PostCategory.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @post_categories }\n end\n end", "def show\n @post181 = Post181.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post181 }\n end\n end", "def index\n @feeds = Feed.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @feeds.to_xml }\n end\n end", "def index\n options = {:page => params[:page] || 1, :per_page => 2}\n @posts = (params[:tag].blank? ? Post.published.search(params[:search], options) : Post.published.paginate_tagged_with(params[:tag], options))\n respond_to do |format|\n format.html{}\n format.xml{ render :xml => @posts }\n end\n end", "def show\n @post253 = Post253.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post253 }\n end\n end", "def show\n @post342 = Post342.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post342 }\n end\n end", "def show\n @post75 = Post75.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post75 }\n end\n end", "def rss\n @headers[\"Content-Type\"] = \"application/xml\"\n @articles = Article.find(:all, \n :order => 'created_at DESC',\n :conditions => [\"articles.approved = ?\", true],\n :limit => 10\n )\n render :layout => false\n end", "def show\n @post81 = Post81.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post81 }\n end\n end", "def show\n @post182 = Post182.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post182 }\n end\n end", "def index\n @posts = Post.search(params[:search], params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n format.js\n format.atom\n end\n end", "def show\n @post55 = Post55.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post55 }\n end\n end", "def show\n @post77 = Post77.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post77 }\n end\n end", "def show\n @post257 = Post257.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post257 }\n end\n end", "def show\n @post445 = Post445.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post445 }\n end\n end", "def show\n @feed = Feed.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @feed.to_xml }\n end\n end", "def show\n @post66 = Post66.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post66 }\n end\n end", "def show\n @blog_post = BlogPost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @blog_post }\n end\n end", "def show\n @post107 = Post107.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post107 }\n end\n end", "def show\n @post321 = Post321.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post321 }\n end\n end", "def show\n @post231 = Post231.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post231 }\n end\n end", "def show\n @post105 = Post105.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post105 }\n end\n end", "def index\n @articles = Article.published\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @articles }\n end\n end", "def index\n # TODO: implement listing all posts\n end", "def index\n @page[:per_page] = params[:limit] || 5\n @blog_posts = BlogPost.order(@order).paginate(@page)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @blog_posts, callback: params[:callback] }\n format.xml { render xml: @blog_posts }\n format.rss { render 'feed' }\n end\n end", "def show\n @post109 = Post109.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post109 }\n end\n end", "def show\n @post184 = Post184.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post184 }\n end\n end", "def show\n @post74 = Post74.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post74 }\n end\n end", "def show\n @post117 = Post117.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post117 }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n make_rss\n end", "def show\n @post10 = Post10.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post10 }\n end\n end", "def show\n @post = Post.find(params[:id], :include => [:blog, :comments, :user, :tags])\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @post }\n end\n end", "def index\n @posts = Post.all\n @title=\"All LitwakRecommends Posts\"\n\t@metadescription = \"Listing of all Posts for LitwakRecommends travel blog\"\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end" ]
[ "0.73163414", "0.72102565", "0.72102565", "0.70133805", "0.69922805", "0.69905823", "0.6946224", "0.68449396", "0.6825624", "0.68239427", "0.67839086", "0.67474705", "0.6744808", "0.67014694", "0.66831535", "0.66570085", "0.66536814", "0.6641173", "0.6569632", "0.6569632", "0.6569632", "0.6569632", "0.6569632", "0.6569632", "0.6569632", "0.6569632", "0.6569632", "0.6569632", "0.6569632", "0.65689623", "0.6562864", "0.6548791", "0.65417695", "0.65400404", "0.6532962", "0.6532095", "0.6509035", "0.6509035", "0.6451045", "0.6432708", "0.6423995", "0.64157194", "0.64118004", "0.6391085", "0.63896364", "0.63731444", "0.63691884", "0.6361821", "0.6360292", "0.63583076", "0.63511515", "0.6342905", "0.6339071", "0.63336664", "0.63287073", "0.6324601", "0.63148195", "0.6311334", "0.6296899", "0.6286889", "0.62864393", "0.62858725", "0.62757164", "0.62744164", "0.6268504", "0.6262129", "0.6247976", "0.6244519", "0.6240205", "0.6239487", "0.6233154", "0.6226862", "0.62248725", "0.6223015", "0.62088597", "0.62063754", "0.6198131", "0.6196574", "0.6194646", "0.61905736", "0.6187951", "0.6187811", "0.6174592", "0.617229", "0.6170761", "0.61688745", "0.61672014", "0.6162086", "0.616047", "0.6160359", "0.6157711", "0.6154687", "0.6154447", "0.61543655", "0.61533695", "0.615046", "0.61485565", "0.6146997", "0.6145814", "0.61350554", "0.61348975" ]
0.0
-1
GET /posts GET /posts.xml
def list @posts = Post.paginate :page => params[:page], :per_page => 24, :order => "created_at DESC" respond_to do |format| format.html # list.html.erb format.xml { render :xml => @posts } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @post }\n format.xml { render xml: @posts }\n end\n end", "def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end", "def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end", "def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.xml { render xml: @posts }\n end\n end", "def index\n @posts = Post.find(:all, :order=>'created_on DESC')\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @posts.to_xml }\n end\n end", "def index\n @posts = Post.find(:all, :order => :created_at)\n\n respond_to do |format|\n format.html # index.rhtml\n# format.xml { render :xml => @posts.to_xml }\n end\n end", "def index\n @posts = Post.find_list(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end", "def feed\r\n @posts = Post.all(:order => \"created_at DESC\")\r\n respond_to do |format|\r\n format.rss\r\n end\r\n end", "def index\n @posts = Post.order(created_at: :desc)\n respond_to do |format|\n format.html { render }\n format.text { render }\n format.xml { render xml: @posts }\n format.json { render json: @posts.to_json }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n format.json { render :json => @post }\n format.rss { render :layout => false }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def index\n @posts = Post.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts,:layout => false }\n end\n end", "def index\n @posts = Post.published.page(params[:page]).per(5).ordered\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @post.to_xml }\n end\n end", "def index\n @posts = Post.paginate(:page=>params[:page], :order=>'created_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def list_posts(api_object)\r\n puts \"Current Post:\"\r\n doc = Nokogiri::XML.parse api_object.read\r\n contents= doc.xpath('posts/post/content').collect {|e| e.text }\r\n puts contents.join(\", \")\r\n puts \"\"\r\nend", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def index\n @posts = Post.find(:all,:order => 'created_at DESC').paginate(:per_page => 5, :page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end", "def show\n\t\t@post = Post.find(params[:id])\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.xml { render:xml => @post}\n\t\tend\n\tend", "def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.atom\n end\n end", "def show\n @post = Post.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n# format.xml { render :xml => @post.to_xml }\n end\n end", "def index\n @posts = Post.all\n\n @title = \"Blog Management\"\n\n respond_to do |format| \n format.html { render :index }\n format.xml { render :xml => @posts.to_xml}\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end", "def show\n r = PostRepository.new\n @post = r.GetPost(\"PostID\", params[:id].to_i)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end \n end", "def show\n @post = Post.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def index\n respond_with(@posts) do |format|\n format.html do\n return redirect_to blog_path, :status => 301 if request.path =~ /^\\/posts(\\/?)$/ && flash.empty?\n\n @posts = user_signed_in? ? Post.latest : Post.published.latest\n @posts = @posts.paginate :page => params[:page], :per_page => Post.per_page\n end\n\n format.rss { @posts = Post.published.latest }\n end\n end", "def index\n authorize! :read, Post\n @posts = Post.accessible_by(current_ability).order('created_at DESC').paginate(:per_page => 15, :page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n format.rss { render :layout => false } \n end\n end", "def index\r\n # @posts = Post.all(:order => \"created_at DESC\")\r\n @posts = Post.paginate :page => params[:page], :per_page => 24, :order => \"created_at DESC\"\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @posts }\r\n end\r\n end", "def index\n @title = \"Home\"\n @posts = Post.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n format.json { render :json => @posts }\n format.atom # index.atom.builder\n end\n end", "def index\n # @posts = Post.paginate :page => params[:page]\n @posts = Post.paginate :page => params[:page], :per_page => 2\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end", "def index\n @posts = Post.limit 50\n @title = \"Weblog - last posts\"\n @updated = @posts.first.created_at unless @posts.empty?\n respond_to do |format|\n format.rss do\n redirect_to feeds_path(format: :atom),\n status: :moved_permanently\n end\n format.atom\n end\n end", "def posts(opts)\n response = get(\"posts\", opts)\n response\n end", "def index\n @posts = Mist::Post.recently_published(20, Mist.authorized?(:view_drafts, self))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @posts }\n end\n end", "def show\n @post251 = Post251.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post251 }\n end\n end", "def index\n @posts = Post.order(\"created_at DESC\").where(:published => true).limit(5)\n @title = \"Home\"\n @description = \"the blog and website of bassist and programmer Johnny Grubb. no baseball information here.\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.xml\n end\n end", "def index\n @posts = if params[:tag]\n Post.tagged_with(params[:tag])\n else\n Post.scoped\n end\n @posts = @posts.where(:published => true).order(\"created_at DESC\")\n @posts = @posts.paginate(:page => params[:page], :per_page => 4) unless params[:count] == \"all\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.rss { render :layout => false }\n format.xml { render :xml => @posts }\n end\n end", "def show\n #render :template => 'posts/show.xml.builder', :layout => false\n render :json => @post, :layout => false\n end", "def show\n @feed = Feed.find(params[:id])\n @posts = @feed.posts.order(\"published desc\").paginate(:page => params[:page], :per_page => 20)\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feed }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feed }\n end\n end", "def show\n provides :xml, :json\n \n @post = Post[params[:id]]\n \n if content_type == :html\n render\n else\n display @post\n end\n end", "def index\n respond_to do |format|\n format.html { \n @posts = Post.search(params[:search_title], params[:search_tags], params[:page])\n }\n \n format.rss { \n @posts = Post.all(:limit => RSS_ITEM_LIMIT, :order => \"created_at DESC\")\n render :layout => false \n }\n\n format.xml { \n @posts = Post.all\n render :xml => @posts\n }\n \n format.json { \n @posts = Post.all\n render :json => @posts\n }\n end\n end", "def index\n\t@posts = list_posts\n end", "def index \n authorize! :read, Post\n @posts = Post.find(:all, :order => \"created_at DESC\")\n respond_to do |format|\n format.html\n format.atom\n end\n\n end", "def rss\n @events = Post.find(:all, {:conditions=> \"status=public\"},:order => \"id DESC\")\n render :layout => false\n headers[\"Content-Type\"] = \"application/xml; charset=utf-8\"\n end", "def show\n @post134 = Post134.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post134 }\n end\n end", "def index\n @posts = PostService.getAllPosts\n end", "def show\n @post125 = Post125.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post125 }\n end\n end", "def show\n @post101 = Post101.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post101 }\n end\n end", "def index\n\n\t\t# GET ALL THE BLOG POSTS\n @posts = Post.find(:all, :limit => 5)\n @downloads = Download.find(:all, :limit => 5, :conditions => {:parent_id => nil})\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end", "def show\n @post246 = Post246.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post246 }\n end\n end", "def show\n @post78 = Post78.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post78 }\n end\n end", "def show\n @post99 = Post99.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post99 }\n end\n end", "def show\n @post120 = Post120.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post120 }\n end\n end", "def show\n @post57 = Post57.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post57 }\n end\n end", "def index\n if params[:all]\n @posts = Post.all\n elsif\n @posts = Post.tagged_with(\"blog\")\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end", "def index\n @post_categories = PostCategory.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @post_categories }\n end\n end", "def show\n @post181 = Post181.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post181 }\n end\n end", "def index\n @feeds = Feed.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @feeds.to_xml }\n end\n end", "def index\n options = {:page => params[:page] || 1, :per_page => 2}\n @posts = (params[:tag].blank? ? Post.published.search(params[:search], options) : Post.published.paginate_tagged_with(params[:tag], options))\n respond_to do |format|\n format.html{}\n format.xml{ render :xml => @posts }\n end\n end", "def show\n @post253 = Post253.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post253 }\n end\n end", "def show\n @post342 = Post342.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post342 }\n end\n end", "def show\n @post75 = Post75.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post75 }\n end\n end", "def rss\n @headers[\"Content-Type\"] = \"application/xml\"\n @articles = Article.find(:all, \n :order => 'created_at DESC',\n :conditions => [\"articles.approved = ?\", true],\n :limit => 10\n )\n render :layout => false\n end", "def show\n @post81 = Post81.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post81 }\n end\n end", "def show\n @post182 = Post182.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post182 }\n end\n end", "def index\n @posts = Post.search(params[:search], params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n format.js\n format.atom\n end\n end", "def show\n @post55 = Post55.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post55 }\n end\n end", "def show\n @post77 = Post77.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post77 }\n end\n end", "def show\n @post257 = Post257.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post257 }\n end\n end", "def show\n @post445 = Post445.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post445 }\n end\n end", "def show\n @feed = Feed.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @feed.to_xml }\n end\n end", "def show\n @post66 = Post66.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post66 }\n end\n end", "def show\n @blog_post = BlogPost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @blog_post }\n end\n end", "def show\n @post107 = Post107.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post107 }\n end\n end", "def show\n @post321 = Post321.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post321 }\n end\n end", "def show\n @post231 = Post231.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post231 }\n end\n end", "def show\n @post105 = Post105.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post105 }\n end\n end", "def index\n @articles = Article.published\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @articles }\n end\n end", "def index\n # TODO: implement listing all posts\n end", "def index\n @page[:per_page] = params[:limit] || 5\n @blog_posts = BlogPost.order(@order).paginate(@page)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @blog_posts, callback: params[:callback] }\n format.xml { render xml: @blog_posts }\n format.rss { render 'feed' }\n end\n end", "def show\n @post109 = Post109.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post109 }\n end\n end", "def show\n @post184 = Post184.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post184 }\n end\n end", "def show\n @post74 = Post74.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post74 }\n end\n end", "def show\n @post117 = Post117.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post117 }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n make_rss\n end", "def show\n @post10 = Post10.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post10 }\n end\n end", "def show\n @post = Post.find(params[:id], :include => [:blog, :comments, :user, :tags])\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @post }\n end\n end", "def index\n @posts = Post.all\n @title=\"All LitwakRecommends Posts\"\n\t@metadescription = \"Listing of all Posts for LitwakRecommends travel blog\"\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end" ]
[ "0.73163414", "0.72102565", "0.72102565", "0.70133805", "0.69922805", "0.69905823", "0.6946224", "0.68449396", "0.6825624", "0.67839086", "0.67474705", "0.6744808", "0.67014694", "0.66831535", "0.66570085", "0.66536814", "0.6641173", "0.6569632", "0.6569632", "0.6569632", "0.6569632", "0.6569632", "0.6569632", "0.6569632", "0.6569632", "0.6569632", "0.6569632", "0.6569632", "0.65689623", "0.6562864", "0.6548791", "0.65417695", "0.65400404", "0.6532962", "0.6532095", "0.6509035", "0.6509035", "0.6451045", "0.6432708", "0.6423995", "0.64157194", "0.64118004", "0.6391085", "0.63896364", "0.63731444", "0.63691884", "0.6361821", "0.6360292", "0.63583076", "0.63511515", "0.6342905", "0.6339071", "0.63336664", "0.63287073", "0.6324601", "0.63148195", "0.6311334", "0.6296899", "0.6286889", "0.62864393", "0.62858725", "0.62757164", "0.62744164", "0.6268504", "0.6262129", "0.6247976", "0.6244519", "0.6240205", "0.6239487", "0.6233154", "0.6226862", "0.62248725", "0.6223015", "0.62088597", "0.62063754", "0.6198131", "0.6196574", "0.6194646", "0.61905736", "0.6187951", "0.6187811", "0.6174592", "0.617229", "0.6170761", "0.61688745", "0.61672014", "0.6162086", "0.616047", "0.6160359", "0.6157711", "0.6154687", "0.6154447", "0.61543655", "0.61533695", "0.615046", "0.61485565", "0.6146997", "0.6145814", "0.61350554", "0.61348975" ]
0.68239427
9
GET /posts/1 GET /posts/1.xml
def show @post = Post.find(params[:id]) unless @post.latitude.blank? or @post.longitude.blank? @map = GMap.new("map") @map.control_init(:large_map => true,:map_type => true) @map.set_map_type_init(GMapType::G_HYBRID_MAP) @map.center_zoom_init([@post.latitude,@post.longitude],17) @map.icon_global_init(GIcon.new(:image => "/rework/location.png", :icon_anchor => GPoint.new(6,11), :info_window_anchor => GPoint.new(6,11)), "businessicon") @map.icon_global_init(GIcon.new(:image => "/rework/youarehere.png", :icon_anchor => GPoint.new(13,14), :info_window_anchor => GPoint.new(13,14)), "hereicon") busloc = Variable.new("businessicon") youarehere = Variable.new("hereicon") @marker = GMarker.new([@post.latitude,@post.longitude], :icon => busloc, :title => @post.company, :info_window => @post.offer) @myloc = GMarker.new([@mylat,@mylong], :icon => youarehere,:title => "You", :info_window => "You Are Here At #@mylat, #@mylong") @map.overlay_init(@marker) @map.overlay_init(@myloc) end respond_to do |format| format.html # show.html.erb format.xml { render :xml => @post } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @post }\n format.xml { render xml: @posts }\n end\n end", "def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end", "def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end", "def index\n @posts = Post.find(:all, :order=>'created_on DESC')\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @posts.to_xml }\n end\n end", "def index\n @posts = Post.find(:all, :order => :created_at)\n\n respond_to do |format|\n format.html # index.rhtml\n# format.xml { render :xml => @posts.to_xml }\n end\n end", "def index\n @posts = Post.find_list(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @post.to_xml }\n end\n end", "def show\n r = PostRepository.new\n @post = r.GetPost(\"PostID\", params[:id].to_i)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end \n end", "def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.xml { render xml: @posts }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n format.json { render :json => @post }\n format.rss { render :layout => false }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def feed\r\n @posts = Post.all(:order => \"created_at DESC\")\r\n respond_to do |format|\r\n format.rss\r\n end\r\n end", "def index\n @posts = Post.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts,:layout => false }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n\t\t@post = Post.find(params[:id])\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.xml { render:xml => @post}\n\t\tend\n\tend", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n# format.xml { render :xml => @post.to_xml }\n end\n end", "def show\n @post = Post.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def index\n @posts = Post.order(created_at: :desc)\n respond_to do |format|\n format.html { render }\n format.text { render }\n format.xml { render xml: @posts }\n format.json { render json: @posts.to_json }\n end\n end", "def show\n @post251 = Post251.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post251 }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "def show\n @post101 = Post101.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post101 }\n end\n end", "def index\n @posts = Post.limit 50\n @title = \"Weblog - last posts\"\n @updated = @posts.first.created_at unless @posts.empty?\n respond_to do |format|\n format.rss do\n redirect_to feeds_path(format: :atom),\n status: :moved_permanently\n end\n format.atom\n end\n end", "def index\n @posts = Post.published.page(params[:page]).per(5).ordered\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end", "def index\n @posts = Post.paginate(:page=>params[:page], :order=>'created_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end", "def show\n @post257 = Post257.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post257 }\n end\n end", "def show\n @post134 = Post134.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post134 }\n end\n end", "def show\n @post246 = Post246.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post246 }\n end\n end", "def index\n @posts = Post.find(:all,:order => 'created_at DESC').paginate(:per_page => 5, :page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end", "def show\n @post99 = Post99.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post99 }\n end\n end", "def show\n @post57 = Post57.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post57 }\n end\n end", "def show\n @post78 = Post78.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post78 }\n end\n end", "def show\n @post181 = Post181.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post181 }\n end\n end", "def show\n @post253 = Post253.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post253 }\n end\n end", "def list_posts(api_object)\r\n puts \"Current Post:\"\r\n doc = Nokogiri::XML.parse api_object.read\r\n contents= doc.xpath('posts/post/content').collect {|e| e.text }\r\n puts contents.join(\", \")\r\n puts \"\"\r\nend", "def list\r\n @posts = Post.paginate :page => params[:page], :per_page => 24, :order => \"created_at DESC\"\r\n\r\n respond_to do |format|\r\n\r\n format.html # list.html.erb\r\n format.xml { render :xml => @posts }\r\n end\r\n end", "def show\n @post342 = Post342.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post342 }\n end\n end", "def show\n @post125 = Post125.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post125 }\n end\n end", "def show\n provides :xml, :json\n \n @post = Post[params[:id]]\n \n if content_type == :html\n render\n else\n display @post\n end\n end", "def index\n\n\t\t# GET ALL THE BLOG POSTS\n @posts = Post.find(:all, :limit => 5)\n @downloads = Download.find(:all, :limit => 5, :conditions => {:parent_id => nil})\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end", "def show\n @post231 = Post231.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post231 }\n end\n end", "def show\n @post77 = Post77.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post77 }\n end\n end", "def show\n @post75 = Post75.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post75 }\n end\n end", "def index\n @posts = Post.all\n\n @title = \"Blog Management\"\n\n respond_to do |format| \n format.html { render :index }\n format.xml { render :xml => @posts.to_xml}\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end", "def show\n @post321 = Post321.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post321 }\n end\n end", "def show\n @post120 = Post120.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post120 }\n end\n end", "def show\n @post81 = Post81.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post81 }\n end\n end", "def index\n @title = \"Home\"\n @posts = Post.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n format.json { render :json => @posts }\n format.atom # index.atom.builder\n end\n end", "def show\n @post107 = Post107.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post107 }\n end\n end", "def show\n @post182 = Post182.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post182 }\n end\n end", "def show\n @post66 = Post66.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post66 }\n end\n end", "def show\n @post227 = Post227.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post227 }\n end\n end", "def show\n @post105 = Post105.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post105 }\n end\n end", "def show\n @post445 = Post445.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post445 }\n end\n end", "def show\n @post55 = Post55.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post55 }\n end\n end", "def show\n @post117 = Post117.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post117 }\n end\n end", "def show\n @post10 = Post10.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post10 }\n end\n end", "def show\n @post74 = Post74.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post74 }\n end\n end", "def show\n @post109 = Post109.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post109 }\n end\n end", "def show\n @post275 = Post275.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post275 }\n end\n end", "def show\n @post129 = Post129.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post129 }\n end\n end", "def show\n @post273 = Post273.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post273 }\n end\n end", "def show\n @post197 = Post197.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post197 }\n end\n end", "def show\n @post157 = Post157.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post157 }\n end\n end", "def index\n # @posts = Post.paginate :page => params[:page]\n @posts = Post.paginate :page => params[:page], :per_page => 2\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end", "def show\n @post245 = Post245.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post245 }\n end\n end", "def show\n @post483 = Post483.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post483 }\n end\n end", "def show\n @post139 = Post139.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post139 }\n end\n end", "def show\n @post267 = Post267.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post267 }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feed }\n end\n end", "def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.atom\n end\n end", "def show\n @post284 = Post284.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post284 }\n end\n end", "def index\r\n # @posts = Post.all(:order => \"created_at DESC\")\r\n @posts = Post.paginate :page => params[:page], :per_page => 24, :order => \"created_at DESC\"\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @posts }\r\n end\r\n end", "def show\n #render :template => 'posts/show.xml.builder', :layout => false\n render :json => @post, :layout => false\n end", "def show\n @post149 = Post149.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post149 }\n end\n end", "def show\n @post143 = Post143.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post143 }\n end\n end", "def show\n @post54 = Post54.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post54 }\n end\n end", "def show\n @post249 = Post249.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post249 }\n end\n end", "def show\n @feed = Feed.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @feed.to_xml }\n end\n end", "def show\n @post184 = Post184.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post184 }\n end\n end", "def show\n @post110 = Post110.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post110 }\n end\n end", "def index\n respond_with(@posts) do |format|\n format.html do\n return redirect_to blog_path, :status => 301 if request.path =~ /^\\/posts(\\/?)$/ && flash.empty?\n\n @posts = user_signed_in? ? Post.latest : Post.published.latest\n @posts = @posts.paginate :page => params[:page], :per_page => Post.per_page\n end\n\n format.rss { @posts = Post.published.latest }\n end\n end", "def show\n @post = Post.find(params[:id])\n @title = @post.title\n \n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @post.to_xml }\n end\n end", "def show\n @post221 = Post221.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post221 }\n end\n end", "def index\n @posts = Post.order(\"created_at DESC\").where(:published => true).limit(5)\n @title = \"Home\"\n @description = \"the blog and website of bassist and programmer Johnny Grubb. no baseball information here.\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.xml\n end\n end", "def show\n @post168 = Post168.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post168 }\n end\n end", "def show\n @post328 = Post328.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post328 }\n end\n end", "def show\n @post85 = Post85.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post85 }\n end\n end", "def show\n @post193 = Post193.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post193 }\n end\n end", "def show\n @post459 = Post459.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post459 }\n end\n end" ]
[ "0.7223093", "0.7073613", "0.7073613", "0.697867", "0.6954207", "0.6903348", "0.679717", "0.6776279", "0.6773115", "0.6706225", "0.670266", "0.6697981", "0.6677228", "0.6665081", "0.6665081", "0.6665081", "0.6665081", "0.6665081", "0.6665081", "0.6665081", "0.6665081", "0.6665081", "0.6665081", "0.6665081", "0.66629696", "0.66568005", "0.662854", "0.6618272", "0.66177094", "0.6602781", "0.6599269", "0.6599269", "0.65776515", "0.6564957", "0.65627366", "0.6557469", "0.65572685", "0.65435797", "0.65387636", "0.6530152", "0.6527847", "0.6524929", "0.6522656", "0.6521842", "0.65162635", "0.6514229", "0.6513675", "0.6504387", "0.6492008", "0.6483185", "0.6479993", "0.647874", "0.6467841", "0.64620936", "0.646115", "0.6458733", "0.64585876", "0.6454007", "0.64528227", "0.6446198", "0.64448816", "0.6431627", "0.64141035", "0.6414076", "0.6412431", "0.64081156", "0.6406891", "0.6406297", "0.6398296", "0.63944304", "0.6394261", "0.6389098", "0.63863903", "0.63774043", "0.6377166", "0.6374342", "0.6364978", "0.6359415", "0.6354285", "0.6353246", "0.63508964", "0.6347064", "0.6344494", "0.63444084", "0.63431305", "0.63415486", "0.6340404", "0.6338225", "0.63377684", "0.6337215", "0.63368046", "0.6333505", "0.6330483", "0.63286555", "0.63280845", "0.63246167", "0.6322015", "0.6315044", "0.631214", "0.63101745", "0.63079894" ]
0.0
-1
GET /posts/new GET /posts/new.xml
def new @post = Post.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @post } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n make_rss\n end", "def new\n \n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n @post = Post.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n @post = Post.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n @posts = Post.find(:all, :order => 'updated_at DESC')\n @post = Post.new\n @post.title = \"Überschrift*\"\n\n respond_to do |format|\n format.html { render :template => \"posts/new\" }\n format.xml { render :xml => @post }\n end\n end", "def new\n @post = Post.new\n\t@posts = Post.all\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n @post101 = Post101.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post101 }\n end\n end", "def new\n @post78 = Post78.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post78 }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n format.xml { render :xml => @post }\n end\n end", "def new\n @post246 = Post246.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post246 }\n end\n end", "def new\n @post197 = Post197.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post197 }\n end\n end", "def new\n @post55 = Post55.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post55 }\n end\n end", "def new\n @post57 = Post57.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post57 }\n end\n end", "def new\n @post125 = Post125.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post125 }\n end\n end", "def new\n @post = Post.new\n @title = \"New Post\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n format.json { render :json => @post }\n end\n end", "def new\n @post253 = Post253.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post253 }\n end\n end", "def new\n @post99 = Post99.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post99 }\n end\n end", "def new\n @post181 = Post181.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post181 }\n end\n end", "def new\n @post120 = Post120.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post120 }\n end\n end", "def new\n @post227 = Post227.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post227 }\n end\n end", "def new\n @post = Post.new\n @publish = false\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n @post54 = Post54.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post54 }\n end\n end", "def new\n @post342 = Post342.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post342 }\n end\n end", "def new\n @post50 = Post50.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post50 }\n end\n end", "def new\n @post134 = Post134.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post134 }\n end\n end", "def new\n @post275 = Post275.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post275 }\n end\n end", "def new\n @post251 = Post251.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post251 }\n end\n end", "def new\n @post117 = Post117.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post117 }\n end\n end", "def new\n @post321 = Post321.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post321 }\n end\n end", "def new\n @post74 = Post74.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post74 }\n end\n end", "def new\n @post184 = Post184.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post184 }\n end\n end", "def new\n @post328 = Post328.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post328 }\n end\n end", "def new\n @post75 = Post75.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post75 }\n end\n end", "def new\n @post182 = Post182.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post182 }\n end\n end", "def new\n @post445 = Post445.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post445 }\n end\n end", "def new\n @post109 = Post109.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post109 }\n end\n end", "def new\n @post133 = Post133.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post133 }\n end\n end", "def new\n @post110 = Post110.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post110 }\n end\n end", "def new\n @post10 = Post10.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post10 }\n end\n end", "def new\n @post77 = Post77.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post77 }\n end\n end", "def new\n @post156 = Post156.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post156 }\n end\n end", "def new\n @post305 = Post305.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post305 }\n end\n end", "def new\n @post105 = Post105.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post105 }\n end\n end", "def new\n @post168 = Post168.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post168 }\n end\n end", "def new\n @post107 = Post107.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post107 }\n end\n end", "def new\n @post245 = Post245.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post245 }\n end\n end", "def new\n @post143 = Post143.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post143 }\n end\n end", "def new\n @post284 = Post284.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post284 }\n end\n end", "def new\n @post150 = Post150.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post150 }\n end\n end", "def new\n @post196 = Post196.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post196 }\n end\n end", "def new\n @post149 = Post149.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post149 }\n end\n end", "def new\n @post85 = Post85.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post85 }\n end\n end", "def new\n @post139 = Post139.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post139 }\n end\n end", "def new\n @post65 = Post65.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post65 }\n end\n end", "def new\n @post273 = Post273.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post273 }\n end\n end", "def new\n @post295 = Post295.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post295 }\n end\n end", "def new\n @post350 = Post350.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post350 }\n end\n end", "def new\n @post122 = Post122.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post122 }\n end\n end", "def new\n @post306 = Post306.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post306 }\n end\n end", "def new\n @post81 = Post81.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post81 }\n end\n end", "def new\n @post231 = Post231.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post231 }\n end\n end", "def new\n @post183 = Post183.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post183 }\n end\n end", "def new\n @post409 = Post409.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post409 }\n end\n end", "def new\n @post377 = Post377.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post377 }\n end\n end", "def new\n @post483 = Post483.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post483 }\n end\n end", "def new\n @post257 = Post257.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post257 }\n end\n end", "def new\n @post453 = Post453.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post453 }\n end\n end", "def new\n @post267 = Post267.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post267 }\n end\n end", "def new\n @post358 = Post358.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post358 }\n end\n end", "def new\n @post33 = Post33.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post33 }\n end\n end", "def new\n @post193 = Post193.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post193 }\n end\n end", "def new\n @post58 = Post58.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post58 }\n end\n end", "def new\n @post21 = Post21.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post21 }\n end\n end", "def new\n @post129 = Post129.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post129 }\n end\n end", "def new\n @post66 = Post66.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post66 }\n end\n end", "def new\n @post290 = Post290.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post290 }\n end\n end", "def new\n @post41 = Post41.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post41 }\n end\n end", "def new\n @post106 = Post106.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post106 }\n end\n end", "def new\n @post425 = Post425.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post425 }\n end\n end", "def new\n @post59 = Post59.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post59 }\n end\n end" ]
[ "0.78365606", "0.7708412", "0.76752806", "0.7665492", "0.7665492", "0.7665492", "0.7665492", "0.7665492", "0.7665492", "0.7665492", "0.7665492", "0.7665492", "0.7665492", "0.7665492", "0.7665492", "0.7665492", "0.7665492", "0.7665492", "0.7665492", "0.7665492", "0.7665492", "0.76420695", "0.76340854", "0.75021523", "0.7495493", "0.74472666", "0.7447242", "0.74021965", "0.7399193", "0.73932934", "0.73880976", "0.73846865", "0.7381505", "0.73672473", "0.73626494", "0.7361229", "0.73511136", "0.73433757", "0.73251563", "0.73185396", "0.73178715", "0.73113936", "0.731135", "0.7310921", "0.7310211", "0.73059136", "0.72991717", "0.72942847", "0.72908795", "0.72849077", "0.7281714", "0.7281635", "0.7280247", "0.72725064", "0.7266951", "0.72652847", "0.7252029", "0.72503525", "0.72498703", "0.7249234", "0.72461545", "0.7245462", "0.72400486", "0.7238213", "0.7234176", "0.72236806", "0.7221183", "0.7220305", "0.72180104", "0.7217864", "0.721566", "0.72096163", "0.7203399", "0.72017276", "0.72002184", "0.71978325", "0.71960825", "0.71959877", "0.71926796", "0.7190176", "0.7186632", "0.71860325", "0.7185198", "0.71838474", "0.71830064", "0.71813864", "0.71792793", "0.71748424", "0.71646976", "0.7164696", "0.71614957", "0.71581435", "0.71568686", "0.7144312", "0.7140119", "0.7138575", "0.7136993", "0.713379", "0.7132396" ]
0.7567351
24
POST /posts POST /posts.xml
def create @post = Post.new(params[:post]) respond_to do |format| if @post.save format.html { redirect_to(@post, :notice => 'Post was successfully created.') } format.xml { render :xml => @post, :status => :created, :location => @post } else format.html { render :action => "new" } format.xml { render :xml => @post.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(uri, xml)\r\n req = Net::HTTP::Post.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def test_should_create_post_via_API_XML\r\n get \"/logout\"\r\n post \"/forum_posts.xml\", :api_key=>'testapikey',\r\n :forum_post => {:title=>'API Test Post',\r\n :body=>'Test Post desc',\r\n :user_id=>1}\r\n assert_response :created\r\n end", "def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end", "def post(*args)\n request :post, *args\n end", "def post(*args)\n request(:post, *args)\n end", "def post #:doc:\n end", "def post(body)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true if uri.scheme == 'https'\n\n request = Net::HTTP::Post.new(uri)\n request['Content-Type'] = 'text/xml'\n request['Accept-Language'] = locale if locale\n request.body = body\n\n response = http.request(request)\n\n Response.new(response, uri)\n end", "def post\n resource.post(request, response)\n end", "def post\r\n end", "def post(*args)\n Request.post(*args)\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.json { render json: @post, status: :created, location: @post }\n format.xml { render xml: @post, status: :created, location: @post }\n else\n format.json { render json: @post.errors, status: :unprocessable_entity }\n format.xml { render xml: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def post\n end", "def create\n respond_with Post.create(params[:posts])\n end", "def create\n\t@posts = Post.all\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to(@post, :notice => 'Post was successfully created.') }\n format.xml { render :xml => @post, :status => :created, :location => @post }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post(*args)\n prepare_request(:post, args)\n @@client.add(:post, @path, *args)\n end", "def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n flash[:notice] = 'Post was successfully created.'\n format.html { redirect_to(posts_url) }\n format.xml { render :xml => @post, :status => :created, :location => @post }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create(params)\n\nxml =<<XML\n<entry xmlns=\"http://purl.org/atom/ns#\">\n <title>#{params[:title]}</title>\n <link rel=\"related\" type=\"text/html\" href=\"#{params[:url]}\" />\n <summary type=\"text/plain\">#{params[:comment]}</summary>\n</entry>\nXML\n\n post('/post', xml)\n end", "def POST; end", "def post(path, **args); end", "def post\n doc = Nokogiri::XML(request.body)\n id= (doc/'id').text\n # p = Post.exists?(id) ? Post.find(id) : Post.new\n p= Post.find_or_create_by_intranet_id id\n p.update_attributes :subject => (doc/'subject').text,\n :body => (doc/'body').text, :post_type => (doc/'post-type').text,\n :pic => (doc/'pic') .text, :begin_on=>(doc/'begin-on').text,\n :pic_postimg => (doc/'pic-postimg').text,\n :video => (doc/'video').text, \n :end_on => (doc/'end-on').text, :stick => (doc/'stick').text \n render :text => \"ok\"\n end", "def post; end", "def create\n @post = Post.new(params[:post])\n\n @post.update_attribute(:user_id, current_user.id)\n\n respond_to do |format|\n if @post.save\n flash[:notice] = 'Post was successfully created.'\n format.html { redirect_to(@post) }\n format.xml { render :xml => @post, :status => :created, :location => @post }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n make_rss\n end", "def post endpoint, data\n do_request :post, endpoint, data\n end", "def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to(posts_url, :notice => 'Post was successfully created.') }\n format.xml { render :xml => @post, :status => :created, :location => @post }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post(*args)\n execute(:post, *args)\n end", "def posts(opts)\n response = get(\"posts\", opts)\n response\n end", "def create(name=\"Default Name\", age=\"50\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <name>#{name}</name>\r\n <age>#{age}</age>\r\n </person>\"\r\n \r\n request = Net::HTTP::Post.new(@url)\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n \r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n response.body \r\n end", "def create_posts\n end", "def create_posts\n end", "def create\n @user = User.find(session[:user_id])\n @post = @user.posts.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to(\"/#{@post.url}\", :notice => t('controller.created')) }\n format.xml { render :xml => @post, :status => :created, :location => @post }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n flash[:notice] = 'Post was successfully created.'\n format.html { redirect_to(@post) }\n format.xml { render :xml => @post, :status => :created, :location => @post }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post251 = Post251.new(params[:post251])\n\n respond_to do |format|\n if @post251.save\n format.html { redirect_to(@post251, :notice => 'Post251 was successfully created.') }\n format.xml { render :xml => @post251, :status => :created, :location => @post251 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post251.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 format.html { redirect_to(@post, :notice => 'Post was successfully created.') }\n format.xml { render :xml => @post, :status => :created, :location => @post }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to(@post, :notice => 'Post was successfully created.') }\n format.xml { render :xml => @post, :status => :created, :location => @post }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post(path, options={})\n request :post, path, options\n end", "def post(uri, doc = nil, options = {})\n execute(uri, :post, options, doc)\n end", "def create_post\n begin\n #asks the user for the title, body, and whether it should be anonymous\n print \"Title: \"\n title = STDIN.gets.chomp\n print \"Body: \"\n body = STDIN.gets.chomp\n print \"Post as Anonymous? (y/n): \"\n anonymous = STDIN.gets.chomp.upcase == 'Y' ? true : false\n # check user information from login\n\n # Rails will reject this unless you configure the cross_forgery_request check to\n # a null_session in the receiving controller. This is because we are not sending\n # an authenticity token. Rails by default will only send the token with forms /users/new and\n # /users/1/edit and REST clients don't get those.\n # We could perhaps arrange to send this on a previous\n # request but we would then have to have an initial call (a kind of login perhaps).\n # This will automatically send as a multi-part request because we are adding a\n # File object.\n response = RestClient.post \"#{@@DOMAIN}/api/posts.json\",\n\n {\n post: {\n title: title,\n body: body,\n anonymous: anonymous\n },\n }, authorization_hash\n\n if (response.code == 201)\n puts \"Created successfully\"\n end\n puts \"URL for new resource: #{response.headers[:location]}\"\n rescue => e\n puts STDERR, \"Error accessing REST service. Error: #{e}\"\n end\n end", "def posts; end", "def post_query( xml )\n url = URI.parse( self.url )\n response = self.http.post_form( url, { \"query\" => xml } )\n return response.body\n end", "def post\n Rentlinx.client.post(self)\n end", "def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n flash[:notice] = 'Post was successfully created.'\n format.html { redirect_to post_url(@post) }\n# format.xml { head :created, :location => post_url(@post) }\n else\n format.html { render :action => \"new\" }\n# format.xml { render :xml => @post.errors.to_xml }\n end\n end\n end", "def create\n post\n end", "def test_create_on_post\n post :create,\n :post_id => posts(:by_quentin).id,\n :content => 'This is a test note from aaron...'\n assert_response :redirect\n end", "def create\n @post = Post.new(params[:post])\n @post.published = true\n\n respond_to do |format|\n if @post.save\n flash[:notice] = 'Запись успешно создана.'\n format.html { redirect_to(@post) }\n format.xml { render :xml => @post, :status => :created, :location => @post }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def posts\n posts = @client.entries(content_type: 'post').items\n posts || []\n end", "def save\n self.client.api_post(\"/feed\", self.create_params)\n end", "def posts\n @url = MYHOST + \"/api/posts/all\"\n\n\n @respuesta = HTTParty.get(\n @url.to_str\n )\n\n @body = @respuesta.body\n if @body \n redirect_to api_resultado_path(:body => @body, :token => @token)\n return\n end\n end", "def create\n @post246 = Post246.new(params[:post246])\n\n respond_to do |format|\n if @post246.save\n format.html { redirect_to(@post246, :notice => 'Post246 was successfully created.') }\n format.xml { render :xml => @post246, :status => :created, :location => @post246 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post246.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\r\n @post = current_user.posts.new(params[:post])\r\n respond_to do |format|\r\n if @post.save\r\n flash[:notice] = 'Post was successfully created.'\r\n format.html { redirect_to(@post) }\r\n format.xml { render :xml => @post, :status => :created, :location => @post }\r\n else\r\n format.html { render :action => \"new\" }\r\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @post78 = Post78.new(params[:post78])\n\n respond_to do |format|\n if @post78.save\n format.html { redirect_to(@post78, :notice => 'Post78 was successfully created.') }\n format.xml { render :xml => @post78, :status => :created, :location => @post78 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post78.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post(data = \"\")\n submit :Post, data\n end", "def post(data = {})\n call data, method: :post\n end", "def post(path, data={})\n request(:post, path, data)\n end", "def post(uri, params = {})\n send_request(uri, :post, params)\n end", "def post(path, params={})\n request(:post, path, params)\n end", "def post(path, params={})\n request(:post, path, params)\n end", "def post(path, params={})\n request(:post, path, params)\n end", "def post(path, params = {})\n\t\trequest(path, :post, params)\n\tend", "def post(path, options={})\n send_request 'post', path, options\n end", "def create\n @post157 = Post157.new(params[:post157])\n\n respond_to do |format|\n if @post157.save\n format.html { redirect_to(@post157, :notice => 'Post157 was successfully created.') }\n format.xml { render :xml => @post157, :status => :created, :location => @post157 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post157.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post_headers\n {\"Content-Type\" => 'text/xml; charset=utf-8'}\n end", "def create\n post_service = PostService.new(current_user, params)\n post_service.create_post\n #post_service.create\n respond_to do |format|\n if post_service.save?\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { redirect_to new_post_url, alert: post_service.errors }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def send_post(data_xml,url)\r\n result = @client.post(self.target_uri(url), :body => data_xml , :head => {'Content-Type' => 'application/xml'} ) \r\n raise \"Invalid status #{result.http_status} from server #{@host}:#{@port}\" if(result.http_status != '200') \r\n #reply = Reply.from_xml(result.http_body)\r\n if block_given?\r\n yield(result.http_body)\r\n else\r\n result.http_body\r\n end\r\n end", "def post(path, options = {})\n request(:post, path, options)\n end", "def post(path, options = {})\n request(:post, path, options)\n end", "def post(path, options = {})\n request(:post, path, options)\n end", "def post!\n request! :post\n end", "def create\n respond_with Post.create(post_params)\n end", "def api_post(action, data)\n api_request(action, data, 'POST')\n end", "def create\n @post405 = Post405.new(params[:post405])\n\n respond_to do |format|\n if @post405.save\n format.html { redirect_to(@post405, :notice => 'Post405 was successfully created.') }\n format.xml { render :xml => @post405, :status => :created, :location => @post405 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post405.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post(path, options = {})\n request(:post, path, options)\n end", "def post(path, options = {})\n request(:post, path, options)\n end", "def post(path, options = {})\n request(:post, path, options)\n end", "def create\n @post57 = Post57.new(params[:post57])\n\n respond_to do |format|\n if @post57.save\n format.html { redirect_to(@post57, :notice => 'Post57 was successfully created.') }\n format.xml { render :xml => @post57, :status => :created, :location => @post57 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post57.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post445 = Post445.new(params[:post445])\n\n respond_to do |format|\n if @post445.save\n format.html { redirect_to(@post445, :notice => 'Post445 was successfully created.') }\n format.xml { render :xml => @post445, :status => :created, :location => @post445 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post445.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n make_rss\n end", "def post(method, params = {})\n url = make_url method, params\n query = url.query\n url.query = nil\n\n req = Net::HTTP::Post.new url.path\n req.body = query\n req.content_type = 'application/x-www-form-urlencoded'\n\n res = Net::HTTP.start url.host, url.port do |http|\n http.request req\n end\n\n xml = Nokogiri::XML(res.body, nil, nil, 0)\n\n check_error xml\n\n parse_response xml\n rescue SystemCallError, SocketError, Timeout::Error, IOError,\n Nokogiri::XML::SyntaxError => e\n raise CommunicationError.new(e)\n rescue Net::HTTPError => e\n xml = Nokogiri::XML(e.res.body) { |cfg| cfg.strict }\n check_error xml\n raise CommunicationError.new(e)\n end", "def render_post\n respond_to do |wants| \n wants.html {render :to_xml => 'POST.xml.builder', :layout => false, :status => 201}\n wants.json {render :to_json => 'POST.xml.builder', :status => 201}\n wants.xml {render :to_xml => 'POST.xml.builder', :layout => false, :status => 201}\n wants.yaml {render :to_yaml => 'POST.xml.builder', :status => 201}\n end \n end", "def post(path, params = {})\n request(:post, path, params)\n end", "def post(path, params = {})\n request(:post, path, params)\n end", "def post(path, params = {})\n request(:post, path, params)\n end", "def post(path, params = {})\n request(:post, path, params)\n end", "def post(path, params = {})\n request(:post, path, params)\n end", "def create\n res = self.class.post('/', body: attrs)\n res.created?\n end", "def create\n @post = postable.posts.build(params[:post])\n @post.author = current_agent\n\n respond_to do |format|\n if @post.save\n flash[:success] = t('post.created')\n format.html { redirect_to(polymorphic_path([ postable.container, postable ], :anchor => dom_id(@post))) }\n format.xml { render :xml => @post, :status => :created, :location => @post }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create(name=\"Default name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Post.new(@url)\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n response.body\n end", "def post(path, params = {})\n request(:post, path, params)\n end", "def create\n @post125 = Post125.new(params[:post125])\n\n respond_to do |format|\n if @post125.save\n format.html { redirect_to(@post125, :notice => 'Post125 was successfully created.') }\n format.xml { render :xml => @post125, :status => :created, :location => @post125 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post125.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post = current_user.posts.build(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to(@post, :notice => 'Post created.') }\n format.xml { render :xml => @post, :status => :created, :location => @post }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @posts = Post.find_all_by_kiez(get_kiez, :order => 'updated_at DESC')\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n flash[:notice] = 'Die Anzeige wurde erfolgreich erstellt.'\n puts @post.inspect\n ContactMailer.deliver_notify(@post)\n format.html { redirect_to(@post) }\n format.xml { render :xml => @post, :status => :created, :location => @post }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post(content)\n post_to(\"/api/v1/messages/\", {:body => content})\n end", "def post(path, params={})\n signature_params = params.values.any?{|value| value.respond_to?(:to_io)} ? {} : params\n request(:post, path, params.to_xml, signature_params)\n end", "def create\n \n @onpost = Onpost.new(params[:onpost])\n respond_to do |format|\n if @onpost.save\n flash[:notice] = 'Onpost was successfully created.'\n format.html { redirect_to :back }\n format.xml { render :xml => @onpost, :status => :created, :location => @onpost }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @onpost.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post168 = Post168.new(params[:post168])\n\n respond_to do |format|\n if @post168.save\n format.html { redirect_to(@post168, :notice => 'Post168 was successfully created.') }\n format.xml { render :xml => @post168, :status => :created, :location => @post168 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post168.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create \n\t\tif params[:message] != ''\n\t\t\t@post = Post.create(:message => params[:message]) \n\t\t\[email protected] = current_user\n\t\t\trespond_to do |format| \n\t\t\t\tif @post.save \n\t\t\t\t\tflash[:notice] = 'Post was successfully created.'\n\t\t\t\t\tformat.html { redirect_to :back } \n\t\t\t\t\tformat.xml { render:xml => @post}\n\t\t\t\telse \n\t\t\t\t\tflash[:notice] = \"Message failed to save.\" \n\t\t\t\t\tformat.html { redirect_to :back }\n\t\t\t\t\tformat.xml { render :xml => @post.errors, \n\t\t\t\t\t\t\t\t\t:status => :unprocessable_entity } \n\t\t\t\tend \n\t\t\tend\n\t\telse\n\t\t\tredirect_to(posts_url)\n\t\tend\n \tend", "def create\n @post245 = Post245.new(params[:post245])\n\n respond_to do |format|\n if @post245.save\n format.html { redirect_to(@post245, :notice => 'Post245 was successfully created.') }\n format.xml { render :xml => @post245, :status => :created, :location => @post245 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post245.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(params[:post])\n @post.user = find_current_user\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to(posts_url, :notice => 'Post was successfully created.') }\n format.xml { render :xml => @post, :status => :created, :location => @post }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post(attrs = nil)\n attrs ||= attributes\n\n execute_request('POST') do |uri, headers|\n HTTP.http_client.post(\n uri,\n body: adapter.serialize(attrs),\n header: headers.merge(CONTENT_TYPE_HEADERS)\n )\n end\n end", "def post(body)\n request = Net::HTTP::Post.new(bind_uri)\n request.body = body\n request.content_length = request.body.size\n request[\"Content-Type\"] = \"text/xml; charset=utf-8\"\n\n Jabber.debug(\"Sending POST request - #{body.strip}\")\n\n response = Net::HTTP.new(domain, port).start { |http| http.request(request) }\n\n Jabber.debug(\"Receiving POST response - #{response.code}: #{response.body.inspect}\")\n\n unless response.is_a?(Net::HTTPSuccess)\n raise Net::HTTPBadResponse, \"Net::HTTPSuccess expected, but #{response.class} was received\"\n end\n\n response\n end" ]
[ "0.6847672", "0.6799606", "0.6638679", "0.6625985", "0.6582057", "0.63850963", "0.6320757", "0.627628", "0.62496513", "0.62292284", "0.6224684", "0.6214792", "0.62033695", "0.61848694", "0.6183795", "0.61547226", "0.61526495", "0.6142421", "0.61416507", "0.6132199", "0.61245", "0.6108245", "0.6101822", "0.60697603", "0.60569924", "0.6050653", "0.6049604", "0.604048", "0.604048", "0.60040534", "0.59886146", "0.5959978", "0.59468424", "0.59468424", "0.5922079", "0.5911393", "0.58793616", "0.5839455", "0.5839107", "0.5831156", "0.58305514", "0.5817215", "0.5810097", "0.5803666", "0.5797193", "0.5789366", "0.578872", "0.5788074", "0.5779689", "0.57708967", "0.5759388", "0.5753247", "0.57518476", "0.57462513", "0.5741735", "0.5741735", "0.5741735", "0.5734553", "0.5733125", "0.57234645", "0.5719181", "0.5718392", "0.5717206", "0.5706701", "0.5706701", "0.5706701", "0.57052946", "0.57021093", "0.57017684", "0.5700551", "0.56868243", "0.56868243", "0.56868243", "0.56861264", "0.568474", "0.5680362", "0.5680195", "0.5675266", "0.56708044", "0.56708044", "0.56708044", "0.56708044", "0.56708044", "0.5662974", "0.5662669", "0.56615037", "0.5657771", "0.5657349", "0.5657287", "0.5653152", "0.5652005", "0.56413996", "0.56398284", "0.5637301", "0.5635525", "0.56298244", "0.5629634", "0.5627891", "0.5627172" ]
0.59137267
35
PUT /posts/1 PUT /posts/1.xml
def update @post = Post.find(params[:id]) respond_to do |format| if @post.update_attributes(params[:post]) format.html { redirect_to(@post, :notice => 'Post was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @post.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n flash[:notice] = 'Post was successfully updated.'\n format.html { redirect_to(@post) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n make_rss\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(post_params)\n format.json { head :no_content }\n format.xml { head :no_content }\n else\n format.json { render json: @post.errors, status: :unprocessable_entity }\n format.xml { render xml: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_with Post.update(params[:id], params[:posts])\n end", "def put(*args)\n request :put, *args\n end", "def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to(\"/#{@post.url}\", :notice => t('controller.updated')) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update(id, name= \"Updated Name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <id type='integer'>#{id}</id>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end", "def update\n @post = Post.find(params[:id])\n\t@posts = Post.all\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to(@post, :notice => 'Post was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_with post.update(params[:id], params[:post])\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n flash[:notice] = 'Post was successfully updated.'\n format.html { redirect_to(@post) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(uri, doc = nil, options = {})\n execute(uri, :put, options, doc)\n end", "def put(*args)\n request(:put, *args)\n end", "def update\n respond_to do |format|\n if @post.update_attributes(params[:post])\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, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to(@post, :notice => 'Post was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if post.update_attributes(params[:post])\n flash[:success] = t('post.updated')\n format.html { redirect_to(polymorphic_path([ postable.container, postable ], :anchor => dom_id(@post))) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put!\n request! :put\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to(posts_url, :notice => 'Post was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to(@post, :notice => 'Post was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to(@post, :notice => 'Post was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to(@post, :notice => 'Post was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to(@post, :notice => 'Post was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_with Post.update(params[:id],post_params)\n end", "def update\n @post = Post.find(params[:id])\n \n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to(@post, :notice => t('posts.show.post_updated')) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n flash[:notice] = 'Post was successfully updated.'\n format.html { redirect_to post_url(@post) }\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 r = PostRepository.new\n @post = r.GetPost(\"PostID\", params[:id])\n @post.PostID = params[:id].to_i\n @post.title = params[:title]\n\n respond_to do |format|\n if r.save(@post)\n flash[:notice] = 'Post was successfully created.'\n format.html { redirect_to(@post) }\n format.xml { render :xml => @post, :status => :created, :location => @post }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(*args)\n prepare_request(:put, args)\n @@client.add(:put, @path, *args)\n end", "def test_update_post\n data = {\n title: \"Roll lemon\",\n content: \"Gingerbread bear claw muffin danish danish marzipan. Toffee lollipop wafer carrot cake dessert.\",\n description: \"Chocolate tootsie roll lemon drops. Chupa chups chocolate bar apple pie\",\n image: \"chocolate.png\",\n status: 1\n }\n expected = 200\n post_id = 1\n uri = URI.parse('http://localhost:3000/v1/posts/'+post_id.to_s)\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end", "def update(*args)\n put(*args)\n end", "def update(*args)\n put(*args)\n end", "def update\n update! { posts_url }\n end", "def update\n @post251 = Post251.find(params[:id])\n\n respond_to do |format|\n if @post251.update_attributes(params[:post251])\n format.html { redirect_to(@post251, :notice => 'Post251 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post251.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n @title = @post.title\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to(@post, :flash => { :success => 'Post was successfully updated.' } ) }\n format.xml { head :ok }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n @post.title = params[:title]\n @post.body = params[:body]\n @tags = params[:tags].split(',') unless params[:tags].blank?\n Post.transaction do\n if @post.save\n destroy_tags(@post, @tags)\n create_tags(@post, @tags)\n format.html { redirect_to posts_path, notice: 'Post was successfully updated.' }\n format.json { render :show, status: :ok, location: @post }\n else\n @action_path = post_path @post\n @method = :put\n format.html { render :edit }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def put(path, doc = nil, options = {})\n execute('PUT', path, options, doc)\n end", "def put_datastream(pid, dsID, xml)\n uri = URI.parse(@fedora + '/objects/' + pid + '/datastreams/' + dsID ) \n RestClient.put(uri.to_s, xml, :content_type => \"application/xml\")\n rescue => e\n e.response \n end", "def update\n @post182 = Post182.find(params[:id])\n\n respond_to do |format|\n if @post182.update_attributes(params[:post182])\n format.html { redirect_to(@post182, :notice => 'Post182 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post182.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n update_resource_response(@post, blog_post_params)\n end", "def update\n redirect_to '/posts'\n end", "def update\n @post157 = Post157.find(params[:id])\n\n respond_to do |format|\n if @post157.update_attributes(params[:post157])\n format.html { redirect_to(@post157, :notice => 'Post157 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post157.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]) then\n Feed.update_post(@post)\n format.js { render :action => \"update.rjs\" } if request.xhr?\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n title = params[:title]\n body = params[:body]\n\n @post.update!(title: title, body: body)\n\n if @post.save!\n json_response(@post)\n else\n json_response(@post.errors)\n end\n end", "def update\n put :update\n end", "def update\n @post231 = Post231.find(params[:id])\n\n respond_to do |format|\n if @post231.update_attributes(params[:post231])\n format.html { redirect_to(@post231, :notice => 'Post231 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post231.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post\n doc = Nokogiri::XML(request.body)\n id= (doc/'id').text\n # p = Post.exists?(id) ? Post.find(id) : Post.new\n p= Post.find_or_create_by_intranet_id id\n p.update_attributes :subject => (doc/'subject').text,\n :body => (doc/'body').text, :post_type => (doc/'post-type').text,\n :pic => (doc/'pic') .text, :begin_on=>(doc/'begin-on').text,\n :pic_postimg => (doc/'pic-postimg').text,\n :video => (doc/'video').text, \n :end_on => (doc/'end-on').text, :stick => (doc/'stick').text \n render :text => \"ok\"\n end", "def put payload, path = \"\"\n make_request(path, \"put\", payload)\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def update\r\n @post = Post.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @post.update_attributes(params[:post])\r\n format.html { redirect_to(:action => 'adminlist') }\r\n format.xml { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @post.author ||= current_user\n @post.current_revision.user = current_user\n check_for_draft\n respond_to do |format|\n if @post.update_attributes(params[:post])\n handle_pingbacks\n flash[:notice] = 'Post was successfully updated.'\n format.html { redirect_to(@post) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post275 = Post275.find(params[:id])\n\n respond_to do |format|\n if @post275.update_attributes(params[:post275])\n format.html { redirect_to(@post275, :notice => 'Post275 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post275.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n render json: Post.update(params[\"id\"], params[\"post\"])\n end", "def update\n @post253 = Post253.find(params[:id])\n\n respond_to do |format|\n if @post253.update_attributes(params[:post253])\n format.html { redirect_to(@post253, :notice => 'Post253 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post253.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post78 = Post78.find(params[:id])\n\n respond_to do |format|\n if @post78.update_attributes(params[:post78])\n format.html { redirect_to(@post78, :notice => 'Post78 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post78.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(path, options={})\n request :put, path, options\n end", "def update\n @post81 = Post81.find(params[:id])\n\n respond_to do |format|\n if @post81.update_attributes(params[:post81])\n format.html { redirect_to(@post81, :notice => 'Post81 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post81.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post246 = Post246.find(params[:id])\n\n respond_to do |format|\n if @post246.update_attributes(params[:post246])\n format.html { redirect_to(@post246, :notice => 'Post246 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post246.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post245 = Post245.find(params[:id])\n\n respond_to do |format|\n if @post245.update_attributes(params[:post245])\n format.html { redirect_to(@post245, :notice => 'Post245 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post245.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\r\n @post = Post.find(params[:id])\r\n @root_post = root_post_of(@post)\r\n\r\n respond_to do |format|\r\n if @post.update_attributes(params[:post])\r\n @root_post.touch(:updated_at)\r\n update_child_posts(@post)\r\n\r\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @post.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @post.update_attributes(params[:post])\n respond_with(@post)\n end", "def update\n @post321 = Post321.find(params[:id])\n\n respond_to do |format|\n if @post321.update_attributes(params[:post321])\n format.html { redirect_to(@post321, :notice => 'Post321 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post321.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post328 = Post328.find(params[:id])\n\n respond_to do |format|\n if @post328.update_attributes(params[:post328])\n format.html { redirect_to(@post328, :notice => 'Post328 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post328.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post181 = Post181.find(params[:id])\n\n respond_to do |format|\n if @post181.update_attributes(params[:post181])\n format.html { redirect_to(@post181, :notice => 'Post181 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post181.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n post = current_user.posts.find_by_uuid(params[:id])\n return render_item_not_found('Post') unless post\n post.update_attributes(post_params)\n broadcast(post, 'update')\n head :ok\n end", "def update\n @request.accept\n redirect_to posts_url\n end", "def update\n id = Post.find(params[:id])._id\n \n respond_to do |format|\n if ((@post.update_attributes(params[:post])) && (@post._id = id))\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(path = '/files/', params = {})\n request :put, path, params\n end", "def update\n @post273 = Post273.find(params[:id])\n\n respond_to do |format|\n if @post273.update_attributes(params[:post273])\n format.html { redirect_to(@post273, :notice => 'Post273 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post273.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n @post.tag_list = params[:tags]\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to(@post, :notice => 'Post was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end", "def put(path, body = nil, ctype = 'application/json')\n make_call(mk_conn(path, 'Content-Type': ctype,\n 'Accept': 'application/json'),\n :put, nil, body.to_json)\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n @post.update_attributes(params[:post])\n format.html { redirect_to posts_url, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n end \n end", "def update\n @post193 = Post193.find(params[:id])\n\n respond_to do |format|\n if @post193.update_attributes(params[:post193])\n format.html { redirect_to(@post193, :notice => 'Post193 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post193.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post107 = Post107.find(params[:id])\n\n respond_to do |format|\n if @post107.update_attributes(params[:post107])\n format.html { redirect_to(@post107, :notice => 'Post107 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post107.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @onpost = Onpost.find(params[:id])\n\n respond_to do |format|\n if @onpost.update_attributes(params[:onpost])\n flash[:notice] = 'Onpost was successfully updated.'\n format.html { redirect_to(@onpost) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @onpost.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post483 = Post483.find(params[:id])\n\n respond_to do |format|\n if @post483.update_attributes(params[:post483])\n format.html { redirect_to(@post483, :notice => 'Post483 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post483.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post120 = Post120.find(params[:id])\n\n respond_to do |format|\n if @post120.update_attributes(params[:post120])\n format.html { redirect_to(@post120, :notice => 'Post120 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post120.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post134 = Post134.find(params[:id])\n\n respond_to do |format|\n if @post134.update_attributes(params[:post134])\n format.html { redirect_to(@post134, :notice => 'Post134 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post134.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post = @contest.posts.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n flash[:notice] = 'Post was successfully updated.'\n format.html { redirect_to(@post) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post66 = Post66.find(params[:id])\n\n respond_to do |format|\n if @post66.update_attributes(params[:post66])\n format.html { redirect_to(@post66, :notice => 'Post66 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post66.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def update\n @post101 = Post101.find(params[:id])\n\n respond_to do |format|\n if @post101.update_attributes(params[:post101])\n format.html { redirect_to(@post101, :notice => 'Post101 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post101.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post143 = Post143.find(params[:id])\n\n respond_to do |format|\n if @post143.update_attributes(params[:post143])\n format.html { redirect_to(@post143, :notice => 'Post143 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post143.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update(doc, uri=nil, content_type=nil)\n return _put_doc(doc, uri, content_type)\n end", "def update\n @post284 = Post284.find(params[:id])\n\n respond_to do |format|\n if @post284.update_attributes(params[:post284])\n format.html { redirect_to(@post284, :notice => 'Post284 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post284.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post125 = Post125.find(params[:id])\n\n respond_to do |format|\n if @post125.update_attributes(params[:post125])\n format.html { redirect_to(@post125, :notice => 'Post125 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post125.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n@post = Post.find(params[:id])\nrespond_to do |format|\nif @post.update_attributes(params[:post])\nflash[:notice] = 'Post was successfully updated.'\nformat.html { redirect_to posts_path(\n:forum_id => params[:forum_id],\n:topic_id => params[:topic_id]) }\nformat.xml { head :ok }\nelse\nformat.html { render :action => \"edit\" }\nformat.xml { render :xml => @post.errors.to_xml }\nend\nend\nend", "def update\n @post = Post.find(params[:id])\n\tpublished = false\n\tif params[:post][:published] == 1\n\t published = true\n\tend\n\n respond_to do |format|\n if @post.update_attributes(params[:post] )\n format.html { redirect_to(@post, :notice => 'Post updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put endpoint, data\n do_request :put, endpoint, data\n end", "def update\n @post156 = Post156.find(params[:id])\n\n respond_to do |format|\n if @post156.update_attributes(params[:post156])\n format.html { redirect_to(@post156, :notice => 'Post156 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post156.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end" ]
[ "0.68651897", "0.6690302", "0.6296158", "0.628079", "0.61023486", "0.60967356", "0.60338587", "0.59068114", "0.59000576", "0.5891347", "0.58817357", "0.58754456", "0.58665144", "0.5847078", "0.58386284", "0.5834547", "0.5827054", "0.5824204", "0.58199763", "0.5814364", "0.58111954", "0.58111954", "0.58111954", "0.58111954", "0.5806228", "0.57838124", "0.57453233", "0.5734771", "0.57342476", "0.56994265", "0.5692338", "0.56895846", "0.56895846", "0.5688499", "0.56619495", "0.5657418", "0.56549454", "0.5652744", "0.56509256", "0.56507367", "0.5644801", "0.56432563", "0.56361365", "0.56128114", "0.56097776", "0.5602351", "0.56010795", "0.5599187", "0.5597997", "0.55975485", "0.55763227", "0.5575733", "0.5575184", "0.55702513", "0.55694616", "0.556813", "0.5565405", "0.5556196", "0.5551796", "0.5551698", "0.5544347", "0.5541181", "0.5539308", "0.55318743", "0.55278736", "0.5520758", "0.55187374", "0.5516241", "0.5515826", "0.55082273", "0.55046123", "0.5483857", "0.548078", "0.547755", "0.5472883", "0.54719096", "0.5468121", "0.5467265", "0.54631805", "0.5462712", "0.5460836", "0.5460683", "0.54606247", "0.54606247", "0.54606247", "0.5454182", "0.5450021", "0.5446556", "0.5445673", "0.5445627", "0.54453915", "0.54417014", "0.5421831", "0.5416023", "0.54112494", "0.54112494", "0.54112494", "0.54112494", "0.54112494", "0.54112494" ]
0.58067876
24
DELETE /posts/1 DELETE /posts/1.xml
def destroy @post = Post.find(params[:id]) @post.destroy respond_to do |format| format.html { redirect_to(posts_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n r = PostRepository.new\n @post = r.GetPost(\"PostID\", params[:id].to_i)\n r.delete @post\n\n respond_to do |format|\n format.html { redirect_to(posts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.deleted = 1\n @post.save\n\n respond_to do |format|\n format.html { redirect_to(posts_url) }\n format.xml { head :ok }\n end\n make_rss\n end", "def destroy\n\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to(posts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to(posts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to(root_path, :notice => t('controller.deleted')) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to(posts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to(posts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to(posts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to(posts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to(posts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to(posts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to(posts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to(posts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to(posts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to(posts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to(posts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to(posts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to(posts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to(posts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to(posts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def delete_post\n\t \n \tend", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n \n respond_to do |format|\n format.html { redirect_to(posts_url, notice: t('posts.index.post_deleted')) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to(root_url, :notice => 'Post was successfully removed.') }\n format.xml { head :ok }\n end\n end", "def destroy\n if @post.destroy\n flash[:notice] = \"post deleted!\"\n end\n respond_to do |format|\n format.html { redirect_to(posts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n# format.xml { head :ok }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n format.xml { head :no_content }\n end\n end", "def destroy\n @post251 = Post251.find(params[:id])\n @post251.destroy\n\n respond_to do |format|\n format.html { redirect_to(post251s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n respond_to do |format|\n format.html { redirect_to(admin_posts_url, :notice => 'Successfully deleted') }\n format.xml { head :ok }\n end\n end", "def destroy\n @post445 = Post445.find(params[:id])\n @post445.destroy\n\n respond_to do |format|\n format.html { redirect_to(post445s_url) }\n format.xml { head :ok }\n end\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @post246 = Post246.find(params[:id])\n @post246.destroy\n\n respond_to do |format|\n format.html { redirect_to(post246s_url) }\n format.xml { head :ok }\n end\n end", "def delete\n @post = Post.find(params[:id])\n end", "def delete(url)\n raise Error, \"Missing URL\" unless url\n get('posts/delete?uri=' << u(url))\n nil\n end", "def destroy\n @post446 = Post446.find(params[:id])\n @post446.destroy\n\n respond_to do |format|\n format.html { redirect_to(post446s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post.destroy\n\n head :no_content\n end", "def destroy\n destroy_q(@post, posts_url)\n end", "def destroy\n @post405 = Post405.find(params[:id])\n @post405.destroy\n\n respond_to do |format|\n format.html { redirect_to(post405s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post134 = Post134.find(params[:id])\n @post134.destroy\n\n respond_to do |format|\n format.html { redirect_to(post134s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post321 = Post321.find(params[:id])\n @post321.destroy\n\n respond_to do |format|\n format.html { redirect_to(post321s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post66 = Post66.find(params[:id])\n @post66.destroy\n\n respond_to do |format|\n format.html { redirect_to(post66s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n #@post = @contest.posts.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to(posts_path) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @post = Post.find(params[:id])\r\n @post.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(:action => 'adminlist') }\r\n format.xml { head :ok }\r\n end\r\n end", "def destroy\n @post.destroy\n head :no_content\n end", "def destroy\n @post.destroy\n head :no_content\n end", "def destroy\n @post407 = Post407.find(params[:id])\n @post407.destroy\n\n respond_to do |format|\n format.html { redirect_to(post407s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post57 = Post57.find(params[:id])\n @post57.destroy\n\n respond_to do |format|\n format.html { redirect_to(post57s_url) }\n format.xml { head :ok }\n end\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy\n@post = Post.find(params[:id])\[email protected]\nrespond_to do |format|\nformat.html { redirect_to posts_path(:forum_id => params[:forum_id],\n:topic_id => params[:topic_id]) }\nformat.xml { head :ok }\nend\nend", "def destroy\n @post55 = Post55.find(params[:id])\n @post55.destroy\n\n respond_to do |format|\n format.html { redirect_to(post55s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n\t@post = Post.find(params[:id])\n @post.destroy\n flash[:success] = \"Post deleted\"\n respond_to do |format|\n format.html { redirect_to(user_posts_path(@post.user)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @offpost = Offpost.find(params[:id])\n @offpost.destroy\n\n respond_to do |format|\n format.html { redirect_to(offposts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post78 = Post78.find(params[:id])\n @post78.destroy\n\n respond_to do |format|\n format.html { redirect_to(post78s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post447 = Post447.find(params[:id])\n @post447.destroy\n\n respond_to do |format|\n format.html { redirect_to(post447s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post54 = Post54.find(params[:id])\n @post54.destroy\n\n respond_to do |format|\n format.html { redirect_to(post54s_url) }\n format.xml { head :ok }\n end\n end", "def delete(id, post)\n File.unlink(post_path(post))\n\n update_digests do |digests|\n digests.delete(id)\n end\n end", "def destroy\n @post157 = Post157.find(params[:id])\n @post157.destroy\n\n respond_to do |format|\n format.html { redirect_to(post157s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n save_notice(\"文章删除成功.\")\n format.html { redirect_to(cpanel_posts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post328 = Post328.find(params[:id])\n @post328.destroy\n\n respond_to do |format|\n format.html { redirect_to(post328s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post.destroy\n head :no_content\n end", "def destroy\n @post.destroy\n back_to = params[:back_to] || posts_url\n respond_to do |format|\n format.html { redirect_to(back_to) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post182 = Post182.find(params[:id])\n @post182.destroy\n\n respond_to do |format|\n format.html { redirect_to(post182s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post = @topic.posts.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to(forum_topic_url(@forum, @topic)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post245 = Post245.find(params[:id])\n @post245.destroy\n\n respond_to do |format|\n format.html { redirect_to(post245s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post = @topic.posts.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to(project_topic_url(@project, @topic)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post483 = Post483.find(params[:id])\n @post483.destroy\n\n respond_to do |format|\n format.html { redirect_to(post483s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post75 = Post75.find(params[:id])\n @post75.destroy\n\n respond_to do |format|\n format.html { redirect_to(post75s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n Post.find(params[:id]).delete\n\n redirect_to '/'\n end", "def destroy\n @post149 = Post149.find(params[:id])\n @post149.destroy\n\n respond_to do |format|\n format.html { redirect_to(post149s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post154 = Post154.find(params[:id])\n @post154.destroy\n\n respond_to do |format|\n format.html { redirect_to(post154s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post125 = Post125.find(params[:id])\n @post125.destroy\n\n respond_to do |format|\n format.html { redirect_to(post125s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post453 = Post453.find(params[:id])\n @post453.destroy\n\n respond_to do |format|\n format.html { redirect_to(post453s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n post.destroy\n\n respond_to do |format|\n format.html { redirect_to(polymorphic_path([@postable.container, @postable], :anchor => 'posts')) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post10 = Post10.find(params[:id])\n @post10.destroy\n\n respond_to do |format|\n format.html { redirect_to(post10s_url) }\n format.xml { head :ok }\n end\n end", "def delete\n request(:delete)\n end", "def delete_post\n post = Post.find_by_id(params[:id])\n if !post.nil?\n post.destroy\n end\n end", "def destroy\n @post184 = Post184.find(params[:id])\n @post184.destroy\n\n respond_to do |format|\n format.html { redirect_to(post184s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post74 = Post74.find(params[:id])\n @post74.destroy\n\n respond_to do |format|\n format.html { redirect_to(post74s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post464 = Post464.find(params[:id])\n @post464.destroy\n\n respond_to do |format|\n format.html { redirect_to(post464s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post.destroy\n end", "def destroy\n @post.destroy\n end", "def destroy\n @post.destroy\n end", "def destroy\n @post.destroy\n end", "def destroy\n @post150 = Post150.find(params[:id])\n @post150.destroy\n\n respond_to do |format|\n format.html { redirect_to(post150s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post.destroy\n\n end", "def destroy\n @post129 = Post129.find(params[:id])\n @post129.destroy\n\n respond_to do |format|\n format.html { redirect_to(post129s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post409 = Post409.find(params[:id])\n @post409.destroy\n\n respond_to do |format|\n format.html { redirect_to(post409s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post21 = Post21.find(params[:id])\n @post21.destroy\n\n respond_to do |format|\n format.html { redirect_to(post21s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post99 = Post99.find(params[:id])\n @post99.destroy\n\n respond_to do |format|\n format.html { redirect_to(post99s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to(posts_url, :notice => \"Post (#{@post.title}) was successfully deleted.\") }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def destroy\n @blog_post = BlogPost.find(params[:id])\n @blog_post.destroy\n\n respond_to do |format|\n format.html { redirect_to(blog_posts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @blog_post = BlogPost.find(params[:id])\n @blog_post.destroy\n\n respond_to do |format|\n format.html { redirect_to(blog_posts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post_note = PostNote.find(params[:id])\n @post_note.destroy\n\n respond_to do |format|\n format.html { redirect_to(post_notes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post101 = Post101.find(params[:id])\n @post101.destroy\n\n respond_to do |format|\n format.html { redirect_to(post101s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to blog_posts_path, notice: 'Post was successfully destroyed.' }\n format.xml {head :ok }\n format.json { head :no_content }\n end\n end", "def destroy\n @post81 = Post81.find(params[:id])\n @post81.destroy\n\n respond_to do |format|\n format.html { redirect_to(post81s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post342 = Post342.find(params[:id])\n @post342.destroy\n\n respond_to do |format|\n format.html { redirect_to(post342s_url) }\n format.xml { head :ok }\n end\n end" ]
[ "0.7365959", "0.73219866", "0.7206054", "0.71519285", "0.71519285", "0.70925856", "0.70686704", "0.70686704", "0.70686704", "0.70686704", "0.70686704", "0.70686704", "0.70686704", "0.70686704", "0.70686704", "0.70686704", "0.70686704", "0.70686704", "0.70686704", "0.70686704", "0.70686704", "0.70451325", "0.70030457", "0.6967416", "0.69646436", "0.69190836", "0.6913736", "0.6887283", "0.6836932", "0.68308616", "0.68181646", "0.6815229", "0.6801816", "0.68006164", "0.67942137", "0.67811096", "0.67738533", "0.6769151", "0.6758862", "0.6755421", "0.67493695", "0.67360175", "0.6734262", "0.6731931", "0.67301184", "0.67286694", "0.67286694", "0.67266613", "0.67159724", "0.67071176", "0.67061836", "0.67021465", "0.6688447", "0.6683409", "0.6681722", "0.66816884", "0.6679102", "0.66753817", "0.6674927", "0.6668025", "0.6658566", "0.6658335", "0.66534454", "0.6650347", "0.66480255", "0.66478366", "0.6644811", "0.6644527", "0.6643579", "0.66401035", "0.66398233", "0.6634145", "0.6629092", "0.66284", "0.6627659", "0.6624822", "0.6620768", "0.66196465", "0.6616136", "0.66107607", "0.6608769", "0.6607719", "0.6607719", "0.6607719", "0.6607719", "0.66064477", "0.6603356", "0.65994495", "0.65975547", "0.6597256", "0.6596106", "0.6595443", "0.6593404", "0.6593404", "0.65836155", "0.6583228", "0.6581257", "0.6579949", "0.6579624" ]
0.7040628
23
output: string, with a comma, space and the first name format is Last name, First name for the return string data structure: array algo: split the string into an array and use parallel assignment, assign two different variables for first and last name return the string in the format above using string interpolation
def swap_name(full_name) first_name, last_name = full_name.split(' ') altered_name = "#{last_name}, #{first_name}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rearrange(string)\n match = /(\\w+), (\\w+) (\\w+)/.match(string) #(1)\n last_name = match[1]\n first_name = match[2]\n middle_name = match[3]\n \"#{first_name} #{middle_name[0,1]}. #{last_name}\" #(2)\nend", "def rearrange(name)\n match = /(\\w+), (\\w+)( \\w+)?/.match(name) # (1)\n\n last_name = match[1]\n first_name = match[2]\n if match[3]\n separator = \"#{match[3][0,2]}. \" # (2)\n else\n separator = ' ' # (3)\n end\n \n \"#{first_name}#{separator}#{last_name}\" # (4)\nend", "def swap_name(str)\n \"#{str.split[1]}, #{str.split[0]}\"\nend", "def swap_name(first_last)\n first, last = first_last.split\n \"#{last}, #{first}\"\nend", "def swap_name(name_str)\n first_name, last_name = name_str.split\n \"#{last_name}, #{first_name}\"\nend", "def proper_name #returns lastname, firstname\n \treturn self.last_name + ', ' + self.first\n end", "def full_name \r\n [firstname, surname].join(\" \") \r\n end", "def swap_name(string)\n \"#{string.split[1]}, #{string.split[0]}\"\nend", "def concat_name(first_name, last_name)\n\treturn \"#{last_name}, #{first_name}\"\nend", "def fullname\n [firstname,middlename,lastname].join(' ')\n end", "def student_name\n [first_name, last_name].join(' ')\n end", "def combine_name(first_name, last_name)\n # Q3 CODE HERE\n return \"#{first_name} #{last_name}\"\nend", "def format_name(first, last)\nif first.length<1 || last.length<1\n\tnil\nelse\n first = first.split.join\n last = last.split.join\n str = (first[0]+last).downcase.gsub(/[^0-9a-z]/i, '')\nend\nend", "def format_name(first, last)\n\tf_return = \"\"\n\tl_return = \"\"\n\tif first[0]\n\t\tf_return = first.gsub(\" \", \"\")\n\t\tf_return =f_return.gsub(/[^A-Za-z]/, '')\n\t\tf_return = f_return[0].downcase\n\telse\n\t\tf_return = \"\"\n\tend\n\tif last[0]\n\t\tl_return = last.gsub(\" \", \"\")\n\t\tl_return = l_return.gsub(/[^A-Za-z]/, '')\n\t\tl_return.downcase!\n\telse\n\t\tlast = \"\"\n\tend\n if f_return[0] && l_return[0]\n \treturn f_return+l_return\n else\n \treturn nil\n end\nend", "def full_name \n [first_name, last_name].join(' ')\n end", "def name\n [firstname, lastname] * ' '\n end", "def name\n [firstname, lastname] * ' '\n end", "def normal_name(text)\n\t\t\tar = text.split(', ')\n\t\t\tlastname = ar[0]\n\t\t\tfirstpart = ar[1]\n\t\t\tfirstname = firstpart.gsub(/[[:upper:]]\\./, '').strip\n\t\t\tfirstname + ' ' + lastname\n\t\tend", "def name\n [first_name, last_name].join(' ').strip\n end", "def swap_name(given_name)\n name_array = given_name.split\n \"#{name_array[1]}, #{name_array[0]}\"\nend", "def example(first_name, last_name)\n full_name = first_name + ' ' + last_name\n \"#{first_name} #{last_name}\"\nend", "def swap_name(string)\n name_array = string.split\n \"#{name_array[1]}, #{name_array[0]}\"\n\nend", "def first_and_last_name\n \"#{first_name} #{last_name}\"\n end", "def full_name\n [@first_name, @last_name].join(' ')\n end", "def swap_name(string)\n first, last = string.split\n \"#{last}, #{first}\"\nend", "def swap_name(string)\n first, last = string.split\n \"#{last}, #{first}\"\nend", "def full_name\n (first_name + ' ' + last_name).titleize\n # another way to do this vv\n # (first_name, last_name).join(' ')\n end", "def full_name\n \"#{first_name} #{middle_name} #{last_name}\".split.join(' ')\n end", "def name\n [firstName, lastName].join(\" \")\n end", "def swap_name(full_name)\n name_array = full_name.split(\" \")\n \"#{name_array[1]}, #{name_array[0]}\"\nend", "def name\n [first_name, last_name].join(' ')\n end", "def name\n [first_name, last_name].join(' ')\n end", "def name\n [first_name, last_name].join(' ')\n end", "def format_name(first, last)\n return nil if first.empty? || last.empty?\n first.gsub! (/[^a-z]/i, \"\")\n last.gsub! (/[^a-z]/i, \"\")\n ((first.split(\" \").join[0]<<last).split(\" \").join.downcase)\n\nend", "def full_name\n [first_name, last_name].join(' ')\n end", "def full_name\n [first_name, last_name].join(' ')\n end", "def full_name\n [first_name, last_name].join(' ')\n end", "def full_name\n [first_name, last_name].join(' ')\n end", "def full_name\n [first_name, last_name].join(' ')\n end", "def full_name\n [first_name, last_name].join(\" \")\n end", "def full_name\n [first_name, last_name].join(\" \")\n end", "def full_name\n [first_name, last_name].join(\" \")\n end", "def full_name\n [first_name, last_name].join(\" \")\n end", "def full_name\n [first_name, last_name].join(\" \")\n end", "def full_name\n [first_name, last_name].join(\" \")\n end", "def names\n nameparts = name.split(' ')\n firstinitial = nameparts.second ? \"#{firstname[0, 1]}.\" : ''\n secondname = nameparts.third ? nameparts.second : ''\n secondinitial = nameparts.third ? \"#{secondname[0, 1]}.\" : ''\n middlenames = nameparts.length > 2 ? nameparts.from(1).to(nameparts.from(1).length - 2) : []\n middleinitials = ''\n middlenames.each_with_index do |name, index|\n middleinitials << ' ' if index.positive?\n middleinitials << \"#{name.to_s[0, 1]}.\"\n end\n lastname = nameparts.last\n names = []\n names << full_name # Joseph Aloysius Hansom\n names << \"#{title} #{name}\" if titled? # Sir Joseph Aloysius Hansom\n names += aka # Boz, Charlie Cheese, and Crackers\n names << \"#{title} #{firstinitial} #{middleinitials} #{lastname}\" if titled? && nameparts.length > 2\n names << \"#{title} #{firstinitial} #{lastname}\" if titled? && nameparts.length > 1\n names << name if name != full_name # Joseph Aloysius Hansom\n if name.include? ',' # George Inn, Barcombe\n names << name.split(/,/).first\n return names\n end\n names << \"#{title} #{name.split(/ of /).first}\" if name.include?(' of ') && titled? # King Charles II [of England]\n names << name.split(/ of /).first if name.include?(' of ') # [King] Charles II [of England]\n names << \"#{firstname} #{middleinitials} #{lastname}\" if nameparts.length > 2 # Joseph A[loysius]. R[obert]. Hansom\n names << \"#{firstinitial} #{middleinitials} #{lastname}\" if nameparts.length > 2 # J. A. R. Hansom\n names << \"#{firstname} #{nameparts.second} #{lastname}\" if nameparts.length > 2 # Joseph Aaron Hansom\n names << \"#{firstname} #{secondinitial} #{lastname}\" if nameparts.length > 2 # Joseph A. Hansom\n names << \"#{firstinitial} #{secondname} #{lastname}\" if nameparts.length > 2 # J. Aaron Hansom\n names << \"#{title} #{firstname} #{lastname}\" if nameparts.length > 2 && titled? # Sir Joseph Hansom\n names << \"#{firstname} #{lastname}\" if nameparts.length > 2 # Joseph Hansom\n names << \"#{firstinitial} #{lastname}\" if nameparts.length > 1 # J. Hansom\n names << \"#{title} #{lastname}\" if titled? # Lord Carlisle\n names << \"#{title} #{firstname}\" if titled? # Sir William\n names << firstname if nameparts.length > 1 # Charles\n names << lastname if nameparts.length > 1 # Kitchener\n names.uniq\n end", "def full_name\n \t([first_name, last_name].compact-['']).join(' ')\n end", "def format_name(first, last)\n(First[0]+last).downcase\nend", "def last_name_first_name\n \"#{last_name}, #{first_name}\"\n end", "def full_name(first, last) #this does the same thing but can't be stored as a variable\n\tfirst + \" \" + last\nend", "def last_first\n last_first = last_name\n last_first += \", \"\n last_first += first_name\n if !@middle_name.nil?\n last_first += \" \"\n #take just first letter of middle name\n last_first += middle_name.slice(0,1)\n last_first += \". \"\n end\n last_first\n end", "def last_first\n last_first = last_name\n last_first += \", \"\n last_first += first_name\n if !@middle_name.nil?\n last_first += \" \"\n last_first += middle_name.slice(0, 1)\n last_first += \".\"\n end\n last_first\n end", "def name\n output = \"\"\n output += first_name + ' ' unless first_name.blank?\n output += last_name unless last_name.blank?\n output.strip\n end", "def swap_name(str)\n full_name = str.split\n \"#{full_name[1]}, #{full_name[0]}\"\nend", "def name\n value = \"#{last_name}, #{first_name}\".strip\n if value == ','\n ''\n else\n value\n end\n end", "def last_name_first_name(name)\n last = last_name(name)\n first = name.gsub(last, '').strip \n \"#{last}, #{first}\"\n end", "def eob_patient_name\n str = \"\" #initialize in case the fileds are blank\n str += self.patient_last_name.upcase if !self.patient_last_name.blank?\n str += \", \"\n str += self.patient_first_name.upcase if !self.patient_first_name.blank?\n return str\n end", "def fullname\n [firstname, middlename, lastname].compact.join(\" \")\n end", "def full_name\n [forename, surname].join(' ')\n end", "def swap_name(str)\n arr = str.split\n p arr[1] + ', ' + arr[0]\nend", "def fullname\n name = firstname + ' ' + lastname\n name.split.map(&:capitalize).join(' ')\n end", "def full_name\n [first_name, last_name].join(' ').strip\n end", "def first_name_last_name\n \"#{first_name} #{last_name}\"\n end", "def pretty_name\n name = @first_name.concat(@last_name).split /(?=[A-Z])/\n name = name[0] + \" \" + name[1]\n return name\n # return first_name + \" \" + last_name\n end", "def names(first_name, last_name)\n\t\"#{last_name.upcase}, #{first_name.capitalize}\"\nend", "def format_name(first, last)\n if first.length == 0\n p nil\n elsif last.length == 0\n p nil\n else\n first_name = first.delete(\" \")\n last_name = last.delete(\" \")\n first_init = first_name[0]\n name_temp = first_init + last_name\n name_v1 = name_temp.delete(\" \").downcase\n p name_v1\n end\nend", "def full_name(first_name, last_name)\n # concatenation\n # first_name.capitalize + \" \" + last_name.capitalize\n # interpolation\n \"#{first_name.capitalize} #{last_name.capitalize}\"\nend", "def full_name2 first_name, last_name\n first_name + \" \" + last_name\nend", "def last_first_name\n ret = \"\"\n ret += name unless name.blank?\n ret += \", \" unless firstname.blank? or name.blank?\n ret += firstname unless firstname.blank?\n ret\n end", "def create_new_fullname (new_fname, new_lname)\nfirst = new_fname.join.capitalize!\nlast = new_lname.join.capitalize!\nnew_fullname = first + \" \" + last \nend", "def full_name1(first, last)\n first + \" \" + last\nend", "def get_first_and_last_name\n if first_name && last_name && !first_name.empty? && !last_name.empty?\n [first_name, last_name]\n elsif description.present?\n [\n description.split(' ')[0],\n description.split(' ')[1]\n ]\n else\n [name[0..4], ''] # Return just the first 5 char from the username, just to increase the chances\n end\n end", "def first_name_and_last_name\n \"#{first_name}-#{last_name}\"\n end", "def swap_name(string)\n new_string = ''\n arr = string.split(' ')\n new_string << \"#{arr[-1]}, #{arr[0]}\"\nend", "def format_name(first, last)\n\n if (first == \"\" || last == \"\")\n nil\n else\n first_name = (first.gsub /\\s/, '')[0] + last\n first_name.downcase.gsub /\\s/, ''\n end\nend", "def format_name(first, last)\n if last == '' || first == ''\n word = nil\n else\n user_name = ''\n user_name += first.gsub(' ', '').gsub(/[^0-9A-Za-z]/, '')[0]\n user_name += (last.gsub(' ','').gsub(/[^0-9A-Za-z]/, ''))\n user_name.gsub(/\\d/, '').downcase\n end\nend", "def fullName()\n return first + \" \" + middle + \" \" + last\n end", "def casual_full_name\n [just_first, last].join(\" \")\n end", "def last_first\n last_first = last_name\n last_first += \", \"\n last_first += first_name\n if !@middle_name.nil?\n last_first += \" \"\n last_first += middle_name.slice(0, 1)\n last_first += \".\"\n end\n last_first\n end", "def last_name_first\n if name\n stripped_name = name.strip\n\n leading_dots = if name =~ /^([A-Za-z\\s\\.]*)\\s/\n $1\n end\n\n if leading_dots\n stripped_name = stripped_name.gsub(/#{leading_dots}/, \"\")\n return stripped_name + \", \" + leading_dots\n end\n\n name_parts = stripped_name.split(' ')\n if name_parts.count > 1\n [name_parts[1, name_parts.length].join(' '), name_parts[0]].join(', ')\n else\n name\n end\n else\n \"\" # return empty string instead of nil if no name\n end\n end", "def rearrange(string)\n has_middle_name = /(\\w+), (\\w+) (\\w+)/.match(string) # (1)\n no_middle_name = /(\\w+), (\\w+)/.match(string) # (2)\n\n if has_middle_name # (3)\n last_name = has_middle_name[1]\n first_name = has_middle_name[2]\n middle_name = has_middle_name[3]\n \"#{first_name} #{middle_name[0,1]}. #{last_name}\"\n elsif no_middle_name\n last_name = no_middle_name[1]\n first_name = no_middle_name[2]\n \"#{first_name} #{last_name}\"\n end\nend", "def name\n \"#{first_name[0]}. #{last_name}\"\n end", "def swap_name(str)\n str.split(\"\\n\").map do |name|\n n = name.split(\" \")\n n[1] + \", \" + n[0]\n end.join\nend", "def fullName()\n \t@first + \" \" + @middle + \" \" + @last\n end", "def full_name\n # if @middle_name.nil?\n # \"#{@first_name} #{@last_name}\"\n # else\n # \"#{@first_name} #{@middle_name} #{@last_name}\"\n # end \n [@first_name, @middle_name, @last_name].compact.join(' ')\n end", "def first_last_name\n names = name.split\n names.first + \" \" + names.last\n end", "def name_and_full_address\n [name, full_address].join ' - '\n end", "def name; \"#{first_name} #{last_name}\";end", "def to_s\n \t\"#{first_name} #{last_name}\"\n #return a formatted string as `first_name(space)last_name`\n end", "def display\n [first_name, last_name].join(\" \")\n end", "def full_name\n [first_name, last_name].join(' ')\n end", "def split_first_lastname s\n last,first = s.split(/,/,2)\n first = '' if first == nil\n return first,last.capitalize\n end", "def swap_name(full_name)\n first, last = full_name.split\n \"#{last}, #{first}\"\n\n # LS solution:\n # full_name.split.reverse.join(', ')\nend", "def name\n [last_name.upcase, first_name].delete_if { |n| n.blank? }.join(\", \")\n end", "def full_name\n \"#{name} #{first_last_name} #{second_last_name}\"\n end", "def surname_and_initials\n a = split\n initials = a.pop\n a.collect(&:capitalize).join(' ') + ' ' + initials\n end", "def full_name_last_first\n return self.first_name unless (self.last_name.length > 0)\n return (self.last_name + \", \" + self.first_name)\n end", "def name\n if first_name.present?\n name = [first_name, last_name].join(\" \")\n end\n name.present? ? name : ''\n end", "def name\n [first_name, last_name].compact.join(' ')\n end", "def full_name\n # TODO: update method -> \"${name}, ${last_name}\"\n name\n end" ]
[ "0.69440377", "0.68824387", "0.6861885", "0.6836154", "0.6815384", "0.681294", "0.68057173", "0.68028796", "0.67968273", "0.67735994", "0.6754903", "0.67395276", "0.66896445", "0.66311324", "0.6630839", "0.662611", "0.662611", "0.660613", "0.6587113", "0.6585405", "0.65850514", "0.65848875", "0.65824103", "0.65782225", "0.6578112", "0.6578112", "0.6572372", "0.6558442", "0.65556383", "0.65517485", "0.6545095", "0.6545095", "0.6545095", "0.65406495", "0.65391964", "0.65391964", "0.65391964", "0.65391964", "0.65391964", "0.6521687", "0.6521687", "0.6521687", "0.6521687", "0.6521687", "0.6521687", "0.6520109", "0.6517969", "0.6513243", "0.65119106", "0.6499269", "0.64982784", "0.64918864", "0.64870995", "0.648329", "0.6471304", "0.64672744", "0.64646715", "0.64630395", "0.6460173", "0.64589405", "0.64586055", "0.64581", "0.64541173", "0.64531875", "0.6447984", "0.64454246", "0.6441766", "0.6419389", "0.6416516", "0.6412613", "0.6411077", "0.64049333", "0.6401553", "0.64009655", "0.63909936", "0.6388916", "0.6384989", "0.6384458", "0.63795865", "0.6378247", "0.6363639", "0.6357934", "0.6350793", "0.63225275", "0.6321879", "0.6317182", "0.63126725", "0.6312029", "0.6307195", "0.6302777", "0.62949854", "0.6292958", "0.62916654", "0.62827015", "0.6278671", "0.6269502", "0.62662786", "0.6263433", "0.62608993", "0.6260882" ]
0.6620172
17
outputs the id's that need to be removed from omni_dev
def output_must_delete_id File.open('duplicate.txt') do |f| f.each_line do |line| is_first_result = true name = line.strip @sqlite.execute("select * from #{@table} where name='#{name}'") do |row| if is_first_result is_first_result = false else @must_delete_id << row[0] end end end end puts @must_delete_id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_ids\n # no-op\n end", "def inspect\n \"#{@id.inspect} (#{@devices.count} devices)\"\n end", "def get_removed_idles( list_of_idles )\n\t\tret_val = []\n\n\t\tcurrent_idles = get_idles\n\n\t\tlist_of_idles.each do |old_idle|\n\t\t\tunless current_idles.include? old_idle\n\t\t\t\tret_val += [ old_idle ]\n\t\t\tend\n\t\tend\n\n\t\treturn ret_val\n\tend", "def garbage_collect_uuids\n Uuidify::Uuid.where(:model_name => self.to_s).find_each do |uuid|\n if !where(:id => uuid.model_id).first\n uuid.destroy\n end\n end\n end", "def ids\n @ids ||= begin\n ioctl(EVIOCGID, buf = '\\x00' * 8)\n buf.unpack('S!4')\n end\n end", "def print_list_delete\n\t\tputs \"\"\n\t\tputs \"\"\n\t\tputs @list_name\n\t\tprint \"-\" * 40\n\t\t@grocery_list.each {|k, v| puts \"#{k} #{v}\"}\n\t\tputs \"\"\n\t\tdelete_item\n\tend", "def delete_element(lines_number)\n\t\tdeleted_element_hash = {modify_nodes: [], add_nodes: [], remove_nodes: [], modify_edges: [], remove_edges: [], add_edges: []}\n\n\t\tlines_number.reverse.each do |number|\n\t\t\tdeleted_element_hash = merge_two_hashes(deleted_element_hash , remove_element(number))\n\t\tend\n\t\treturn uniqify_arrays_in_hash(deleted_element_hash, :id)\n\tend", "def connect_deleted_beer\n \"#{beer_name} [id: #{id}]\"\n end", "def object_ids\n #FIXME\n base = @datapath\n Dir.glob(\"#{base}/[0-9][0-9]/[0-9][0-9]/[0-9][0-9]/[0-9][0-9]\").map do |dir|\n dir[base.length..-1].delete('/').to_i\n end\n end", "def obliterate()\n @@users_by_uid.delete(@uid)\n @@users_by_nick.delete(Channel.to_lower(@nick))\n part_all()\n end", "def delete(v)\n\n\tif List.all[v.to_i - 1] == nil\n\n\n\t# id = List.all[v.to_i - 1][:id]\n\n # list_of_ids = []\n\n # List.all.each do |idv|\n\t # list_of_ids << idv.id\n # end\n\n # if (list_of_ids.include?id) == false \n\n # target_id = List.where(id: id)\n\n # if target_id.count == 0\n\n\n clear_screen\n 20.times do blank_line \n end \n \tputs \"Sorry man, there is no such id/person! Did you remember correctly? Please try again..\".center(180)\n blank_line\n puts \"Your list still looks like this! Woohoo!\".center(180)\n sleep(3)\n clear_screen\n normal_list\n blank_line\n else\n id = List.all[v.to_i - 1][:id]\n\n target_person = List.find(id)\n\ttarget_person.destroy\n\n \t# list_of_people = List.where(id: id)\n \t# target = list_of_people[0]\n \t# target.destroy\n \n clear_screen\n 20.times do blank_line \n end \n \tputs \"Muahahhahaahha!! AHHAHA! We've found that person and BLOWN that person up!\".center(180)\n \tblank_line\n \tputs \"THIS IS YOUR UPDATED CONTACT LIST WITH THAT PERSON DEAD! MUAHAHAHHAHA!\".center(180)\n \tsleep(3)\n \tclear_screen\n \tnormal_list\n \tblank_line\n end \nend", "def id\n @values.fetch('ai.device.id') { \n @values['ai.device.id'] = nil\n }\n end", "def remove_monitoring_contributor_ids\n ids = monitoring_contributor_ids - contributors_to_monitor\n @remove_monitoring_contributor_ids ||= ids.empty? && monitoring_contributor_ids.any? ? contributors_to_monitor : ids\n end", "def delete_plates\n show do \n title \"Discard Plates\"\n \n discard_plate_ids = operations.select { |op| op.temporary[:delete] }.map { |op| op.input(\"Plate\").item.id }\n note \"Discard the following plates with 0 colonies: #{discard_plate_ids}\"\n end if operations.any? { |op| op.temporary[:delete] }\n end", "def cleanup_nonces\n now = Time.now.to_i\n nonces = OpenidNonce.all\n ids = nonces.collect { |n| n.id if (n.timestamp - now).abs > Nonce.skew }\n OpenidNonce.delete ids.compact\n end", "def cmd_ids\n print_tree(Editor, 0, true)\n end", "def libraries_remove_display\n string = \"\"\n self.library.each do |l|\n string += \"#{l.id}. #{l.branch_name}\\n\"\n end\n string\n end", "def del(opts)\n \"\"\n end", "def deletions\n stat[1]\n end", "def resetSimulator deviceID\n command = \"#{self.getXcodeSimctlPath} erase #{deviceID}\"\n puts command.green\n puts `#{command}`\n\n end", "def remove_tracking_id(a)\n value = a[self::TRACKING_FIELD]\n a[self::TRACKING_FIELD] =\n value.dup.sub!(/\\n?-- Managed by kennel .*/, \"\") ||\n raise(\"did not find tracking id in #{value}\")\n end", "def delete_edy\n msg = \"SCNM=#{self.uid}\"\n header = {'Cookie' => \"WRPWD=#{IEConfig::LDAP::EdyPass}\"}\n IEConfig::LDAP::EdyDevices.each do |device|\n begin\n http = Net::HTTP.new(device[1])\n http.open_timeout = IEConfig::LDAP::Timeout\n res = http.post('/card.cgi', msg, header)\n res.body.gsub(/(\\s|\\\")|=|\\[|\\]/,\"\").split('cd')[1].split(';')[0].gsub(/\\d{16}/,'').scan(/\\d{5}/).each do |id|\n http.post('/card.cgi', \"INDEX=#{id}&MODE=D\", header)\n end\n rescue Timeout::Error\n next\n end\n end\n end", "def clear_target_id\n RssLog.all_types.each do |type|\n send(\"#{type}_id=\", nil)\n end\n end", "def other_devices(device_id)\n\t\t\t\tdb\n\t\t\t\t\t.view('devices/all')['rows']\n\t\t\t\t\t.reject { |device| device['id'].eql? device_id }\n\t\t\t\t\t.map! { |device| device['id'] }\n\t\t\tend", "def filter_id\n retrieve_name_columns.each do |name|\n next if name == \"church_name\"\n original_stdout = STDOUT.clone\n STDOUT.reopen(new_file(name), \"w\")\n special_character_records(name).each do |record| \n puts \"#{record.id}\\n\"\n end\n STDOUT.reopen(original_stdout)\n puts \"Total number of ids for #{name}: #{special_character_records(name).count}\"\n end\n single_ucf_file_lists\n remove_duplicate_entries\n end", "def remove_pre_mongified_ids\n self.copy_tables.each do |t|\n Mongify::Status.publish('remove_pre_mongified', :size => 1, :name => \"Removing pre_mongified_id #{t.name}\", :action => 'add')\n no_sql_connection.remove_pre_mongified_ids(t.name)\n Mongify::Status.publish('remove_pre_mongified', :action => 'finish')\n end\n end", "def clean_ids(_node)\n _node.xpath(\".//*[@local_id]\").each do |node|\n parent_name = node.parent.node_name\n name = \"#{parent_name}\"\n if $id_counters[name]\n $id_counters[name] = $id_counters[name] + 1\n else\n $id_counters[name] = 1\n end\n node.set_attribute(\"local_id\", \"dyn_#{name}_#{$id_counters[name]}\")\n end\n _node.xpath(\".//*[@id]\").each do |node|\n node.set_attribute(\"id\", %x|uuidgen|.strip)\n end\nend", "def contributors_removed # :nodoc:\n @properties[REMOVED].map { |id| @context.users[id] }\n end", "def remove_note_list()\n remove_upload_ids = []\n @document.uploads.each do |upload|\n remove_upload_ids << upload\n end\n \n return remove_upload_ids\n end", "def participants_removed # :nodoc:\n @properties[REMOVED].map { |id| @context.users[id] }\n end", "def show # NOT USED \n puts \"xxxxxxx NodeAttrC a:show - used for HACK for DEL but now fixed xxxxxxx\"\n \n # puts \"xxxxxxx NodeAttr a:show xxxxxxx\"\n # id = params[:id]\n # @node_attrb = NodeAttrb.find(id)\n\n destroy\n\n end", "def all_ids\n @all_ids ||= @ids_fenotypes.keys\n @all_ids\n end", "def remove_note_list()\n remove_upload_ids = []\n @collection.uploads.each do |upload|\n remove_upload_ids << upload\n end\n \n return remove_upload_ids\n end", "def deletion_id\n SecureRandom.hex(20)\n end", "def remove_from_list *list\n @show = @show - TinyPng::Path.get_all(list)\n end", "def delete_vuln(opts)\n raise ArgumentError.new(\"The following options are required: :ids\") if opts[:ids].nil?\n\n ::ApplicationRecord.connection_pool.with_connection {\n deleted = []\n opts[:ids].each do |vuln_id|\n vuln = Mdm::Vuln.find(vuln_id)\n begin\n deleted << vuln.destroy\n rescue # refs suck\n elog(\"Forcibly deleting #{vuln}\")\n deleted << vuln.delete\n end\n end\n\n return deleted\n }\n end", "def deleteEntityList( gen_id, entity_id)\n params = Hash.new\n params['gen_id'] = gen_id\n params['entity_id'] = entity_id\n return doCurl(\"delete\",\"/entity/list\",params)\n end", "def delete\n puts \"Device #{name}::#{serial} Dettached!\\n\"\n log_message(\"#{self}\", \"Device #{name}::#{serial} Dettached!\\n\")\n rfid_delete\n end", "def representation_ids\n (Array.wrap(representations) + Array.wrap(additional_representation)).uniq.delete_if(&:empty?)\n end", "def deletions\n Array(@gapi.deletions).map { |gapi| Record.from_gapi gapi }\n end", "def del\n\t\t#methode ruft show auf ==> !?! ==> err aber funktioniert\n\tend", "def promotion_id_dump\n pending_promotions.map(&:id)\n end", "def recordInAll id\n\t0.upto(@toRemove.length - 1) { |i|\n\t\t\t@toRemove[i] << id\n\t}\nend", "def bulk_delete\n module_ids_string = params[:ids]\n module_ids = eval(module_ids_string)\n\n module_ids.each do |id|\n uni_module = UniModule.find(id.to_i)\n can_delete = true\n if !uni_module.nil?\n\n Group.all.each do |group|\n if group.uni_modules.include?(uni_module)\n can_delete = false\n break\n end\n end\n if can_delete\n uni_module.comments.each do |comment|\n logs = UniModuleLog.all.where(:uni_module_id => uni_module.id)\n if logs.size >0\n logs.each do |log|\n log.destroy\n end\n end\n pflogs = PathwaySearchLog.all.where(:first_mod_id => @uni_module.id)\n if pflogs.size >0\n pflogs.each do |log|\n pflogs.destroy\n end\n end \n pslogs = PathwaySearchLog.all.where(:second_mod_id => @uni_module.id)\n if pslogs.size >0\n pslogs.each do |log|\n pslogs.destroy\n end\n end \n comment.destroy\n end\n uni_module.destroy\n end\n\n end\n #uni_module.update_attribute(\"name\", id)\n\n end\n\n head :no_content\n\n end", "def omim_ids\n @table.keys\n end", "def destroy\n self.littles.each do | little|\n little.big_id = nil;\n end\n self.positions.each do | pos |\n pos.dke_info_id = nil;\n end\n return super\n end", "def remove\r\n session_user.details.select { |d| d.key =~ /^cc_/ }.each { |d| d.destroy }\r\n render :text => \"Craftsman Club details wiped clean.\"\r\n end", "def nfs_prune(valid_ids)\n end", "def to_s\n return \"{Deleted embedded #{@type} object which had ZICCLOUDSYNCINGOBJECTS.ZIDENTIFIER: #{uuid}}\" \n end", "def all_ids\n json = JSON.parse(http_client.get(\"mobiledevices\"))\n json[\"mobile_devices\"].map { |c| c[\"id\"] }\n end", "def remove\n ids = params[\"#{model.name.underscore}_ids\"]\n if ids.is_a?(Array) && ids.length > 0\n model.where(id: params[\"#{model.name.underscore}_ids\"]).destroy_all\n flash[:info] = \"Successfully deleted #{ids.length} #{type_label}\"\n end\n redirect_to sti_path(@type)\n end", "def sub_remove _value=0\n send_cmd(\"sub_remove #{_value}\")\n end", "def refresh_ids\n\t\t# Find all puzzle IDs retrieved\n\t\tpuzzle_files = Dir[\"./puzzles/*.pdf\"]\n\t\tids = puzzle_files.map do |path|\n\t\t\tpath.split(\"/puzzle-\").last.split(\".\").first\n\t\tend\n\t\t@puzzle_ids = Set.new(ids)\n\n\t\t# Find all puzzle IDs mailed in packets\n\t\tpuzzle_packet_files = Dir[\"./puzzles/packets/*.pdf\"]\n\t\tid_groups = puzzle_packet_files.map do |path|\n\t\t\tpath.split(\"/\").last.split(\".\").first.split(\"-\")\n\t\tend\n\t\t@puzzle_packet_ids = Set.new(id_groups.flatten)\n\tend", "def destroy\n @otg_ident.destroy\n respond_to do |format|\n format.html { redirect_to otg_idents_url, notice: 'Otg ident was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def puts_massage_and_delete_md()\n puts \"created #{@id}.org\".green\n puts \"URL: #{@items[\"url\"]}\"\n system \"rm -f #{@id}.md\"\n end", "def del_weblog_explain; \"Remove weblog from your list.\"; end", "def destroy(ids)\n end", "def destroy(ids)\n end", "def del_unused\n if params[:tags_ids].nil?\n flash[:notice] = l('tags.no_tags_selected')\n redirect_to :action => \"index\"\n else\n @tags = Tag.find_all_by_id params[:tags_ids]\n @tags = @tags.to_a.map(&:name)\n Tag.destroy params[:tags_ids]\n flash[:notice] = \"#{l('tags.deleted_tags')}: #{@tags.join(\", \")}\"\n redirect_to :action => \"index\"\n end\n end", "def destroy\n Clenum.destroy params[:ids].split(',')\n\n respond_to do |format|\n format.html { redirect_to(clenums_url) }\n format.xml { head :ok }\n end\n end", "def delete_id_column(players)\n players.map do |player|\n player.delete_if do |key, value|\n key == :id\n end\n end\n end", "def clear_legacy_ingest_id( dirname )\n\n begin\n f = File.join( dirname, TaskHelpers::INGEST_ID_FILE )\n File.delete( f )\n rescue => e\n end\n end", "def on_remove\n @context.notifications.off(\"graph.start\", self)\n @context.notifications.off(\"graph.stop\", self)\n\n io.outputs.each { |k, o| @context.connections.delete(o.guid) }\n io.unregister_inputs\n var.unregister\n stop\n end", "def remove_servers ids\n @station.remove_servers ids\n end", "def attachment_reference_ids_removed\n attachment_reference_ids = []\n self.class.attachable_columns.each do |column|\n attachment_reference_ids += send(\"#{column}#{ATTACHMENT_REMOVED_SUFFIX}\")\n end\n\n attachment_reference_ids\n end", "def remove_genomes_by_prot_id!(prot_ids)\n prot_ids.map{ |i| @genomes.delete(i) }.flatten.compact\n end", "def CleanUp\n\tallGroups.exec(\"killall ITGRecv >/dev/null 2>&1;\")\n\tallGroups.exec(\"killall ITGManager >/dev/null 2>&1; killall ITGSend >/dev/null 2>&1;\") \n\t#set the interfaces down\n @nodes.each do |node|\n\t\tif node.GetType()==\"R\"\n\t\t node.GetInterfaces().each do |ifn|\n\t\t # self.GetGroupInterface(node, ifn).down\n\t\t end\n\t\tend\n\t\t\n\t\tnode.GetInterfaces().each do |ifn| \n\t\t ifn.GetAddresses().each do |add|\n\t\t #info(\"Deleting address #{add.ip} from interface #{add.interface} on node #{node.id}\")\n\t\t Node(node.id).exec(\"ip addr del #{add.ip}/#{add.netmask} dev #{ifn.GetName()}\")\n\t\t end\n\t\tend\n\tend\n end", "def deletions\n commit_summary(:deletions)\n end", "def remove_data!\n connector.remove_torrent @ids, true\n @deleted = true\n end", "def kill!()\n s = \"\"\n self.playlist_test_cases.each do |playlist_test_case|\n s += playlist_test_case.freeze_version!.to_s\n s += playlist_test_case.id.to_s\n s += \", \"\n end\n self.dead = true\n self.save! \n s\n end", "def reset\n @item_id = []\n @in_format = \"EwsLegacyId\"\n @out_format = \"EwsId\"\n @mail_box = \"\"\n end", "def generate_ids\n hex_str = SecureRandom.hex(32)\n bytes = hex_str.scan(/.{1,2}/).map do |h|\n Integer(h, 16)\n end\n @doc_id = xtext(bytes[0, 16])\n @rev_id = xtext(bytes[16, 16])\n @attributes[:ID] = list([@doc_id, @rev_id])\n end", "def destroy\n output = \"oneimage delete #{resource[:name]} \", self.class.login\n `#{output}`\n end", "def parse_command_id_list\n ids = detail('default:noun', {this: self}) || []\n ids << detail('default:name')\n ids.compact.uniq\n end", "def deleteEntityYext_list( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/yext_list\",params)\n end", "def delete_all_custom_fields\n puts \"Deleting custom fields for user #{@user_id}\"\n fieldlist = get_all_custom_fields\n\n fields = JSON.parse(fieldlist)\n # make an array of ids\n field_ids = fields['custom_fields'].map {|k,v| k['id']}\n puts field_ids.length\n field_ids.each do |i|\n res = delete_custom_field(i)\n end\n end", "def destroy\n @renter = Renter.find(params[:id])\n Aidat.destroy_all(:daire => ( @renter.ap_num ) )\n @renter.destroy\n flash[:success] = \"Kiracı başarıyla silindi.\"\n redirect_to renters_path\n end", "def ids\n @nodes.map(&:id)\n end", "def ssu_ids\n dwelling_units.map(&:ssu_id).compact.uniq\n end", "def clear(id); end", "def delete_ids(args)\n while !args[:ids].empty? and ids = args[:ids].shift(500)\n objs = self.list(args[:class], \"id\" => ids)\n self.deletes(objs)\n end\n\n return nil\n end", "def delete_list\n logger.debug(params[:deleteIdList])\n\n if params[:deleteIdList].present?\n # 一括削除実行\n KonyuRireki.update_all(\"\\\"delFlg\\\"=1, \\\"koshinshaId\\\"=\" + params[:koshinshaId], \"\\\"id\\\" IN (\" + params[:deleteIdList] + \")\")\n end\n\n respond_to do |format|\n format.html { redirect_to action: \"index\", notice: 'KonyuRireki was successfully bulk logical deleted.', reload: 'on' }\n format.json { head :no_content }\n end\n end", "def report_list_uids\r\n post = { \"token\" => @token }\r\n docxml = nessus_request('report/list', post)\r\n uuids = Array.new\r\n docxml.root.elements['contents'].elements['reports'].each_element('//report') do |report| \r\n uuids.push(report.elements['name'].text)\r\n end\r\n return uuids\r\n end", "def test_delete_Port\n printf \"\\n@T:#{__method__}\\n\"\n @root_org = XMLParse.read(\"./tp/test_simple.xml\")\n# p XMLParse::get_PortList(@root_org,\"test\").keys\n\n @root = XMLParse.read(\"./tp/test_simple.xml\")\n golden = [\"CLK2\",\"RST\",\"DIN2\",\"IO_PORT1\"]\n golden.each do |signal|\n @root = XMLParse::delete_Port(@root,\"test\",signal)\n end\n# p XMLParse::get_PortList(@root_org,\"test\").keys\n# XMLParse::save(@root_org,\"mod.xml\")\n# `XMLtoVerilog mod.xml > tp/mod.v`\n# exit\n \n diff = port_diff(@root_org,@root,\"test\")\n revised = Array.new\n diff.each do |signal|\n revised << signal.Name\n end\n assert_equal(golden,revised)\n end", "def delete(oid)\n end", "def hide_parts(device)\n action_parts(device, '-d')\n end", "def ids\n @ids ||= []\n end", "def delete_list\n logger.debug(params[:deleteIdList])\n\n if params[:deleteIdList].present?\n # 一括削除実行\n Kokyaku.update_all(\"\\\"delFlg\\\"=1, \\\"koshinshaId\\\"=\" + params[:koshinshaId], \"\\\"kokyakuId\\\" IN (\" + params[:deleteIdList] + \")\")\n end\n\n respond_to do |format|\n format.html { redirect_to action: \"index\", notice: 'Kokyaku was successfully bulk logical deleted.', reload: 'on' }\n format.json { head :no_content }\n end\n end", "def rem_admin oid\n self.admins.delete oid\n end", "def errata_ids(id)\n criteria = {:type_ids => [Runcible::Extensions::Errata.content_type],\n :fields => {:unit => [], :association => ['unit_id']}}\n\n unit_search(id, criteria).map { |i| i['unit_id'] }\n end", "def destroy\n @interface = Interface.find(params[:id])\n @virtualmachine = Virtualmachine.find(@interface.virtualmachine_id)\n position_networkcard = `cat /etc/libvirt/qemu/#{@virtualmachine.hostname}.xml | grep -n \"slot='0x#{@interface.pci_slot}\" | cut -d ':' -f1`\n begin_networkcard = position_networkcard.to_i - 4\n end_networkcard = position_networkcard.to_i + 1\n delete_networkcard = `sed -i '#{begin_networkcard},#{end_networkcard}d' /etc/libvirt/qemu/#{@virtualmachine.hostname}.xml`\n\n @interface.destroy\n\n respond_to do |format|\n format.html { redirect_to interfaces_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @unidades = Unidade.find(params[:id])\n\n $uni_id = params[:id]\n @estagiario = Estagiario.find(:all, :conditions => ['unidade_id = ' + $uni_id])\n @laboratorio = Laboratorio.find(:all, :conditions => ['unidade_id = ' + $uni_id])\n @administracao = Administracao.find(:all, :conditions => ['unidade_id = ' + $uni_id])\n for estagiario in @estagiario\n estagiario.destroy\n end\n for laboratorio in @laboratorio\n laboratorio.destroy\n end\n for administracao in @administracao\n administracao.destroy\n end\n @unidades.destroy\n\n respond_to do |format|\n format.html { redirect_to(homes_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @log_pelea_blaz_blue_general = LogPeleaBlazBlueGeneral.find(params[:id])\n\n #get info de los usuarios\n id1=LigaBlazBlueGeneral.where(:cuenta=>@log_pelea_blaz_blue_general.ganador)\n id2=LigaBlazBlueGeneral.where(:cuenta=>@log_pelea_blaz_blue_general.perdedor)\n #salvar los datos\n id1[0].puntos-=@log_pelea_blaz_blue_general.puntos_ganador\n id1[0].save\n id2[0].puntos-=@log_pelea_blaz_blue_general.puntos_perdedor\n id2[0].save\n #Fin de saves externos\n\n @log_pelea_blaz_blue_general.destroy\n\n respond_to do |format|\n format.html { redirect_to(log_pelea_blaz_blue_generals_url) }\n format.xml { head :ok }\n end\n end", "def parse_list2remove_pg(info)\n ix_to_remove = info[:index]\n @pg_data_table.delete(ix_to_remove)\n return ix_to_remove\n end", "def short_ids(images)\n images.map { |img| img.id.to_s }\n .map { |x| x[0..11] }\n .join(',')\nend", "def clear_room_instance_ids\n get_attribute(:room_instance_ids).clear\n nil\n end", "def delete_nsds(nsds)\n not_found = []\n nsds.each do |nsd_td|\n descriptor = Nsd.where({ 'nsd.name' => nsd_td['name'],\n 'nsd.vendor' => nsd_td['vendor'],\n 'nsd.version' => nsd_td['version'] }).first\n if descriptor.nil?\n logger.error 'NSD Descriptor not found ' + nsd_td.to_s\n not_found << nsd_td\n else\n if descriptor['pkg_ref'] == 1\n descriptor.destroy\n del_ent_dict(descriptor, :nsd)\n else descriptor.update_attributes(pkg_ref: descriptor['pkg_ref'] - 1)\n end\n end\n end\n not_found\n end", "def ids(things)\n things.map(&:id).join(\",\")\n end", "def get_ids(array)\n ids = \"(\"\n array.each do |me|\n ids << me.id.to_s + \",\"\n end\n ids = ids.chomp(\",\")\n ids = ids + \")\"\n return ids\n\n end", "def delete\n @one.info\n @one.delete\n end", "def discard_bad_plates\n show do \n title \"Discard Plates\"\n \n discard_plate_ids = operations.select { |op| op.temporary[:delete] }.map { |op| op.input(\"Plate\").item.id }\n note \"Discard the following plates with 0 colonies: #{discard_plate_ids}\"\n end\n end" ]
[ "0.5599664", "0.5580426", "0.5575944", "0.55665547", "0.5501211", "0.5484019", "0.54737633", "0.5441215", "0.54245925", "0.5377052", "0.5376775", "0.5353674", "0.5346943", "0.5339038", "0.53124845", "0.52985525", "0.527253", "0.52724665", "0.5271439", "0.5262856", "0.5207046", "0.5195054", "0.51877683", "0.5169194", "0.5167286", "0.51439756", "0.51213974", "0.5117881", "0.5099864", "0.50877005", "0.5087052", "0.50732017", "0.50700384", "0.5067004", "0.50630367", "0.5059666", "0.5058477", "0.50534874", "0.50503737", "0.50492096", "0.5046691", "0.5041218", "0.50409776", "0.5038693", "0.5036462", "0.50350076", "0.50316566", "0.501654", "0.5015506", "0.49962366", "0.49951217", "0.4985896", "0.49842638", "0.49840114", "0.497883", "0.49782124", "0.49759015", "0.49759015", "0.49749723", "0.4974539", "0.49681348", "0.49650982", "0.4960267", "0.49569228", "0.49542713", "0.4952446", "0.49502617", "0.49486795", "0.4946294", "0.4943616", "0.49435005", "0.49370897", "0.49351093", "0.4934342", "0.49342534", "0.4932427", "0.4931606", "0.49292552", "0.4925428", "0.49243665", "0.4922644", "0.49215236", "0.49138227", "0.4912894", "0.4910276", "0.49094066", "0.49087614", "0.49079788", "0.4904956", "0.49049485", "0.48998883", "0.48994395", "0.4897954", "0.4897248", "0.48923594", "0.48914182", "0.48856091", "0.4877866", "0.4875899", "0.48756137", "0.4871152" ]
0.0
-1
You are following user
def follow(other) active_relationships.create(followed_id: other.id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def following?\n user.present?\n end", "def following\n @following||= get(\"/user/show/#{login}/following\")['users'].map { |u| User.new(connection, :login => u) }\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def follow \n @user = User.find_by_id(params[:id])\n if @user and current_user.follow(@user)\n flash[:notice] = \"You are now following #{@user.login}\"\n redirect_to home_path()\n elsif @user\n flash[:notice] = \"Already following\"\n redirect_to user_path(@user.login)\n else\n redirect_to home_path()\n end\n end", "def following_user?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n\t following.include?(other_user)\n \tend", "def following\n @following = @current_user.friends\n end", "def following_user?(other_user)\n following_users.include?(other_user)\n end", "def following?(user)\n following.include?(user)\n end", "def following?(other_user)\n\t following.include?(other_user)\n\tend", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?( other_user )\n followings.include?( other_user )\n end", "def following? (other_user)\n following.include?(other_user)\n end", "def follow\n current_user.follow_user(@user)\n render json: {ok: 1}\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n\t\t\tfollowing.include?(other_user)\n\t\tend", "def following?(other_user)\n \tfollowing.include?(other_user)\n \tend", "def following?(other_user)\n \tfollowing.include?(other_user)\n \tend", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end" ]
[ "0.7828037", "0.7586434", "0.74211264", "0.7385046", "0.73594207", "0.7353077", "0.7333545", "0.7329447", "0.73188686", "0.7316479", "0.7313342", "0.7313342", "0.7313342", "0.7300331", "0.7300331", "0.7300331", "0.7300331", "0.73001903", "0.72838545", "0.7278638", "0.72708505", "0.726456", "0.7262066", "0.7262066", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734", "0.7261734" ]
0.0
-1
checks whether you are following some user or not
def following?(other) following.include?(other) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def following?\n user.present?\n end", "def following?(other_user)\n\t following.include?(other_user)\n \tend", "def following?(user)\n following.include?(user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n\t following.include?(other_user)\n\tend", "def following_user?(other_user)\n following.include?(other_user)\n end", "def following?( other_user )\n followings.include?( other_user )\n end", "def following_user?(other_user)\n following_users.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n followeds.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(user)\n followings.include?(user)\n end", "def following?(other_user)\n \tfollowing.include?(other_user)\n \tend" ]
[ "0.83064127", "0.8088459", "0.80749756", "0.80683", "0.8048035", "0.8039388", "0.8020794", "0.8015167", "0.8004677", "0.7994099", "0.7988969", "0.7988969", "0.7988969", "0.7988969", "0.7979337", "0.7979337", "0.7979337", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.79730475", "0.7972511", "0.7956109" ]
0.0
-1
Creates a new Matrix with a (list of lists)
def initialize (row_list) @rows = row_list @rows_reduced = 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assemble_matrix(mat_list)\n mat_list.flatten!\n rows = columns = mat_list.length**(0.5)\n final_matrix = (0..rows-1).map { |x| [] }\n\n (0..rows-1).each do |row|\n (0..columns-1).each do |column|\n offset = ( ( row / 2 ) * 8 ) +\n ( ( row % 2 ) * 2 ) +\n ( ( column / 2 ) * 2 ) +\n column\n\n final_matrix[row] << mat_list[offset]\n end\n end\nfinal_matrix\nend", "def assemble_matrix(mat_list)\n mat_list.flatten!\n rows = columns = mat_list.length**(0.5)\n final_matrix = (0..rows-1).map { |x| [] }\n\n (0..rows-1).each do |row|\n (0..columns-1).each do |column|\n offset = ( ( row / 2 ) * 8 ) +\n ( ( row % 2 ) * 2 ) +\n ( ( column / 2 ) * 2 ) +\n column\n\n final_matrix[row] << mat_list[offset]\n end\n end\n final_matrix\n end", "def create_matrix\n (0...@height).to_a.map {|element| [0]*@width}\n end", "def matrix(arg); return Matrix::new(arg); end", "def a_matrix\n rowNames = (1..4).collect { |i| \"row\" + i.to_s }\n colNames = (1..4).collect { |i| \"col\" + i.to_s }\n TripletRep.new(\n [0,0,1,2,2], \n [0,2,0,0,2],\n [1.0,1.0,2.0,3.0,2.0], \n rowNames, colNames)\n end", "def matrix(*arrays)\n Array.new(arrays.size){|i| arrays[i]} ;\n end", "def to_matrix\n rows = Matrix.zero(@row_size, @column_size).to_a\n @data.to_enum().map{\n |k,v| rows[split_xy(k).last][split_xy(k).first] = v\n }\n Matrix.rows(rows)\n end", "def matrix(x, y, z)\n sub_array = []\n y.times do\n sub_array.push(z);\n end\n #sub_array\n array = [];\n x.times do\n array.push(sub_array)\n end\n array\nend", "def createMatrix()\n #matriks = Matrix.new\n @matriks_data = Matrix.zero(@jumlah_node)\n for i in 0..@jumlah_node-1\n for j in 0..@jumlah_node-1\n @matriks_data[i,j] = @file_data[i*@jumlah_node+ j]\n end\n end\n end", "def initialize_matrix(rows, columns)\n # create the matrix using the rows and columns\n matrix = Array.new(rows){Array.new(columns)}\n\n # initialize the matrix\n rows.times do |row|\n columns.times do |column|\n matrix[row][column] = 1\n end\n end\n return matrix\nend", "def initialize_matrix(rows, columns)\n # create the matrix using the rows and columns\n matrix = Array.new(rows){Array.new(columns)}\n\n # initialize the matrix\n rows.times do |row|\n columns.times do |column|\n matrix[row][column] = 1\n end\n end\n\n return matrix\nend", "def initialize( valor_entrada) \n @filas = valor_entrada.length\n\t@columnas = valor_entrada[0].length\n \t@matriz = Array.new(filas){Array.new(columnas)}\n\n \[email protected]{ |i|\n \t\[email protected]{ |j|\n \t\t@matriz[i][j] = valor_entrada[i][j]\n \t\t}\n \t}\nend", "def make_matrixarray\n\t\tmatrix = []\n\t\[email protected] do |this_speaker|\n\t\t\tmatrix << row(this_speaker)\n\t\tend\n\t\t#return matrix array\n\t\treturn matrix\n\tend", "def generate_matrix\n [].tap { |a| 25.times { a << 'X' } }.each_slice(5).to_a\n end", "def to_matrix\n rows = Matrix.zero(@row_size, @column_size).to_a\n DelegateMatrix.iterate_matrix(rows, Proc.new do |x,y,v|\n rows[y][x] = self[x,y]\n end)\n Matrix.rows(rows)\n end", "def to_matrix\n # Uses the Matrix(double[] vals, int m) constructor by packing the array by\n # transposition.\n Eureka::Matrix.new(self.transpose.flatten.to_java(:double), self.length)\n end", "def to_immut_matrix()\n return Matrix.rows self\n end", "def matrix_of(parse_result)\n\t\tif parse_result.nil? || parse_result.empty?\n\t\t\treturn Matrix.I(3)\n\t\tend\n\t\t\n#\t\tp parse_result # debug\n\t\t\n\t\tmatrix = (parse_result.map { |key_values|\n\t\t\t@_matrix_factory.create(key_values)\n\t\t}).reduce(:*)\n\t\t\n#\t\tp matrix # debug\n\t\t\n\t\tmatrix\n\tend", "def new_matrix(row_dimension, column_dimension)\n Array.new(row_dimension) do\n Array.new(column_dimension) do\n @cell = [' ', 'X'].sample\n end\n end\nend", "def create_matrix\n @long.times do |long|\n @matriz.push([])\n @width.times do |_width|\n @matriz[long].push([' . ', ' * '].sample)\n end\n end\n kill_cells_in_borders\n end", "def initMatrix(a)\n\t\tfor i in 0..5\n\t\tcolumn = []\n\t\ta[i] = column\n\t\t\tfor j in 0..5\n\t\t\tcolumn[j] = \" \"\n\t\t\tend\n\t\tend\n\treturn a\t\n\tend", "def matrix\n end", "def create_matrix\n rows_affected = []\n columns_affected = []\n\n # converting from string to int\n @rows_affected.each do |row|\n rows_affected << row.to_i\n end\n @columns_affected.each do |column|\n columns_affected << column.to_i\n end\n\n max_rows = rows_affected.max\n max_columns = columns_affected.max\n\n # round up to odd num\n if max_rows % 2 == 0\n max_rows = max_rows + 1\n end\n if max_columns % 2 == 0\n max_columns = max_columns + 1\n end\n\n @matrix = Array.new(max_rows)\n for index in 0...max_rows\n @matrix[index] = Array.new(max_columns)\n end\n\n # initialize matrix with 0s\n for i in 0...max_rows\n for j in 0...max_columns\n @matrix[i][j] = 0\n end\n end\n\n @number_of_rows = @matrix.size\n @number_of_columns = @matrix[0].size\n end", "def matrix(input)\n # shortcut for making matrix\n #array = Array.new(input[0].length) {Array.new}\n new_array= []\n \n #creating structure\n #get number of columns to create number of rows\n input[0].length.times do\n new_array.push([]) \n end\n puts \"new_array #{new_array}\"\n\n i = 0 \n # i represents col for input\n # i represents row for new_array\n # [row][col]\n # input[j][i]\n # new_array[i][j]\n while i < input[0].length\n j = 0 \n # j represents row for input\n # j represents col for new_array\n # [row][col]\n # input[j][i]\n # new_array[i][j]\n while j < input.length\n \n value = input[j][i]\n #puts \"value #{input[j][i]}\"\n new_array[i].push(value) #i represents column, adding values into columns\n j += 1\n end\n # puts \"new_array #{new_array}\"\n i += 1\n end\n return new_array\nend", "def make_matrixes col, row\n\n if row == 1 or col == 1\n return [ # matrixes\n [ # matrix\n Array.new(row, []), # rows\n [] # groups\n ]\n ]\n end\n\n #\n # type make_row_patterns : [[Int]]\n # when col = 3\n # => [[], [0], [1], [2], [0, 2]]\n make_row_patterns = -> {\n patterns = (0...col).to_a.subset(0, (col / 2.0).ceil)\n .select { |nums|\n nums.each_cons(2).none? { |ns| ns[0] + 1 == ns[1] }\n }\n }\n\n #\n # type make_row_patterns_hash : { [Int] => [Int] }\n # when col = 3\n # => {\n # [] => [[], [0], [1], [2], [0, 2]],\n # [0] => [[], [1], [2]],\n # [1] => [[], [0], [2], [0, 2]],\n # [2] => [[], [0], [1]],\n # [0, 2] => [[], [1]]\n # }\n #\n make_row_patterns_hash = -> {\n ps = make_row_patterns.call\n ps.each_with_object({}) { |nums, h|\n h[nums] = ps.select { |ns|\n ns.size + nums.size < col and\n ns - nums == ns\n }\n }\n }\n\n #\n # type patterns : { [Int] => [Int] }\n #\n patterns = make_row_patterns_hash.call\n\n #\n # type matrixes : [matrix]\n # type matrix : [rows, groups]\n # type rows : [row]\n # type row : [Int]\n # type groups : [Group]\n #\n matrixes = patterns.keys.map { |row|\n [[row], row.map { |x| Group.new [Point.make(x, 0)] }]\n }\n\n #\n # loop : apply flat_map\n (1...row).each { |y|\n matrixes = matrixes.flat_map { |matrix|\n rows = matrix.first\n groups = matrix[1]\n patterns[rows.last].map { |pattern|\n #\n # merge pattern with groups\n #\n # what a pain logic!!\n #\n new_groups = []\n catch(:pattern) do\n old_groups = groups.clone\n pattern.lazy.map { |x| Point.make x, y }\n .each { |point|\n\n # new_groups.map.size === 0, 1\n ngs = new_groups.lazy.map { |group|\n [group, group.corner_points(point)]\n }.select { |group_corners|\n group_corners[1].size > 0\n }.map { |g_c|\n\n # if group has (two) corner points,\n # when the group surround.\n if g_c[1].size > 1\n new_groups = nil\n throw :pattern\n end\n\n g_c[0]\n }.to_a\n new_groups = new_groups - ngs\n\n # old_groups.map.size === 0, 1, 2\n ogs = old_groups.lazy.map { |group|\n [group, group.corner_points(point)]\n }.select { |group_corners|\n group_corners[1].size > 0\n }.map { |g_c|\n\n # if group has (two) corner points,\n # when the group surround.\n if g_c[1].size > 1\n new_groups = nil\n throw :pattern\n end\n\n g_c[0]\n }.to_a\n old_groups = old_groups - ogs\n\n # new_group\n new_group = if ngs.empty? and ogs.empty?\n Group.new [point]\n else\n n_g = (ngs + ogs)\n .inject { |g_s, g| g_s.merge g }\n .add(point)\n\n # if group has (two) side points,\n # when the group surround.\n if n_g.side_points(col, row).size > 1\n new_groups = nil\n throw :pattern\n end\n\n n_g\n end\n new_groups << new_group\n }\n end # end of catch(:pattern)\n\n if new_groups\n [rows + [pattern], new_groups]\n else\n nil\n end\n }.compact\n }\n }\n matrixes\nend", "def clone\n Matrix.rows(@rows)\n end", "def run(list, rows)\n raise \"Cannot make a square matrix out of #{list.size} elements and #{rows} rows.\" unless list.size % rows == 0\n r.inverseFromList(:x => list, :y => rows)\n end", "def generate_matrix\n elements_qty = (@size * @size) - 1\n\n elements = *(0..(elements_qty)).map { |n| rand(A_CHAR_ASCII..Z_CHAR_ASCII).chr }\n matrix = []\n elements.each_slice(@size) { |x| matrix.push(x) }\n matrix\n end", "def get_matrix\n matrix = SnekMath::Matrix.new(area[0].length, area.length, 'empty')\n area.each_with_index do |row, y|\n row.each_with_index do |cell, x|\n matrix.set(x, y, cell)\n end\n end\n matrix\n end", "def deep_copy\n return Matrix.new(\n @matrix.map{|row| row.map{|e| e.dup}},\n @rownames.map{|e| e.dup},\n @colnames.map{|e| e.dup}\n )\n end", "def trasponer\n\t\telemento = Array.new(0)\n\t\tfor i in 0...colum do\n\t\t\tfila = Array.new(0)\n\t\t\tfor j in 0...filas do\n\t\t\t\tfila << pos[j][i]\n\t\t\tend\n\t\t\telemento << fila\n\t\tend\n\t\tMatriz.new(@ncol, @nfil, elemento)\n\tend", "def createMatrix\n jsonArray = Array.new(@matrixRow)\n #Tenim un array vertical de n files, en cada casella es crea un altre\n #vector horitzontal amb tantes posicions com \"tags\" té aquest tipus de taula\n\t\tfor i in 0..@matrixRow-1\n\t\t\tjsonArrayColumns = Array.new(@matrixColumn)\n\t\t\tfor j in 0..@matrixColumn-1\n if i==0 #Quan es la primera fila s'afegeixen els tags a la matriu\n jsonArrayColumns[j] = @firstRow[j]\n else\n\t\t\t\t jsonArrayColumns[j] = @jsonObject[i-1][@firstRow[j]]\n end\n\t\t\tend\n\t\t\tjsonArray[i] = jsonArrayColumns\n\t\tend\n return jsonArray\n end", "def ask_matrix(rows, columns)\n accl = []\n while accl.length < rows * columns do\n accl.concat ask\n end\n Matrix::build(rows, columns) do |r, c|\n accl[ c + r * rows ]\n end\nend", "def column2matrix(c)\n a = self.send(:column, c).to_a\n if c.is_a?(Range) and c.entries.size > 1\n return Matrix[*a]\n else\n return Matrix[*a.collect{|x| [x]}]\n end\n end", "def trasponer\n\t\t\telemento = Array.new(0)\n\t\t\tfor i in 0...colum\n\t\t\t\tfila = Array.new(0)\n\t\t\t\tfor j in 0...filas\n\t\t\t\t\tfila << pos[j][i]\n\t\t\t\tend\n\t\t\t\telemento << fila\n\t\t\tend\n\t\t\tMatriz.new(@ncol, @nfil, elemento)\n\t\tend", "def matriz_clave\n @m_clave=Array.new(4){Array.new()}\n i,j,contador=0,0,0\n @k.each do |x|\n if(contador==4)\n contador=0\n i=0\n j+=1\n end\n @m_clave[i][j] = x\n i+=1\n contador+=1\n end\n @m_clave\n end", "def to_matrix(default_value = nil, diagonal_value = nil)\n\n # Note: following code only fills the outer Array with the reference\n # to the same inner Array object.\n #\n # matrix = Array.new(nodes, Array.new(nodes))\n #\n # so create a new Array object for each row as follows:\n\n matrix = Array.new\n nodes.times do\n\tmatrix.push(Array.new(nodes, default_value))\n end\n\n if diagonal_value\n\tnodes.times do |i|\n\t matrix[i][i] = diagonal_value\n\tend\n end\n\n # assign index number for each node\n @graph.keys.each_with_index do |k, i|\n\t@index[k] = i\n end\n\n if @relations.empty?\t\t# only used after clear_relations!\n\[email protected] do |from, hash|\n\t hash.each do |to, relation|\n\t x = @index[from]\n\t y = @index[to]\n\t matrix[x][y] = relation\n\t end\n\tend\n else\n\[email protected] do |rel|\n\t x = @index[rel.from]\n\t y = @index[rel.to]\n\t matrix[x][y] = rel.relation\n\t matrix[y][x] = rel.relation if @undirected\n\tend\n end\n Matrix[*matrix]\n end", "def matriz_mensaje\n @m_mensaje=Array.new(4){Array.new(4,'')}\n i,j,contador=0,0,0\n @m.each do |x|\n if(contador==4)\n contador=0\n i=0\n j+=1\n end\n @m_mensaje[i][j] = x\n #p a[i][j]\n i+=1\n contador+=1\n end\n @m_mensaje\n\n end", "def initialize(rows, columns, input)\n @matrix = rows.times.map do |y| \n columns.times.map do |x| \n Cell.new(self, x, y, rand(input).to_i.even?)\n end\n end\n end", "def grid(n, m)\n Array.new(n) { Array.new(n) } # If you attempted to write this as Array.new(n, Array.new(m)) the contents would be repeated for each array rather\nend", "def build_multiplication_table(num_list)\n rows = []\n rows << ['-'] + num_list\n num_list.each do |n|\n rows << [n] + num_list.map{|p| n*p}\n end\n rows\n end", "def to_matrix\n rows = to_a(with_colnames: false)\n rows.each do |row|\n row.collect! do |x|\n case x\n when true then 1.0\n when false then 0.0\n else Float(x) rescue Float::NAN\n end\n end\n end\n rows.to_matrix\n end", "def add_rows! *rows\r\n matrix_new = add_rows *rows\r\n @rows = matrix_new.to_a\r\n end", "def matrix_join\n return self.dup if size == 0 # Deal with the trivial case\n normalized_matrixes = self.map{|matrix| matrix.normalize } # Ensure component matrixes are squared up\n row_counts = normalized_matrixes.map {|matrix| matrix.size }\n column_counts = normalized_matrixes.map {|matrix| matrix.row_sizes.max || 0 }\n result_rows = row_counts.max\n padded_matrixes = normalized_matrixes.map.with_index do |matrix, i|\n matrix + [[\"\"]*column_counts[i]]*(result_rows-matrix.size)\n end\n result = []\n result_rows.times do |i|\n joined_row = padded_matrixes.map{|matrix| matrix[i]}.flatten\n result << joined_row\n end\n result\n end", "def grid\n Matrix.build(@row_count, @column_count) { Cell.new }.to_a\n end", "def from_matrix(matrix)\n @bandwidth = BandMatrixFactory.calculate_bandwidth(matrix)\n @row_size = matrix.row_size\n @column_size = matrix.column_size\n \n @data = Array.new(@row_size){Array.new(@bandwidth*2+1,0)}\n\n DelegateMatrix.iterate_matrix(matrix, Proc.new do |x,y,v|\n self.[]=(x,y,v)\n end)\n end", "def initialize(*args)\n if args.size == 2 # no array initializer\n rows = args[0]\n cols = args[1]\n elsif args.size == 3 # flat array initializer\n rows = args[0]\n cols = args[1]\n ary = args[2]\n elsif args.size == 1 # nested list (by rows) initializer\n rows = args[0].size\n cols = args[0][0].size\n ary = args[0]\n else\n raise ArgumentError.new(\"wrong args: #{args.size} for 1, 2, or 3\")\n end\n\n @gsl = MatrixStruct.new(alloc(rows, cols))\n\n @size = [@gsl[:rows], @gsl[:cols]]\n\n if (args.size == 3) # flat array of value\n row = 0\n col = 0\n ary.each do |v|\n self[row, col] = v\n col += 1\n if (col == cols)\n col = 0\n row += 1\n end\n end\n elsif (args.size == 1) # nested array of rows of values\n row = 0\n ary.each do |rowdata|\n col = 0\n rowdata.each do |v|\n self[row, col] = v\n col += 1\n end\n row += 1\n end\n end\n end", "def matrix_clone\n @matrix_clone ||= matrix.map { |row| row.clone }\n end", "def setup_with_rows(row_contents)\n @fm = Array.new\n\n raise 'Invalid input to create fmatrix from rows' unless row_contents.kind_of?(Array) && row_contents.length > 0 && row_contents[0].kind_of?(Array) && row_contents[0].length > 0\n expected_row_size = row_contents[0].length\n row_contents.each do |row|\n raise 'Provided rows are not all the same size!' unless row.length == expected_row_size\n @fm.concat(row)\n end\n\n @rows = row_contents.length\n @cols = row_contents[0].length\n end", "def to_matrix(default_value = nil, diagonal_value = nil)\n\n #--\n # Note: following code only fills the outer Array with the reference\n # to the same inner Array object.\n #\n # matrix = Array.new(nodes, Array.new(nodes))\n #\n # so create a new Array object for each row as follows:\n #++\n\n matrix = Array.new\n nodes.times do\n matrix.push(Array.new(nodes, default_value))\n end\n\n if diagonal_value\n nodes.times do |i|\n matrix[i][i] = diagonal_value\n end\n end\n\n # assign index number\n if @index.empty? then\n # assign index number for each node\n @graph.keys.each_with_index do |k, i|\n @index[k] = i\n end\n else\n # begin workaround removing depencency to order of Hash#each\n # assign index number from the preset @index\n indices = @index.to_a\n indices.sort! { |i0, i1| i0[1] <=> i1[1] }\n indices.collect! { |i0| i0[0] }\n @index.clear\n v = 0\n indices.each do |k, i|\n if @graph[k] and !@index[k] then\n @index[k] = v; v += 1\n end\n end\n @graph.each_key do |k|\n unless @index[k] then\n @index[k] = v; v += 1\n end\n end\n # end workaround removing depencency to order of Hash#each\n end\n\n if @relations.empty?\t\t# only used after clear_relations!\n @graph.each do |from, hash|\n hash.each do |to, relation|\n x = @index[from]\n y = @index[to]\n matrix[x][y] = relation\n end\n end\n else\n @relations.each do |rel|\n x = @index[rel.from]\n y = @index[rel.to]\n matrix[x][y] = rel.relation\n matrix[y][x] = rel.relation if @undirected\n end\n end\n Matrix[*matrix]\n end", "def create_table\n dimension_length = (@numbers_to_multiply.length - 1)\n @multiplication_table = []\n new_table_row = [\" \"]\n\n for i in 0..dimension_length\n new_table_row << @numbers_to_multiply[i]\n end\n\n new_table_row\n @multiplication_table << new_table_row\n\n for x in 0..dimension_length \n new_table_row = []\n new_table_row << @numbers_to_multiply[x]\n # rowValues = \"#{@numbers_to_multiply[x]} |\"\n for y in 0..dimension_length\n nextEntry = @numbers_to_multiply[x] * @numbers_to_multiply[y]\n new_table_row << nextEntry\n end\n @multiplication_table << new_table_row\n end\n end", "def from_arrays(array2d)\n @bandwidth = BandMatrixFactory.calculate_bandwidth(array2d)\n @row_size = array2d.size\n @column_size = array2d.first.size\n \n @data = Array.new(@row_size){Array.new(@bandwidth*2+1,0)}\n \n DelegateMatrix.iterate_matrix(array2d, Proc.new do |x,y,v|\n self.[]=(x,y,v)\n end)\n end", "def add_one_vector(*matrices)\n matrices.map { |m|\n \tnum_rows = m.row_size\n \tnum_cols = m.column_size \t\n \tcolumns = [ Array.new(num_rows) { 1.0 } ]\n \tcolumns.push *(m.column_vectors.map { |v| v.to_a })\n \tMatrix.columns(columns)\n }\n end", "def initialize_matrix!\n @matrix = config.map do |_hand, minimum_position|\n minimum_position\n end.each_slice(13).to_a\n end", "def row2matrix(r)\n a = self.send(:row, r).to_a\n if r.is_a?(Range) and r.entries.size > 1\n return Matrix[*a]\n else\n return Matrix[a]\n end\n end", "def initialise_pheromone_matrix(num_cities, naive_score)\n v = num_cities.to_f / naive_score\n # Lembra uma matriz de incidencia! A coluna/ linha e uma cidade. o encontro da coluna e linha e o pheromonio entre as cidades.\n return Array.new(num_cities){|i| Array.new(num_cities, v)}\nend", "def multiply_matrix_and_term_list(matrix, term_list)\n\t\n\tresult_rows = []\n\tmatrix.values.each { |row|\n\t\tresult_row = []\n\t\trow.each { |elem|\n\n\t\t\tcase elem\n\t\t\tin Term\n\t\t\t\tproduct = multiply_term_and_term_list(elem, term_list)\n\t\t\tin TermList\n\t\t\t\tproduct = multiply_term_list_and_term_list(term_list, elem)\n\t\t\tin Fraction\n\t\t\t\tproduct = multiply_fraction_and_term_list(elem, term_list)\n\t\t\telse\n\t\t\t\tthrow_error(\"Matrix does not contain only Terms, TermLists, and Fractions.\", matrix, []) # TODO: Add stack trace (make a global)\n\t\t\tend\n\t\t\tresult_row.append(product)\n\t\t}\n\t\tresult_rows.append(result_row)\n\t}\n\treturn Matrix.new(matrix.line, matrix.col, result_rows)\nend", "def rowwise_seat_matrix\n number_of_columns = []\n @seat_matrix.map{|item| number_of_columns << item.last}\n number_of_rows = number_of_columns.flatten.uniq.max\n result =[]\n number_of_rows.times do |row|\n row_array = Array.new()\n @seat_matrix.each do |seat_matrix|\n unless seat_matrix.last <= row\n row_array << Array.new(seat_matrix.first, \"XX\") #Initializing array with string value \"XX\"\n else\n row_array << []\n end\n end\n result << row_array\n end\n return result\n end", "def t\n return Matrix.new(@rows, @cols) {|i,j| self[j,i]}\n end", "def my_transpose\n new_array = []\n\n (0...self.length).each do |row|\n new_row = []\n\n (0...self.length).each do |col|\n new_row << self[col][row]\n \n end\n new_array << new_row\n end\n new_array\n end", "def +(other)\n raise ArgumentError, \"Las dimensiones de las matrices no coinciden\" unless @filas == other.filas && @columnas == other.columnas\n new_mat = Array.new\n @filas.times do |i|\n fila = Array.new\n @columnas.times do |j|\n fila << @elementos[i][j] + other.at(i, j)\n end\n new_mat << fila\n end\n Matriz.new(new_mat)\n end", "def transpose\n return Matrix.new @rows.transpose\n end", "def create_work_matrix(array)\n array[1..-2].each_with_object([]) do |line, arr|\n line.gsub!(/\\s/, '0')\n arr << line[1..-2].chars\n end.to_a\n end", "def make_board\n board = Array.new(8) { Array.new(8) { Array.new(2) } }\n board.each_with_index do |row, row_i|\n row.each_with_index { |column, column_i| column[0], column[1] = row_i, column_i }\n end\n end", "def t\n return Matrix.new(@cols, @rows) {|i,j| self[j,i]}\n end", "def transpose(matrix)\n new_matrix = [[], [], []]\n matrix.each do |array|\n 3.times do |i|\n new_matrix[i] << array[i]\n end\n end\n new_matrix\nend", "def container_matrix\n cm = Array.new(container_type.y_dimension, Array.new(container_type.x_dimension, nil))\n children.each do |c|\n cm[c.container_y][c.container_x] = container_x\n end\n samples.each do |s|\n cm[s.container_y][container_x] = s\n end\n return cm\n end", "def d; Matrix.new(RAtlas.vec2diag(@storage)); end", "def matrix(fill_value = -1)\n Matrix[*@stats.pad(fill_value).each_slice(7).to_a.transpose]\n end", "def transpose(mtrx)\n new_mtrx = Array.new(3) { Array.new(3) }\n new_mtrx.each_with_index do |sub_arr, idx|\n sub_arr.each_with_index do |element, inner_idx|\n new_mtrx[idx][inner_idx] = mtrx[inner_idx][idx]\n end\n end\n new_mtrx\nend", "def transpose(matrix)\n new_matrix = Array.new(3) { Array.new }\n matrix.each_with_index do |row, row_index|\n row.each_with_index do |element, element_index|\n # binding.pry\n new_matrix[element_index][row_index] = element\n end\n end\n new_matrix\nend", "def make_columns(rows)\n columns = Array.new(rows.size) { [] }\n # make an empty nested array to represent columns.\n # iterate through the rows, for each row...\n # place the number into the new nested array evenly across the subarrays\n rows.each do |row|\n row.each_with_index do |num, col_idx|\n columns[col_idx] << num\n end\n end\n columns\nend", "def grid(n, m)\n arr = Array.new(n) { Array.new(m, :N) }\n arr\nend", "def inputs_matrix\n x = explicit_range(@x_range, @height)\n y = explicit_range(@y_range, @width)\n\n matrix_X = x.map{|e| [e]*@width}.flatten\n matrix_Y = ([y]*@height).flatten\n\n matrix_X.zip(matrix_Y)\n end", "def add_rows *rows\r\n matrix_a = self.to_a\r\n\r\n rows.each {|m|\r\n if m.column_size != self.column_size\r\n raise ArgumentError, \"number of columns should be identical\"\r\n end\r\n\r\n matrix_a += m.to_a\r\n }\r\n\r\n Matrix.rows(matrix_a)\r\n end", "def mda(width, height) \n return Array.new(width){ Array.new(height) }\nend", "def make_grid\n @grid = Array.new(4){Array.new(4)}\n end", "def create_position_array()\n array_2D = []\n array_1D = []\n\n (0...@row).each_with_index do |value, row_index|\n (0...@col).each_with_index { |value, col_index| array_1D.append(value+(row_index*@col)) }\n array_2D.append(array_1D)\n array_1D = []\n end\n\n return array_2D\n end", "def initialize(num_rows,num_columns)\n @num_rows = num_rows\n @num_columns = num_columns\n @rows = []\n for x in 1..num_rows\n fresh_row = Row.new(num_columns)\n @rows << fresh_row\n end\n end", "def generar_Matriz(tamano_N)\n fila_iter = []\n matriz_iter = []\n for fila in 1..tamano_N #Columnas\n for columna in 1..tamano_N #Filas\n fila_iter.push generar_Num(true,0,0)\n end\n matriz_iter.push fila_iter\n fila_iter = []\n end\n return matriz_iter\n end", "def row; reshape(1, length); end", "def generate_submatrices\n @hilbert_basis.find.to_a.combination(VERTICES).collect{ \n |x|Matrix.rows(x)}\n end", "def my_transpose\n output = Array.new(self.length) {Array.new(self.length)}\n\n self.each_with_index do |row, row_i|\n row.each_with_index do |col, col_i|\n output[col_i][row_i] = self[row_i][col_i]\n end\n end\n output\n end", "def matrix_addition(matrix1, matrix2)\n new_matrix = Array.new(matrix1.length) { Array.new(matrix1[0].length) }\n\n (0...matrix1.length).each do |i|\n (0...matrix1[i].length).each do |j|\n new_matrix[i][j] = matrix1[i][j] + matrix2[i][j]\n end\n end\n\n new_matrix\nend", "def to_matrix axis=:horizontal\n if axis == :horizontal\n Matrix[to_a]\n elsif axis == :vertical\n Matrix.columns([to_a])\n else\n raise ArgumentError, \"axis should be either :horizontal or :vertical, not #{axis}\"\n end\n end", "def multidimArray\n # fill multidimensional\n puts \"----------- Multi-dimensional arrays -------------- \"\n empty_table = Array.new(3) { Array.new(3) }\n Array({:a => \"a\", :b => \"b\"}) #=> [[:a, \"a\"], [:b, \"b\"]]\n number_array = [ [1,2,3], [4,5,6] ]\n puts number_array.to_s\nend", "def initialize(size)\n @size = size\n @rows = Array.new(size) { Array.new(size) }\n end", "def generate_matrix(rows, columns, min = 0, max = 10)\n Matrix::build(rows, columns) { |_, __| rand(min..max) }\nend", "def create_empty_field\n @field_matrix = Array.new(length) { Array.new(width, ' . ') }\n end", "def clone\n Sudoku.new Marshal.load(Marshal.dump(@matrix))\n end", "def populate(lines)\n\t\ti = 1\n\t\[email protected]_index do |x|\n\t\t\t# split each line into an array of integers and map to a 2 dimensional array\n\t\t\t@matrix[x] = lines[i].split(' ').map(&:to_i)\n\t\t\ti+=1\t\n\t\tend\t\n\tend", "def transpose(matrix)\n result = Array.new(matrix[0].length, []) #HARD - PASS BY REFERENCE ISSUE\n matrix.each do |row|\n row.each_with_index do |el, col_idx|\n result[col_idx] << el\n end\n end\n result\nend", "def *(other)\n\t\telemento = Array.new(0)\n\t\tfor i in 0...filas do\n\t\t\tfila = Array.new(0)\n\t\t\tfor j in 0...colum do\n\t\t\t\tfila << pos[i][j]*other\n\t\t\tend\n\t\t\telemento << fila\n\t\tend\n\t\tMatriz.new(@nfil, @ncol, elemento)\n\tend", "def my_transpose\n result = Array.new(length) { Array.new(length) }\n self.each_with_index do |row, r|\n row.each_with_index do |num, c|\n result[r][c] = self[c][r]\n end\n end\n result\n end", "def initialize (dimension1,dimension2)\n @grid = Matrix.rows((0...dimension2).collect{ |i| \n ((1+i*dimension1)..(i+1)*dimension1).to_a })\n end", "def clone\n return (Matrix.new(@x,@y) do |i,j| self[i][j].clone end)\n end", "def add_two_matrices(left, right)\n\t\n\tif left.rows != right.rows or left.cols != right.cols\n\t\tthrow_error(\"Matrix dimensions don't match when adding two matrices.\", left, []) # TODO: Add stack trace (make a global)\n\tend\n\n\tnew_rows = []\n\tfor row_index in (0..left.rows - 1)\n\t\trow = []\n\t\tfor col_index in (0..left.cols - 1)\n\t\t\tcase [left.values[row_index][col_index], right.values[row_index][col_index]]\n\t\t\tin [Term, Term]\n\t\t\t\trow.append(add_two_terms(left.values[row_index][col_index], right.values[row_index][col_index]))\n\t\t\tin [Term, TermList]\n\t\t\t\trow.append(add_term_and_term_list(left.values[row_index][col_index], right.values[row_index][col_index]))\n\t\t\tin [TermList, Term]\n\t\t\t\trow.append(add_term_and_term_list(right.values[row_index][col_index], left.values[row_index][col_index]))\n\t\t\tin [TermList, TermList]\n\t\t\t\trow.append(add_term_list_and_term_list(left.values[row_index][col_index], right.values[row_index][col_index]))\n\t\t\tin [Fraction, Term]\n\t\t\t\trow.append(add_fraction_and_term(left.values[row_index][col_index], right.values[row_index][col_index]))\n\t\t\tin [Fraction, TermList]\n\t\t\t\trow.append(add_fraction_and_term_list(left.values[row_index][col_index], right.values[row_index][col_index]))\n\t\t\tin [Term, Fraction]\n\t\t\t\trow.append(add_fraction_and_term(right.values[row_index][col_index], left.values[row_index][col_index]))\n\t\t\tin [TermList, Fraction]\n\t\t\t\trow.append(add_fraction_and_term_list(right.values[row_index][col_index], left.values[row_index][col_index]))\n\t\t\tin [Fraction, Fraction]\n\t\t\t\trow.append(add_fraction_and_fraction(left.values[row_index][col_index], right.values[row_index][col_index]))\n\t\t\telse\n\t\t\t\tthrow_error(\"Matrix addition with matrices that don't contain only Terms, TermLists, and Fractions.\", left, []) # TODO: Add stack trace (make a global)\n\t\t\tend\n\t\tend\n\t\tnew_rows.append(row)\n\tend\n\treturn Matrix.new(left.line, left.col, new_rows)\nend", "def x(escalar)\n maux=Array.new(@nFil) { Array.new(@mCol) }\n \n (@nFil).times do |i|\n (@mCol).times do |j|\n maux[i][j] = @matriz[i][j]\n end\n end\n \n aux = Matriz.new(maux)\n for i in 0...@nFil do\n for j in 0...@mCol do\n aux.matriz[i][j] = @matriz[i][j] * escalar\n end\n end\n aux\n end", "def transposed(matrix, size)\n # TODO (Step 2): Implement on CPU\n return [1.0, 2.0, 3.0, 4.0]\nend", "def matrix_addition_reloaded(*matrices)\n return nil if matrices.any? {|matrix| matrices[0].length != matrix.length}\n\n new_matrix = Array.new(matrices.first.length) {Array.new(matrices.first.first.length, 0)}\n\n matrices.each_with_index do |matrix, mi|\n matrix.each_with_index do |array, ai|\n array.each_with_index do |el, eli|\n new_matrix[ai][eli] += el\n end\n end\n end\n new_matrix\nend", "def *(other)\n\t\t\telemento = Array.new(0)\n\t\t\tfor i in 0...filas\n\t\t\t\tfila = Array.new(0)\n\t\t\t\tfor j in 0...colum\n\t\t\t\t\tfila << pos[i][j]*other\n\t\t\t\tend\n\t\t\t\telemento << fila\n\t\t\tend\n\t\t\tMatriz.new(@nfil, @ncol, elemento)\n\t\tend" ]
[ "0.6812207", "0.6791393", "0.67234606", "0.6601026", "0.64917505", "0.6472199", "0.62914264", "0.6275328", "0.626044", "0.62409323", "0.62270796", "0.62007165", "0.6162556", "0.6161933", "0.6155848", "0.61508954", "0.6127435", "0.6120087", "0.61091703", "0.6100586", "0.6095249", "0.60925716", "0.6072477", "0.600696", "0.59608924", "0.59252423", "0.58957964", "0.58764714", "0.58552617", "0.5731508", "0.5700193", "0.5696636", "0.5674575", "0.56344587", "0.5632953", "0.5605583", "0.55906653", "0.5587346", "0.5583115", "0.5582139", "0.55701137", "0.5566796", "0.5566012", "0.55443954", "0.5543905", "0.55371505", "0.5526845", "0.55012506", "0.5499087", "0.5461119", "0.5454738", "0.54492986", "0.5447377", "0.54439604", "0.5437273", "0.5425531", "0.54203445", "0.54184407", "0.54124224", "0.54021645", "0.54020184", "0.54008615", "0.5380552", "0.5379277", "0.5359618", "0.53570884", "0.5350021", "0.53472835", "0.53390706", "0.5320836", "0.5315225", "0.52956444", "0.52904534", "0.5288169", "0.5278213", "0.52760595", "0.5262454", "0.52457225", "0.5235566", "0.52303183", "0.5205966", "0.5198221", "0.5197416", "0.51938254", "0.5192607", "0.5190361", "0.51899356", "0.5183057", "0.5180488", "0.5178628", "0.517199", "0.51695436", "0.516689", "0.516395", "0.5163328", "0.51563853", "0.51515543", "0.51418215", "0.51352847", "0.5134523", "0.51321834" ]
0.0
-1
Calculates the minimum element in a row
def min (row_num) row = @rows[row_num] min = row[0] row.each do |num| if min == 0 then min = num end if (num < min) && (num != 0) then min = num end end return min end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min\n min = get(0,0)\n\tfor i in 0...@filas\n for j in 0...@columnas\n if (get(i,j) < min)\n min = get(i,j)\n end\n end\n end\n min\n end", "def min\n # Establecemos valor del primer elemento\n min = @matrix[0][0]\n i = 0\n \n # Fila a fila actualizando el valor minimo\n while (i < @fil)\n j = 0\n while (j < @col)\n if (@matrix[i][j] < min)\n min = @matrix[i][j]\n end\n j += 1\n end\n i += 1\n end\n min\n end", "def min\n min = @valor[0][0]\n i = 0\n self.fil.times do |i|\n j = 0\n self.col.times do |j|\n if (@valor[i][j] < min)\n min = @valor[i][j]\n end\n j=j+1\n end\n i=i+1\n\tend\n min\n end", "def minimum(column_name)\n calculate(:minimum, column_name)\n end", "def min_element\n self.to_a.min\n end", "def step_one\n matrix.map_rows! do |row|\n min = row.min\n row.map { |cell| cell - min }\n end\n end", "def min() end", "def min\n min = @m[0][0]\n for i in 0...fi\n for k in 0...co\n if @m[i][k] < min then\n min=@m[i][k]\n end\n end\n end \n min\n end", "def min\n\t\tm = self.mat[0][0]\n\t\tfor i in ([email protected]_i)\n\t\t\t#for j in ([email protected]_i)\n\t\t\[email protected]_i.times do |j| \n\t\t\t\tif (self.mat[i][j] < m)\n\t\t\t\t\tm = self.mat[i][j]\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\treturn m\n\tend", "def minimum(arr)\n m = arr.min\n m\n end", "def min(&block)\n flag = true # 1st element?\n result = nil\n self.each{|*val|\n val = val.__svalue\n if flag\n # 1st element\n result = val\n flag = false\n else\n if block\n result = val if block.call(val, result) < 0\n else\n result = val if (val <=> result) < 0\n end\n end\n }\n result\n end", "def my_min2(array)\n min = array.first\n array.each do |el|\n min = [el, min].min\n end\n min\nend", "def better_my_min\n min = self.first\n self.each do |el|\n min = el if el < min\n end\n min\n end", "def min(args)\n col = column field: args[:field]\n col.map! {|item| item = item.to_f} \n col.min\n end", "def my_min(arry)\n mini = arry.first\n arry.each do |ele|\n if ele < mini\n mini = ele\n end\n end\n mini\nend", "def min(column)\n _all_with_present_column(column).min\n end", "def my_min(array)\n\n smallest = array.first\n array.each_with_index do |el, i|\n smallest = el if el < smallest\n end\n smallest\n\nend", "def min\n if min_element.kind_of? Array\n min_element.first\n else\n min_element\n end\n end", "def find_min()\r\n self.min\r\n end", "def min(attr)\n column(attr).min\n end", "def min(*x, &block)\n return x.first if x.size == 1\n return min2(x[0], x[1], &block) if x.size == 2\n a = x.first\n (1...x.size).each { |b| \n a = min2(a,x[b], &block) }\n a\n end", "def good_my_min(arr)\n smallest = arr.first\n arr.each do |el|\n smallest = el if el < smallest\n end\n smallest\nend", "def min\n\t\tm = self.valor[0]\n\t\tfor i in (0...self.valor.size.to_i)\n\t\t\t\tif (self.valor[i]< m)\n\t\t\t\t\tm = self.valor[i]\n\t\t\t\tend\n\t\tend\n\t\treturn m\n\tend", "def eqp_r_min(item)\n end", "def my_min(arr)\n min = arr.first\n\n arr.each do |el|\n min = el if el < min\n end\n\n min\nend", "def min\n\n minimo = 0.to_f\n for i in 0...matriz.size \n if matriz[i] != nil \n matriz[i].each do |key, value|\n if matriz[i][key].to_f < minimo\n minimo = matriz[i][key].to_f\n end\n end\n end \n end\n minimo\n\tend", "def my_min2(arr)\n smallest = arr.first\n arr.each do |el|\n smallest = el if el < smallest\n end\n smallest\nend", "def my_min(arr) #linear\n arr.reduce do |smallest, num|\n if smallest < num\n smallest\n else\n smallest = num\n end\n end\nend", "def min\n\t w=0\n\t for i in(0..@n_elem-1)\n\t if(i == 0)\n\t w = @elem[i]\n\t end\n\t if(w > @elem[i])\n\t w = @elem[i]\n\t end\n\t end\n\t w\n\tend", "def my_min(arr)\n min = arr.first\n\n arr.each_with_index do |ele1, i| \n arr.each_with_index do |ele2, j|\n next if i == j \n min = ele2 if ele2 < min \n end\n end\n\n min\nend", "def my_min(list)\r\n smaller_ele = []\r\n list.each do |ele1|\r\n list.each do |ele2|\r\n smaller_ele << [ele1,ele2].min \r\n end\r\n end\r\n return smaller_ele.min\r\nend", "def my_min2(array)\n minimum = array.first\n array.each_index do |idx|\n if array[idx] < minimum\n minimum = array[idx]\n end\n end\n minimum\nend", "def my_min(array)\n\t\n\tarray.min\n\t\nend", "def better_my_min(array)\n smallest = array[0]\n array[1..-1].each do |el|\n smallest = el if el < smallest\n end\n smallest\nend", "def my_min_fast(arr)\n smallest = arr[0]\n arr.each do |ele|\n if ele < smallest\n smallest = ele\n end\n end\n return smallest\nend", "def get_min()\n @data.min\n end", "def get_min()\n @array[-1][1]\n end", "def find_min_value(array)\n return array.min\nend", "def my_min_improved(arr)\n min = arr[0]\n\n arr.each do |el|\n min = el if el < min\n end\n\n return min\nend", "def get_min()\n # smallest = Float::INFINITY\n # @stack.each do |item|\n # if item < smallest\n # smallest = item\n # end\n # end\n # return smallest\n @stack.min\n end", "def my_min2(arr)\n minimum = arr.first\n arr.each do |num|\n minimum = num if num < minimum\n end\n minimum\nend", "def minimo\r\n\t\t\r\n\t\tmin = @matrix[0][0]\r\n\t\t\r\n\t\ti = 0\t\t\t\t\t\t\t\t\r\n\t\t\r\n#\t\twhile i < @fil\t\t\t\t\t\t\r\n\t\t(@fil).times do\r\n\t\t\t\r\n\t\t\tj = 0\r\n\t\t\t\r\n#\t\t\twhile j < @col\t\t\t\t\t\r\n\t\t\t(@col).times do\r\n\t\t\t\t\r\n\t\t\t\tif(@matrix[i][j] < min)\r\n\t\t\t\t\t\r\n\t\t\t\t\tmin = @matrix[i][j]\r\n\t\t\t\t\t\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\t\t\t\tj += 1\r\n\t\t\t\t\r\n\t\t\tend\r\n\t\t\t\r\n\t\t\ti += 1\r\n\t\t\t\r\n\t\tend\r\n\t\t\r\n\t\t#puts \"minimo: #{min}\"\r\n\t\t\r\n\t\treturn min\r\n\t\t\r\n\tend", "def find_min\r\n return nil if !@head\r\n cursor = @head\r\n min = cursor.data\r\n while cursor\r\n if cursor.data < min\r\n min = cursor.data\r\n end\r\n cursor = cursor.next\r\n end\r\n return min\r\n end", "def my_min(arr)\n smallest = nil\n\n arr.each do |n|\n smallest = n if smallest.nil? || n < smallest\n end\n\n smallest\nend", "def my_min_linear(array)\n min = array[0]\n\n array.each do |num|\n min = num if num < min\n end\n min\nend", "def min_coordinates\n\t\t\treturn @min_coordinates if @min_coordinates\n\n\t\t\t# Initialize\n\t\t\t# Convert to square matrix by adding zero filled rows or columns.\n\t\t\tif @width < @height\n\t\t\t\tm = @matrix.map do |row|\n\t\t\t\t\trow.dup.fill(0, @width, @height - @width)\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tm = @matrix.map {|row| row.dup}\n\t\t\t\t(@width - @height).times do\n\t\t\t\t\tm << Array.new(@width, 0)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# Step 1\n\t\t\tm.each do |row|\n\t\t\t\tmin = row.min\n\t\t\t\tnext row.dup if min.zero?\n\t\t\t\[email protected] {|i| row[i] -= min}\n\t\t\tend\n\n\t\t\t# Step 2\n\t\t\[email protected] do |j|\n\t\t\t\tmin = m.map{|row| row[j]}.min\n\t\t\t\tnext if min.zero?\n\t\t\t\tm.each{|row| row[j] -= min}\n\t\t\tend\n\n\t\t\tloop do\n\t\t\t\t# Step 3\n\t\t\t\tassign, cover = assign_or_cover(m)\n\t\t\t\tif assign\n\t\t\t\t\treturn @min_coordinates = assign.sort.select do |i, j|\n\t\t\t\t\t\ti < @height and j < @width\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\t# Step 4\n\t\t\t\trows_cover, cols_cover = cover\n\t\t\t\t# complement set\n\t\t\t\trows_cover_cmp = (0...@size).to_a - rows_cover\n\t\t\t\tcols_cover_cmp = (0...@size).to_a - cols_cover\n\n\t\t\t\tmin = Float::INFINITY\n\t\t\t\trows_cover_cmp.each do |i|\n\t\t\t\t\tcols_cover_cmp.each do |j|\n\t\t\t\t\t\tv = m[i][j]\n\t\t\t\t\t\tmin = v if v < min\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\trows_cover_cmp.each do |i|\n\t\t\t\t\tcols_cover_cmp.each do |j|\n\t\t\t\t\t\tm[i][j] -= min\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\trows_cover.each do |i|\n\t\t\t\t\tcols_cover.each do |j|\n\t\t\t\t\t\tm[i][j] += min\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def my_min_ii(list)\n min = list.first\n list.each do |el|\n min = el if el < min\n end\n min\nend", "def my_min(list)\r\n smallest = 0\r\n \r\n list.each_with_index do |ele1, idx1|\r\n list.each_with_index do |ele2, idx2|\r\n if idx2 > idx1 \r\n if ele1 < smallest\r\n smallest = ele1\r\n end\r\n if ele2 < smallest\r\n smallest = ele2\r\n end\r\n end\r\n end\r\n end\r\n\r\n smallest\r\nend", "def smallest(array)\nend", "def find_min\n loc = find_min_locator and loc.value\n end", "def my_min(arr) #O(n2)\n min = arr.first\n arr.each_with_index do |el_1 , i|\n (i+1...arr.length).each do |el_2|\n if arr[el_2] < el_1 && arr[el_1] < min \n min = arr[el_2]\n end \n end \n end \n min \n end", "def find_min_in_nested_arrays(src)\nrow_index = 0\nouter_results = []\nwhile row_index < src.count do\n element_index = 0\n smallest_integers = 100\n while element_index < src[row_index].count do\n if src[row_index][element_index] < smallest_integers\n smallest_integers = src[row_index][element_index]\n end\n element_index += 1\n end\n outer_results << smallest_integers\n row_index += 1\n end\n outer_results\nend", "def my_min(list)\n smallest = list.first\n list.each do |el|\n smallest = el if el < smallest\n end\n smallest\nend", "def my_min_iterative(array)\n minimum = nil\n\n array.each { |element| minimum = element if minimum.nil? || element < minimum }\n\n minimum\nend", "def smallest_column\n # Slow but concise version of this method:\n #return columns.min_by &:size\n\n column = smallest = right\n min_size = column.size\n while true\n column = column.right\n return smallest if column == self\n \n if column.size < min_size\n smallest, min_size = column, column.size\n return smallest if min_size == 0\n end\n end\n end", "def my_min2(arr)\n min = arr.first\n arr.each { |el| min = el if el < min }\n min\nend", "def min\n empty? ? Float::INFINITY : @list.head.value[1]\n end", "def min\n empty? ? Float::INFINITY : @list.head.value[1]\n end", "def min_index(*x, &block)\n x.index(min(*x, &block))\n end", "def my_min(arr)\n min = arr.first\n (0...arr.length).each do |idx1|\n (idx1...arr.length).each do |idx2|\n if (idx2 != idx1) && (arr[idx1] < arr[idx2]) && (arr[idx1] < min)\n min = arr[idx1]\n end\n\n end\n end\n min\n\nend", "def find_min_value(array)\n min = 0\n array.length.times do |count|\n if count == 0\n min = array[count]\n else\n if array[count] < min\n min = array[count]\n end\n end\n end\n min\nend", "def my_min2(arr)\n smallest = arr[0]\n arr[1..-1].each do |el|\n smallest = el if el < smallest\n end\n smallest\nend", "def my_min(list)\n min = list.first \n\n list.each do |el|\n if el < min \n min = el \n end\n end\n min\nend", "def find_min(arr)\n min = arr.first\n (1...arr.length).each do |idx|\n min = arr[idx] if arr[idx] < min\n end\n min\nend", "def my_min2(array)\n lowest_val = Float::INFINITY\n array.each do |el|\n lowest_val = el if el < lowest_val\n end\n\n lowest_val\nend", "def my_min_2(arr)\n least = arr[0]\n\n arr.each do |i|\n arr.each do |y|\n if i < y && i < least\n least = i\n end\n end\n end\n\n least\n\n\nend", "def my_min_v2(array)\n minimum = array.first\n\n array[1..-1].each do |element|\n minimum = element if minimum > element\n end\n\n minimum\nend", "def find_min_elem(matrix)\n min = matrix[1][2]\n indices = [1, 2] \n for i in 1...matrix.length\n for j in i+1...matrix.length\n if ( matrix[i][j] < min )\n min = matrix[i][j]\n indices = [i, j]\n end\n end\n end\n indices\nend", "def my_min2(arr)\n minimum = arr[0]\n arr[1..-1].each do |el|\n minimum = el if el < minimum\n end\n minimum\nend", "def my_min2(arr)\n min = arr.first \n arr.each {|ele| min = ele if ele < min }\n min\nend", "def min\n self.reduce('lambda{|memo, item| memo < item ? memo : item }')\n end", "def my_min(list)\r\n smallest = list.first\r\n list.each do |ele|\r\n smallest = ele if ele < smallest\r\n end\r\n return smallest\r\nend", "def my_min(arr)\n min = arr[0]\n (0...arr.size).each do |i1|\n (i1 + 1...arr.size).each do |i2|\n min = arr[i2] if arr[i2] < min\n end\n end\n min\nend", "def my_min(arr)\n min = arr[0]\n arr.each do |num|\n if num < min\n min = num\n end\n end\n min\n\nend", "def min_c_cell\n @min_c_cell ||= Matrices::Cell.new(c.min_index)\n end", "def min_index\n self.to_a.index(min_element)\n end", "def my_min(arr)\n output = arr.first\n \n (1...arr.length).each do |i|\n (i+1...arr.length).each do |j|\n output = arr[j] if arr[j] < output\n end\n end\n \n output\nend", "def linear_my_min(arr)\n # arr.inject do |min, ele|\n # min > ele \n # end\n # arr.first \n\n min = arr.first \n\n arr.each do |ele|\n min = ele if ele < min \n end\n min \n\nend", "def my_min(arr)\n answer = 0\n arr.each_with_index do |ele1, idx1|\n arr.each_with_index do |ele2, idx2|\n if idx2 > idx1 && ele1 < ele2\n answer = ele1 if answer >= ele1\n end\n end\n end\n answer \nend", "def calculate_min_slots(matrix)\n output = []\n @sums.each.with_index do |e, i|\n if e == @min\n output << i\n end\n end\n #require 'pry';binding.pry\n output\n end", "def my_min(arr)\n min = arr[0]\n (1...arr.length).each do |i|\n if arr[i] < min\n min = arr[i]\n end\n end\n min\nend", "def better_min(array)\n min_val = array.first\n\n array.each do |el| #O(n)\n if el < min_val\n min_val = el\n end\n end\n min_val\n end", "def min; end", "def min; end", "def faster_my_min(arr) # O(n)\n min = arr[0]\n arr.each do |ele|\n min = ele if ele < min\n end\n min\nend", "def best_my_min(arr)\n smallest = arr.shift\n arr.each do |el|\n smallest = el unless el > smallest\n end\n smallest\nend", "def my_min_better(list)\n min = list.first\n list.each do |el|\n min = el if el < min\n end\n min\nend", "def my_min(arr) # Find\n min = arr[0]\n\n arr.each do |el| # Go through array once O(n)\n min = el if el < min # update min while going through if found min\n end\n min\nend", "def get_min()\n @min\n end", "def my_min(array)\n min_val = array.first\n array.each_with_index do |el1, idx1| # O(n)\n array.each_with_index do |el2, idx2| # O(n)\n if idx1 < idx2 # O(1)\n if el1 < el2# O(1)\n if el1 < min_val# O(1)\n min_val = el1# O(1)\n end\n else\n if el2 < min_val# O(1)\n min_val = el2# O(1)\n end\n end\n end\n end\n end\n min_val\n end", "def my_min_linear(list)\n smallest_number = list.first\n \n list.each do |num|\n smallest_number = num if num < smallest_number\n end\n\n smallest_number\nend", "def minimo\r\n\t\t\r\n\t\tmin = 0\r\n\t\t\r\n\t\ti = 0\r\n\t\t\r\n\t\twhile i < @numElementos\t\t\t\t\t\t\r\n\t\t\t\r\n\t\t\tif(@eleM[i] < min)\r\n\t\t\t\t\r\n\t\t\t\tmin = @eleM[i]\r\n\t\t\t\t\r\n\t\t\tend\r\n\t\t\t\r\n\t\t\ti += 1\r\n\t\tend\r\n\t\t\r\n\t\t#puts \"minimo: #{min}\"\r\n\t\t\r\n\t\treturn min\r\n\t\t\r\n\tend", "def smallest array\n [array.min]\n end", "def my_min(list)\n\n min = nil\n\n list.each do |ele|\n min ||= ele\n list.each do |ele2|\n if ele2 < min\n min = ele2\n end\n end\n end\n\n min\nend", "def my_min_once\n min = first\n each do |num|\n if num < min\n min = num\n end\n end\n min\n end", "def find_min2(array)\n min = array[0]\n \n array.each do |num|\n if num < min\n min = num\n end\n end\n \n return min\nend", "def my_min2(arr)\n smallest = arr.first\n\n arr.each do |i|\n smallest = i if smallest > i\n end\n\n smallest\nend", "def my_min2(array)\n lowest_num = array.first\n array.each do |el1|\n next if lowest_num == el1\n if el1 < lowest_num\n lowest_num = el1\n end\n end\n lowest_num\nend", "def t_min\n @temp.min\n end", "def my_min(array)\n min = array.first\n array.each {|el| min = el if min > el}\n min\nend" ]
[ "0.7722905", "0.7538922", "0.7506053", "0.7400789", "0.7291085", "0.72551525", "0.72491235", "0.7223778", "0.72022706", "0.7177007", "0.7140284", "0.709822", "0.70954186", "0.7068832", "0.7055058", "0.7050754", "0.70164704", "0.7001922", "0.70006156", "0.69394386", "0.69277894", "0.6925273", "0.6919312", "0.690819", "0.6878687", "0.68710035", "0.68408924", "0.6830083", "0.68142474", "0.68013924", "0.67926204", "0.67913246", "0.678764", "0.6785223", "0.6780041", "0.67756504", "0.67719597", "0.6768682", "0.6767205", "0.6756005", "0.67488307", "0.6745366", "0.67328817", "0.6730793", "0.67207295", "0.670699", "0.67014486", "0.6692117", "0.66854805", "0.6676768", "0.6675164", "0.6673129", "0.66659105", "0.6663855", "0.66602755", "0.66547585", "0.66452277", "0.66452277", "0.6640887", "0.6639279", "0.66380644", "0.66358465", "0.66276973", "0.66266847", "0.6625569", "0.6625447", "0.6625357", "0.66226435", "0.6612489", "0.6611291", "0.6611178", "0.661081", "0.66093534", "0.660635", "0.6603965", "0.6603079", "0.6600067", "0.6595803", "0.6587679", "0.65794873", "0.65766644", "0.65716726", "0.65537006", "0.65537006", "0.65512687", "0.6545911", "0.65457606", "0.65376633", "0.65358645", "0.65355814", "0.6532049", "0.65241605", "0.6520063", "0.6516522", "0.6514163", "0.65038073", "0.6503438", "0.6498557", "0.64970887", "0.6493754" ]
0.81465644
0
Calculates the common factor of a row
def has_common (row_num, row_min) row = @rows[row_num] result = false if row_min != 0 then result = true row.each do |num| if result == true then if (num != 0) && ((num.abs).modulo(row_min.abs) != 0) then result = false end end end end return result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_common_factors(arg_one,arg_two)\n max_factor_one, max_factor_two = arg_one / 2, arg_two / 2\n arg_one_factors = (2..max_factor_one).filter{|num| arg_one % num === 0 }\n arg_two_factors = (2..max_factor_two).filter{|num| arg_two % num === 0 }\n\n return arg_one_factors + arg_two_factors\n\nend", "def common a\n a.reduce :gcd\nend", "def common_x\n ah, bh, ch = [a,b,c].map {|arr| arr.each_with_object(Hash.new(0)) {|e,h| h[e] += 1}}\n (a & b & c).inject(0) {|sum, e| sum += e * [ah[e], bh[e], ch[e]].min}\nend", "def least_common_multiple(num_1, num_2)\n #if not the smaller num is not a factor of the bigger num\n #we need to find the greatest common factor\n #and multiply bigger num by greatest common factor\n # common_factors = []\n # smaller_factors = (1..num_1).select { |n| num_1 % n == 0 }\n # larger_factors = (1..num_2).select { |n| num_2 % n == 0 }\n # p smaller_factors\n # p larger_factors\n # common_factors = \n num_1.lcm(num_2)\nend", "def scoreExclusivity\n covered = 0\n xor = 0\n colSums.each{|sum|\n if sum == 1\n xor += 1\n covered += 1\n elsif sum > 1\n covered += 1\n end\n }\n return xor.to_f/covered.to_f\n end", "def coprime?(num1, num2)\n factor1 = []\n factor2 = []\n\n#------- Adding Factors to Arrays\n (2..num1).each do |fact|\n if num1 % fact == 0\n factor1 << fact\n end\n end\n (2..num2).each do |fact2|\n if num2 % fact2 == 0\n factor2 << fact2\n end\n end\n\n #-------Iterating through to find common Factors\n\n factor2.each do |num|\n factor1.each do |count|\n if count == num\n return false\n end\n end\n end\n#-------If no common factor found returning TRUE\n return true\nend", "def scoreExclusivity(mat)\n covered = 0\n xor = 0\n mat.first.each_index{|i|\n sum = 0\n mat.each{|node|\n sum += node[i].to_i\n }\n if sum == 1\n xor += 1\n covered += 1\n elsif sum > 1\n covered += 1\n end\n }\n \n return xor.to_f/covered.to_f\nend", "def least_common_multiple(num_1, num_2)\n (1...num_1 * num_2).each do |num|\n if num % num_1 == 0 && num % num_2 == 0\n return num\n end\n end\nend", "def least_common_multiple(num_1, num_2)\n num_1, num_2 = num_2, num_1 if num_1 > num_2\n num_1 * num_2 / getGCD(num_1, num_2)\nend", "def least_common_multiple(num_1, num_2)\n (1...num_1 * num_2).each do |multiple|\n return multiple if multiple % num_1 === 0 && multiple % num_2 === 0\n end\nend", "def greatest_common_factor(first_number, second_number)\n \nend", "def greatest_common_factor(first_number, second_number)\n \nend", "def leastCommonMultiple( factors )\n return nil if factors.include?( 0 )\n\n maxFactor = 1\n minFactor = 1\n factorial = 1\n\n factors.each do | factor |\n maxFactor = factor if factor > maxFactor\n minFactor = factor if factor < minFactor\n factorial *= factor\n end\n\n Range.new( minFactor * minFactor, factorial ).each do | multiple |\n foundMultiple = true\n\n factors.each do | factor |\n if multiple % factor != 0\n foundMultiple = false\n break\n end\n end\n\n if foundMultiple == true\n return multiple\n end\n\n foundMultiple = true\n end\nend", "def mutual_factors(*nums)\n # common_h = Hash.new(0)\n # nums.sort!\n\n # factors(nums[0]).each do |factor|\n # nums.each { |num| common_h[factor] += 1 if num % factor == 0 }\n # end\n\n # common_f = []\n # common_h.each {|k,v| common_f << k if v == nums.length}\n # common_f\n nums.sort!\n facts = factors(nums.first)\n facts.select {|f| nums.all? {|num| num % f == 0} }\nend", "def least_common_multiple(num_1, num_2)\n (1..num_1 * num_2).each do |el|\n return el if el % num_1 == 0 && el % num_2 == 0\n end\nend", "def greatest_common_factor(first_number, second_number)\nend", "def greatest_common_factor(num1, num2)\n divisor = 1\n 2.upto([num1.abs, num2.abs].min) do |num|\n if num1 % num == 0 && num2 % num == 0\n divisor = num\n end\n end\n divisor\nend", "def common(a,b,c)\n ah, bh, ch = hash_count(a), hash_count(b), hash_count(c)\n ah.keys.reduce(0) {|sum, e| sum += e * [ah[e], bh[e], ch[e]].min}\nend", "def least_common_multiple(num_1, num_2)\n num_1, num_2 = [num_1, num_2].sort\n\n (1..num_2).each do |i|\n mutiple_1 = num_1 * i\n\n return mutiple_1 if mutiple_1 % num_2 == 0\n end\nend", "def reducable(row, x)\n row.select {|values| values.include?(x) }.length == 1\nend", "def reducable(row, x)\n row.select {|values| values.include?(x) }.length == 1\nend", "def getTotalX(a,b)\n least_common_multiple = a.reduce(:lcm)\n greatest_common_factor = b.reduce(:gcd)\n counter = 0\n\n (least_common_multiple..greatest_common_factor).each do |num|\n if num % least_common_multiple == 0 && greatest_common_factor % num == 0\n counter += 1\n end\n end\n\n return counter\nend", "def least_common_multiple(num_1, num_2)\n match = false \n n = 0\n while !match \n n += 1\n if n % num_1 == 0 && n % num_2 == 0\n match = true \n end \n end \n n \n\nend", "def least_common_multiple(num_1, num_2)\n max = (num_1 * num_2) \n (1..max).each do |n|\n if n % num_1 == 0 && n % num_2 == 0 \n return n\n end\n end\nend", "def lcm\n result = 1\n children.each do |child|\n result = result.lcm(child.row_span)\n end\n result\n end", "def similarity(user, row)\n (user.transpose.dot(row.transpose)) / (row.norm * user.norm)\nend", "def least_common_multiple(num_1, num_2)\n\n (1..num_2).each do |i|\n prod = num_1 * i\n return prod if prod % num_2 == 0\n end \nend", "def least_common_multiple(num_1, num_2)\n new_array = [num_1, num_2]\n max_num = new_array.max\n\n (1...max_num).each do |i|\n (1...max_num).each do |i2|\n if num_1 * i == num_2 * i2\n return num_1 * i\n end\n end\n end\nend", "def find_checksum_pt2(spreadsheet_rows)\n spreadsheet_rows.reduce(0) do |sum, row|\n (divisor, dividend) = row.\n combination(2).\n find do |(val, c_val)|\n case\n when divides_nicely?(val, c_val) then [val, c_val]\n when divides_nicely?(c_val, val) then [c_val, val]\n end\n end\n\n q = (dividend / divisor)\n\n sum + q\n end\nend", "def greatest_common_factor(number1, number2)\n new = number1.to_i\n number2 = number2.to_i\n while number1 > 0\n if (number1 % new == 0.0) && (number2 % new == 0.0)\n return new\n end\n new -= 1.0\n end\nend", "def greatest_common_factor(number1, number2)\n # get the smaller number\n n = number1 < number2 ? number1 : number2\n\n # check each number i\n # starting from this number n down to 1\n # if it divides both number1 and number2 evenly\n # if so, then this is the gcd\n n.downto(1).each do |i|\n if number1 % i == 0 and number2 % i == 0\n return i\n end\n end\n 1\nend", "def greatest_common_factor( num1, num2)\n\n gcf = 1 # all numbers share 1 as a common factor\n\n array1 = [] # stores all factors of num1\n array2 = [] # stores all factors of num2\n\n common_factors_array = [] # stores common factors of both numbers\n\n i = 1\n while( num1 >= i ) # putting all factors of num1 into array1\n\n if( num1 % i == 0 )\n array1.push(i)\n end\n\n i += 1\n end\n\n p array1\n\n j = 1\n while( num2 >= j ) # putting all factors of num2 into array2\n\n if( num2 % j == 0 )\n array2.push(j)\n end\n\n j += 1\n end\n\n p array2\n\n\n # START\n # collect all common factors of both numbers\n\n # num1 > num2 ? limit = num1 : limit = num2\n # k = 0\n # while( limit > k) # use largest num parameter as limit\n # end\n #\n # abandoned the above way of collecting matching elements from array1 and array2\n\n # take the INTERSECT of array1 and array2\n # source: https://stackoverflow.com/questions/5678108/how-can-i-get-the-intersection-union-and-subset-of-arrays-in-ruby\n\n common_factors_array = array1 & array2\n\n p common_factors_array\n\n # collect all common factors of both numbers\n # END\n\n # Find the largest number in the array i.e. common_factors_array:\n #\n # ASUMPTION !!!\n #\n # Asumming always the last element of common_factors_array !!!!!\n\n if( common_factors_array[common_factors_array.length - 1] != nil )\n gcf = common_factors_array[common_factors_array.length - 1]\n end\n\n p \"The common factor of #{num1} and #{num2} is #{gcf}.\"\n return gcf\n\nend", "def least_common_multiple(num_1, num_2)\n find=true\n lcm=[num_1,num_2].max\n while find\n if lcm%num_1==0 && lcm%num_2==0\n return lcm\n end\n lcm+=1\n end\n\n\nend", "def most_common_value\n class_var = @tree.class_var\n class_values = @tree.dataset.column_values(class_var)\n count = class_values.each.with_object({}) do |val, o|\n o[val] = 0\n end\n self.subset.each.with_object(count) do |row, o|\n count[row[class_var]] += 1\n end\n count.max_by{|v, c| c}[0]\n end", "def least_common_multiple(num_1, num_2)\n greatest = num_1 * num_2\n common_multiple = (2..greatest).select {|multiplo| multiplo % num_1 == 0 && multiplo % num_2 == 0}\n return common_multiple.first\n\nend", "def coprime?(num1, num2)\n return false if num1 < 2 || num2 < 2\n\n # & Returns a new array containing elements common to the two arrays, with no duplicates\n similar_elements = factors_of(num1) & factors_of(num2)\n if similar_elements.length == 1 && similar_elements.include?(1)\n true\n else\n false\n end\n\nend", "def greatest_common_factor(first_number, second_number)\n x, y = first_number, second_number\n n = x < y ? x : y\n n.downto(1).each do |i|\n if x % i == 0 and y % i == 0\n return i\n end\n end\n 1\nend", "def greatest_common_factor(first_number, second_number)\n first_number_factors = factors(first_number)\n second_number_factors = factors(second_number)\n\n first_number_factors.reverse.each do |factor|\n if second_number_factors.include?(factor)\n return factor\n end\n end\n\nend", "def smallest_common_multiple(n)\n\n\treturn 0\nend", "def common_primes(m, n)\n gcd = gcd(m, n)\n if factor_gcd(m, gcd) == 1 && factor_gcd(n, gcd) == 1\n return 1\n else\n return 0\n end\nend", "def least_common_multiple(num_1, num_2)\n arr_1 = []\n arr_2 = []\n (1..num_2).each do |mult|\n arr_1 << num_1 * mult\n end\n (1..num_1).each do |mult|\n arr_2 << num_2 * mult\n end\n arr_1.each do |elem|\n if arr_2.include?(elem)\n return elem\n end\n end\n num_1 * num_2\nend", "def common_divisors(args)\n sum_arr = args.inject { |acc, ele| acc + ele}\n sum_arr.uniq.select do |ele|\n sum_arr.count(ele) == args.length\n end\nend", "def least_common_multiple(num_1, num_2)\n multiple = 1\n multiple += 1 until multiple % num_1 == 0 && multiple % num_2 == 0\n multiple\nend", "def kinployee_similar_culture_score\n num_common_backgrounds.to_f / @kinployee_backgrounds.length\n end", "def greatest_common_factor(tolerance=0)\n gcf = nil\n if all_ints? self\n dupe_self = self.dup\n dupe_self.delete(0)\n factor_sets = find_factor_sets(dupe_self, tolerance)\n ampersand_sets = \"\" \n factor_sets.each_with_index do |set,i|\n if i == 0\n ampersand_sets << set.inspect\n else\n ampersand_sets << \" & #{set.inspect}\"\n end\n end \n common_factors = eval(ampersand_sets) \n gcf = common_factors.max\n end\n gcf\n end", "def coprime?(num1, num2)\n factors = (findFactors(num1) + findFactors(num2)).sort\n\n count = Hash.new(0)\n\n factors.each {|factor| count[factor] += 1}\n\n return count.all? {|k,v| v <= 1}\nend", "def coprime?(num_1, num_2)\n num_1_factors = (1...num_1).select { |factor| num_1 % factor == 0 }\n num_2_factors = (1...num_2).select { |factor| num_2 % factor == 0 }\n common_nums = num_1_factors.select { |num| num_2_factors.include?(num) }\n !common_nums.any? { |n| n != 1 }\nend", "def greatest_common_factor(a, b)\n a, b = b, a%b until b == 0\n a\nend", "def greatest_common_factor(number1, number2)\n\tif ((number1 || number2) == 0)\n\t\treturn 1\n\tend\n\tsmall_num = 0\n\tbig_num = 0\n\tif number1 < number2\n\t\tsmall_num = number1\n\t\tbig_num = number2\n\telse \n\t\tsmall_num = number2\n\t\tbig_num = number1\n\tend \n\t\n\ti = 1\n\tfactors = []\n\twhile i <= small_num\n\t\tif small_num%i == 0\n\t\t\tfactors.push(i)\n\t\tend\n\t\ti+=1\n\tend\n\n\tj = 0\n\tbig_factors = []\n\twhile j < factors.length\n\t\tif big_num%factors[j] == 0\n\t\t\tbig_factors.push(factors[j])\n\t\tend\n\t\tj +=1\n\tend\n\tif big_factors[((big_factors.length)-1)] != nil\n\t\treturn big_factors[((big_factors.length)-1)]\n\telse\n\t\tputs \"#{number1} and #{number2} have no common factors\"\n\tend\nend", "def least_common_multiple(num_1, num_2)\n (num_1 * num_2) / greatest_common_denominator(num_1, num_2)\nend", "def greatest_common_factor(number1, number2)\n\n if number1 < number2\n smallest = number1\n largest = number2\n elsif number2 < number1\n smallest = number2\n largest = number1\n else \n puts 'Numbers must de different.'\n end \n\n factor = smallest\n\n while factor > 0\n if largest % factor == 0 && smallest % factor == 0\n puts factor # debug\n return factor\n else\n factor -= 1\n end\n \n end\nend", "def least_common_multiple(num_1, num_2)\n number = 1\n while ((number % num_1 != 0) || (number % num_2 != 0))\n number +=1\n end\n number\nend", "def mutual_factors(*num)\n common = []\n combined = Array.new(num.length)\n (0...num.length).each { |index| combined[index] = factors(num[index])}\n\n combined.inject(:&)\nend", "def check(sheet)\n cells = sheet.map {|row| row.split.map {|cell| cell.to_i} }\n\n total = 0\n\n cells.each do |row|\n row.each do |cell|\n row.each do |divisor|\n dividend, modulo = cell.divmod(divisor)\n total += dividend if modulo == 0 && dividend != 1\n end\n end\n end\n\n total\nend", "def mutual_factors(*nums)\n common_fact = []\n \n max_val = nums.max\n (1..max_val).each do |n|\n is_common = nums.all? { |el| el%n == 0 }\n if is_common\n common_fact << n\n end\n end\n\n return common_fact\nend", "def least_common_multiple(num_1, num_2)\n num_1 > num_2 ? max = num_1 : max = num_2\n (max..num_1 * num_2).each {|n| return n if n % num_1 == 0 && n % num_2 == 0}\nend", "def calculateFactors()\n @factorHash = getCachedResult(@sourceArray)\n if [email protected]?\n return @factorHash\n end\n @factorHash = {}\n for i in [email protected] do\n tempArray = []\n for j in [email protected] do\n # don't compare the same number and don't modulus a zero\n if (i == j ||\n @sourceArray[j] == 0)\n next\n end\n # if i modulus j is 0, then j is a factor of i\n if (@sourceArray[i] % @sourceArray[j] == 0)\n tempArray.append(@sourceArray[j])\n end\n end\n # add entry to the hash, i is the key and the array of factors is the value\n @factorHash[@sourceArray[i]] = tempArray\n end\n storeCalculation(@sourceArray, @factorHash)\n return @factorHash\n end", "def gcf(num1, num2)\n\tx = num1 < num2 ? num1 : num2\n\twhile x > 1 do\n\t\tif num1 % x == 0 && num2 % x == 0\n\t\t\treturn x\n\t\tend\n\t\tx -= 1\n\tend\n\treturn 1\nend", "def common(x, y); end", "def least_common_multiple(num_1, num_2)\n check = num_1 <=> num_2\n return num_1 if check == 0\n if check == -1\n lcm = num_2\n while true\n return lcm if lcm % num_1 == 0\n lcm += num_2\n end\n else\n lcm = num_1\n while true\n return lcm if lcm % num_2 == 0\n lcm += num_1\n end\n end\n # (1..num_1 * num_2).each do |i|\n # return i if i % num_1 == 0 && i % num_2 == 0\n # end\nend", "def kinployment_similar_culture_score\n num_common_backgrounds.to_f / @kinployment_backgrounds.length\n end", "def commonChild(s1, s2)\n arr_s1 = s1.split(//)\n arr_s2 = s2.split(//)\n common = arr_s1 & arr_s2\n if common.length != 0\n s1_com = []\n s2_com = []\n arr_s1.each do |s1|\n if common.include?(s1)\n s1_com << s1\n end\n end\n arr_s2.each do |s2|\n if common.include?(s2)\n s2_com << s2\n end\n end\n row = [0]*(s2_com.size+1)\n for i in 1..s1_com.size\n column = [0]\n for j in 1..s2_com.size\n column.push s1_com[i-1] == s2_com[j-1] ? row[j-1]+1 : [column[j-1], row[j]].max\n end\n row = column\n end\n return row[-1]\n else\n return 0\n end\n # create first liine\n # row = [0]*(s1.size+1)\n # for i in 1..s1.size\n # column = [0]\n # for j in 1..s2.size\n # column.push s1[i-1] == s2[j-1] ? row[j-1]+1 : [column[j-1], row[j]].max\n # end\n # row = column\n # end\n # return row[-1]\n # # arr_s1 = s1.split(//)\n # # arr_s2 = s2.split(//)\n # common = arr_s1 & arr_s2\n # if common.length != 0\n # s1_com = []\n # s2_com = []\n # arr_s1.each do |s1|\n # if common.include?(s1)\n # s1_com << s1\n # end\n # end\n # arr_s2.each do |s2|\n # if common.include?(s2)\n # s2_com << s2\n # end\n # end\n # com_length = Array.new(s1_com.length, Array.new(s2_com.length, 0))\n # p com_length\n # com_length[0][1] = 'A'\n # com_length[1][1] = 'C'\n # com_length[1][0] = 'B'\n # p com_length[1][1]\n # s1_com.each_with_index do |s1,i|\n # s2_com.each_with_index do |s2, j|\n # if i == 0\n # if s1 == s2\n # com_length[i][j] = 1\n # else\n # if j != 0\n # if com_length[i][j-1] != 0\n # com_length[i][j] = com_length[i][j-1]\n # end\n # end\n # end\n # else\n # if j == 0\n # if s1 == s2\n # com_length[i][1] = 1\n # end\n # else\n # if s1 == s2\n # com_length[i][j] = com_length[i-1][j-1] + 1\n # else\n # if com_length[i-1][j] != 0 && com_length[i][j-1] != 0\n # com_length[i][j] = [com_length[i-1][j], com_length[i][j-1]].max\n # elsif com_length[i-1][j] != 0\n # com_length[i][j] = com_length[i-1][j]\n # elsif com_length[i][j-1] != 0\n # com_length[i][j] = com_length[i][j-1]\n # end\n # end\n # end\n # end\n # end\n # end\n # rs = 0\n # p com_length\n # com_length.each do |r|\n # if r.max > rs\n # rs = r.max\n # end\n # end\n # return rs\n # else\n # return 0\n # end\nend", "def least_common_multiple(num_1, num_2)\n # return [num_1, num_2].max if num_1 % num_2 == 0 || num_2 % num_1 == 0\n m = num_1\n while true\n return m if m % num_1 == 0 && m % num_2 == 0\n m += num_1\n end\nend", "def least_common_multiple(num_1, num_2)\n i = [num_1,num_2].max\n while i > 0\n if i%num_1==0 && i%num_2==0\n return i\n end\n i+=1\n end\nend", "def mutual_factors(*args)\n div_hash = Hash.new\n args.each do |num|\n div_hash[num] = divisors(num)\n end\n common_divisors(div_hash.values)\nend", "def prime_factors\n return self.prime_factorization.uniq\n end", "def common_array(ary) # rubocop: disable AbcSize\n return ary unless ary.is_a? Array\n count = ary.count\n return ary if count.zero?\n return ary.flatten.uniq if count == 1\n common = ary[0] & ary[1]\n return common if count == 2\n (count - 2).times { |x| common &= ary[x + 2] } if count > 2\n common\n end", "def least_common_multiple(num_1, num_2)\n min = [num_1, num_2].min\n max = [num_1, num_2].max\n (1..min).each { |num| return num*max if num*max % min == 0}\nend", "def least_common_multiple(num_1, num_2)\n value = [num_1, num_2].max\n while (value % num_1 != 0) || (value % num_2 != 0)\n value += 1\n end\n return value\nend", "def index_of_coincidence(matrix)\n\n matrix.inject([]) do |indices, row_letters|\n frequencies = letter_frequencies(row_letters)\n\n indices << (\"A\"..\"Z\").inject(0) { |a,v|\n x = frequencies[v]\n a += x*(x-1)\n a\n } / (row_letters.size * (row_letters.size - 1))\n end\n\nend", "def common_dividor(num1, num2)\n limit = [num1, num2].min\n limit.downto(1) do |int|\n return int if num1 % int == 0 && num2 % int == 0\n end\nend", "def coprime?(num_1, num_2)\n # initialize arrays for common\n # determine the minimum between the two nums\n # loop from 1 to minimum using iterator idx\n # push common divisors to array\n # if length is not 1, return false, else true\n minimum = [num_1, num_2].min\n \n (2..minimum).each do |idx|\n return false if num_1 % idx == 0 && num_2 % idx == 0 \n end\n return true\n\nend", "def arith_geo(arr)\n common_differences = Hash.new(0)\n common_ratios = Hash.new(0)\n arr.each_with_index do |num, i|\n if !(arr[i + 1].nil?)\n common_differences[arr[i + 1] - arr[i]] += 1\n common_ratios[arr[i + 1] / arr[i]] += 1\n end\n end\n\n return \"Arithmetic\" if common_differences.keys.count == 1\n return \"Geometric\" if common_ratios.keys.count == 1\n return -1\nend", "def elements_in_common(subs1,subs2)\n\t si = Hash.new\n\n\t # recupero gli elementi in comune\n\t subs1.each_pair do |item,value|\n\t si[item] = 1 if subs2.include?(item)\n\t end\n \n\t return si\n\tend", "def mutual_factors(*nums)\n all_factors = Hash.new\n nums.each { |num| all_factors[num] = find_factors(num) }\n all_factors.values[0].intersection(*all_factors.values[1..-1])\nend", "def coprime?(num_1, num_2)\n arr1 = factors(num_1)\n arr2 = factors(num_2)\n final = arr1 & arr2 # & is the intersection of two arrays.\n if final.length != 0\n return false\n else\n return true\n end\nend", "def common_values(array)\n not_common = []\n not_common += self - array\n not_common += array - self\n (self + array - not_common).uniq\n end", "def coprime?(num_1, num_2)\n fact_1 = factors(num_1)\n fact_2 = factors(num_2)\n return fact_1.none?{|factor| fact_2.include?(factor)}\nend", "def coprime?(num1, num2)\n # Get factors and remove 1 and num1\n factors1 = factor(num1)\n factors1.shift\n factors1.pop\n\n # Get factors and remove 1 and num2\n factors2 = factor(num2)\n factors2.shift\n factors2.pop\n\n # return false if nums share a common factor\n factors1.each { |factor| return false if factors2.include?(factor) }\n\n return true\nend", "def comman_fact(num1, num2)\n if num1 < num2\n small = num1\n else\n small = num2\n end\n\n for i in 2..small\n if (num1% i == 0 && num2 % i == 0)\n hcf = i\n #\n end\n end\n\n if hcf\n num1 = num1/hcf \n num2 = num2/hcf\n end\n \n if num1/2 == 0 && num2/2 == 0\n comman_fact(num1, num2)\n \n else\n return num1.to_s+\"/\"+num2.to_s\n end\n end", "def least_common_multiple(num_1, num_2)\n larger_num = [num_1, num_2].max\n smaller_num = [num_1, num_2].min\n i = 1\n done = false\n until done\n if (i * larger_num) % smaller_num == 0\n answer = i * larger_num\n done = true\n end\n i += 1\n end\n answer\nend", "def lcm(a, b)\n #\n # your code goes here\n # create two empty arrays to accumulate mutliples of 'a' and 'b'\n # iterate 1 thru a and 1 thru b getting multiples for 'a' and 'b'\n # select multiples from both arrays if common (*)\n # choose the leat from above (*)\n multiples_of_a, multiples_of_b = [], []\n\n (1..b).each do |n|\n multiples_of_a << n * a\n end\n\n (1..a).each do |n|\n multiples_of_b << n * b\n end\n\n common_multiples = multiples_of_a.select do |multiple|\n multiples_of_b.include?(multiple)\n end\n\n common_multiples.first\nend", "def coprime?(num_1, num_2)\n arr = []\n\n # pass in the smaller value first\n # any factors past the smaller value will not matter since it won't be divisible by both\n # could have called factors() twice to get two arrays containing factors of both numbers and compare\n # this method would have taken longer since I would have to write another iteration to compare both arrays\n if num_1 < num_2\n arr = factors(num_1, num_2)\n else\n arr = factors(num_2, num_1)\n end\n\n arr.all? { |el| el == 1 }\nend", "def factors() (1..self).select { |n| (self % n).zero? } end", "def coprime?(a, b)\n 1 == gcd(a, b)\nend", "def greatest_common_factor(number1, number2)\n\t\n\tgreatest_num = nil\n\ti = 1\n\t\n\twhile i < 10\n\t\n\t if number1 % i == 0 && number2 % i == 0\n\t \n\t if greatest_num == nil || greatest_num < i\n\t \tgreatest_num = i\n\t\n end\n end\n\t\t\n\ti += 1\n end\n return greatest_num\n \nend", "def shares_common\n securities.uniq.map(&:shares_common).sum\n end", "def sim_euclidean(prefs, person1, person2)\n #find items in common\n shared = {}\n prefs[person1].each do |k,v|\n if prefs[person2][k] != nil\n shared[k] = 1\n end\n end\n\n #both persons doesn't have anything in common\n if shared.length == 0\n return 0\n end\n\n #calculate sum of squares\n sum_of_squares = 0\n shared.each do |k,v|\n sum_of_squares += (prefs[person1][k] - prefs[person2][k]) ** 2\n end\n\n #return euclidean distance. 1 is added to denominator to avoid divide by zero\n 1/(1 + sqrt(sum_of_squares))\nend", "def num_factors(elem, rest)\n rest.select { |n| (elem % n).zero? }\nend", "def common_chars(arr)\n new_arr = []\n test_letters = arr[0].chars.uniq\n test_letters.each do |letter|\n count = arr[0].count(letter)\n arr.each do |word|\n temp_count = word.count(letter)\n count = temp_count if temp_count < count \n end\n new_arr += [letter] * count \n end\n new_arr\nend", "def check_factor_candidate(relations)\n # computes the factor candidate\n p1 = 1\n p2_vec = Hash.new(0) # XXX: use FactoredInteger\n relations.each do |h, qx_vec|\n p1 = p1 * h % @kn\n qx_vec.each {|p, e| p2_vec[p] += e }\n end\n p2 = 1\n p2_vec.each {|p, e| p2 = (p2 * Utils.mod_pow(p, e / 2, @kn)) % @kn }\n\n return if p1 == p2 || (p1 + p2) % @kn == 0\n\n factor = (p1 + p2).gcd(@n)\n\n # check the factor candidate\n if factor != 1 && factor != @n\n throw :factor_found, factor\n end\n end", "def coprime?( a, b )\n gcd( a, b ) == 1\nend", "def super_lcm(collection)\n super_lcm = 1\n collection.each { |integer| super_lcm = super_lcm.lcm(integer) }\n return super_lcm\nend", "def distinct_factors(tuples)\n accumulator = []\n tuples.each { |el| accumulator << el }\n return accumulator.uniq == accumulator\nend", "def MeanMode(arr)\n arr.select {|i| arr.count(i) > 1}[0] == arr.inject(:+) / arr.length ? 1 : 0\nend", "def coprime(a,b)\n a.gcd(b) == 1\nend", "def hash\n value = 0\n my_rows = @rows\n r_size = my_rows.size\n for i in 0..r_size-1 do\n a_row = my_rows[i]\n a_size = a_row.size\n for j in 0..a_size-1 do\n value ^= a_row[j].hash\n end\n end\n return value\n end", "def gcd(x, y) # finds greatest common factor of x,y\n while y != 0\n t = y\n y = x % y\n x = t\n end\n x\nend", "def perfect?\n divisors.reduce(:+) == self\n end", "def similarity(other_user)\n return 0 if common_bands(other_user).empty?\n\n 1 / (1 + cumulative_euclidean_distance(other_user))\n end" ]
[ "0.61979204", "0.6130847", "0.6073339", "0.5945819", "0.583233", "0.576845", "0.57225376", "0.5704762", "0.5702288", "0.5690293", "0.5666728", "0.5666728", "0.56572676", "0.5652409", "0.5642133", "0.56305593", "0.5611286", "0.55926484", "0.559128", "0.55783755", "0.55783755", "0.5557762", "0.5551488", "0.555106", "0.55494857", "0.55297977", "0.55256957", "0.5523888", "0.55205846", "0.55185527", "0.54842204", "0.54816884", "0.5474231", "0.54466295", "0.5434354", "0.5424084", "0.5419595", "0.541641", "0.541403", "0.54140264", "0.5407062", "0.53925586", "0.53848326", "0.5369325", "0.53658557", "0.53567934", "0.5355055", "0.5353493", "0.5337816", "0.5336734", "0.5334579", "0.5317294", "0.5314242", "0.5302463", "0.530114", "0.52964413", "0.52951807", "0.5285929", "0.5276388", "0.5275692", "0.527409", "0.5258644", "0.5242987", "0.5241315", "0.52239686", "0.522393", "0.52099866", "0.52074987", "0.51922125", "0.518442", "0.5149816", "0.51410997", "0.5135935", "0.51331776", "0.5124354", "0.511579", "0.5114339", "0.5096178", "0.50879204", "0.50856745", "0.5055658", "0.50488", "0.5045425", "0.50384796", "0.50135833", "0.5001546", "0.49952465", "0.4995062", "0.49929526", "0.497127", "0.49675092", "0.4963244", "0.49544314", "0.4941592", "0.49206653", "0.49150598", "0.49139225", "0.4913862", "0.49126083", "0.4909005" ]
0.6766124
0
Divides a whole row by its common factor (Row , Common Factor)
def reduce (row_num, row_min) row = @rows[row_num] for i in 0..(row.length - 1) do @rows[row_num][i] = (@rows[row_num][i])/row_min if @rows[row_num][i] == -0.0 then @rows[row_num][i] = 0.0 end end num, den = row_min.to_fraction if den == 1 then puts "R#{row_num + 1} -> R#{row_num + 1}/#{num}" else puts "R#{row_num + 1} -> R#{row_num + 1}/(#{num}/#{den})" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def divide_by(iFactor)\n case @Function[:FunctionType]\n when FCTTYPE_PIECEWISE_LINEAR\n @Function[:Points].each do |ioPoint|\n ioPoint[1] /= iFactor\n end\n else\n log_err \"Unknown function type: #{@Function[:FunctionType]}\"\n end\n end", "def divide_line_by(i,pivot, m)\n for j in 1..m[0].size-1\n m[i][j] /= pivot.to_f\n end\n print \"Dividir L#{i} por #{pivot}\".italic.blue \n m\nend", "def divide(ary)\n left = ary.take(ary.count/2)\n right = ary - left\n if left.count > 1\n divide(left)\n divide(right) \n end\n\n if left.count == 1\n @final_ary.push(left)\n end\n\n if right.count == 1\n @final_ary.push(right)\n end\n\n if @final_ary.count == ary.count * 2\n merge(@final_ary, 0)\n p @final_ary\n end\n\n end", "def reduced_row_echelon_form(ary)\n lead = 0\n rows = ary.size\n cols = ary[0].size\n rary = convert_to_rational(ary) # use rational arithmetic\n catch :done do\n rows.times do |r|\n throw :done if cols <= lead\n i = r\n while rary[i][lead] == 0\n i += 1\n if rows == i\n i = r\n lead += 1\n throw :done if cols == lead\n end\n end\n # swap rows i and r \n rary[i], rary[r] = rary[r], rary[i]\n # normalize row r\n v = rary[r][lead]\n rary[r].collect! {|x| x /= v}\n # reduce other rows\n rows.times do |i|\n next if i == r\n v = rary[i][lead]\n rary[i].each_index {|j| rary[i][j] -= v * rary[r][j]}\n end\n lead += 1\n end\n end\n rary\n end", "def division(value) \n\t\tdiv = Fraccion.new(0, 0)\n\t\taux = value.numer\n\t\tvalue.numer = value.denom\n\t\tvalue.denom = aux\n\t\tdiv.numer = @numer * value.numer\n\t\tdiv.denom = @denom * value.denom \n \treturn div \n\tend", "def lcm\n result = 1\n children.each do |child|\n result = result.lcm(child.row_span)\n end\n result\n end", "def check(sheet)\n cells = sheet.map {|row| row.split.map {|cell| cell.to_i} }\n\n total = 0\n\n cells.each do |row|\n row.each do |cell|\n row.each do |divisor|\n dividend, modulo = cell.divmod(divisor)\n total += dividend if modulo == 0 && dividend != 1\n end\n end\n end\n\n total\nend", "def find_checksum_pt2(spreadsheet_rows)\n spreadsheet_rows.reduce(0) do |sum, row|\n (divisor, dividend) = row.\n combination(2).\n find do |(val, c_val)|\n case\n when divides_nicely?(val, c_val) then [val, c_val]\n when divides_nicely?(c_val, val) then [c_val, val]\n end\n end\n\n q = (dividend / divisor)\n\n sum + q\n end\nend", "def greatest_common_divisor(slice_dimension)\n width = slice_dimension[0]\n length = slice_dimension[1]\n while length != 0\n remainder = width % length\n width = length\n length = remainder\n end\n\n width\nend", "def pre_divide; end", "def div_factor(n, fact)\n\t# check to make sure it's a factor\n\tif n % fact == 0\n\t\twhile n % fact == 0\n\t\t\tn = n.div(fact)\n\t\tend\n\tend\n\tn\nend", "def similarity(user, row)\n (user.transpose.dot(row.transpose)) / (row.norm * user.norm)\nend", "def factors() (1..self).select { |n| (self % n).zero? } end", "def div(other)\n divmod(other).first\n end", "def divide_element(el, divider)\n if Object.const_defined?('CFunc')\n if el.is_a?(CFunc::UInt64)\n el.divide(divider)\n else\n el.value\n end\n else\n el / divider\n end\n end", "def precision category,a\n x=getValue category\n y=getValue category\n return a[x][y]/colsum(a,y).to_f\nend", "def call_div(reg_key, addr, i_reg, m_spec)\n mem_addr = get_mem_addr(addr, i_reg)\n\n adder = @computer.memory.read(mem_addr, m_spec[:l], m_spec[:r])\n num1 = @registers['A'].word.to_i\n num2 = adder.to_i\n @registers['A'].word.from_int(num1 / num2)\n @registers['X'].word.from_int(num1 % num2)\n end", "def /(other)\n c=Matriz.new(@n,@m,[0,0],[0,0])\n for i in 0...@n do\n for j in 0...@m do\n c.A[i][j] =@A[i][j] / other.to_f\n end\n end\n return c\n end", "def has_common (row_num, row_min)\n row = @rows[row_num]\n result = false\n if row_min != 0 then\n result = true\n row.each do |num|\n if result == true then\n if (num != 0) && ((num.abs).modulo(row_min.abs) != 0) then\n result = false\n end\n end\n end\n end\n return result\n end", "def div(p0) end", "def Divide(val)\n self.value /= val\n end", "def factors\n k = 1\n max = Math.sqrt(self).ceil\n lofacs = []\n hifacs = []\n while k <= max.ceil\n if (self.to_f/k) == (self.to_i/k)\n lofacs << k\n hifacs << self/k unless self/k == k\n end\n k += 1\n end\n lofacs + hifacs.reverse\n end", "def get_common_factors(arg_one,arg_two)\n max_factor_one, max_factor_two = arg_one / 2, arg_two / 2\n arg_one_factors = (2..max_factor_one).filter{|num| arg_one % num === 0 }\n arg_two_factors = (2..max_factor_two).filter{|num| arg_two % num === 0 }\n\n return arg_one_factors + arg_two_factors\n\nend", "def divisors\n [self] + self.factors << 1\n end", "def factors\n all_factors = []\n (1..Math.sqrt(self).to_i).each do |x|\n all_factors.push(x, self/x) if (self % x == 0)\n end\n\n all_factors.sort.uniq\n end", "def divide_c!(j, c)\n @body.divide_c!(j, c)\n @right.divide_c!(j, c)\n end", "def averageif( find_header, avg_header )\n return to_enum( :sumif ) unless block_given?\n find_col, avg_col = ch( find_header ), ch( avg_header )\n sum = find_col.each_cell_wh.inject([0,0]) do |sum,ce|\n if yield( ce.value )\n sum[0] += avg_col[ ce.row ]\n sum[1] += 1\n sum \n else\n sum\n end\n end\n sum.first.to_f / sum.last\n end", "def common a\n a.reduce :gcd\nend", "def calculateFactors()\n @factorHash = getCachedResult(@sourceArray)\n if [email protected]?\n return @factorHash\n end\n @factorHash = {}\n for i in [email protected] do\n tempArray = []\n for j in [email protected] do\n # don't compare the same number and don't modulus a zero\n if (i == j ||\n @sourceArray[j] == 0)\n next\n end\n # if i modulus j is 0, then j is a factor of i\n if (@sourceArray[i] % @sourceArray[j] == 0)\n tempArray.append(@sourceArray[j])\n end\n end\n # add entry to the hash, i is the key and the array of factors is the value\n @factorHash[@sourceArray[i]] = tempArray\n end\n storeCalculation(@sourceArray, @factorHash)\n return @factorHash\n end", "def kth_divisor(k)\n\t\tndf = self.num_distinct_factors\n\t\tif ndf <= 0\n\t\t\tif !@trivial_factor.nil?\n\t\t\t\treturn @trivial_factor / @trivial_factor # abstract one\n\t\t\telse\n\t\t\t\traise << \"Factorization.kth_divisor: \"\n\t\t\t\t\t\"No factors have been inserted.\\n\"\n\t\t\tend\n\t\tend\n\n\t\tx = @factors_and_multiplicities[0][0]\n\t\trv = x / x # abstract one\n\t\tfor i in (0..(ndf-1))\n\t\t\tbase = @factors_and_multiplicities[i][1] + 1\n\t\t\tpower = k % base\n\t\t\tk = k / base\n\t\t\trv *= @factors_and_multiplicities[i][0] ** power\n\t\tend\n\t\treturn rv\n\tend", "def divide_term_list_by_fraction\n\ttl_fraction = Fraction.new(term_list.line, term_list.col, numerator: term_list)\n\treturn multiply_fraction_and_fraction(invert_fraction(fraction), tl_fraction)\nend", "def proper_divisors\n self.factors << 1\n end", "def compute_row(row)\n row\n end", "def divide(how_many)\n me = self.dup\n (1..how_many).to_a.reverse.inject([]) do |parts,i|\n part,me = me.break((me.size.to_f / i).ceil)\n parts.push(part)\n end\n end", "def divide(grid, chamber_info)\n if chamber_info.width <= 1 || chamber_info.height <= 1\n set_chamber_done(grid, chamber_info)\n return\n end\n\n orientation = choose_orientation(chamber_info.width, chamber_info.height)\n\n return orientation == Orientation::HORIZONTAL ? divide_horizontally(grid, chamber_info) : divide_vertically(grid, chamber_info)\n\nend", "def num_factors(elem, rest)\n rest.select { |n| (elem % n).zero? }\nend", "def post_divide; end", "def normalize row, col\n [row % @rows, col % @cols]\n end", "def divide\n match '/'\n factor\n emit_ln 'MOVE (SP)+,D1'\n emit_ln 'DIVS D1,D0'\nend", "def divide_fraction_by_term(fraction, term)\n\tterm_fraction = Fraction.new(term.line, term.col, denominator: term)\n\treturn multiply_fraction_and_fraction(fraction, term_fraction)\nend", "def triangle_divisor(divisor)\r\n\tstep = 1\r\n\ttriangle = 0\r\n\tcount = 0\r\n\r\n\twhile count < divisor\r\n\t\tcount = 0\r\n\t\ttriangle += step\r\n\t\t#Start counting factors for triangle\r\n\t\t#Only need to go up to sqrt of triangle for factors\r\n\t\t(1..Math.sqrt(triangle)).each do |n|\r\n\t\t\t#If a factor set, increase count by 2\r\n\t\t\tif triangle%n == 0\r\n\t\t\t\tunless n**2 == triangle\r\n\t\t\t\t\tcount += 2\r\n\t\t\t\t#If a perfect square, only increase count by 1\r\n\t\t\t\telse\r\n\t\t\t\t\tcount +=1\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\tend\r\n\t\tstep += 1\r\n\tend\r\n\tputs triangle\r\nend", "def subdivide\n smallerFaces = Array.new\n\n @faces.each { |t| smallerFaces.concat t.subdivide }\n\n @faces = smallerFaces\n end", "def div!(*args)\n dotop!(RAtlas::method(:div!), RAtlas::method(:mdiv!),\n *args)\n end", "def least_common_multiple(num_1, num_2)\n #if not the smaller num is not a factor of the bigger num\n #we need to find the greatest common factor\n #and multiply bigger num by greatest common factor\n # common_factors = []\n # smaller_factors = (1..num_1).select { |n| num_1 % n == 0 }\n # larger_factors = (1..num_2).select { |n| num_2 % n == 0 }\n # p smaller_factors\n # p larger_factors\n # common_factors = \n num_1.lcm(num_2)\nend", "def divide_r!(i, c)\n @left.divide_r!(i, c)\n @body.divide_r!(i, c)\n end", "def divide_term_by_fraction(term, fraction)\n\tterm_fraction = Fraction.new(term.line, term.col, numerator: term)\n\treturn multiply_fraction_and_fraction(invert_fraction(fraction), term_fraction)\nend", "def division_and_average(array_1,array_2)\n \tavg = 0\n \ttotal_element = 0\n \tarray_1.each_with_index do |array_pixel,i|\n \t\tarray_pixel.each_with_index do |number,j|\n \t\t\tarray_1[i][j] = number / array_2[i][j]\n \t\t\tavg = avg + array_1[i][j] \n \t\t\ttotal_element = total_element + 1\n \t\tend\n \tend\n\n \treturn (avg / total_element)\n end", "def div(x, y)\n x / y\nend", "def divide(other)\n Rubinius.primitive :float_div\n redo_coerced :/, other\n end", "def leastCommonMultiple( factors )\n return nil if factors.include?( 0 )\n\n maxFactor = 1\n minFactor = 1\n factorial = 1\n\n factors.each do | factor |\n maxFactor = factor if factor > maxFactor\n minFactor = factor if factor < minFactor\n factorial *= factor\n end\n\n Range.new( minFactor * minFactor, factorial ).each do | multiple |\n foundMultiple = true\n\n factors.each do | factor |\n if multiple % factor != 0\n foundMultiple = false\n break\n end\n end\n\n if foundMultiple == true\n return multiple\n end\n\n foundMultiple = true\n end\nend", "def division (other) # para hacer la division le damos la vuelta a la fraccion que se nos pasa por parametro y la multiplicamos\n\t\tdiv = Fraccion.new(0,0)\n\t\t#¡SE HACE EL CAMBIO!\t\t\n\t\tauxiliar = other.x\n\t\tother.x=other.y\n\t\tother.y=auxiliar\n\t\t# SE MULTIPLICA\t\n\t\tdiv.x= @x * other.x\n\t\tdiv.y= @y * other.y\t\n\treturn div\t\n\tend", "def promedio(h)\n suma = h.values.inject(0) {|sum, x| sum + x}\n p suma\n suma / h.count.to_f\nend", "def Division(num1,num2)\n factors = []\n (1..10**3).each {|idx| factors << idx if (num1 % idx == 0 && num2 % idx == 0)}\n factors.max\nend", "def divide\n C.curry.(->(x, y) { x / y })\n end", "def /(other)\n matrix_cls = Matrix\n if other._isNumeric\n # rows = @rows.collect { |row|\n # row.collect { |e| e / other }\n # }\n array_cls = Array\n my_rows = @rows\n my_rows_size = my_rows.size\n rows = array_cls.new(my_rows_size)\n for i in 0..my_rows_size-1 do\n row = my_rows[i]\n r_size = row.size\n res_row = array_cls.new(r_size)\n for j in 0..r_size-1 do\n res_row[j] = row[j] / other \n end\n rows[i] = res_row\n end\n return matrix_cls.rows(rows, false)\n elsif other._kind_of?(matrix_cls)\n return self * other.inverse\n else\n cr = other.coerce(self)\n return cr[0] / cr[1]\n end\n end", "def divide(dividend, divisor)\n # new_dividend = dividend > 0 : -divident : dividend\n # new_divisor = divisor > 0 : -divisor : divisor\n\n new_dividend = dividend\n new_divisor = divisor\n\n quotient = 0\n while new_dividend >= new_divisor\n multiplier = 0\n while (new_divisor << multiplier + 1) < new_dividend\n multiplier += 1\n end\n\n quotient += (1 << multiplier)\n new_dividend -= new_divisor << multiplier\n end\n\n quotient\nend", "def promedio(visitas_diarias)\n visitas_diarias.sum / visitas_diarias.count #suma de los datos dividido la cantidad de datos\nend", "def terms_in_pascal_triangle_for_row(row)\n c = 1\n cols = [1]\n return cols if row == 1\n until cols.length == (row.to_f / 2).ceil\n cols << (cols[c - 1].to_f * ((row.to_f - c.to_f) / c.to_f)).to_i\n c += 1\n end\n # cheat a little bit, we know it's symmetric\n if row.even?\n cols << cols.reverse\n else\n # don't grab the middle term if we are an odd row\n cols << cols[0..(row/2)-1].reverse\n end\n return cols.flatten\nend", "def divide\n\n\t\t# make sure when can perform the operation\n\t\tempty?\n\n\t\t# pop the last 2 numbers and store but need to be converted to a float\n\t\tnum_1 = @calculator.pop.to_f\n\t\tnum_2 = @calculator.pop.to_f\n\n\t\t# division is performed and pushed to @calc\n\t\t@calculator << num_2 / num_1\n\n\tend", "def point_per_movie_seat_row(seat_row)\n if seat_row.to_f / venueRows < 0.333\n return 0.25\n elsif seat_row.to_f / venueRows < 0.666\n return 1.0\n else\n return 0.8\n end\n end", "def division(n, d)\n n, d = reducir(n, d)\n \n @n *= d\n @d *= n\n \n reducir(@n, @d)\n return @n, @d\n end", "def scoreExclusivity\n covered = 0\n xor = 0\n colSums.each{|sum|\n if sum == 1\n xor += 1\n covered += 1\n elsif sum > 1\n covered += 1\n end\n }\n return xor.to_f/covered.to_f\n end", "def convolve_divide(other)\n throw ArgumentError, \"Divisor may be zero\" if other.min < 1\n h = Hash.new{|h, k| h[k] = 0}\n # We can do this faster using a sieve, but be lazy for now\n # TODO: Be less lazy\n range.each do |v1|\n other.range.each do |v2|\n h[v1 / v2] += percent_exactly(v1) * other.percent_exactly(v2)\n end\n end\n self.class.new(h)\n end", "def /(divider)\n raise ZeroDivisionError if divider.zero?\n new(amount / divider.to_f, currency)\n end", "def divDeComplejos(c)\n\t\tif c.class != NumCom && c.class != Float && c.class != Fixnum && c.class != Bignum\n\t\t\treturn \"El numero rescibido no es valido\"\n\t\t\texit\n\t\telse\n\t\t\ta2 = (@r * c.getReal + @i * c.getImaginario)/(c.getReal * c.getReal + c.getImaginario * c.getImaginario)\n\t\t\tb2 = (@i * c.getReal - @r * c.getImaginario)/(c.getReal * c.getReal + c.getImaginario * c.getImaginario)\n\t\tend\n\t\treturn NumCom.new(a2,b2)\n\tend", "def /(divisor)\n return map {|currency, money| money / divisor}\n end", "def volume_per_glass_j_in_row_i(volume, volume_of_glass_j, row_i)\n if volume > volume_in_row_i(volume_of_glass_j, row_i)\n volume_of_glass_j\n else\n volume/number_of_glasses_j_in_row_i(row_i)\n end\n end", "def dividing_line; end", "def divide(other)\n clone.divide! other\n end", "def division(r, i)\n p_r = (@r*r + @i*i).to_f / (r**2 + i**2)\n p_i = (@i*r - @r*i).to_f / (r**2+i**2)\n c3 = Complejo.new(p_r, p_i)\n return c3.to_s\n end", "def Division(num1, num2)\n\t# start with the lowest number and then iterate one down from there until zero, and return the first number that\n\t# divides into both\n\n\tif num1 < num2\n\t\tgreatest_common_factor = num1\n\telse\n\t\tgreatest_common_factor = num2\n\tend\n\n\twhile greatest_common_factor > 0\n\t\tif num1 % greatest_common_factor == 0 && num2 % greatest_common_factor == 0\n\t\t\treturn greatest_common_factor\n\t\tend\n\t\tgreatest_common_factor -= 1\n\tend\nend", "def evenly_divisible_values(array)\n array.permutation(2)\n .select { |a, b| (a % b).zero? }\n .map { |a, b| a / b }\nend", "def factors1(number)\n dividend = number\n divisors = []\n while dividend > 0 do\n divisors << number / dividend if number % dividend == 0\n dividend -= 1\n end\n divisors\nend", "def comparator_density(cmp)\n uniqued_hash = {}\n cmp.similar_clusters.each do |cluster_pair|\n cluster_pair[1].keys.each do |key|\n uniqued_hash[key] = [uniqued_hash[key], cluster_pair[1][key]]\n .flatten.uniq.compact\n end\n end\n numer = 0\n denom = cmp.source.word_array.join.split('').length.to_f\n uniqued_hash.keys.each do |key|\n numer += (key.split('').length * uniqued_hash[key].length) #\n end\n return (numer / denom)\n end", "def factorize\n if even?\n return [2, self/2]\n else\n 3.upto(self) do |i|\n return [i, self/i] if self % i == 0\n end\n end\n end", "def recall category\n\t\tsend(category).values.sum > 0 ? send(category)[category].fdiv(send(category).values.sum) : 0\n\tend", "def divide_by_function(iDivFunction)\n case @Function[:FunctionType]\n when FCTTYPE_PIECEWISE_LINEAR\n case iDivFunction.function_data[:FunctionType]\n when FCTTYPE_PIECEWISE_LINEAR\n lNewPoints = []\n unionXWithFunction_PiecewiseLinear(iDivFunction) do |iX, iY, iOtherY|\n if (iY == nil)\n lNewPoints << [ iX, 0 ]\n elsif (iOtherY == nil)\n lNewPoints << [ iX, 0 ]\n else\n lNewPoints << [ iX, iY / iOtherY ]\n end\n end\n # Replace with new points\n @Function[:Points] = lNewPoints\n else\n log_err \"Unknown function type: #{@Function[:FunctionType]}\"\n end\n else\n log_err \"Unknown function type: #{@Function[:FunctionType]}\"\n end\n optimize\n end", "def prime_factorization(min_div)\r\n\tlist = []\r\n\tmin_div.prime_division.each{|arr| arr[1].times {list << arr[0]}}\r\n\tpowers = list.reverse.map{|i| i - 1}\r\n\tlist = Prime.take(list.size)\r\n\tlist.map.with_index{|_, idx| list[idx] ** powers[idx]}.inject(:*)\r\nend", "def mutual_factors(*args)\n div_hash = Hash.new\n args.each do |num|\n div_hash[num] = divisors(num)\n end\n common_divisors(div_hash.values)\nend", "def divide(num1, num2)\n num2.to_f / num1.to_f;\nend", "def count_horizontal(row)\n count_vector(horizontal_vector(row))\n end", "def all_divisors\n\t\tndf = self.num_distinct_factors\n\t\tif ndf <= 0\n\t\t\tif @trivial_factor.nil?\n\t\t\t\traise \"Factorization.all_divisors: \" \\\n\t\t\t\t\t\"No factors have been inserted.\\n\"\n\t\t\tend\n\t\tend\n\t\tnd = self.num_divisors\n\t\trv = [0] * nd\n\t\tfor k in (0..(nd-1))\n\t\t\trv[k] = self.kth_divisor(k)\n\t\tend\n\t\trv.sort!\n\t\treturn rv\n\tend", "def /( scalar )\n\t\t\tscalar = Float(scalar)\n\t\t\traise ZeroDivisionError if scalar == 0.0\n\n\t\t\treturn self.class.new( self.collect {|elem| elem / scalar} )\n\t\tend", "def convertFracts(fraction_array)\n least_common_multiple = fraction_array.transpose { |x, y, z| [x, y, z] }[1].reduce(1, :lcm)\n \n fraction_array.map do |numer, denom|\n [numer*least_common_multiple/denom, least_common_multiple]\n end\nend", "def on_div(ast_node, context)\n left, right = *ast_node\n\n return on_call_number(context, left) / on_call_number(context, right)\n end", "def div(arg0)\n end", "def factors(number)\n dividend = number\n divisors = []\n while dividend > 0\n divisors << number / dividend if number % dividend == 0\n dividend -= 1\n end \n divisors\nend", "def num_divisors\n\t\tndf = self.num_distinct_factors\n\t\tif ndf <= 0\n\t\t\tif @trivial_factor.nil?\n\t\t\t\traise \"Factorization.num_divisors: \" \\\n\t\t\t\t\t\"No factors have been inserted.\\n\"\n\t\t\tend\n\t\tend\n\t\trv = 1\n\t\tfor i in (0..(ndf-1))\n\t\t\trv *= @factors_and_multiplicities[i][1] + 1\n\t\tend\n\t\treturn rv\n\tend", "def divide_fraction_by_term_list(fraction, term_list)\n\ttl_fraction = Fraction.new(term_list.line, term_list.col, denominator: term_list)\n\treturn multiply_fraction_and_fraction(fraction, tl_fraction)\nend", "def div(signal)\n self.class.new(self, signal) { |a, b| a / b }\n end", "def gc_divisor(ints:[]) \n arr = []\n arr2 = []\n for i in ints \n arr << i \n end\n \n arr.each do |num|\n for i in (1..num)\n if (num % i == 0)\n arr2 << i\n end\n end\n end\n # positive \n #divides numbers without a remainder\n #largetst one of such number\n arr2.each\nend", "def reduce!\n g = gcd(@numer, @denom)\n @numer /= g\n @denom /= g\n self\n end", "def calc_contribution(f)\n each_class do |k|\n a, b, c, d = get_A(f, k), get_B(f, k), get_C(f, k), get_D(f, k)\n \n s = 0.0\n x = b*c\n \n s = (a*d) / x if not x.zero?\n \n set_feature_score(f, k, s)\n end\n end", "def / other\n other.is_a?(Vips::Image) ?\n divide(other) : linear(Image.smap(other) { |x| 1.0 / x }, 0)\n end", "def row_estimates(stats, total_rows, rows_left, op)\n case op\n when \"null\"\n rows_left * stats[\"null_frac\"].to_f\n when \"not_null\"\n rows_left * (1 - stats[\"null_frac\"].to_f)\n else\n rows_left *= (1 - stats[\"null_frac\"].to_f)\n ret =\n if stats[\"n_distinct\"].to_f == 0\n 0\n elsif stats[\"n_distinct\"].to_f < 0\n if total_rows > 0\n (-1 / stats[\"n_distinct\"].to_f) * (rows_left / total_rows.to_f)\n else\n 0\n end\n else\n rows_left / stats[\"n_distinct\"].to_f\n end\n\n case op\n when \">\", \">=\", \"<\", \"<=\", \"~~\", \"~~*\"\n (rows_left + ret) / 10.0 # TODO better approximation\n when \"<>\"\n rows_left - ret\n else\n ret\n end\n end\n end", "def scoreExclusivity(mat)\n covered = 0\n xor = 0\n mat.first.each_index{|i|\n sum = 0\n mat.each{|node|\n sum += node[i].to_i\n }\n if sum == 1\n xor += 1\n covered += 1\n elsif sum > 1\n covered += 1\n end\n }\n \n return xor.to_f/covered.to_f\nend", "def sum_of_factors(x)\n\tsum = 0\n\t\n\t(1..x / 2).each do |y|\n\t\t\n\t\tif x % y == 0\n\t\t\t\n\t\t\tsum += y\n\t\tend\n\tend\n\treturn sum\nend", "def mutual_factors(*nums)\n # common_h = Hash.new(0)\n # nums.sort!\n\n # factors(nums[0]).each do |factor|\n # nums.each { |num| common_h[factor] += 1 if num % factor == 0 }\n # end\n\n # common_f = []\n # common_h.each {|k,v| common_f << k if v == nums.length}\n # common_f\n nums.sort!\n facts = factors(nums.first)\n facts.select {|f| nums.all? {|num| num % f == 0} }\nend", "def point_per_non_movie_seat_row(seat_row)\n Math.exp(-((1.0/venueRows)*(seat_row.to_f+1))) \n end", "def part2(line)\n numbers_str = line.chomp.split()\n numbers = numbers_str.map(&:to_i).sort\n\n # Start from the end\n i = numbers.size - 1\n\n while i > 0\n j = 0\n while j < i\n return numbers[i] / numbers[j] if numbers[i] % numbers[j] == 0\n j = j + 1\n end\n i = i - 1\n end\n return 0\nend" ]
[ "0.55781704", "0.5515967", "0.54971004", "0.53898335", "0.53534096", "0.5316323", "0.524927", "0.5216814", "0.51739395", "0.51715213", "0.5171128", "0.5137487", "0.51267326", "0.51240975", "0.510751", "0.5067971", "0.5049427", "0.5044258", "0.5015577", "0.50066626", "0.49902055", "0.49718097", "0.49659666", "0.49620312", "0.49618414", "0.4944841", "0.4941378", "0.49396634", "0.49366108", "0.49359724", "0.49315688", "0.4931196", "0.49292138", "0.49102274", "0.48998806", "0.48919475", "0.48853764", "0.4853514", "0.48483157", "0.4847325", "0.4837135", "0.4832736", "0.4830885", "0.48290625", "0.48218173", "0.48188612", "0.48147818", "0.48140937", "0.4805533", "0.4780283", "0.47684166", "0.4759975", "0.4752619", "0.47522312", "0.47509524", "0.47392416", "0.47330153", "0.4732706", "0.47321448", "0.472731", "0.4724776", "0.47228774", "0.47220123", "0.47128847", "0.47118604", "0.471011", "0.47077772", "0.4698503", "0.46926346", "0.4691902", "0.46873355", "0.46865144", "0.46726236", "0.46689492", "0.46663928", "0.46493736", "0.46435004", "0.46345055", "0.4627507", "0.4627234", "0.46235216", "0.4616071", "0.46151736", "0.4614218", "0.4606779", "0.4605028", "0.4602738", "0.45939937", "0.45888802", "0.45794898", "0.45784345", "0.45781395", "0.457153", "0.4568574", "0.456776", "0.45675552", "0.4567027", "0.45630464", "0.45579502", "0.45570818" ]
0.5858023
0
Swaps two rows with each other (Index 's)
def swap (row1, row2) row1_copy = @rows[row1] row2_copy = @rows[row2] new_row1 = row2_copy new_row2 = row1_copy @rows[row1] = new_row1 @rows[row2] = new_row2 puts "R#{row1 + 1} <-> R#{row2 + 1}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def swap(index1,index2)\n if index1==index2\n return\n end\n # swap the entries in the list\n @content[index1],@content[index2] = @content[index2],@content[index1]\n # fix the indices map\n @indices[@content[index1]] = index1\n @indices[@content[index2]] = index2\n end", "def swapper(arr, idx_1, idx_2)\n \n arr[idx_1], arr[idx_2] = arr[idx_2], arr[idx_1]\n arr\nend", "def swapper(arr, idx_1, idx_2)\n \n arr[idx_1], arr[idx_2] = arr[idx_2], arr[idx_1]\n arr\nend", "def swap_indexes!(i,j)\n\t\tself[i],self[j] = self[j],self[i]\n\t\tself\n\tend", "def swapper(arr, idx_1, idx_2)\n arr[idx_1], arr[idx_2] = arr[idx_2], arr[idx_1]\n arr\nend", "def swap_line!(matrix, i, j)\n matrix[i], matrix[j] = matrix[j], matrix[i]\n matrix.each { |array| array[i], array[j] = array[j], array[i] }\nend", "def swap_indexes(i,j)\n\t\tnew_array = self.dup\n\t\tnew_array[i],new_array[j] = self[j],self[i]\n\t\tnew_array\n\tend", "def swapper(arr, idx1, idx2)\n arr[idx1], arr[idx2] = arr[idx2], arr[idx1]\n arr\nend", "def swap_with_index(i1, i2)\n v1 = self[i1]\n v2 = self[i2]\n self[i1] = v2\n self[i2] = v1\n self\n end", "def swapper(arr, idx_1, idx_2)\n arr[idx_1] = arr[idx_2] # as soon as I execute this line, it will be [\"c\", \"b\", \"c\", \"d\"]\n arr[idx_2] = arr[idx_1] # then, I excute this line, then it will be [\"c\", \"b\", \"c\", \"d\"], which is wrong!\n arr\n\nend", "def swap_line!(matrix, i, j)\n\tmatrix[i], matrix[j] = matrix[j], matrix[i]\n\tmatrix.each { |array| array[i], array[j] = array[j], array[i] }\nend", "def swap(arr, idx1, idx2)\n\n tmp = arr[idx1]\n\n arr[idx1] = arr[idx2]\n arr[idx2] = tmp\n end", "def swap(arr, idx1, idx2)\n tmp = arr[idx1]\n arr[idx1] = arr[idx2]\n arr[idx2] = tmp\n end", "def swap(idx1, idx2)\n @ary[idx1] += @ary[idx2]\n @ary[idx2] = @ary[idx1] - @ary[idx2]\n @ary[idx1] -= @ary[idx2]\n end", "def swap_elements(arry)\n #oldx = x x = y y = oldx\n\n val1 = arry[2]\n val2 = arry[1]\n\n arry[1] = val1\n arry[2] = val2\n\n arry\nend", "def swap_elements_from_to(array, i_a, i_b)\n array[i_a], array[i_b] = array[i_b], array[i_a]\n return array\nend", "def swap_order(index1, index2)\n @positions[index1], @positions[index2] = @positions[index2], @positions[index1]\n $game_player.refresh\n end", "def swap(index_1, index_2)\n temp = @store[index_1]\n @store[index_1] = @store[index_2]\n @store[index_2] = temp\n end", "def swap(index_1, index_2)\n temp = @store[index_1]\n @store[index_1] = @store[index_2]\n @store[index_2] = temp\n end", "def swap(index_1, index_2)\n temp = @store[index_1]\n @store[index_1] = @store[index_2]\n @store[index_2] = temp\n end", "def swap(index_1, index_2)\n temp = @store[index_1]\n @store[index_1] = @store[index_2]\n @store[index_2] = temp\n end", "def swap(index_1, index_2)\n temp = @store[index_1]\n @store[index_1] = @store[index_2]\n @store[index_2] = temp\n end", "def swap(index_1, index_2)\n temp = @store[index_1]\n @store[index_1] = @store[index_2]\n @store[index_2] = temp\n end", "def swap(index_1, index_2)\n temp = @store[index_1]\n @store[index_1] = @store[index_2]\n @store[index_2] = temp\n end", "def swap(index_1, index_2)\n temp = @store[index_1]\n @store[index_1] = @store[index_2]\n @store[index_2] = temp\n end", "def swap(index_1, index_2)\n temp = @store[index_1]\n @store[index_1] = @store[index_2]\n @store[index_2] = temp\n end", "def swap(index_1, index_2)\n temp = @store[index_1]\n @store[index_1] = @store[index_2]\n @store[index_2] = temp\n end", "def swap(index_1, index_2)\n temp = @store[index_1]\n @store[index_1] = @store[index_2]\n @store[index_2] = temp\n end", "def swap(index_1, index_2)\n temp = @store[index_1]\n @store[index_1] = @store[index_2]\n @store[index_2] = temp\n end", "def swap(index_1, index_2)\n temp = @store[index_1]\n @store[index_1] = @store[index_2]\n @store[index_2] = temp\n end", "def swap_elements_from_to(array, index, destination_index)\n array[index], array[destination_index] = array[destination_index], array[index]\n array\nend", "def swap(array, index_one, index_two)\n temp = array[index_one]\n array[index_one] = array[index_two]\n array[index_two] = temp\nend", "def map_swap value_i, value_j, index_i, index_j\n set_i = @map[value_i]\n set_j = @map[value_j]\n\n set_i.delete?(index_i)\n set_j.delete?(index_j)\n\n set_i.add(index_j)\n set_j.add(index_i)\n end", "def swap_elements_from_to(array, index, destination_index)\n array[index], array[destination_index] = array[destination_index], array[index]\n array\nend", "def swap\n @store[-1], @store[-2] = @store[-2], @store[-1] if size > 1\n end", "def swap(array, first_index, second_index)\n temp = array[first_index]\n array[first_index] = array[second_index]\n array[second_index] = temp\nend", "def swap(array, index1, index2)\n temp = array[index2]\n array[index2] = array[index1]\n array[index1] = temp\nend", "def swap(array, index1, index2)\n temp = array[index2]\n array[index2] = array[index1]\n array[index1] = temp\nend", "def swap(array, a_index, b_index)\n temp = array[a_index]\n\tarray[a_index] = array[b_index]\n\tarray[b_index] = temp\n return array\nend", "def swapper(arr, idx_1, idx_2)\n temp = arr[idx_1]\n arr[idx_1] = arr[idx_2] # as soon as I execute this line, it will be [\"c\", \"b\", \"c\", \"d\"]\n arr[idx_2] = temp # then, I excute this line, then it will be [\"c\", \"b\", \"c\", \"d\"], which is wrong!\n arr\n\nend", "def swap(index1, index2)\n #YOUR WORK HERE\n end", "def swap_elements_from_to(array, index, destination_index)\n array[index], array[destination_index] = array[destination_index], array[index]\n return array\nend", "def swap_elements_from_to(any_array, index, destination_index)\n any_array[index], any_array[destination_index] = any_array[destination_index], any_array[index]\n any_array\n end", "def swap(array, index1, index2)\n temp = array[index1]\n array[index1] = array[index2]\n array[index2] = temp\n array\nend", "def swap_elements_from_to(arr, index, dest_index)\n arr[index], arr[dest_index] = arr[dest_index], arr[index] \n arr\nend", "def mergerows(row1,row2)\n\t\tif row2 >= @text.length\n\t\t\treturn\n\t\tend\n\t\tcol = @text[row1].length\n\t\t@text[row1] = @text[row1].dup\n\t\t@text[row1] += @text[row2]\n\t\[email protected]_at(row2)\n\tend", "def swap!(a, b) self[a], self[b] = self[b], self[a]; self; end", "def swap(i, j)\n ei, pi, si = get_entry(i)\n ej, pj, sj = get_entry(j)\n set_entry(i, ej, pj, sj)\n set_entry(j, ei, pi, si)\n ei.send(:index=, j)\n ej.send(:index=, i)\n end", "def swap(arr, x, y)\n array = arr.clone\n array[x], array[y] = array[y], array[x]\n array\nend", "def swap(word, index1, index2)\n temp_word = word.dup\n temp_word[index1], temp_word[index2] = temp_word[index2], temp_word[index1]\n return temp_word\nend", "def swap_elements(array)\n array.insert(1,array.delete_at(2))\nend", "def swap_elements(array)\n array.insert(1, array.delete_at(2))\nend", "def swap_up\n # Creates new state matrix\n new_state = current_state_dup\n\n # Swap values\n new_state[blank_y][blank_x] = new_state[blank_y + 1][blank_x]\n new_state[blank_y + 1][blank_x] = 0\n\n # Returns new matrix\n new_state\n end", "def swap(input, position1, position2)\n output = input.clone\n output[position2] = input[position1]\n output[position1] = input[position2]\n output\n end", "def swap; end", "def swap_elements(array, index = 1, destination_index = 2)\n array[index], array[destination_index] = array[destination_index], array[index]\n\n array\nend", "def pair_swap(pairs, shift_sign)\n pairs.collect do |pair|\n l1 = locate(pair[0,1])\n l2 = locate(pair[1,1])\n if l1.first == l2.first # on the same column\n shift_swap(l1, 1, shift_sign)\n shift_swap(l2, 1, shift_sign)\n elsif l1.last == l2.last # on the same row\n shift_swap(l1, 0, shift_sign)\n shift_swap(l2, 0, shift_sign)\n else \n l1[1], l2[1] = l2[1], l1[1] # normal swap\n end\n [at(*l1), at(*l2)]\n end\n end", "def swap(a,start1,start2,d)\n for i in 0...d\n temp = a[start1+i]\n a[start1+i] = a[start2+i]\n a[start2+i] = temp\n end\nend", "def SwapRows(matrix, n)\n for i in 0...matrix.size\n if matrix[i][n] != 0 \n matrix[i], matrix[n] = matrix[n], matrix[i]\n return\n end\n end\nend", "def swap(a, i1, i2)\n a = a.dup\n t = a[i1]\n a[i1] = a[i2]\n a[i2] = t\n a\n end", "def transpose(before)\n after = [[],[]]\n\n before.each_with_index do |n1, i|\n n1.each_with_index do |n2, j|\n after[i][j] = before[j][i]\n end\n end\n\n after\nend", "def swap_elements(array)\n array[1], array[2], = array[2], array[1]\n return array\nend", "def swap_elements_from_to(array,a,b)\n array[a] = array[a]^array[b]\n array[b] = array[b]^array[a]\n array[a] = array[a]^array[b]\nend", "def swap_elements(array)\n second_element = array.slice(1)#grab the second element and store it in second_element\n array.delete_at(1)#delete the second element\n array.insert(2, second_element)#insert second_element at the third index\nend", "def swap_elements(a)\n a[0], a[1], a[2] = a[0], a[2], a[1]\nend", "def swap\n\t\t\ta = pop\n\t\t\tb = pop\n\t\t\tpush a\n\t\t\tpush b\n\t\tend", "def swap_down\n # Creates new state matrix\n new_state = current_state_dup\n\n # Swap values\n new_state[blank_y][blank_x] = new_state[blank_y - 1][blank_x]\n new_state[blank_y - 1][blank_x] = 0\n\n # Returns new matrix\n new_state\n end", "def remix pairs\n col1, col2 = pairs.transpose\n new_col2 = col2.shuffle\n while new_col2.zip(col2).any? { |newer,original| newer == original }\n new_col2 = col2.shuffle\n end\n col1.zip(new_col2)\nend", "def swap(a,b)\n i = self.clone\n av = i[a]\n i[a] = i[b]\n i[b] = av\n return i\n end", "def swap (array, first, second)\n original_first = array[first]\n array[first] = array[second]\n array[second] = original_first\nend", "def swap_elements (array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap(name, headers, row)\n name.gsub(/<([^>]*)>/) do\n Hash[headers.zip(row)][$1]\n end\n end", "def reversal(array)\n array = array.map{|element| element} #creates a copy of array, remove to have same object_id's\n left_index = 0\n right_index = -1\n \n while left_index < array.size / 2\n array[left_index], array[right_index] = array[right_index], array[left_index]\n left_index += 1\n right_index -=1\n end\n\n array\nend", "def swap_elements(array)\n array[1],array[2] = array[2], array[1] \n array\nend", "def swap(index1, index2, list)\n temp = list[index1]\n list[index1] = list[index2]\n list[index2] = temp\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def transpose\n first_row = @list[0]\n other_rows = @list[1..-1]\n @list = first_row.zip(*other_rows)\n self\n end", "def swap_elements(array)\n\n array[1], array[2] = array[2], array[1]\n array\n #swap_elements_from_to(array, 1, 2)\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap(array, x, y)\n temp_1 = array[x]\n temp_2 = array[y]\n array[y] = temp_1\n array[x] = temp_2\n return array\nend", "def swap(index1, index2)\n @tree[index1], @tree[index2] = @tree[index2], @tree[index1]\n end", "def swap_elements(array)\n array[0], array[1], array[2] = array[0], array[2], array[1]\nend", "def swap(arr, i1, i2)\n\n tmp = arr[i1]\n\n arr[i1] = arr[i2]\n arr[i2] = tmp\n end", "def swap_right\n # Creates new state matrix\n new_state = current_state_dup\n\n # Swap values\n new_state[blank_y][blank_x] = new_state[blank_y][blank_x - 1]\n new_state[blank_y][blank_x - 1] = 0\n\n # Returns new matrix\n new_state\n end", "def swap_elements(array)\n #array[0], array[3] = array[3], array[0]\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap(a, i, j) \n\ttemp = a[i]\n\ta[i] = a[j]\n\ta[j] = temp\n\treturn a\nend", "def swap(arr, x, y)\n aux = arr[x]\n arr[x] = arr[y]\n arr[y] = aux\n nil\nend", "def reverse_rows!\n @data = skip_headers &:reverse\n end", "def flip_horizontally\n dup.flip_horizontally!\n end", "def swap(i, j)\n @arr[i], @arr[j] = @arr[j], @arr[i]\n end", "def rotate_row(a, b, screen)\n edge = screen[a].pop(b)\n screen[a].unshift(edge)\n screen[a].flatten!\n\n screen\nend" ]
[ "0.68529135", "0.6794802", "0.6794802", "0.6791486", "0.6727307", "0.65977305", "0.6593027", "0.65798867", "0.6435022", "0.63789755", "0.63758546", "0.63704634", "0.6353265", "0.634496", "0.63039774", "0.6301512", "0.6294747", "0.6292657", "0.6292657", "0.6292657", "0.6292657", "0.6292657", "0.6292657", "0.6292657", "0.6292657", "0.6292657", "0.6292657", "0.6292657", "0.6292657", "0.6292657", "0.62923384", "0.6286011", "0.62741274", "0.6270446", "0.6257093", "0.6252156", "0.6249562", "0.6249562", "0.6246136", "0.6244132", "0.6238163", "0.62316877", "0.6223026", "0.62199324", "0.6205893", "0.620282", "0.6198488", "0.6176288", "0.61674863", "0.6148174", "0.61008894", "0.6083598", "0.60790473", "0.6040995", "0.60403913", "0.6038763", "0.60386866", "0.60219043", "0.60161436", "0.59927", "0.5979662", "0.5964012", "0.59594053", "0.5937123", "0.5935196", "0.59338653", "0.59194046", "0.59159136", "0.5907292", "0.59060925", "0.5903197", "0.5901685", "0.590067", "0.5898886", "0.5895228", "0.5883646", "0.5883493", "0.5877584", "0.58762664", "0.5875975", "0.5875975", "0.5875975", "0.5875975", "0.5875975", "0.5875975", "0.5875975", "0.5875975", "0.5875975", "0.5872128", "0.5871084", "0.5870523", "0.5854697", "0.58454084", "0.58243406", "0.5821492", "0.5818221", "0.5811935", "0.5810941", "0.5805704", "0.5804872" ]
0.71538293
0
Calculates the value needed to multiply a row through, with a pivot value row value for a particular column
def cancel_val (pivot_val, cancel) return cancel/pivot_val end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_row(row)\n row\n end", "def value\n @items.map{ |x| x.price * x.quantity}.inject(:+)\n end", "def substitute (pivot_row_num, cancel_row_num, cancel_val)\n for i in 0..(((@rows[pivot_row_num]).length) - 1)\n @rows[cancel_row_num][i] = @rows[cancel_row_num][i] - (cancel_val)*(@rows[pivot_row_num][i])\n if @rows[cancel_row_num][i] == -0.0 then\n @rows[cancel_row_num][i] = 0.0\n end\n end\n num, den = cancel_val.to_fraction\n outp = \"\"\n if den == 1 then\n outp += \"#{num}\"\n else\n outp += \"#{num}/#{den}\"\n end\n if (cancel_val < 0) then\n puts \"R#{cancel_row_num + 1} -> R#{cancel_row_num + 1} - (#{outp})R#{pivot_row_num + 1}\"\n else\n puts \"R#{cancel_row_num + 1} -> R#{cancel_row_num + 1} - (#{outp})R#{pivot_row_num + 1}\"\n end\n end", "def _reduce_585(val, _values, result)\n result = [:dot, val[0][1]]\n\n result\nend", "def product_right\n unless @col > 16 \n product = @arr[@row][@col] * @arr[@row][@col + 1] * @arr[@row][@col + 2] * @arr[@row][@col + 3]\n check_new_max(product)\n end \nend", "def _reduce_585(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def rowsum a,row\n sum=0\n 0.upto(4){|i| sum+=a[row][i]}\n return sum.to_f\nend", "def Multiply(val)\n self.value *= val\n end", "def calculate_score\n @results.collect { |mir| mir.send(@column.to_sym) }.sum\n end", "def _reduce_479(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n \n result\nend", "def _reduce_597(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def sum_column(column_name)\n @result.inject(0.0) { |sum, item_hash|\n if item_hash.has_key?(column_name)\n sum + item_hash[column_name].to_f\n else\n sum\n end\n }\n end", "def _reduce_593(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def _reduce_590(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def _reduce_478(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n \n result\nend", "def _reduce_693(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def basis(v)\n self * self.inner_product(v)\n end", "def calculate_row(index)\n index/9\n end", "def _reduce_718(val, _values, result)\n result = val[1]\n \n result\nend", "def column_reduction\n\n reduction_ar = Array.new\n reduced_matrix_ar = self.to_a\n\n #for each column...\n (0..(self.column_size-1)).each do |j|\n col = self.column(j)\n minval = col.min\n\n reduction_ar.push(minval)\n\n #loop through each row to to update this column\n (0..(self.row_size-1)).each do |i|\n val = reduced_matrix_ar[i][j]\n\n #Skip doing calculations with infinity.\n next(Float::INFINITY) if (val.equal? Float::INFINITY or minval.equal? Float::INFINITY)\n\n #sets the column value for this row\n reduced_matrix_ar[i][j] = val - minval\n end\n end\n\n return {\n :matrix=>Matrix[*reduced_matrix_ar], \n :reduction=>reduction_ar.reject{|el| el.equal? Float::INFINITY}\n }\n end", "def _reduce_595(val, _values, result)\n result = val[1]\n \n result\nend", "def carbon_emissions_per_product()\n sql = 'SELECT (conversion_factor * weight) AS converted FROM plastics\n INNER JOIN products ON products.plastic_id = plastics.id\n WHERE products.id = $1'\n values=[@id]\n results= SqlRunner.run(sql, values)\n emission_of_product = results.first['converted'].to_f * @quantity\n return emission_of_product\nend", "def precision category,a\n x=getValue category\n y=getValue category\n return a[x][y]/colsum(a,y).to_f\nend", "def _reduce_522(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n\n result\nend", "def _reduce_524(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n\n result\nend", "def _reduce_436(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n \n result\nend", "def _reduce_589(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def calculate_multiplication_table\n \tprime_array.each_with_index do |element1, index1|\n \t\toutput_array[index1] = []\n \t\tprime_array.each_with_index do |element2, index2|\n\t \t\tif(index1 == 0 && index2 == 0)\n\t \t\t\toutput_array[index1][index2] = element1\n\t \t\telsif (index1 == 0)\n\t \t\t\toutput_array[index1][index2] = element2\n\t \t\telsif (index2 == 0)\n\t \t\t\toutput_array[index1][index2] = element1\n\t \t\telse\n \t\t\t\toutput_array[index1][index2] = element2*element1\n \t\t\tend\n \t\tend\n \tend\n \treturn output_array\n end", "def sum(column)\n result = all\n\n if result.any?\n result.inject(0.0) do |acc, record|\n if value = record.public_send(column)\n acc += value\n end\n\n acc\n end\n end\n end", "def _reduce_711(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def p_value(pr,k)\n GSL::Cdf.tdist_Pinv(pr,k)\n end", "def _reduce_699(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def _reduce_591(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def _reduce_724(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def _reduce_588(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def _reduce_699(val, _values, result)\n result = [:dot, val[0][1]]\n\n result\nend", "def multiplication(tab)\n mini = 1\n maxi = 1\n for i in 0..tab.length-1\n if tab[i].is_a?(IntVar)\n mini*=tab[i].domain.first\n maxi*=tab[i].domain.last\n elsif tab[i].is_a?(Integer)\n mini*= tab[i]\n maxi*= tab[i]\n tab[i] = IntVarStat.new(\"DuMmyINT\"+tab[i].to_s,[tab[i]],self)\n end\n end\n var_returned = civ(\"MultDuMmy\"[email protected]_s,mini,maxi)\n var_returned.depend=true\n @dummyNameNb+=1\n var_in_const = civ(\"MultDuMmy\"[email protected]_s,mini,maxi)\n @dummyNameNb+=1\n post(eq(var_returned,var_in_const))\n \n post(ContrainteMul.new([var_in_const]+tab))\n \n return var_returned\n \n end", "def _reduce_591(val, _values, result)\n result = [:dot, val[0][1]]\n\n result\nend", "def cal()\n @v = 0.0;\n @n.times {|i|\n @v += @wn[i] * @xn[i];\n }\n nil;\n end", "def _reduce_507(val, _values, result)\n result = \"*#{value(val[1])}\".to_sym\n \n result\nend", "def _reduce_696(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def update(row, col, val) \n diff = val - matrix[row][col]\n matrix[row][col] = val\n matrix_row = sum_matrix[row]\n col.upto(matrix_row.length - 1) do |idx|\n matrix_row[idx] += diff\n end\n end", "def _reduce_489(val, _values, result)\n result = \"*#{value(val[1])}\".to_sym\n \n result\nend", "def total_value\n @quantity * @price_per_share\n end", "def pi_product\n self.inject{|a,b| a*b}\n end", "def target_value\n items.reduce(0) do |sum, item|\n sum + item.target * item.price\n end\n end", "def find_pivot(col, m)\n aux = 999999\n row = 0\n num_cols = m[0].size\n init = m[0][0] == 'z' ? 1:2\n for i in init..m.size-1\n div = (m[i][col] != 0) ? (m[i][num_cols-1] / m[i][col]) : -1\n if div < aux && div >= 0\n aux = div\n row = i \n end\n end\n m[row][0] = 'X' + (col).to_s\n print \"Encontrar o pívot => m[#{row}][#{col}] = #{m[row][col]}\".italic.blue\n row\nend", "def amount_calc\n quantity * price\n end", "def _reduce_712(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def pascal(row, column)\n result = 1\n 1.upto(column) do |i|\n result = (result * (row + 1 - i)) / i\n end\n result\nend", "def reduce (row_num, row_min)\n row = @rows[row_num]\n for i in 0..(row.length - 1) do\n @rows[row_num][i] = (@rows[row_num][i])/row_min\n if @rows[row_num][i] == -0.0 then\n @rows[row_num][i] = 0.0\n end\n end\n num, den = row_min.to_fraction\n if den == 1 then\n puts \"R#{row_num + 1} -> R#{row_num + 1}/#{num}\"\n else\n puts \"R#{row_num + 1} -> R#{row_num + 1}/(#{num}/#{den})\"\n end\n end", "def _reduce_728(val, _values, result)\n result = [:dot, val[0][1]]\n\n result\nend", "def total\n @state[0]*VALUES[0] + @state[1]*VALUES[1] + @state[2]*VALUES[2] + @state[3]*VALUES[3] + @state[4]*VALUES[4]\n end", "def compute(triangle)\n line = 0\n while line < triangle.length-1\n triangle[line+1].each_index do |idx|\n triangle[line+1][idx] += [triangle[line][idx], triangle[line][idx+1]].max\n end\n line += 1\n end\n return triangle[line]\nend", "def calc_calorie\n self.ingredients.map {|x| x.calories * x.qty }.sum\n end", "def calculate(input)\n input.reduce(0) { |a, e| table[a][e] }\n end", "def compute_total_value\n @value= @net_price * @count\n end", "def _reduce_551(val, _values, result)\n result = \"*#{value(val[1])}\".to_sym\n \n result\nend", "def _reduce_596(val, _values, result)\n result = val[1]\n \n result\nend", "def getval(dimension)\n raise(\"Invalid dimension array passed as input.\",ShapeError) if dimension.length != self.dimensions.length\n (0..dimension.length-1).each do |i|\n raise(\"Invalid dimension array passed as input.\",ShapeError) if dimension[i] > self.dimensions[i] || dimension[i] < 1\n end\n sum = dimension[dimension.length - 1] - 1\n prod = self.dimensions[self.dimensions.length - 1]\n (0..dimension.length - 2).each do |i|\n sum += (dimension[dimension.length - 2 - i] - 1) * prod\n prod *= self.dimensions[self.dimensions.length - 2 - i]\n end\n self.flatten[sum]\n end", "def ahorrodinero(año)\n\n i = 0\n final = Array.new \n final1 = Array.new \n final2 = Array.new \n \n\n datos = Valore.where(:año => año)\n \n datos.each do |datos|\n \n \n final[i] = datos.read_attribute(\"es\")\n final1[i] = datos.read_attribute(\"tarifa\")\n final2[i] = final1[i]*final[i]\n \n i = i +1\n \n \n end\n \n return final2\n\n\n\n end", "def _reduce_579(val, _values, result)\n result = val[1]\n\n result\nend", "def _reduce_579(val, _values, result)\n result = val[1]\n\n result\nend", "def element(n,k,row)\n return 1 if k == 0 or k==n\n previous_element = row[k-1] #we can\n return previous_element * (n+1-k)/k\nend", "def total\n price - original_value\n end", "def total\n price - original_value\n end", "def calc_of_parent_one(field_set)\n unless @@result_group[self.id].blank?\n @@result_group[self.id].map{|x| x.calc_of_parent_one(field_set)}\n sum_value = total_calc(@@result_group[self.id],field_set[0]) \n @@result_group[self.parent_id].map{|x| x.id == self.id && x[field_set[0]] = sum_value}\n end \n end", "def choose_supplier_value(current_cell, value)\n update_result(current_cell, value)\n data.b[current_cell.column] -= value\n increase_row(current_cell)\n end", "def divide_line_by(i,pivot, m)\n for j in 1..m[0].size-1\n m[i][j] /= pivot.to_f\n end\n print \"Dividir L#{i} por #{pivot}\".italic.blue \n m\nend", "def _reduce_333(val, _values, result)\n result = val[1]\n \n result\nend", "def total_value\n category_value = 0 \n self.products.each do |product|\n category_value += (product.price * product.quantity)\n end\n category_value\n end", "def inventory_value\n x = DB.execute(\"SELECT * FROM products WHERE category_id = #{@id};\")\n x = hash_to_object(x)\n Orm.calc_value(x)\n end", "def get_invoices_value_product(product, year, value)\n invoices = Invoice.where([\"invoices.return = '0' AND company_id = ? AND date_processed >= ? AND date_processed <= ?\", self.id, \"#{year}-01-01 00:00:00\", \"#{year}-12-31 23:59:59\"])\n ids = []\n \n for invoice in invoices\n ids.push(invoice.id)\n end\n \n begin\n invoice_products = InvoiceProduct.where([\"product_id = ? AND invoice_id IN (#{ids.join(\",\")})\", product.id])\n rescue\n return 0\n end\n \n ret = 0\n \n for ip in invoice_products\n if(value == \"quantity\")\n ret += ip.quantity\n else\n ret += ip.total\n end\n end\n \n return ret\n end", "def get_invoices_value_product(product, year, value)\n invoices = Invoice.where([\"invoices.return = '0' AND company_id = ? AND date_processed >= ? AND date_processed <= ?\", self.id, \"#{year}-01-01 00:00:00\", \"#{year}-12-31 23:59:59\"])\n ids = []\n \n for invoice in invoices\n ids.push(invoice.id)\n end\n \n begin\n invoice_products = InvoiceProduct.where([\"product_id = ? AND invoice_id IN (#{ids.join(\",\")})\", product.id])\n rescue\n return 0\n end\n \n ret = 0\n \n for ip in invoice_products\n if(value == \"quantity\")\n ret += ip.quantity\n else\n ret += ip.total\n end\n end\n \n return ret\n end", "def get_invoices_value_product(product, year, value)\n invoices = Invoice.where([\"invoices.return = '0' AND company_id = ? AND date_processed >= ? AND date_processed <= ?\", self.id, \"#{year}-01-01 00:00:00\", \"#{year}-12-31 23:59:59\"])\n ids = []\n \n for invoice in invoices\n ids.push(invoice.id)\n end\n \n begin\n invoice_products = InvoiceProduct.where([\"product_id = ? AND invoice_id IN (#{ids.join(\",\")})\", product.id])\n rescue\n return 0\n end\n \n ret = 0\n \n for ip in invoice_products\n if(value == \"quantity\")\n ret += ip.quantity\n else\n ret += ip.total\n end\n end\n \n return ret\n end", "def calc_row(previous)\n thisrow = [1]\n previous.each_pair do |x, y|\n thisrow << x + y\n end\n thisrow << 1\n end", "def _reduce_442(val, _values, result)\n result = val[1]\n \n result\nend", "def multiplicador_iva\n return 1.0 unless percepcion_iva.present?\n 1 + 0.01 * percepcion_iva\n end", "def _reduce_547(val, _values, result)\n result = val[1]\n\n result\nend", "def _reduce_594(val, _values, result)\n result = val[1]\n \n result\nend", "def _reduce_466(val, _values, result)\n result = val[1]\n\n result\nend", "def _reduce_466(val, _values, result)\n result = val[1]\n\n result\nend", "def _reduce_516(val, _values, result)\n result = \"*#{value(val[1])}\".to_sym\n \n result\nend", "def get\n\t\t\[email protected](BigDecimal.new(0)) { |m, (k,v)| m + v }\n\t\tend", "def _reduce_467(val, _values, result)\n result = val[1]\n\n result\nend", "def part_one\n two_entries = @sum_finder.find_two\n return if two_entries.nil?\n\n first, second = two_entries\n return if first.nil? || second.nil?\n\n first * second\n end", "def _reduce_582(val, _values, result)\n result = val[1]\n\n result\nend", "def _reduce_684(val, _values, result)\n result = val[1]\n\n result\nend", "def total(rows)\n rows.map { |row| row[\"Money we made\"].to_i }.reduce(:+)\nend", "def multiply(arr_in)\n\treturn nil if arr_in.empty?\n\ttotal = arr_in.first\n\tarr_in.delete_at(0)\n\tarr_in.each { |elem| total *= elem }\n\ttotal\nend", "def _reduce_557(val, _values, result)\n result = val[1]\n \n result\nend", "def _reduce_597(val, _values, result)\n result = val[1]\n \n result\nend", "def _reduce_441(val, _values, result)\n result = val[1]\n \n result\nend", "def _reduce_441(val, _values, result)\n result = val[1]\n \n result\nend", "def _reduce_441(val, _values, result)\n result = val[1]\n \n result\nend", "def _reduce_441(val, _values, result)\n result = val[1]\n \n result\nend", "def _reduce_441(val, _values, result)\n result = val[1]\n \n result\nend", "def vector_product(y_index, x_index, y_vector, x_vector)\n\n product = 1\n velocity = y_vector == 0 && x_vector == 0 ? 0 : 3\n\n cells = get_cells(y_index, x_index, y_vector, x_vector, velocity)\n cells.each { |cell| product *= cell.val }\n\n return product\nend", "def _reduce_597(val, _values, result)\n result = val[1]\n\n result\nend", "def column_value\n row.fetch(column){row[@column.to_s]}\n end", "def residual_price\n temp_bills = TempBill.find(:all, :conditions => [\"bill_id = ?\", self.id])\n residuum = 0\n temp_bills.each{|temp_bill| residuum += temp_bill.price}\n \n return (self.price - residuum)\n end" ]
[ "0.5785032", "0.55998653", "0.5552603", "0.5357219", "0.53565675", "0.53564423", "0.5345897", "0.53409773", "0.5313853", "0.53080297", "0.5303662", "0.52953607", "0.52818656", "0.5277714", "0.52754194", "0.5256929", "0.5243743", "0.52409494", "0.52359104", "0.5211393", "0.51924497", "0.5187244", "0.51754713", "0.5166434", "0.5164013", "0.5160906", "0.51509446", "0.51466495", "0.513676", "0.513511", "0.513378", "0.5122179", "0.51065534", "0.51046985", "0.51043314", "0.50982594", "0.50946474", "0.50753915", "0.5062705", "0.50611895", "0.50497055", "0.5035881", "0.5023621", "0.50203294", "0.5012543", "0.5010138", "0.498204", "0.49709237", "0.4970121", "0.49699762", "0.49647138", "0.49569428", "0.49357203", "0.4911439", "0.4897787", "0.48925644", "0.4891039", "0.4881485", "0.48810834", "0.48801044", "0.48785812", "0.48785698", "0.48785698", "0.48730004", "0.4871354", "0.4871354", "0.48707655", "0.48704222", "0.48645434", "0.4861351", "0.48585668", "0.48566806", "0.48551747", "0.48551747", "0.48551747", "0.48440936", "0.4841633", "0.48395482", "0.483939", "0.48348343", "0.48309982", "0.48309982", "0.48301834", "0.48259434", "0.4824515", "0.48229268", "0.48157963", "0.4811879", "0.48115227", "0.4803806", "0.47985595", "0.47960764", "0.4796014", "0.4796014", "0.4796014", "0.4796014", "0.4796014", "0.47955775", "0.47944316", "0.47936064", "0.47914726" ]
0.0
-1
Substitutes Pivot Row (Array Index) with the row you are performing a row operation on (Array Index). Applies cancel_val (See cancel_val above) as the multiplier
def substitute (pivot_row_num, cancel_row_num, cancel_val) for i in 0..(((@rows[pivot_row_num]).length) - 1) @rows[cancel_row_num][i] = @rows[cancel_row_num][i] - (cancel_val)*(@rows[pivot_row_num][i]) if @rows[cancel_row_num][i] == -0.0 then @rows[cancel_row_num][i] = 0.0 end end num, den = cancel_val.to_fraction outp = "" if den == 1 then outp += "#{num}" else outp += "#{num}/#{den}" end if (cancel_val < 0) then puts "R#{cancel_row_num + 1} -> R#{cancel_row_num + 1} - (#{outp})R#{pivot_row_num + 1}" else puts "R#{cancel_row_num + 1} -> R#{cancel_row_num + 1} - (#{outp})R#{pivot_row_num + 1}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cancel_val (pivot_val, cancel)\n return cancel/pivot_val\n end", "def inverted_rows(options = {})\n rows = voucher_rows\n rows.reject!(&:canceled?) unless options[:canceled]\n rows.map do |old|\n vr = old.dup\n vr.sum *= -1\n vr\n end\n end", "def _reduce_479(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n \n result\nend", "def back_substitution(matrix)\n (matrix.length - 1).downto(0) do |pivot_idx|\n # Multiply the current vector position by the pivot_idx inverse (1/pivot_idx)\n inverse = 1 / matrix[pivot_idx][pivot_idx]\n matrix[pivot_idx][-1] *= inverse\n matrix[pivot_idx][pivot_idx] = 1r # We know it will be 1\n puts \"Multiply the #{format_ordinal pivot_idx + 1} row by its diagonal inverse: \"\\\n \"#{inverse.to_s.split('').join(' ')}\"\n\n if (pivot_idx - 1).negative?\n puts 'And we don\\'t have to zero any row'\n else\n puts 'We iterate over the rows above the current pivot index, to zero them'\n print_new_line\n (pivot_idx - 1).downto(0) do |row|\n if !matrix[row][pivot_idx].zero?\n puts \"Cancel R#{row + 1} #{format_ordinal row + 1} coefficient: \" \\\n \"R#{row + 1} <- R#{row + 1} #{matrix[row][pivot_idx] >= 0 ? '-' : '+'} \" \\\n \"( #{matrix[row][pivot_idx].abs.to_s.split('').join(' ')} ) * R#{pivot_idx + 1}\"\n\n matrix[row][-1] -= matrix[row][pivot_idx] * matrix[pivot_idx].last\n matrix[row][pivot_idx] = 0r # We know it will be 0\n else\n puts \"The #{format_ordinal row + 1} coefficient in R#{row + 1} is already zeroed, \" \\\n 'so we follow along'\n end\n end\n end\n\n print_new_line\n puts 'After it, this is the matrix'\n pp_matrix matrix\n print_separator\n end\n\n puts 'And in the reduced row echelon form we have:'\n pp_matrix matrix\n print_separator\n\n matrix\nend", "def _reduce_524(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n\n result\nend", "def _reduce_436(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n \n result\nend", "def _reduce_522(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n\n result\nend", "def _reduce_478(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n \n result\nend", "def compute_row(row)\n row\n end", "def previous_row num=(($multiplier.nil? or $multiplier == 0) ? 1 : $multiplier)\n @oldrow = @current_index\n # NOTE that putting a multiplier inside, prevents an event from being triggered for each row's\n # on leave and on enter\n num.times { \n @current_index -= 1 if @current_index > 0\n }\n bounds_check\n $multiplier = 0\n end", "def choose_supplier_value(current_cell, value)\n update_result(current_cell, value)\n data.b[current_cell.column] -= value\n increase_row(current_cell)\n end", "def index_multiplier_method\n #@multiplied_integer_array = []\n @reversed_array.each_with_index do |value, index|\n if index.odd? == true\n value = value * 2\n @multiplied_integer_array << value\n else\n value = value\n @multiplied_integer_array << value\n end\n end\n return @multiplied_integer_array\n end", "def shift(index, pivot, collection)\n index.upto(pivot) do |i|\n collection[i] = collection[i + 1]\n end\n collection\nend", "def customize_row_index(row_index)\n row_index += 1\n end", "def transform_row!(row)\n @row_transform.call(row) unless @row_transform.nil?\n @col_transforms.each do |name, func|\n next unless row.has_key?(name)\n if func.respond_to?(:transform)\n row[name] = func.transform(row[name])\n else\n row[name] = func.call(row[name])\n end\n end\n end", "def translateAnswerRow( valArr )\n valStr = \"\"\n index = 0\n valArr.each { |value|\n valStr += ( translateFromFillValue( value, index ) + \",\" )\n index = index + 1\n }\n valStr\n end", "def _reduce_597(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def _reduce_585(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def get_products_of_all_ints_except_index(arr)\n products_array = []\n \n arr.each_with_index do |num, index|\n # new array with number at the current index removed\n \n removed_num = arr.delete_at(index)\n\n # multiply the other numbers\n # push that into the products array\n products_array << arr.reduce(:*)\n\n # reinsert removed number\n arr.insert(index, removed_num)\n \n end\n puts products_array\nend", "def _reduce_585(val, _values, result)\n result = [:dot, val[0][1]]\n\n result\nend", "def _reduce_693(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def subtract_value(index)\n val = @puzzle[index]\n if val != \".\"\n row = @rows[calculate_row(index)]\n row.delete_at(row.index(val) || row.length)\n\n column = @columns[calculate_column(index)]\n column.delete_at(column.index(val) || column.length)\n\n box = @boxes[calculate_box(index)]\n box.delete_at(box.index(val) || box.length)\n end\n end", "def get_products_of_all_ints_except_at_index(array)\n result_array = []\n array.each do |num|\n working_array = array.dup\n working_array.delete(num)\n product = working_array.reduce {|sum, num| sum * num}\n result_array << product\n end\n\n return result_array\nend", "def _reduce_593(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def _reduce_711(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def _reduce_718(val, _values, result)\n result = val[1]\n \n result\nend", "def _reduce_501(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n \n result\nend", "def _reduce_501(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n \n result\nend", "def _reduce_501(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n \n result\nend", "def _reduce_501(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n \n result\nend", "def calculate_row(index)\n index/9\n end", "def up num=(($multiplier.nil? or $multiplier == 0) ? 1 : $multiplier)\n #@oldindex = @current_index if num > 10\n @current_index -= num\n #unless is_visible? @current_index\n #if @prow > @current_index\n ##$status_message.value = \"1 #{@prow} > #{@current_index} \"\n #@prow -= 1\n #else\n #end\n #end\n $multiplier = 0\n end", "def _reduce_591(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def _reduce_724(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def _reduce_589(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def _reduce_699(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def _reduce_595(val, _values, result)\n result = val[1]\n \n result\nend", "def _reduce_591(val, _values, result)\n result = [:dot, val[0][1]]\n\n result\nend", "def assign_qc_row_col\n temp = sortByMultipleIO(operations, [\"in\", \"in\"], [\"PCR\", \"PCR\"], [\"id\", \"column\"], [\"collection\", \"io\"])\n operarations = temp\n \n # TODO account for ridealong samples which are not actually operations but are in the stripwell and count towards num_sample total\n operations.each_with_index do |op, i|\n op.associate :qc_row, (i / ANALYZER_COLUMNS.to_f).floor\n op.associate :qc_column, i % ANALYZER_COLUMNS\n rep = 1;\n existing_rc_assoc = op.plan.get \"qc_row_and_column_#{op.input(\"PCR\").sample.id}\"\n while (existing_rc_assoc) do\n rep += 1\n existing_rc_assoc = op.plan.get \"qc_row_and_column_#{op.input(\"PCR\").sample.id}_rep#{rep}\"\n end\n key = if rep > 1\n \"qc_row_and_column_#{op.input(\"PCR\").sample.id}_rep#{rep}\"\n else\n \"qc_row_and_column_#{op.input(\"PCR\").sample.id}\"\n end\n \n op.plan.associate key, \"Your QC result for #{op.input(\"PCR\").sample.id} is in row #{op.get(:qc_row) + 1} and column #{op.get(:qc_column) + 1}\"\n end\n operations\n end", "def _reduce_590(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def _reduce_696(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def find_pivot(col, m)\n aux = 999999\n row = 0\n num_cols = m[0].size\n init = m[0][0] == 'z' ? 1:2\n for i in init..m.size-1\n div = (m[i][col] != 0) ? (m[i][num_cols-1] / m[i][col]) : -1\n if div < aux && div >= 0\n aux = div\n row = i \n end\n end\n m[row][0] = 'X' + (col).to_s\n print \"Encontrar o pívot => m[#{row}][#{col}] = #{m[row][col]}\".italic.blue\n row\nend", "def choosePivot(array, start, fin)\n return start\n end", "def calculate_multiplication_table\n \tprime_array.each_with_index do |element1, index1|\n \t\toutput_array[index1] = []\n \t\tprime_array.each_with_index do |element2, index2|\n\t \t\tif(index1 == 0 && index2 == 0)\n\t \t\t\toutput_array[index1][index2] = element1\n\t \t\telsif (index1 == 0)\n\t \t\t\toutput_array[index1][index2] = element2\n\t \t\telsif (index2 == 0)\n\t \t\t\toutput_array[index1][index2] = element1\n\t \t\telse\n \t\t\t\toutput_array[index1][index2] = element2*element1\n \t\t\tend\n \t\tend\n \tend\n \treturn output_array\n end", "def _reduce_712(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def _reduce_506(val, _values, result)\n lhs, _, args, _ = val\n\n pop_pktbl\n result = new_array_pattern(lhs, nil, args, lhs.line)\n\n result\nend", "def _reduce_699(val, _values, result)\n result = [:dot, val[0][1]]\n\n result\nend", "def _reduce_588(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def _reduce_482(val, _values, result)\n result = [val[0]]\n \n result\nend", "def _reduce_519(val, _values, result)\n _, (num, line) = val\n result = [-num, line]\n\n result\nend", "def invert_item(item)\n item_fq = item.fq.symbolize_keys\n item_value = item_fq.delete(pivot[0].to_sym)\n item_fq = item_fq.merge(item.field.to_sym => item.value).slice(*pivot.map(&:to_sym))\n PivotValue.new(value: item_value, fq: item_fq)\n end", "def reduced_row_echelon_form\n (0...min_dimension).inject(clone) do |matrix, j|\n eliminate_row(matrix, j)\n end\n end", "def multiply_arrnums_by_index(numbers) # array of ints\n new_array = [] # empty array\n i = 0 # start at indice 0\n while i < numbers.length\n new_array << numbers[i] * i # shovel value of int val of the indice * the indice\n # numb_to_mult = numbers[i]\n # numb_multd = numbers[i] * numb_to_mult\n # new_array << numb_multd\n i += 1 # next iteration\n end\n return new_array\nend", "def product_right\n unless @col > 16 \n product = @arr[@row][@col] * @arr[@row][@col + 1] * @arr[@row][@col + 2] * @arr[@row][@col + 3]\n check_new_max(product)\n end \nend", "def calc_row(previous)\n thisrow = [1]\n previous.each_pair do |x, y|\n thisrow << x + y\n end\n thisrow << 1\n end", "def revalue\n @value = nil\n @ops.each do |v|\n v[1].revalue\n end\n end", "def transform_row(row)\n row\n end", "def fix_row(row)\n values = (1..SIZE).to_a\n values.each do |v|\n if reducable(row, v)\n row = replace_possible_with_known(row, v)\n end\n end\n row\nend", "def fix_row(row)\n values = (1..SIZE).to_a\n values.each do |v|\n if reducable(row, v)\n row = replace_possible_with_known(row, v)\n end\n end\n row\nend", "def _reduce_430(val, _values, result)\n result = val[1]\n \n result\nend", "def pivot()\n @view__.pivot.to_a[0, 2]\n end", "def cancel\n raise CancelInterpolation.new\n end", "def key_expansion_inv(key_arr)\n expanded_key = key_expansion(key_arr)\n\n # Apply InvMixColumn to all Round Keys except the first and the last one\n mix_colled = expanded_key[1..-2].map do |key|\n mix_cols_inv(key)\n end\n\n [expanded_key[0]] + mix_colled + [expanded_key[-1]]\n end", "def up num=(($multiplier.nil? or $multiplier == 0) ? 1 : $multiplier)\n @oldindex = @current_index if num > 10\n @current_index -= num\n unless is_visible? @current_index\n if @prow > @current_index\n #$status_message.value = \"1 #{@prow} > #{@current_index} \"\n @prow -= 1\n else\n end\n end\n $multiplier = 0\n end", "def _reduce_728(val, _values, result)\n result = [:dot, val[0][1]]\n\n result\nend", "def reduced_row_echelon_form(ary)\n lead = 0\n rows = ary.size\n cols = ary[0].size\n rary = convert_to_rational(ary) # use rational arithmetic\n catch :done do\n rows.times do |r|\n throw :done if cols <= lead\n i = r\n while rary[i][lead] == 0\n i += 1\n if rows == i\n i = r\n lead += 1\n throw :done if cols == lead\n end\n end\n # swap rows i and r \n rary[i], rary[r] = rary[r], rary[i]\n # normalize row r\n v = rary[r][lead]\n rary[r].collect! {|x| x /= v}\n # reduce other rows\n rows.times do |i|\n next if i == r\n v = rary[i][lead]\n rary[i].each_index {|j| rary[i][j] -= v * rary[r][j]}\n end\n lead += 1\n end\n end\n rary\n end", "def multiplier(grid,r,c,dir)\n '''\n grid = array of arrays >> 20 arrays, 20 elements each, 400 element grid\n r, c = integers representing row and column indecies 0 <= r,c < 20\n dir = string for direction on the grid to travel to gather terms for product\n '''\n first_term = grid[r][c]\n\n case dir\n\n when \"U\"\n return (first_term * grid[r-1][c] * grid[r-2][c] * grid[r-3][c])\n when \"UR\"\n return (first_term * grid[r-1][c+1] * grid[r-2][c+2] * grid[r-3][c+3])\n when \"R\"\n return (first_term * grid[r][c+1] * grid[r][c+2] * grid[r][c+3])\n when \"DR\"\n return (first_term * grid[r+1][c+1] * grid[r+2][c+2] * grid[r+3][c+3])\n when \"D\"\n return (first_term * grid[r+1][c] * grid[r+2][c] * grid[r+3][c])\n when \"DL\"\n return (first_term * grid[r+1][c-1] * grid[r+2][c-2] * grid[r+3][c-3])\n when \"L\"\n return (first_term * grid[r][c-1] * grid[r][c-2] * grid[r][c-3])\n when \"UL\"\n return (first_term * grid[r-1][c-1] * grid[r-2][c-1] * grid[r-3][c-1])\n\n end\n\nend", "def _reduce_247(val, _values, result)\n result = val[0]\n \n result\nend", "def _reduce_247(val, _values, result)\n result = val[0]\n \n result\nend", "def _reduce_247(val, _values, result)\n result = val[0]\n \n result\nend", "def _reduce_247(val, _values, result)\n result = val[0]\n \n result\nend", "def _reduce_247(val, _values, result)\n result = val[0]\n \n result\nend", "def _reduce_247(val, _values, result)\n result = val[0]\n \n result\nend", "def _reduce_247(val, _values, result)\n result = val[0]\n \n result\nend", "def _reduce_247(val, _values, result)\n result = val[0]\n \n result\nend", "def _reduce_247(val, _values, result)\n result = val[0]\n \n result\nend", "def _reduce_442(val, _values, result)\n result = val[1]\n \n result\nend", "def _reduce_705(val, _values, result)\n yyerrok\n \n result\nend", "def row_reduction\n reduction_ar = Array.new\n\n #get 2d array from matrix for updating...\n reduced_matrix_ar = self.to_a\n\n #for each row in this matrix...\n (0..(self.row_size-1)).each do |i|\n row = self.row(i)\n\n #this is the minimum value found in this row...\n minval = row.min\n\n #add this minimum value to the return object\n reduction_ar.push(minval)\n\n #set the row to the reduced version\n reduced_matrix_ar[i] = row.to_a.collect do |row_el|\n #skips rows where calculations involve infinity.\n next(Float::INFINITY) if (row_el.equal? Float::INFINITY or minval.equal? Float::INFINITY)\n\n #the actual reduction happens here\n row_el - minval\n end\n end\n\n return {\n :matrix=>Matrix[*reduced_matrix_ar], \n :reduction=>reduction_ar.reject{|el| el.equal? Float::INFINITY}\n }\n end", "def product_prev_next(array)\n previous = array.first\n array[0] = array[1]*array[2]\n (1..array.length - 2).to_a.each do |idx|\n current = array[idx]\n array[idx] = previous*array[idx + 1]\n previous = current\n end\n array[array.length - 1] = array[array.length - 1]*previous\n return array\nend", "def shift_variant_values\n Option.transaction do\n for higher_option in higher_positioned_options\n current_column = higher_option.variant_column\n target_column = \"option_value_#{ higher_option.order_in_good - 1 }\"\n \n higher_option_variants = higher_option.associated_variants\n \n # Shift their values lower.\n higher_option_variants.update_all( \"#{ target_column } = #{ current_column }\" )\n higher_option_variants.update_all( \"#{ current_column } = NULL\" )\n end\n end\n end", "def pivot()\r\n @warrior.pivot!\r\n end", "def _reduce_202(val, _values, result)\n result = new_irange(val[0], val[1], val[2])\n \n result\nend", "def process_cancel\r\n super\r\n @@last_top_row = top_row\r\n @@last_index = index\r\n end", "def precompute_row(row, csv_row_number)\n row[:errors] = []\n row[:unknown_errors] = []\n row[:csv_row_number] = csv_row_number\n row\n end", "def pivot_index(nums)\n sum = nums.sum\n left_sum = 0\n nums.each_with_index do |num, i|\n if left_sum == sum - left_sum - num\n return i\n end\n left_sum += num\n end\n return -1\nend", "def _reduce_385(val, _values, result)\n result = val[1]\n \n result\nend", "def _reduce_549(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_602(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_217(val, _values, result)\n result = new_assign val[0], val[2]\n\n result\nend", "def _reduce_595(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_602(val, _values, result)\n yyerrok\n \n result\nend", "def quicksort_pivot\n (self[0] + self[-1] + self.sample)/3.0\n end", "def _reduce_174(val, _values, result)\n result = new_assign val[0], val[2]\n \n result\nend", "def _reduce_174(val, _values, result)\n result = new_assign val[0], val[2]\n \n result\nend", "def _reduce_705(val, _values, result)\n result = val[1]\n \n result\nend", "def _reduce_173(val, _values, result)\n result = new_assign val[0], val[2]\n \n result\nend", "def _reduce_417(val, _values, result)\n result = val[1]\n \n result\nend", "def optimize\n operand.operand.drop(sum_offset)\n end", "def product_array(input_array)\n return_array = []\n input_array.each_with_index do |x, i|\n # puts \"x is #{x} and i is #{i}\"\n product = 1\n input_array.each_with_index do |y,j|\n if i!=j\n product *= y\n end\n end\n return_array << product\n end\n return return_array\nend" ]
[ "0.6452407", "0.555063", "0.53112596", "0.52505565", "0.5119662", "0.5103442", "0.5039365", "0.501498", "0.49772435", "0.496464", "0.47991565", "0.47860178", "0.4782933", "0.47543213", "0.4746215", "0.47361553", "0.47243476", "0.46922165", "0.468925", "0.4661551", "0.46506196", "0.46344662", "0.46296462", "0.46039787", "0.4603911", "0.46008474", "0.46003896", "0.46003896", "0.46003896", "0.46003896", "0.45944646", "0.4589881", "0.45822883", "0.45818838", "0.4580678", "0.4534833", "0.45336947", "0.4524393", "0.4517219", "0.45122874", "0.45015073", "0.44977796", "0.44975495", "0.44970268", "0.44884792", "0.44868657", "0.44854164", "0.4474472", "0.44741917", "0.44618014", "0.44597012", "0.44559002", "0.44535777", "0.44523522", "0.44441772", "0.44424278", "0.44376582", "0.443602", "0.443602", "0.44328535", "0.44089285", "0.44035447", "0.44018358", "0.4394342", "0.4394118", "0.43919608", "0.43807116", "0.43708923", "0.43708923", "0.43708923", "0.43708923", "0.43708923", "0.43708923", "0.43708923", "0.43708923", "0.43708923", "0.43678775", "0.436757", "0.43655038", "0.43641573", "0.43512872", "0.4349939", "0.43472454", "0.43451336", "0.434219", "0.4335557", "0.43347183", "0.43334836", "0.43300894", "0.43225238", "0.43208733", "0.43205678", "0.43174687", "0.43159854", "0.43159854", "0.43143147", "0.43120793", "0.43077546", "0.43063235", "0.4305804" ]
0.7500678
0